shared-config-sync skill
✓ 공식~/.claude-config에 프라이빗 git repository를 관리하여 여러 기기 간의 Claude 설정 파일을 동기화합니다.
- GitHub 스타
- 145
- 파일
- 1
- 마지막 커밋
- 2026년 11월 12일
- 라이선스
- Apache-2.0
- 허용된 도구
- —
shared-config-sync skill은 무엇을 하나요?
shared-config-sync은(는) agent skill입니다. ~/.claude-config에 프라이빗 git repository를 관리하여 여러 기기 간의 Claude 설정 파일을 동기화합니다.
skill의 SKILL.md에서 생성된 요약입니다.
shared-config-sync skill 정보
여러 기기에서 Claude를 사용하는 개발자는 ~/.claude-config에 위치한 프라이빗 git repository를 통해 설정 파일을 동기화할 수 있습니다. 이 skill은 repository가 없는 경우 부트스트랩하거나, 기존 원격 저장소를 클론하거나, gh CLI를 사용하여 GitHub에 새로운 프라이빗 repository를 생성하는 등 저장소의 생명주기를 관리합니다. 또한 commit 전에 rebase와 autostash를 포함한 git pull을 수행하여 로컬 변경 사항이 안전하게 업스트림으로 push되도록 보장하며, 작업 내용이 덮어씌워지는 것을 방지합니다.
에이전트가 로컬 편집이나 새로운 호스트 설정을 감지하면 동기화 프로세스를 시작할 수 있습니다. 에이전트는 사용자의 승인을 받기 위해 commit 메시지 초안을 작성하며, 사용된 에이전트와 모델을 식별하기 위한 특정 attribution trailer를 포함합니다. 이 skill은 강제 push를 하지 않고, 심볼릭 링크 연결을 제외하고 지정된 디렉토리 외부의 파일을 수정하지 않으며, 새로 생성된 모든 원격 저장소를 프라이빗으로 유지하는 등 안전 프로토콜을 엄격히 준수합니다. 또한 주기적인 백그라운드 동기화 스크립트와의 경합 상태를 방지하기 위해 파일 잠금을 준수합니다.
agent가 수행할 수 있는 작업
- 1로컬 설정 변경 사항 동기화Claude 설정 파일에 적용된 최근 편집 사항을 원격 repository에 push하여 다른 기기에서도 사용할 수 있도록 합니다.
- 2동기화 중 히스토리 충돌 방지push 전에 rebase를 수행하여 로컬 commit이 다른 기기의 작업 내용을 덮어쓰지 않도록 보장합니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
shared-config-sync skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.플러그인에 shared-config-sync skill 설치
/plugin marketplace add apache/magpie /plugin install magpie-setup@apache-magpie
Claude Code에 shared-config-sync skill 설치
~/.claude/skills/shared-config-sync/SKILL.md
$ npx degit apache/magpie/plugins/magpie-setup/skills/shared-config-sync ~/.claude/skills/shared-config-syncClaude Code (project)에 shared-config-sync skill 설치
.claude/skills/shared-config-sync/SKILL.md
$ npx degit apache/magpie/plugins/magpie-setup/skills/shared-config-sync .claude/skills/shared-config-syncCodex에 shared-config-sync skill 설치
~/.agents/skills/shared-config-sync/SKILL.md
$ npx degit apache/magpie/plugins/magpie-setup/skills/shared-config-sync ~/.agents/skills/shared-config-syncGemini CLI에 shared-config-sync skill 설치
~/.gemini/skills/shared-config-sync/SKILL.md
$ npx degit apache/magpie/plugins/magpie-setup/skills/shared-config-sync ~/.gemini/skills/shared-config-syncClaude.ai에 shared-config-sync skill 설치
npx degit apache/magpie/plugins/magpie-setup/skills/shared-config-sync shared-config-sync && zip -r shared-config-sync.zip shared-config-sync # claude.ai → Customize → Skills → + → Create skill → Upload a skill → shared-config-sync.zip
SKILL.md
GitHub에서 보기setup-shared-config-sync
This skill pushes local edits in ~/.claude-config/ to the sync repo's remote, so other machines can pull them.
It is the counterpart to the periodic git pull --rebase --autostash that the framework's example sync.sh runs on a timer: that pulls upstream into the local clone; this skill pushes local changes upstream.
Adopter overrides
Before running its default behaviour, this skill consults
setup-shared-config-sync.md in the personal layer
(.apache-magpie-local/ when the project adopted Magpie, falling back to the main checkout's in a linked worktree,
or <git-common-dir>/apache-magpie/ when Magpie is only installed; applied first, wins on conflict) and
.apache-magpie-overrides/setup-shared-config-sync.md (committed, project-wide)
in the adopter repo, if present, and applies any agent-readable overrides it finds.
See docs/setup/agentic-overrides.md for the contract.
Hard rule: agents NEVER modify the snapshot under <adopter-repo>/.apache-magpie/.
Local modifications go in the override file; framework changes go via PR to apache/magpie.
Hardcoded path
The sync repo lives at ~/.claude-config/, the convention documented in
docs/setup/secure-agent-setup.md → Syncing user-scope config across machines.
The path is intentionally not parameterised: the doc names one canonical location, so adopters with a sync repo elsewhere fork this skill.
The default remote
When the skill has to bootstrap a missing ~/.claude-config/
(see Bootstrapping a missing ~/.claude-config/),
it resolves the remote to clone or create in this order:
- An explicit URL the user passed this invocation (e.g. "bootstrap from
git@gitlab.com:me/claude-config.git") wins over everything. - The default GitHub convention:
git@github.com:<handle>/claude-config.git, the SSH form the doc's Setting up a fresh host snippet uses.<handle>comes fromgh api user --jq .login(requires an authenticatedgh). The repo name isclaude-config.
If neither resolves (gh is missing or unauthenticated and the user gave no URL), ask the user for the remote URL rather than guessing.
Any remote the skill creates is private (see the golden rules); never public.
Golden rules
- Never force-push. No
--force, no--force-with-lease, no--no-verify, no rewriting commits already pushed to the remote. The sync repo is the source of truth between machines; rewriting its history can lose work from a machine that has not been pulled here yet. - Never modify a file outside
~/.claude-config/. If the user's intended change is to a file in~/.claude/directly (not via a symlink into~/.claude-config/), surface that and stop; they need a different action, not this skill. The one exception is the fresh-host symlink wiring during bootstrap (ln -sfn ~/.claude-config/... ~/.claude/...), and only after the user confirms it; see Bootstrapping a missing~/.claude-config/. - Any remote the skill creates is private. When bootstrap creates a new remote (
gh repo create), it always passes--private: never public, never--internalunless the user asks.~/.claude/CLAUDE.mdcarries personal collaboration preferences and the scripts may reference internal paths; a public config repo leaks both. This mirrors the doc's "a private git repository (private, not public …)" rule. - Confirm before creating or pushing to a new remote. Creating a GitHub repo and pushing the first commit is outward-facing and hard to reverse.
Bootstrap shows the exact plan (repo name,
--privatevisibility, remote URL, the files it will scaffold) and waits for explicit approval before runninggh repo createor the initialgit push. Cloning an existing remote is lower-risk (it writes only into the new~/.claude-config/checkout) and may proceed without a separate confirmation, though the skill still reports what it cloned. - Never clobber a non-repo
~/.claude-config/. If the path exists but is not a git working tree, stop and surface it; do notrmit orgit initover it. Bootstrap only ever creates a~/.claude-config/that was entirely absent. - Pull-with-rebase first. If
git fetchshows the local checkout is behind the remote, rungit pull --rebase --autostashbefore the commit + push. Concurrent work from another machine takes precedence; the local commit lands on top, as the examplesync.shdoes for the periodic pull. - Draft the commit message; never auto-send. For every uncommitted change, draft a one-line commit subject (plus a 2–4 line body if the change merits it) and show it to the user.
The user replies "go" / "yes" / edits / "split into two commits" etc. before any
git commitruns. - Use the resolved attribution trailer, added with
--trailer. Agent-authored commits carry the trailer the user's commit-attribution convention names, resolved percommit-attribution.md(the sync repo has no project file, so the user's choice applies, elseGenerated-by: <agent> (<model>)), where<agent>and<model>are the agent and model you are actually running as (e.g.Claude (Opus 4.8),OpenCode (Big Pickle)). Add it withgit commit --trailer, never in the message body. Do not hardcode either, and never useCo-Authored-By:. Canonical wording: AGENTS.md → Commit and PR conventions. - Stop on lock conflict. The example
sync.shusesflock --nonblockon~/.claude-config/.sync.lockso two sync runs do not race. If.sync.lockis held, do not steal the lock; surface the conflict and stop. The other process is likely the user's recurring sync timer.
Bootstrapping a missing ~/.claude-config/
Reached from Walk-through step 1 when the sync repo is entirely absent.
The goal is a working ~/.claude-config/ git checkout wired to a private remote, by cloning the default remote if it exists or creating it if not.
The skill touches nothing outside the new checkout except the confirmed fresh-host symlink wiring at the end.
Step B1 — resolve the remote
Resolve the remote per The default remote: an explicit URL the user passed, else git@github.com:<handle>/claude-config.git with <handle> from gh api user --jq .login.
If neither resolves (gh missing/unauthenticated and no URL given), ask the user for the remote URL and stop until they provide one; do not guess a handle.
Step B2 — does the remote exist?
- GitHub default:
gh repo view <handle>/claude-config: exit0⇒ exists, non-zero ⇒ does not exist. If the error is auth/permission rather than "not found", surface it and stop rather than assuming absence. - Explicit non-GitHub URL:
git ls-remote <url>: exit0⇒ exists, non-zero ⇒ does not exist / unreachable.
Step B3a — remote exists → clone
git clone <url> ~/.claude-config.
This low-risk path (it writes only the new checkout) may proceed without a separate create-confirmation; report the clone result.
Then continue to Step B4 — fresh-host symlink wiring and resume the sync walk-through from step 2 (typically "in sync, nothing to do").
Step B3b — remote does not exist → create + scaffold + push
Creating an outward-facing remote is confirm-first (golden rule).
Show the full plan and wait for explicit approval: the repo name, --private visibility, the remote URL, and the files to be scaffolded.
On approval:
-
Create the private remote.
- GitHub:
gh repo create <handle>/claude-config --private --description "Personal Claude Code shared config (synced across machines)"(no--clone, no auto-init; the local scaffold below becomes the first commit). - Non-GitHub explicit URL: the skill cannot create the remote; tell the user to create an empty private repo at that URL and re-invoke.
- GitHub:
-
Init + scaffold the minimal layout under
~/.claude-config/, matching the doc's Layout and A minimalsync.sh:git init -b main ~/.claude-config ~/.claude-config/ ├── README.md # what's in the repo + per-machine install steps ├── sync.sh # the pull/commit/push helper (chmod +x) ├── scripts/ # (empty; hooks land here as the user adopts them) └── .gitignore # excludes .sync.lock and any *.credentials* / secretssync.shis the verbatim script from the doc's A minimalsync.shsection..gitignoremust at minimum carry.sync.lock(theflockfile) so the lock is never committed. -
Initial commit + push.
git addthe scaffolded files individually (nevergit add -A; see Walk-through step 5), commit with the resolved attribution trailer (via--trailer),git remote add origin <url>, thengit push -u origin main.
Step B4 — fresh-host symlink wiring
The new (or freshly cloned) checkout only protects this host once its tracked artifacts are symlinked into ~/.claude/.
This is the one write outside ~/.claude-config/ the skill performs, and only after the user confirms.
Offer to run the
Setting up a fresh host
wiring (the ln -sfn ~/.claude-config/… ~/.claude/… block, which mvs any pre-existing real file to .bak before symlinking).
If the user declines, point them at that doc section.
Wire only the artifacts the checkout contains; on a brand-new scaffold scripts/ may be empty, so this step is often a no-op beyond CLAUDE.md.
Walk-through
-
cd ~/.claude-configand verify it is a git working tree pointing at a private remote.- If the directory does not exist at all, do not stop — bootstrap it: jump to
Bootstrapping a missing
~/.claude-config/, then resume the sync walk-through from step 2. - If the directory exists but is not a git repo, surface that and stop (per the golden rule — never clobber a non-repo path).
The user has a stray
~/.claude-config/; they resolve it, then re-invoke. - If it is a git repo, continue to step 2.
- If the directory does not exist at all, do not stop — bootstrap it: jump to
Bootstrapping a missing
-
git fetch originto learn the remote's current state. Report:- commits behind upstream (will be pulled in step 4),
- commits ahead of upstream (committed local work not yet pushed),
- uncommitted working-tree modifications (
git status --short), - untracked files the user may want to either add or
.gitignore.
-
Decide the action. The four reachable states:
- In sync, nothing to do. No uncommitted changes, no unpushed commits, not behind. Report and stop.
- Push-only. Committed local work needs to land on the remote, but not behind and no uncommitted edits. Pull-with-rebase is unnecessary; go straight to push.
- Commit-then-push. Uncommitted edits exist. Walk each modified file with the user (diff + draft commit message + approval), commit each batch the user accepts, then push.
- Pull-then-commit-then-push. Uncommitted edits and behind upstream.
Run
git pull --rebase --autostashfirst; if rebase succeeds cleanly, proceed to the commit-then-push flow. If rebase conflicts, stop and surface — conflicts in~/.claude-config/are the user's to resolve, not the skill's.
-
Pull-with-rebase (when applicable). Run
git pull --rebase --autostash. Report what changed (commits pulled, files touched). -
Stage + commit (when applicable). For each modification the user approves:
git add <file>for the specific file (nevergit add -Aorgit add .— the sync repo is the user's most personal directory andgit add -Arisks staging an editor swap file or a.DS_Storeyou forgot to gitignore),git commit -m '<subject>' -m '<body>' --trailer '<trailer>'with the approved message.<trailer>is the resolved attribution trailer (see the golden rule above) — the actual agent and model you are running as, not a hardcoded value; omit--trailerwhen the convention isnone.
Probe the gpg-agent cache first when
commit.gpgsignis true: a token-backed key with a cold cache stalls this commit untilgpg: signing failed: Timeout. Surface a dialogue, or hand the user the command — seeAGENTS.md→ Commit and PR conventions. -
Push.
git pushto the upstream branch. No--force. A rejected (non-fast-forward) push means another machine pushed after ourgit fetchin step 2; stop, surface, and recommend re-invoking the skill (which repeats the fetch + pull-with-rebase). Do not retry in-flight.
After the push lands
Report:
- which commit SHA is now on the remote,
- a one-line summary of what was pushed (so the user can confirm in their terminal scrollback),
- whether other-machine pulls are needed (the timer-driven
sync.shon the user's other hosts picks the change up on its next run; do not nag about this).
If the changes touched a file under ~/.claude-config/scripts/ that is symlinked from ~/.claude/scripts/, also note that the change is immediately live on this host, since the symlink resolves to the modified file.
No re-cp needed.
이 스킬의 파일
1shared-config-sync skill 질문
Claude Code에 shared-config-sync skill을 어떻게 설치하나요?
npx degit apache/magpie/plugins/magpie-setup/skills/shared-config-sync ~/.claude/skills/shared-config-sync를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
shared-config-sync skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
다른 기기와의 충돌은 어떻게 처리하나요?
로컬 변경 사항이 업스트림 작업 위에 쌓이도록 commit 및 push 전에 rebase와 autostash를 포함한 pull을 수행합니다.
~/.claude-config 디렉토리가 이미 존재하지만 git repo가 아닌 경우에는 어떻게 되나요?
기존 디렉토리를 덮어쓰거나 초기화하는 대신 작업을 중단하고 문제를 보고합니다.
에이전트가 변경 사항을 자동으로 commit 하나요?
아니요, 에이전트는 commit 메시지 초안을 작성하여 사용자에게 보여주고 승인을 받은 후에 git commit 명령을 실행합니다.