worktree-cleanup
Skill1.2k starsChanged 17 days agoMITView on GitHub
List this repository's git worktrees with their branch state (merged, PR open, uncommitted changes, age) and remove the ones that are done — only after the person confirms. Use after a PR is merged, or when the person says "clean up the worktrees".
10 other projects use a version of this.
Trending
Less talk lately.thin dataabout the whole repository
Most recently taken up by
- anotherben/claude-harnesstheir own version, first seen Nov 8, 2026
- my-chiefmind/ai-maestrotheir own version, first seen Oct 13, 2026
- TentacleOpera/switchboardtheir own version, first seen Oct 8, 2026
- dstotijn/agent-skillstheir own version, first seen Sep 21, 2026
- syanga/astacktheir own version, first seen Sep 20, 2026
- Jador/skillstheir own version, first seen Aug 27, 2026
Who's talking about perber/leafwiki
- @chrisshort.net“perber/leafwiki: LeafWiki - Self-hosted wiki. Single Go binary, SQLite, Markdown on disk. No external …”Bluesky · Jul 11, 2026 · 2 likes
- YunoHost-Apps/leafwiki_ynh“Upgrade to v0.14.2”GitHub · Oct 22, 2026
- YunoHost-Apps/leafwiki_ynh“Upgrade to v0.14.1”GitHub · Oct 9, 2026
- shukiv/jabali-panel“More docker apps suggest”GitHub · Jun 14, 2026
- kuaizhongqiang/AgentRouter“[P2] 集成 LeafWiki 作为内置 Wiki:静默子进程 + MCP 工具,不 Fork 源码”GitHub · Jun 4, 2026
The biggest 5 of 5 mentions linking to the repository that our crawl found. Each line is their own headline.
Used with
Projects with it also use handoff.
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.
MicrosoftSkillhandoff
Compact the current conversation into a handoff document for another agent to pick up.
Also in 4 projects that use this
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- TentacleOpera/switchboard★ 215same name
- anotherben/claude-harness★ 7same name
- my-chiefmind/ai-maestro★ 6same name
- dstotijn/agent-skills★ 1same name
- Jador/skills★ 1same name
- jelbirt/LLM-Skill-Build★ 1same name
- luw2007/skills★ 1same name
- EdenGibson/claude-skills★ 0same name
- Enverge-Labs/skills★ 0same name
- syanga/astack★ 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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- developSkill
- docs-reviewSkill
- runSkill
- tidy-testsSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
0
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
- Very specific: line 43
Never use --force on a worktree with uncommitted changes unless the person explicitly asked for that specific one.
“Common” is measured: kept by at least 6 in 10 of the 10 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
Worktree cleanup
Agent work creates one worktree per branch; they pile up. Never delete anything without showing the list and getting an explicit OK.
1. Collect
git fetch -q --prune origin
git worktree list --porcelainFor every worktree except the main checkout, determine:
- branch (or detached HEAD) and last commit date (
git -C <path> log -1 --format=%cr), - uncommitted changes:
git -C <path> status --porcelain(count tracked + untracked), - merged:
git branch --merged origin/maincontains the branch, orgh pr list --state merged --head <branch>finds a merged PR (squash merges don't show up as merged in git), - open PR:
gh pr list --state open --head <branch>, - prunable: marked
prunableby git (directory already gone).
2. Propose
Show a table grouped as:
- Safe to remove — merged (or PR merged), no uncommitted changes.
- Probably done — no open PR, last commit older than 30 days, no uncommitted changes.
- Keep — open PR, uncommitted changes, or recent work. List why.
3. Remove (after OK, per group or per entry)
git worktree remove <path> # refuses if there are uncommitted changes — good
git branch -d <branch> # only for merged branches; -D only if the person says so
git worktree pruneNever use --force on a worktree with uncommitted changes unless the person explicitly asked
for that specific one. Report what was removed and what was kept.
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.

