| name | sync-with-claude |
| description | Sync files from ~/.claude to claude-code-config repository |
| allowed-tools | Bash(cp :*), Bash(diff :*), Bash(ls :*), Bash(cat :*), Bash(mkdir :*), Bash(git status*), Bash(find :*), Bash(date :*), Bash(rsync :*), Bash(rm :*), Bash(bash :*), Bash(chmod :*), Bash(sed :*), Read, Write, Edit |
Sync ~/.claude to Repository
Sync configuration files from ~/.claude to claude-code-config folder in this repository.
Configuration
- Source:
~/.claude
- Target:
$CWD/claude-code-config
Directories to Sync
- commands/ - Slash commands (.md files and subdirectories)
- skills/ - Skills (subdirectories with SKILL.md)
- agents/ - Agent definitions (.md files)
- scripts/ - All script projects (statusline, command-validator, auto-rename-session, claude-code-ai, etc.)
- settings.json - Claude Code settings (hooks, permissions, env)
Exclusions
Always exclude:
node_modules/ - Dependencies (reinstall locally)
data/ - Runtime data
*.db - Database files
*.log - Log files
bun.lockb - Lock files
.DS_Store - macOS files
melvyn/ - Personal commands (NEVER sync this folder)
Additional exclusions: See references/do-not-copy.md for personal/private paths that must NEVER be copied.
Protected paths: See references/do-not-change.md for paths in the target that must NEVER be updated or deleted.
Process
Step 1: Read Exclusions
Read both exclusion lists before syncing:
Step 2: Dry-Run Preview
Run rsync with --dry-run to list ALL changes without applying them:
rsync -avn --delete --exclude 'melvyn' --exclude 'prompts/setup-tmux.md' ~/.claude/commands/ $CWD/claude-code-config/commands/
rsync -avn --delete \
--exclude 'melvyn-dub-cli' \
--exclude 'melvyn-softcompact' \
--exclude 'variations-generator' \
--exclude '__disabled__' \
~/.claude/skills/ $CWD/claude-code-config/skills/
rsync -avn --delete ~/.claude/agents/ $CWD/claude-code-config/agents/
rsync -avn --delete \
--exclude 'node_modules' \
--exclude 'data' \
--exclude '*.db' \
--exclude '*.log' \
--exclude 'bun.lockb' \
--exclude '.DS_Store' \
--exclude '.claude' \
~/.claude/scripts/ $CWD/claude-code-config/scripts/
diff ~/.claude/settings.json $CWD/claude-code-config/settings.json || true
Step 3: Show Summary & Ask for Confirmation
Present a clear summary of what will be:
- Added: New files to be copied
- Updated: Modified files to be overwritten
- Deleted: Files in target that don't exist in source (due to --delete)
ASK USER FOR CONFIRMATION before proceeding. Do NOT sync without explicit approval.
Step 4: Execute Sync (only after approval)
rsync -av --delete --exclude 'melvyn' --exclude 'prompts/setup-tmux.md' ~/.claude/commands/ $CWD/claude-code-config/commands/
rsync -av --delete \
--exclude 'melvyn-dub-cli' \
--exclude 'melvyn-softcompact' \
~/.claude/skills/ $CWD/claude-code-config/skills/
rsync -av --delete ~/.claude/agents/ $CWD/claude-code-config/agents/
rsync -av --delete \
--exclude 'node_modules' \
--exclude 'data' \
--exclude '*.db' \
--exclude '*.log' \
--exclude 'bun.lockb' \
--exclude '.DS_Store' \
--exclude '.claude' \
~/.claude/scripts/ $CWD/claude-code-config/scripts/
cp ~/.claude/settings.json $CWD/claude-code-config/settings.json
Step 4.5: Fix hooks paths in settings.json
ALWAYS run the after-sync script to replace hardcoded absolute paths (e.g. /Users/melvynx/.claude/) with the portable {CLAUDE_PATH}/ placeholder:
bash $CWD/.claude/skills/sync-with-claude/scripts/after-sync.sh $CWD/claude-code-config/settings.json
Step 5: Review & Finish
- Review changes with
git status
- DO NOT COMMIT - Let the user review and commit manually
Success Criteria
- All directories synced without errors
- Exclusions properly applied (no node_modules, data, melvyn/, etc.)
- Show git status at the end for user to review
User: Sync now #$ARGUMENTS