src/claude/skills/post-merge/SKILL.md
Run after a PR is merged on GitHub. Verifies merge, merges origin into master, invokes /sync-all.
npx skillsauth add the-agency-ai/the-agency src/claude/skills/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.
Run after a PR is merged on GitHub. Verifies the merge, merges origin into master, then invokes /sync-all. Never resets master to origin. See claude/REFERENCE-GIT-MERGE-NOT-REBASE.md.
gh pr list --state merged --limit 1.When the user says "merged", "done" (after a PR), or indicates a PR has landed.
Run gh pr view {number} --json state,mergedAt,mergeCommit. Confirm state is "MERGED".
Run git fetch origin.
Check divergence: git rev-list --left-right --count origin/master...HEAD
If diverged (both sides > 0 — expected after squash PR merge):
git merge-base origin/master HEAD. If fails, ABORT.git tag sync/pre-merge-$(date +%Y%m%d-%H%M%S)git merge origin/master -m "Merge origin/master (post-PR-merge sync)"git merge --abort, report, ask user.If behind only: git merge origin/master
Never git reset --hard origin/master. See claude/REFERENCE-GIT-MERGE-NOT-REBASE.md.
Invoke /sync-all via the Skill tool to sync all worktrees.
Every PR is a release. This step is MANDATORY. Mechanically enforced by the release-tag-check GitHub Actions workflow (D41-R20, issue #113) — if a merge commit lands on main without a matching release tag, CI goes red on main immediately. Don't rely on that catching you; create the release here.
agency/config/manifest.json has the correct agency_version. The version bump should have been done BEFORE the PR was created (in /pr-prep or /release). If it wasn't, stop and warn — do not push to main to fix it. Create a follow-up PR instead.gh release create v{version} --title "{PR title}" --notes "{release notes}" --target main
gh release view v{version} --repo {owner}/{repo}
If this returns non-zero, the release was NOT created. Fix and retry before exiting the skill. Do not move to Step 7 on a missing release. Until the release lands, the release-tag-check workflow keeps main red.If the version format doesn't match D#-R# (e.g., a hotfix PR), use the PR number as the version suffix (e.g., v39.pr78).
Never push directly to main. If the 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 is required for post-merge cleanup because the local PR branch typically contains commits not reachable from main's history (RGR receipts, dispatch artifacts). Safe -d would refuse. The --force flag is gated for exactly this case (added in D41-R21, issue #110). The same protections apply: cannot delete main, cannot delete the current branch.
If the branch doesn't exist locally (e.g. you pr-merge --delete-branch already removed the remote and you never had a local copy), this step is a no-op — move on.
Post-merge complete:
PR: #{number} ({title})
Version: {old} → {new}
Release: v{version} created on GitHub
Master: merged with origin/master ({commit})
Worktrees: synced via /sync-all
Branch cleanup: {branch} deleted/kept
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