post-merge-cleanup
Skill1 starsChanged 3 months agoMITView on GitHub
Verify a merged PR and remove its clean, idle task worktree. Use for post-merge cleanup.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- h-wata/claude-skillstheir own version, first seen Oct 13, 2026
- dolanmiu/docxtheir own version, first seen Oct 8, 2026
- hannasdev/skillstheir own version, first seen Jun 28, 2026
- yasunori0418/skillstheir own version, first seen Jun 27, 2026
- dcolclazier/skillstheir own version, first seen May 18, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- dolanmiu/docx★ 6ksame name
- yasunori0418/skills★ 9same name
- dcolclazier/skills★ 1same name
- hannasdev/skills★ 1same name
- h-wata/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- templates/AGENTS.mdAGENTS.md
- templates/CLAUDE.mdCLAUDE.md
- adversarial-reviewSkill
- architect-reviewSkill
- delivery-loopSkill
- fast-pr-workflowSkill
- orchestratorSkill
- qa-automationSkill
- security-reviewSkill
- see-it-liveSkill
- task-researchSkill
- web-devSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Read repository rules. Identify the exact repository, PR, base branch, PR head branch and task worktree from the user's request or …
- Very specific: line 20
Run git worktree remove <exact path> from another checkout, without --force.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Post merge cleanup
An explicit cleanup request or a standing user or repository rule to run the cleaner when a known PR is reported merged authorizes removing only its identified task worktree after proving the merge. A generic PR handoff or request to merge alone does not authorize removal. On Claude Code, dispatch the cleaner agent; on Codex, dispatch a cleaner subagent and tell it to read this SKILL.md completely. If no subagent is available, take this role in the current session. The cleaner never merges a PR.
- Read repository rules. Identify the exact repository, PR, base branch, PR head branch and task worktree from the user's request or established handoff. If more than one candidate fits, stop and report ambiguity. Inspect
git status --short --branch,git worktree list --porcelain, and the worktree path before mutation. - Resolve the selected local Git remote's canonical repository identity. Query the PR with explicit repository selection independent of
GH_REPOor other ambient defaults, and require its returned repository identity to match that remote. Require the PR's actualMERGEDstate, base branch, head branch, full head commit ID, and full merge commit ID. Fetch only that base ref from the verified remote and require the merge commit reachable from it. Never infer a merge from a closed PR, branch deletion, or the user's statement. If identity, merge metadata, or the matching ref cannot be verified, stop. - Match one non-primary linked worktree's exact canonical path and branch from
git worktree list --porcelainto that PR head. Require itsHEADto equal the PR's full head commit ID; detached, moved, duplicate, and branchless cases stop. Never select by directory-name resemblance or clean up the primary checkout. - In that exact worktree, require empty
git status --porcelain=v1 --untracked-files=alland emptygit status --porcelain=v1 --ignored=matching --untracked-files=all. Inspect its worktree lock and live processes' current directories, open files, command lines, executables, and mapped files (lsof,ps, or/procas available). Resolve paths before comparing. If any process view is unavailable, fails, or leaves worktree use uncertain, skip removal. Recheck identity, status, lock, and use immediately before removal. - Run
git worktree remove <exact path>from another checkout, without--force. Do not prune broadly or delete branches. Stop on any failure; never retry with a stronger command. Preserve dirty, ignored, locked, active, primary, and unrelated worktrees. - Report the PR URL, merge commit, fetched base ref and tip, removed path or precise skip reason, and primary checkout status. For a tracked task, use its tracker adapter under repository instructions and copy every reconciliation line; never hand-edit its ledger. Do not pull, merge, rebase, reset, stash, push, delete branches, or update protected branches as part of cleanup.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

