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:
-
references/do-not-copy.md - paths to not copy from source
-
references/do-not-change.md - paths to preserve in target
Step 2: Dry-Run Preview
Run rsync with --dry-run to list ALL changes without applying them:
Preview commands sync (preserve setup-tmux in target)
rsync -avn --delete --exclude 'melvyn' --exclude 'prompts/setup-tmux.md' ~/.claude/commands/ $CWD/claude-code-config/commands/
Preview skills sync
rsync -avn --delete
--exclude 'melvyn-dub-cli'
--exclude 'melvyn-softcompact'
--exclude 'variations-generator'
--exclude 'disabled'
~/.claude/skills/ $CWD/claude-code-config/skills/
Preview agents sync
rsync -avn --delete ~/.claude/agents/ $CWD/claude-code-config/agents/
Preview scripts sync (preserve .claude/ in target)
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/
Preview settings.json diff
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)
Sync commands (exclude melvyn/ folder, preserve setup-tmux in target)
rsync -av --delete --exclude 'melvyn' --exclude 'prompts/setup-tmux.md' ~/.claude/commands/ $CWD/claude-code-config/commands/
Sync skills (exclude paths from do-not-copy.md)
rsync -av --delete
--exclude 'melvyn-dub-cli'
--exclude 'melvyn-softcompact'
~/.claude/skills/ $CWD/claude-code-config/skills/
Sync agents
rsync -av --delete ~/.claude/agents/ $CWD/claude-code-config/agents/
Sync scripts (with exclusions, preserve .claude/ in target)
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/
Sync settings.json
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