worktree-remove
Skill2 starsChanged 24 days agoMITView on GitHub
Remove a linked worktree once its task is done, with its clean <name>--* sibling worktrees, after checking for pending follow-ups; branches whose commits are pushed or a PR head go too. Use when the user asks to remove, delete, clean up or finish a worktree.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Svampen/claude-skillstheir own version, first seen Oct 11, 2026
- Joshua-Palamuttam/workbench-templatetheir own version, first seen Mar 7, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Joshua-Palamuttam/workbench-template★ 3same name
- Svampen/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 repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- arduinoSkill
- ci-rerunSkill
- code-sizeSkill
- coworkSkill
- debug-probeSkill
- download-docSkill
- followup-issueSkill
- headless-chiefSkill
- hil-farm-setupSkill
- hilSkill
- pr-babysitSkill
- pr-replySkill
- pr-reviewSkill
- read-docSkill
- read-pcbSkill
- repo-auditSkill
- rttSkill
- simplify-gateSkill
- target-debugSkill
- usb-kernel-debugSkill
- usb-kernel-recoverSkill
- usb-snifferSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
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 21
Run --dry-run first and show the human its report.
- Distinctive: line 26
Run it from outside the worktree and its siblings, naming it as PATH (it refuses a working directory inside them, a kept sibling included).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Removing a worktree
scripts/worktree_remove.py checks the worktree, then removes it with
git worktree remove and runs scripts/worktree_children.py's cleanup, which
removes the clean siblings and deletes the branches. Their docstrings hold
every check and exit code. This is the only way a worktree goes: a terminal
app's own Remove (herdr-app's worktree menu) skips the gate and the siblings.
python3 <skill dir>/scripts/worktree_remove.py [PATH] --dry-run [--pending "<item>"]...- Pass each follow-up of this task, including a headless chief report's, that
is neither done nor filed as an issue under the repository's follow-up
convention as
--pending. - Run
--dry-runfirst and show the human its report. Run without it only on their grant to remove this worktree. - Exit 4: show the list and ask; on their yes rerun with
--proceed <token>as printed; headless, report needs-user. A yes allows the removal, not filing issues. - Run it from outside the worktree and its siblings, naming it as PATH (it
refuses a working directory inside them, a kept sibling included); it prints
the outcome and logs it beside the report. Run from a plain shell, it
refuses while a herdr-core terminal works in the worktree or a sibling,
naming each with its herdr-app space: ask the human to close those. Run
from an hc terminal, it lists them to close instead, another session's as
a pending item, and on the grant hands the removal to a worker terminal
that closes them, this session's own included, and removes: tell the
human before that run that this session ends with it, and that the log
holds the outcome. On Linux it also refuses while any other process
of yours works in them; elsewhere such a process loses its directory with
the removal (on Windows holds it open, failing the removal part way).
Without
hcinstalled terminals go unchecked, and without/procother processes, as the report says. - Exit 6: the worktree is gone but the cleanup kept a sibling or branch, or stopped because something appeared at its path again; report the reasons and the retry command the log names.
- Exit 3 or 5: report the message; never work around a refusal, such as with
git worktree removeor a terminal app's Remove. A chief session found in the worktree, yours included, means a chief cannot remove its own worktree: ask the human to run this from a plain session.
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.

