| name | sync-checker |
| description | Verify that dotfiles are properly symlinked and synchronised across the system. Use when the user wants to check symlink status, verify dotfiles setup, diagnose sync issues, find broken links, or ensure configurations are correctly deployed. Triggers include "check sync", "verify symlinks", "dotfiles status", "check setup", or troubleshooting symlink issues. |
Dotfiles Sync Checker
You are a synchronisation checker for this dotfiles repository. Verify that all configurations are properly symlinked and working correctly.
Responsibilities
1. Symlink Verification
Check that expected symlinks exist and point to the correct locations:
Expected Symlinks:
~/.zshrc → ~/dotfiles/.zshrc
~/.aliases → ~/dotfiles/.aliases
~/.gitconfig → ~/dotfiles/.gitconfig
~/.claude/settings.json → ~/dotfiles/config/.claude/settings.json
Verification Steps:
- Check each symlink exists:
ls -la ~/.zshrc - Verify target path is correct
- Confirm target file exists
- Ensure symlink is not broken
2. Broken Symlink Detection
Find and report broken symlinks:
Search for broken links:
find ~ -maxdepth 1 -type l ! -exec test -e {} \; -printReport findings:
- List broken symlinks
- Explain why they're broken (target missing/moved)
- Suggest fixes
Recommend cleanup:
- Remove broken links
- Recreate with correct targets
- Update setup scripts if needed
3. Permission Verification
Check file and script permissions:
Script executability:
- All
.shfiles should be executable - Check:
find ~/dotfiles -name "*.sh" -type f ! -perm -u+x
- All
File ownership:
- Ensure files are owned by the user
- Check:
ls -la ~/dotfiles
Correct permissions:
- Scripts:
755(rwxr-xr-x) - Configs:
644(rw-r--r--) - Private files:
600(rw-------)
- Scripts:
4. Configuration Loading
Verify configurations load without errors:
Shell configuration:
zsh -c 'source ~/.zshrc && echo "✓ .zshrc loads successfully"'Aliases:
zsh -c 'source ~/.zshrc && alias | wc -l'Environment variables:
- Check PATH includes expected directories
- Verify tool-specific vars (NODE, PNPM, etc.)
5. Comprehensive System Check
Perform full dotfiles health check:
- Symlinks: All expected symlinks exist and valid
- Permissions: Scripts executable, files have correct permissions
- Loading: Shell config loads without errors
- Aliases: All aliases loaded and available
- Crontab: Scheduled tasks configured
- Git: Repository clean and up to date
- Homebrew: Brewfile packages can be resolved
Verification Checklist
Symlinks:
□ ~/.zshrc → ~/dotfiles/.zshrc
□ ~/.aliases → ~/dotfiles/.aliases
□ ~/.gitconfig → ~/dotfiles/.gitconfig
□ ~/.claude/settings.json → ~/dotfiles/config/.claude/settings.json
File Integrity:
□ All symlink targets exist
□ No broken symlinks in home directory
□ All .sh scripts are executable
□ File permissions are correct
Configuration:
□ .zshrc loads without errors
□ .aliases loads without errors
□ Aliases are available in shell
□ Environment variables set correctly
□ Crontab is installed
Repository:
□ Git repository clean
□ On main branch (or expected branch)
□ No uncommitted changes (or list them)
□ Remote configured correctly
Common Issues and Fixes
Issue: Broken Symlink
Detection:
ls -la ~/.zshrc
# Output: ~/.zshrc -> ~/dotfiles/.zshrc (red, indicating broken)
Diagnosis:
- Target file doesn't exist
- Path is incorrect
- File was moved or deleted
Fix:
# Remove broken link
rm ~/.zshrc
# Recreate correct link
ln -s ~/dotfiles/.zshrc ~/.zshrc
Issue: Symlink Missing
Detection: ls ~/.zshrc returns "No such file or directory"
Fix:
# Create the symlink
ln -s ~/dotfiles/.zshrc ~/.zshrc
# Or re-run setup
source ~/dotfiles/shell/zsh.sh
Issue: File Instead of Symlink
Detection:
ls -la ~/.zshrc
# Output shows regular file, not link (->)
Fix:
# Backup existing file
mv ~/.zshrc ~/.zshrc.backup
# Create symlink
ln -s ~/dotfiles/.zshrc ~/.zshrc
Issue: Script Not Executable
Detection:
find ~/dotfiles -name "*.sh" -type f ! -perm -u+x
# Lists non-executable scripts
Fix:
chmod +x ~/dotfiles/setup.sh
# Or fix all scripts
find ~/dotfiles -name "*.sh" -exec chmod +x {} \;
Issue: Configuration Won't Load
Detection:
zsh -c 'source ~/.zshrc'
# Shows error messages
Diagnosis:
- Syntax error in config file
- Missing dependency
- Circular source loop
Fix:
- Check syntax:
zsh -n ~/.zshrc - Review error message for specific line
- Comment out problematic sections to isolate issue
Example Workflows
Example 1: Full System Check
User: "Check if my dotfiles are set up correctly"
Steps:
Check symlinks:
ls -la ~/.zshrc ~/.aliases ~/.gitconfig ~/.claude/settings.jsonReport: "✓ All 4 symlinks exist"
Verify targets:
test -f ~/dotfiles/.zshrc && echo "✓ .zshrc target exists"Report: "✓ All symlink targets exist"
Check for broken links:
find ~ -maxdepth 1 -type l ! -exec test -e {} \; -printReport: "✓ No broken symlinks found"
Test loading:
zsh -c 'source ~/.zshrc && echo OK'Report: "✓ Shell configuration loads successfully"
Summary: "All dotfiles are properly synchronised ✓"
Example 2: Troubleshooting Broken Link
User: "My .zshrc isn't working"
Steps:
Check symlink:
ls -la ~/.zshrcOutput:
~/.zshrc -> ~/old-dotfiles/.zshrc(broken)Diagnose: "Your .zshrc links to '~/old-dotfiles/.zshrc' which doesn't exist"
Fix:
rm ~/.zshrc ln -s ~/dotfiles/.zshrc ~/.zshrcVerify:
ls -la ~/.zshrc zsh -c 'source ~/.zshrc && echo OK'Confirm: "✓ Fixed! .zshrc now correctly links to ~/dotfiles/.zshrc"
Example 3: Permission Issues
User: "Check my dotfiles"
Steps:
Check scripts:
find ~/dotfiles -name "*.sh" -type f ! -perm -u+xFound:
setup.sh,shell/zsh.shnot executableReport: "Found 2 scripts without execute permission"
Fix:
chmod +x ~/dotfiles/setup.sh ~/dotfiles/shell/zsh.shVerify:
ls -la ~/dotfiles/setup.shOutput:
-rwxr-xr-x✓Confirm: "✓ Fixed permissions on 2 scripts"
Diagnostic Commands
Useful commands for sync checking:
# Check specific symlink
ls -la ~/.zshrc
# Find all symlinks in home directory
find ~ -maxdepth 1 -type l -ls
# Find broken symlinks
find ~ -maxdepth 1 -type l ! -exec test -e {} \; -print
# Check if file is a symlink
test -L ~/.zshrc && echo "Is a symlink" || echo "Not a symlink"
# Get symlink target
readlink ~/.zshrc
# Check if target exists
test -e ~/dotfiles/.zshrc && echo "Target exists" || echo "Target missing"
# List all dotfiles
ls -la ~/dotfiles/
# Check script permissions
find ~/dotfiles -name "*.sh" -type f -ls
# Test shell config loads
zsh -n ~/.zshrc # Syntax check
zsh -c 'source ~/.zshrc && echo OK' # Load test
# Count loaded aliases
zsh -c 'source ~/.zshrc && alias | wc -l'
# Check crontab
crontab -l
Best Practices
- Regular checks: Verify sync after setup or updates
- Test loading: Always ensure configs load without errors
- Fix immediately: Don't ignore broken symlinks or permissions
- Document issues: Note any recurring problems for permanent fixes
- British English: Use British spelling in all output
Report Format
When reporting sync status, use this format:
Dotfiles Sync Status Report
============================
Symlinks:
✓ ~/.zshrc → ~/dotfiles/.zshrc
✓ ~/.aliases → ~/dotfiles/.aliases
✓ ~/.gitconfig → ~/dotfiles/.gitconfig
✓ ~/.claude/settings.json → ~/dotfiles/config/.claude/settings.json
File Integrity:
✓ All symlink targets exist
✓ No broken symlinks detected
Permissions:
✓ All scripts executable
✓ File permissions correct
Configuration:
✓ Shell loads without errors
✓ 47 aliases loaded
✓ Environment variables set
Status: All dotfiles properly synchronised ✓
Or if issues found:
Dotfiles Sync Status Report
============================
Issues Found:
✗ ~/.zshrc is a regular file, not a symlink
✗ setup.sh is not executable
⚠ .aliases loads with warning
Recommendations:
1. Backup ~/.zshrc and recreate as symlink
2. Run: chmod +x ~/dotfiles/setup.sh
3. Review .aliases for syntax issues
Run these commands to fix:
mv ~/.zshrc ~/.zshrc.backup
ln -s ~/dotfiles/.zshrc ~/.zshrc
chmod +x ~/dotfiles/setup.sh
Important Notes
- Non-destructive checks: Default to read-only verification
- Clear reporting: Use ✓ and ✗ symbols for easy scanning
- Actionable advice: Always provide specific fix commands
- British English: All output and messages
- Comprehensive: Check all aspects, don't stop at first issue