src/claude/skills/pr-captain-merge/SKILL.md
Captain-only. Merge a PR safely — true merge commit (never squash, never rebase), branch protection respected, --principal-approved gate for --admin override. Prevents the "accidentally squashed via the wide GitHub UI button" failure mode that has burned the fleet.
npx skillsauth add the-agency-ai/the-agency pr-captain-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 safe wrapper for merging PRs on GitHub. Always a true merge commit (no squash, no rebase). Respects branch protection by default. --principal-approved is the only way to engage --admin override.
Name pattern: pr- prefix groups with the PR skill family (autocomplete /pr<tab> shows the full kit), captain- qualifier makes captain-only scope visible at a glance.
Raw gh pr merge is too easy to misuse:
--squash flag is one keystroke away from --merge--admin bypasses branch protection silentlypr-captain-merge is the gate — skill-level enforcement plus the underlying agency/tools/pr-merge tool that does the actual work.
Before running, Read the files in required_reading: frontmatter. GIT-MERGE-NOT-REBASE.md explains why we never squash or rebase. SAFE-TOOLS.md covers the safe-tool family this skill composes.
/pr-captain-merge <pr-number>
/pr-captain-merge <pr-number> --principal-approved
/pr-captain-merge <pr-number> --delete-branch
/pr-captain-merge <pr-number> --dry-run
--principal-approved: the principal's authorization is in THIS conversation. Do not infer from prior sessions.If any precondition is missing, STOP. Ask the principal to resolve, or use the non-approved path and let branch protection block.
--principal-approved, confirm the principal has authorized in THIS conversation. Don't infer from history../agency/tools/post-merge-state check. If exit 1, STOP — a prior PR was merged but its release hasn't been cut yet. Run /pr-captain-post-merge <pending-PR> first, then re-invoke this skill. New work cannot start while a prior PR is in pending state. Exit 0 → continue../agency/tools/pr-merge <N>
Or with explicit principal approval (only when they verbally OK'd in-session):
./agency/tools/pr-merge <N> --principal-approved
Tool enforces:
--merge always (never --squash, never --rebase)--admin only when --principal-approved flag is presentOn success (exit 0): report merge URL + next-step recommendation (sync master via ./agency/tools/_sync-main-ref, or wait for /pr-captain-post-merge).
On branch-protection block (exit 3): tool prints the gate. Two resolutions:
gh pr review <N> --approve in GitHub UI, then re-run.--principal-approved.On merge conflict (exit 1): resolve locally first:
gh pr checkout <N>
./agency/tools/git-safe merge-from-master --remote
# resolve conflicts
./agency/tools/git-safe add <files>
./agency/tools/git-captain merge-continue
./agency/tools/git-push <branch>
# then retry
/pr-captain-merge <N>
After successful merge:
./agency/tools/_sync-main-ref/pr-captain-post-merge (or /pr-captain-post-merge once refactored) to create GitHub release + fleet notification./dispatch create --type master-updated --to <agent>/collaborate if relevant/pr-prep or captain's diagnosis./pr-captain-post-merge).gh release create afterward (or via /pr-captain-post-merge).agency/tools/pr-merge).Both rewrite history. The-agency framework is built on visible, append-only history:
git log --graph shows the actual flowCost: heavier git log output. Benefit: you can SEE what happened and WHY, which is essential when fleet agents and adopters all have to read the same history.
Defense in depth against accidental invocation from the wrong context:
paths: [] (intentionally empty) — no file-path auto-activation; universally discoverable for the captain but scoped out of worktree contexts.captain- — any reader sees scope in the skill listing.agency/tools/pr-merge checks caller context before engaging --admin.(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 — ships as of agency-skill-version 2 adoption 2026-04-19. Replaces v1 pr-merge skill.
/pr-captain-land — composite skill that calls this as its merge step/pr-prep — the QG-before-PR-create (agent-side)/pr-submit — agent hands branch to captain for landing/pr-captain-post-merge (TBD refactored to /pr-captain-post-merge) — release + fleet-notify after mergeagency/tools/pr-merge — the underlying safe-merge toolclaude/hookify/hookify.block-raw-gh-pr-merge.md — hookify rule that blocks bare gh pr mergeagency/REFERENCE-GIT-MERGE-NOT-REBASE.md — the discipline rationaleOFFENDERS 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