/post-merge-cleanup:post-merge-cleanupfrom post-merge-cleanup
Clean up after the user's own pull request or merge request has merged - confirm the merge from the remote (squash merges included), remove its worktree and branch, revert churn in the main checkout, fast-forward the default branch, and retire notes or memory files that still describe the work as open. Use when the user says "PR merged", "MR landed", "do the cleanups", "prune worktrees", "clean up merged branches", or names a merged branch or PR number. GitHub through gh, GitLab through glab, git always.
Ships in post-merge-cleanup. 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.
None: SKILL.md is the whole skill.
A merged change leaves three kinds of residue: its branch and worktree, churn in the main checkout, and notes that still call it open. Close all three. Delete nothing the remote does not confirm as merged; rewrite nothing in notes the current default branch does not confirm.
With no branch or number given, list the local branches git branch -vv marks gone and take
them one at a time.
Never from recall or from the user's word alone. Where the forge answers, gh pr view <n> or
glab mr view <n> must say merged. Always: git fetch --prune origin, then git branch -vv shows
[origin/<branch>: gone], and the branch's own files diff empty against origin/<default>
(git diff --stat <branch> origin/<default> -- <paths>). Squash merges leave --merged blind.
Content on the branch that is not on default: name the commits and stop. That change is not
closed, in git or in notes.
git -C <worktree> status --ignored --short. Anything listed: name it and stop.git worktree remove <path>, git worktree prune, git branch -D <branch>, then
git checkout -- <churned file>.git pull --ff-only on the default branch in the main checkout.Never remove the main checkout, the default branch, or a branch whose remote ref still exists.
Skip this section when the agent keeps no memory or notes files for the project.
In scope: files whose body names the merged branch, PR or MR number, or ticket. Out of scope: every other claim in every other file, including one that looks wrong. Those go in the report under "seen, not touched".
Each claim in a scoped file gets one of four fates, decided by reading the current default branch or the review thread, never by recall:
Then delete the merged change's file, fix every link to it (search the directory), drop its entry from any index file, and update the index entry of each file that gained a paragraph.
Four lists, at most five items each:
Then one line: what was assumed rather than read. Nothing else.
| Thought | Reality |
|---|---|
| "This durable file's claim is wrong, I'll fix it while here" | Out of scope. Report it; the user decides. |
"--merged lists it" or "the remote branch is gone, so it merged" | Squash hides both. Diff the content against default. |
| "The user said it merged" | The remote says it merged. Fetch, then look. |
| "Lockfile changes are always churn" | Read the diff first. |
| "The report should explain the reasoning" | Four lists and one line. The deciding line is the reasoning. |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub arefmozafari/post-merge-cleanup --plugin post-merge-cleanup