sync-claude

Backs up the live ~/.claude global config into a git repository with allowlist filtering and secret scanning.

3|1|Updated Aug 23, 2025
One-click install
npx skills add https://github.com/samuelpatro/.claude --skill sync-claude-samuelpatro
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sync-claude
Source: https://github.com/samuelpatro/.claude/tree/main/.claude/skills/sync-claude
Command: npx skills add https://github.com/samuelpatro/.claude --skill sync-claude-samuelpatro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Keeping a personal Claude Code configuration (settings.json, CLAUDE.md, statusline.ts, and custom skills) under version control is risky and tedious: copying everything by hand can leak credentials, history files, or session transcripts into git. This Skill automates a safe, allowlist-based backup of the live ~/.claude directory into a git repo. ## Core Features & Use Cases - Allowlist-based sync: Only settings.json, CLAUDE.md, statusline.ts, own (non-skills.sh) skills, and the skills.sh lock file are ever read; credentials, history, and project transcripts are never touched. - Secret scanning: Every copied text file is scanned for key and token patterns (Anthropic, OpenAI, GitHub, AWS, JWT, private keys); flagged files are skipped and the script exits non-zero. - Dry-run and apply modes: Run a check first to preview changes and orphan skills, then apply the copy with LF line-ending normalization. - skills.sh restore: A companion script reinstalls skills.sh-managed skills from the backed-up lock file on a new machine. - Use Case: After tweaking your global Claude Code settings or adding a new personal skill, run the sync to commit an exact, secret-free snapshot of your config to your backup repo. ## Quick Start Ask Claude to sync your live .claude config into the backup repo by running the sync script in check mode first, then with --apply, and committing the result.

Frequently Asked Questions about sync-claude

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I back up my Claude Code config to git?▼

Run the sync script from the repo root with bun .claude/skills/sync-claude/sync.ts to preview changes, then rerun with --apply to copy files. Review the diff and commit directly to main; pushing is only done if you ask.

How do I restore skills.sh skills on a new machine?▼

Run bun .claude/skills/sync-claude/install-skills.ts to reinstall every skill recorded in .agents/.skill-lock.json. Use the --list flag first to print the bunx skills add commands without executing them.

Does the sync copy credentials or session history?▼

No. The sync is allowlist-based and only reads settings.json, CLAUDE.md, statusline.ts, own skills, and the skills.sh lock file. Files like .credentials.json, history.jsonl, projects/, and sessions/ are never read.

Why did the sync script exit with a non-zero code?▼

Exit code 2 means the secret scan flagged a possible key or token in an allowlisted file, so that file or skill was skipped. Inspect the flagged line shown in the output and do not commit until it is resolved.

What are orphan skills reported by the sync check?▼

Orphans are skill folders in the repo that are not live own skills. Either they are managed by skills.sh and were vendored by mistake, or they were removed from ~/.claude/skills and should be deleted or restored by hand.