| 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 {} \; -print
-
Report 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
.sh files should be executable
- Check:
find ~/dotfiles -name "*.sh" -type f ! -perm -u+x
-
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-------)
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
Diagnosis:
- Target file doesn't exist
- Path is incorrect
- File was moved or deleted
Fix:
rm ~/.zshrc
ln -s ~/dotfiles/.zshrc ~/.zshrc
Issue: Symlink Missing
Detection: ls ~/.zshrc returns "No such file or directory"
Fix:
ln -s ~/dotfiles/.zshrc ~/.zshrc
source ~/dotfiles/shell/zsh.sh
Issue: File Instead of Symlink
Detection:
ls -la ~/.zshrc
Fix:
mv ~/.zshrc ~/.zshrc.backup
ln -s ~/dotfiles/.zshrc ~/.zshrc
Issue: Script Not Executable
Detection:
find ~/dotfiles -name "*.sh" -type f ! -perm -u+x
Fix:
chmod +x ~/dotfiles/setup.sh
find ~/dotfiles -name "*.sh" -exec chmod +x {} \;
Issue: Configuration Won't Load
Detection:
zsh -c 'source ~/.zshrc'
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.json
Report: "✓ 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 {} \; -print
Report: "✓ 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 ~/.zshrc
Output: ~/.zshrc -> ~/old-dotfiles/.zshrc (broken)
-
Diagnose: "Your .zshrc links to '~/old-dotfiles/.zshrc' which doesn't exist"
-
Fix:
rm ~/.zshrc
ln -s ~/dotfiles/.zshrc ~/.zshrc
-
Verify:
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+x
Found: setup.sh, shell/zsh.sh not executable
-
Report: "Found 2 scripts without execute permission"
-
Fix:
chmod +x ~/dotfiles/setup.sh ~/dotfiles/shell/zsh.sh
-
Verify:
ls -la ~/dotfiles/setup.sh
Output: -rwxr-xr-x ✓
-
Confirm: "✓ Fixed permissions on 2 scripts"
Diagnostic Commands
Useful commands for sync checking:
ls -la ~/.zshrc
find ~ -maxdepth 1 -type l -ls
find ~ -maxdepth 1 -type l ! -exec test -e {} \; -print
test -L ~/.zshrc && echo "Is a symlink" || echo "Not a symlink"
readlink ~/.zshrc
test -e ~/dotfiles/.zshrc && echo "Target exists" || echo "Target missing"
ls -la ~/dotfiles/
find ~/dotfiles -name "*.sh" -type f -ls
zsh -n ~/.zshrc
zsh -c 'source ~/.zshrc && echo OK'
zsh -c 'source ~/.zshrc && alias | wc -l'
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