Agent skill
sync-migrations
Use when creating dotfiles migrations for one-time cleanup on existing machines (removing old tools, uninstalling replaced packages, cleaning deprecated files). Also use when a migration fails and user needs help diagnosing or recovering.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/sync-migrations
SKILL.md
Sync Migrations
One-time scripts that run on existing machines when dotfiles changes require cleanup.
When to Use
Create migration for:
- Removing/uninstalling replaced tools (npm → brew)
- Deleting deprecated files/directories
- Cleaning stale symlinks
Don't create for:
- Adding new configs (sync handles this)
- Updating existing configs (symlinks auto-update)
Quick Reference
| Item | Value |
|---|---|
| Location | migrations/YYYY-MM-DD-description.sh |
| Marker | ~/.dotfiles-migration-marker |
CLI Flags
| Flag | Description |
|---|---|
./sync |
Full sync, no migrations |
./sync --migrate |
Full sync + run pending migrations at the end |
./sync --migrate-only |
Skip sync, run pending migrations only |
Creating a Migration
#!/bin/bash
set -e
# Always check before acting (idempotent)
if [ -d ~/.old-thing ]; then
rm -rf ~/.old-thing
fi
if command -v old-tool &>/dev/null; then
brew uninstall old-tool
fi
Requirements:
- Timestamped filename:
YYYY-MM-DD-description.sh set -efor fail-fast- Idempotent checks before each action
- Make executable:
chmod +x
How It Works
- Marker file stores last-run date
- Migrations with timestamp > marker are pending
- User confirms before running
- Marker updates after each success
New machines: No marker = all pending. User decides to run or skip (fresh setup doesn't need cleanup).
Troubleshooting Failures
When a migration fails, help the user recover:
- Read the failed migration script to understand intent
- Check the sync log at
/tmp/dotfiles-sync-*.logfor error details - Diagnose the issue - missing dependency, permission error, path doesn't exist, etc.
- Options:
- Fix the issue and re-run:
./sync --migrate-only - Run commands manually, then update marker:
echo "YYYY-MM-DD" > ~/.dotfiles-migration-marker - Skip the migration entirely by advancing the marker past it
- Fix the issue and re-run:
Common failure patterns:
command not found→ tool not installed, check Brewfile ran firstpermission denied→ may need sudo (sync doesn't have it)No such file→ path changed or doesn't exist on this machine (make script idempotent)
Recovery example:
# Migration 2025-01-10-foo.sh failed
# Fix: run the commands manually
brew uninstall old-thing # or whatever failed
# Then advance marker so it won't retry
echo "2025-01-10" > ~/.dotfiles-migration-marker
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?