src/claude/skills/pr-captain-post-merge/SKILL.md
Captain-only. After a PR has merged on GitHub, verify the merge, merge origin/master locally, sync all worktrees, create the GitHub release (every PR is a release), and clean up the PR branch. Formerly `/post-merge` — v2 rename to noun-actor-verb.
npx skillsauth add the-agency-ai/the-agency pr-captain-post-mergeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Captain's post-merge flow. Runs after a PR has landed on GitHub to verify the merge, reconcile master locally, propagate to worktrees, create the GitHub release, and clean up the PR branch.
Name pattern: pr- prefix groups with the PR skill family (autocomplete /pr<tab>), captain- qualifier flags captain-only scope, post-merge describes the action.
After a PR merges on GitHub, several things must happen locally and across the fleet:
release-tag-check workflow)Without this skill, each step is manual and skippable. The release-tag-check workflow in particular will turn main CI red if a merge lands without a release tag. This skill ensures every merge has a release.
Never resets master to origin — per REFERENCE-GIT-MERGE-NOT-REBASE.md, we merge, never reset.
Before proceeding, Read the files listed in required_reading: frontmatter. GIT-MERGE-NOT-REBASE.md explains the merge discipline that this skill enforces. WORKTREE-DISCIPLINE.md covers the fleet propagation step.
/pr-captain-post-merge <pr-number>
If <pr-number> is omitted, the skill queries gh pr list --state merged --limit 1 for the most recently merged PR and confirms with the user before proceeding.
REFERENCE-GIT-MERGE-NOT-REBASE.md convention resolution).gh pr view <N> returns state MERGED).agency/config/manifest.json version was bumped BEFORE the PR was created (via /pr-prep or /release or /pr-captain-land). If not, skill stops and warns — do NOT push directly to main to fix; create a follow-up PR instead.gh pr view <N> --json state,mergedAt,mergeCommit
Confirm state is MERGED. If not, stop.
./agency/tools/git-captain fetch origin
Check divergence:
git rev-list --left-right --count origin/master...HEAD
git merge-base origin/master HEAD. If fails, ABORT.git tag sync/pre-merge-$(date +%Y%m%d-%H%M%S)./agency/tools/git-captain merge-from-origin (produces merge commit per framework discipline)../agency/tools/git-captain merge-from-origin fast-forwards cleanly.Never git reset --hard origin/master. Per REFERENCE-GIT-MERGE-NOT-REBASE.md, we never rewrite history.
/sync-all
Propagates the merge to every worktree. Worktree-side agents pick up the new content on their next /session-resume.
Every PR is a release. MANDATORY. Mechanically enforced by release-tag-check workflow (the-agency equivalent of D41-R20).
As of C#372 Fix D, the auto-release.yml GitHub Action cuts the release automatically within seconds of the merge. This skill's Step 6 now defers to that workflow and creates the release only as a fallback:
Parse PR title + manifest to determine target v<version>.
Check if release already exists — Fix D auto-release may have cut it:
gh release view v<version> 2>/dev/null
Create release as fallback (Fix D failed, transient outage, or this is a pre-Fix-D path):
./agency/tools/gh-release create v<version> --target master --title "<title>" --notes "<notes>"
Hard-verify release exists (fail-loud, not optional):
gh release view v<version>
If non-zero, the release was NOT created. Do NOT proceed to Step 7. Fix and retry.
Clear pending-post-merge state (C#372 Fix B). Once the release is hard-verified:
./agency/tools/post-merge-state clear <pr-number>
This unblocks the new-work captain skills (/pr-captain-merge, /captain-release, /pr-captain-land) that were refusing while this merge was in pending state. Clearing is tied to gh release view succeeding — NOT to the skill exiting — so a partial post-merge that created the release but failed later still unblocks correctly.
If version format doesn't match D#-R# (e.g., hotfix PR), use v<agency_version>.pr<N> as fallback.
Never push directly to main. If version is wrong, create a follow-up PR.
If the PR's head branch still exists locally:
./agency/tools/git-captain branch-delete <branch> --force
--force required — the local PR branch typically has commits not reachable from main's history (QGR receipts, dispatch artifacts). Safe -d would refuse.
If the branch doesn't exist locally (e.g., captain used pr-merge --delete-branch already), this step is a no-op.
Post-merge complete:
PR: #<N> (<title>)
Version: <old> → <new>
Release: v<version> created at <url>
Master: synced with origin/master (<sha>)
Worktrees: synced via /sync-all
Branch cleanup: <branch> deleted / kept
git-captain merge-from-origin reports conflict. Captain resolves manually, then re-runs from Step 4./pr-captain-merge./pr-captain-create (or agent-side via /pr-submit → /pr-captain-land)./pr-prep pre-PR.paths: [] — no file-path auto-activation; universally discoverable for the captain but scoped out of worktree contexts.captain- — visible scope in the skill listing.(Historically disable-model-invocation: true was a fourth layer. That flag was removed 2026-04-20 because the captain session IS the principal's session — DMI was blocking the captain from invoking captain-* skills. See REFERENCE-SKILL-CONVENTIONS.md §1.)
active (v2, post-refactor from legacy post-merge 2026-04-19).
/pr-captain-merge — the merge itself, runs before this skill/pr-captain-land — the full captain-owned PR lifecycle (this skill is Step 8 of that flow)/sync-all — the fleet-sync sub-skill this calls in Step 5/release (TBD refactored to /captain-release) — alternate entry point that runs /pr-captain-merge + this skill in one flowagency/tools/gh-release — the release-creation toolagency/tools/git-captain — safe captain-side git operationsagency/REFERENCE-GIT-MERGE-NOT-REBASE.md — the merge disciplineOFFENDERS WILL BE FED TO THE — CUTE — ATTACK KITTENS!
business
Sync worktree with master — merge, copy settings, run sandbox-sync, report changes
tools
List all git worktrees with status info (branch, clean/dirty, deps)
tools
Remove a git worktree and optionally delete its branch
development
Create a new git worktree with dedicated branch and bootstrapped dev environment