cleanup
Skill2 starsChanged 12 days agoMITView on GitHub
Tear down a merged branch: check the merged PR, close the issues, remove the worktree and branches, and refresh the trunk.
- Commits and pushes
74 other projects use a version of this.
Adopted by
Most recently taken up by
- gregwebs/skills-sdlctheir own version, first seen Nov 15, 2026
- ekirton/Pouletheir own version, first seen Nov 15, 2026
- willcoliveira/mac-cleanup-agenttheir own version, first seen Nov 15, 2026
- PanQiWei/pqw-skillstheir own version, first seen Nov 15, 2026
- Integralist/agent-skillstheir own version, first seen Nov 14, 2026
- udecode/better-convextheir own version, first seen Nov 9, 2026
Used with
Projects with it also use chips, react-query-best-practices and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
udecodeSkillchips
Run the project's suggested-task ledger, the chips. /chips alone brings this session's open tasks up to date: it applies what the ledger helper says, settles stale and split tasks, cards what can start and reports the board, and /chips all also takes the ship-list tasks and the ones no live session owns, and merges duplicate tasks across the board. Use for /chips, /chips offer, start or drop, \"what chips are open\", \"suggest a task for X\", \"update the chips\", \"clean up the chips\", \"which chips are stale\", \"is this chip still worth doing\", \"merge duplicate chips\", at the last hand-back of a run that offered a task, and whenever pstack would file a tracked issue, a follow-up, a reflect Backlog item or an out-of-band PR.
Also in 3 projects that use this
bibektimilsina00Skillreact-query-best-practices
Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.
Also in 3 projects that use this
bibektimilsina00Skillyou-might-not-need-a-callback
Analyze and fix useCallback anti-patterns in your code
Also in 3 projects that use this
Scylla23Skillredo
Re-run the last routed task one model tier up (haiku → sonnet → opus → fable). User-invoked escalation when the previous result missed. Pass --dry-run to preview without running.
Also in 3 projects that use this
Aetheria-Labs1Skillplan-page
Plan one storefront page from strategy through final copy, section order, proof, offers, template direction, responsive layout, and production asset requirements. Stops at an approved execution-ready specification.
Also in 3 projects that use this
SocialKit-APISkillvideo-transcripts
Extract transcripts from social videos through SocialKit across YouTube, TikTok, Instagram, Facebook, X/Twitter, LinkedIn, and direct video file URLs. Use when the user asks to transcribe, get captions or subtitles, pull the spoken text, or read what a video says, including one video or many at once. Returns full text plus timestamped segments. Not for posting, private accounts, or unrelated website scraping.
Also in 3 projects that use this
- +3 more from bibektimilsina00
Other versions74 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 74
- simstudioai/sim★ 30ksame name
- pipecat-ai/pipecat★ 17ksame name
- udecode/plate★ 17ksame name
- civitai/civitai★ 7.3ksame name
- mampfes/hacs_waste_collection_schedule★ 2.3ksame name
- trycompai/comp★ 2.1ksame name
- udecode/dotai★ 1.2ksame name
- LedgerHQ/ledger-live★ 627same name
- ericboy0224/learn-docker-and-k8s★ 472same name
- udecode/better-convex★ 452same name
64 more not listed
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 repository22 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 2 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 62 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
An open PR: stop, and give its URL.
- Very specific: line 26
No PR: stop. The next step is /ship.
- Very specific: line 32
Read the closing line of the PR body.
- Very specific: line 53
Call the Skill tool with worktree to remove the worktree of the branch, also when you know its steps.
- Very specific: line 59
Run git ls-remote --exit-code --heads origin <branch>.
- Very specific: line 67
When it does not fast-forward, list the local-only commits with git log --oneline origin/<trunk>..<trunk>.
- Distinctive: line 71
Stop: keep everything as it is.
“Common” is measured: kept by at least 6 in 10 of the 62 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
Cleanup
/cleanup runs after the user merges a PR from /ship. It ends with the issues in the right state, the worktree and branches gone, and the primary checkout on the latest trunk. It deletes nothing before the gate passes.
Run it from the primary checkout. When the session is in a worktree, call ExitWorktree with keep first. When ExitWorktree says that no session is active, the session went into the worktree with cd: run cd to the first path of git worktree list, which is the primary checkout. When the session is still not in the primary checkout, stop, and tell the user to run /cleanup in a session there.
1. Find
The target is the argument, or the branch you just shipped. Find the trunk as the worktree skill does.
Completion: you have the branch, its issue and the trunk.
2. Gate
Run gh pr list --head <branch> --state all --json number,url,state,body.
- A merged PR: go on. Read its merge commit with
gh pr view <pr> --json mergeCommit. When that commit has two parents (git cat-file -p <commit>after a fetch), the PR merged with a merge commit. When the merge line of the PR body names another method, name the difference in the report, and name the repo setting that blocks it,gh repo edit --enable-merge-commit=false. - An open PR: stop, and give its URL.
- No PR: stop. The next step is
/ship.
Completion: the branch has a merged PR.
3. Issues
Read the closing line of the PR body. Use docs/agents/tracker.md, or NO-SETUP.md in the folder of the setup-skills skill. A PR with no closing line has no issue to change.
Closes #<n>: when the issue is still open, close it astracker.mdsays. When it is a ticket and every ticket of its spec is closed now, close the spec too. The keyword fires only on a merge into the default branch, so when the trunk is not the default branch, a close by hand is the normal path.Refs #<n>: the fix added instrumentation, and the cause is not confirmed. The issue stays open. Name in the report what confirms the cause.
Completion: each issue is in the state that the closing line gives, and you know which closed by keyword and which by hand.
4. Servers
Stop each dev server and background task that runs from the worktree. Check the background tasks of this session, and each process whose working directory is in the worktree: lsof -d cwd lists them. A task can survive a /clear, so look also when you think this session started none.
In a repo with a .xcodeproj or a .xcworkspace, also shut down the simulators, because their working directory is not in the worktree. When pgrep xcodebuild finds no other build, run xcrun simctl shutdown all, then xcrun simctl --set testing shutdown all. The second one fails harmlessly when no test clone exists.
Then delete the test clones, which are disposable: Xcode leaves them on disk, and one session found 5 clone folders with one booted. Record the size with du -sh ~/Library/Developer/XCTestDevices, then run xcrun simctl --set testing delete all.
Leave Claude Code's own processes, which are the session shell, caffeinate and the MCP servers. Then clear what this session left: close each browser page that it opened, and delete each partial install and temp file that it made. Name each one in the report.
Completion: no process other than Claude Code's has its working directory in the worktree, and no simulator is booted unless another build uses it.
5. Worktree
Call the Skill tool with worktree to remove the worktree of the branch, also when you know its steps. When the primary checkout has the branch and no worktree has it, run git switch <trunk>, then git branch -D <branch>, and skip worktree.
Completion: git worktree list does not show the branch, and the local branch is gone.
6. Remote branch
Run git ls-remote --exit-code --heads origin <branch>. When the branch is there, run git push origin --delete <branch>. GitHub can delete it on merge, so a missing branch is normal.
Completion: origin does not have the branch.
7. Trunk
Record the trunk head with git rev-parse HEAD. Run git pull --ff-only.
When it does not fast-forward, list the local-only commits with git log --oneline origin/<trunk>..<trunk>. Ask with the question tool:
- Move to a branch (recommended):
git branch local/<trunk>-<date> <trunk>, thengit reset --keep origin/<trunk>. The commits stay on the branch, and the user ships them with a PR. - Rebase and push:
git rebase origin/<trunk>, thengit push origin <trunk>. Only for a repo where the user pushes to the trunk. - Stop: keep everything as it is.
Completion: the primary checkout is on the latest trunk, or the user picked Stop.
8. Migrations
Find the migration folder in AGENTS.md, or in the config of the migration tool, such as script_location in alembic.ini. Run git diff --name-only <old head> HEAD -- <folder>. When it shows new migrations, run the migrate command from AGENTS.md or package.json on the trunk dev database. When the repo has no such command, name the migrations in the report.
Completion: the trunk dev database has each new migration, or the report names them.
Report
PR · merge method, when it differs from the merge line of the PR · issues closed by keyword, by hand, or left open · servers stopped · session leftovers cleared · size of the test clones deleted · worktree removed · branches deleted · trunk head · migrations applied.
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.

