Safely closes out merged branches: verifies merge evidence, removes associated worktrees, deletes local branches, and audits remaining refs. Not for creating worktrees or integrating branches.
Ships in branch-closeout. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Safely tear down local scaffolding after work has merged. Closeout proves landing evidence before removing any ref or worktree, distinguishes canonical and fork remotes, protects dirty or ignored worktree state, and audits surviving repository references.
See the closeout checklist for detailed commands and edge cases.
Arguments are passed in the user invocation message. Interpret them structurally from the prompt:
/skill:branch-closeout [--canonical remote] [--base branch] [--delete-fork-branch] <branch...>
/skill:branch-closeout feat/worker-profiles/skill:branch-closeout --base main --canonical upstream fix/session-leak/skill:branch-closeout --delete-fork-branch feat/issue-99<branch...>: One or more local branch names to close out.
git check-ref-format --branch <branch>).--canonical <remote>: Remote name of the canonical upstream repository.
upstream / origin.--base <branch>: Base branch on which the changes landed.
main or master).--delete-fork-branch: Delete the corresponding branch on the contributor's fork remote after local closeout.
false.<canonical> remote: inspect git remote -v and gh repo view.<base> branch: inspect gh repo view --json defaultBranchRef or check git symbolic-ref refs/remotes/<canonical>/HEAD.<fork> remote: locate the contributor's personal fork remote if --delete-fork-branch is requested. If <canonical> is the only remote, fork deletion is not applicable.Never delete a branch based on similar commit subjects or author names alone.
For each <branch>:
git fetch --prune <canonical>git merge-base --is-ancestor <branch> <canonical>/<base>
gh pr view <branch> --repo <canonical> --json state,mergedAt,mergeCommit
Confirm that the reported mergeCommit.oid is present on <canonical>/<base>.<branch> is unmerged and refuse to delete it.git worktree list --porcelain.<branch>:
git -C <path> status --porcelaingit -C <path> status --ignored --porcelainask_user before removal.git worktree remove <path>.
rm -rf.--force only if the user explicitly approved discarding remaining uncommitted/untracked artifacts.git branch -d <branch>
-D (as when a squash merge was used), confirm landing evidence, explain why -d warned, and prompt for confirmation before running git branch -D <branch>.--delete-fork-branch is set and authorized:
<fork> is not <canonical>.git push --delete <fork> refs/heads/<branch>.<canonical>, and never delete <base>.Audit and output the complete survivor inventory:
git worktree list)git branch)git stash list)git tag -l vs remote tags)git ls-remote --heads <canonical>)In a canonical-main-only repository, the expected canonical head set is strictly refs/heads/<base>. Report any extra heads as anomalies.
main or canonical remote branches.rm -rf instead of git worktree remove.What SKILL.md sets; muted values are Claude Code's defaults
/branch-closeout:branch-closeoutfrom branch-closeout
npx claudepluginhub panstudio/pancode --plugin branch-closeoutOther plugins' skills for the same job