Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/Morrison-Lab/ai-config --skill sync-pr-branchコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
SKILL.md を表示中
| name | sync-pr-branch |
| description | Sync PR branch with main. |
| user-invocable | true |
| allowed-tools | ["Bash","Read","Edit","Write"] |
Keep a PR branch current with both main and its own remote, so
reviewers (human and the @claude bot) evaluate it against today's main, and
so commits that reached the remote from elsewhere (the @claude CI bot,
another machine, a teammate, GitHub's web editor) are merged in rather than
causing a rejected git push. The standing rule: whenever main or the
remote branch has moved, merge it in — don't wait for a conflict to surface
or for the user to ask.
Synonyms: sync, resync-branch, merge-main — all route here.
main is ahead of the branch, or suspect the remote copy
of the branch has moved ahead of (or sideways from) your local copy — e.g.
the @claude bot pushed a commit, or you worked on this branch from two
machines.Fetch everything from origin (gets both origin/main and the
remote-tracking copy of the current branch in one shot):
git fetch origin # FETCH
BR="$(git branch --show-current)"
If BR is empty (detached HEAD) or main/master, stop and tell the user
— this skill is for a feature/PR branch, not main itself.
Verify the branch's PR is still active before changing or pushing it. A branch may have been merged or closed while this checkout was stale; pushing it again can recreate a deleted head branch with no PR, or make a merged diff look like new work. Query every PR for the branch, including closed ones:
gh pr list --head "$BR" --state all --json number,state,mergedAt,url
If its PR is MERGED (or has a non-null mergedAt), stop: do not merge
or push the old branch. Update the local checkout from origin/main and
start a new branch for any genuinely new work. If no PR exists, or its PR
remains open, continue. A CLOSED (unmerged) PR is treated like no PR, but
flag it to the user before proceeding because the branch may still carry
genuine work.
Merge origin/main into the branch. A merge commit (not a rebase)
matches GitHub's "Update branch" button and preserves PR history. Never
rebase or squash-rewrite a published branch unless the user explicitly
asks.
git merge origin/main # MERGE_BRANCH
Merge origin/<current-branch> into local — reconcile any commits that
reached the remote from elsewhere:
git merge "origin/$BR" # MERGE_BRANCH
"Already up to date" just means local was already ahead of or equal to the remote — fine, carry on.
(As you see fit) re-merge . If step 4 pulled in new commits, those may predate the you merged in step 3. When that's the case, merge once more so the final tree is current with both inputs:
origin/main first (step 3) then the
remote branch (step 4) is the canonical flow, but the reverse converges to
the same tree. Optional step 5 papers over whichever you did first.ardi round (step 4). When
iterating, run it before each review trigger.origin/main and origin/<this branch> — never another
open PR's branch. Cross-PR changes belong in their own branch.origin/mainmainmaingit merge origin/main # MERGE_BRANCH
Skip this when step 4 was a no-op — it would just be an empty merge.
Resolve any conflicts fully in the working tree (from any of steps 3–5)
— consolidate the best of both sides, don't blind-pick --ours/--theirs.
See the resolve-conflicts skill (alias rc) for the how-to. Don't push a
half-resolved merge.
Run the repo's pre-commit checks before committing a conflict
resolution. Run whatever the current repo's checks are — build, lint,
test, spellcheck — and only proceed once they pass. If the repo ships
render / lint / spell / test skills, use them. A clean,
conflict-free merge auto-commits and needs no extra commit.
quarto render <chapter.qmd> --to html # each parent chapter touched by the merge
Rscript -e 'lintr::lint("path/to/file")' # each changed .R / .qmd
Rscript -e 'spelling::spell_check_package()'
(Or use that repo's quarto-preflight / render / lint / spell skills.)
Push the branch back to origin:
git push origin HEAD # PUSH
Because step 4 already merged the remote tip, this is a fast-forward of the remote and won't be rejected. If it is rejected, the remote moved again between fetch and push — re-run from step 1.