teardown
Skill0 starsChanged 7 months agoMITView on GitHub
Remove a feature clone after its work is merged. Verifies the branch was merged into main before deleting. Can target a specific clone or list all clones for selection. Use when asked to "teardown", "remove clone", "delete workspace", "clean up clone", or "prune workspaces".
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
6 other projects use a version of this.
Adopted by
Most recently taken up by
- blueclover22/mw_agent_kittheir own version, first seen Nov 4, 2026
- elvarofficial/teardowntheir own version, first seen Nov 1, 2026
- jakubkrehel/skillstheir own version, first seen Oct 25, 2026
- Scino/fstacktheir own version, first seen Oct 25, 2026
- OlegTestov/prove-it-minitheir own version, first seen Oct 20, 2026
- mik2win/foureyestheir own version, first seen Oct 8, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- jakubkrehel/skills★ 12ksame name
- elvarofficial/teardown★ 538same name
- Scino/fstack★ 18same name
- mik2win/foureyes★ 2same name
- blueclover22/mw_agent_kit★ 1same name
- OlegTestov/prove-it-mini★ 1same 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.
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 7 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Run these in parallel:
- Very specific: line 38
If it doesn't exist, try BASE_DIR/<base-repo-name>--<name> with common variations (with/without feat- prefix, etc.)
- Distinctive: line 39
If still not found, list available clones and ask.
- Very specific: line 52
If the target has no -- suffix (it's the base/main clone), refuse immediately: "Cannot teardown the base clone.
- Very specific: line 57
If CURRENT_DIR matches the target path, refuse: "You're inside this clone.
- Very specific: line 69
If gh is not available or returns nothing, fall back to git:
- Very specific: line 116
Use AskUserQuestion to confirm.
- Very specific: line 127
Delete the clone: rm -rf <target-clone-path>
- Distinctive: line 131
Check if any remaining clone's AGENTS.md has a port table with a row for the deleted clone.
- Very specific: line 133
If found, use AskUserQuestion: "Remove the row for --<name> from AGENTS.md?
- Distinctive: line 135
If yes, edit the table in the appropriate clone.
- Very specific: line 152
NEVER delete the base clone (the one without a -- suffix).
- Distinctive: line 153
NEVER delete without explicit confirmation from the user.
- Distinctive: line 154
NEVER delete if the user is inside the target clone.
- Distinctive: line 156
Always check merge status before deleting — this is the primary safety check.
- Very specific: line 158
If gh is not installed, fall back to git-only merge detection.
“Common” is measured: kept by at least 6 in 10 of the 5 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
Teardown — Remove a Merged Clone
Safely remove a feature clone after its branch has been merged.
Steps
1. Orient — Identify the base repo
Run these in parallel:
git rev-parse --show-toplevel— repo root pathbasename $(git rev-parse --show-toplevel)— directory name
Derive the base repo name by stripping any --<suffix> from the directory name.
Set BASE_DIR to the parent directory of the repo root.
Set CURRENT_DIR to the repo root.
2. Identify the target
If the user specified a clone name (e.g., /teardown backend):
- Set target to
BASE_DIR/<base-repo-name>--<name> - If it doesn't exist, try
BASE_DIR/<base-repo-name>--<name>with common variations (with/withoutfeat-prefix, etc.) - If still not found, list available clones and ask.
If no name specified:
- List all sibling clones:
ls -d BASE_DIR/<base-repo-name>--* 2>/dev/null - For each clone, gather in parallel: branch name, merge status, port, uncommitted changes
- Present a numbered list and use
AskUserQuestionto ask which to tear down (allow multiple selection)
3. Pre-flight checks
For each target clone, run these checks:
3a. Refuse to delete base clone
If the target has no -- suffix (it's the base/main clone), refuse immediately:
"Cannot teardown the base clone. Only feature clones (--<name>) can be removed."
3b. Refuse if user is inside the target
If CURRENT_DIR matches the target path, refuse:
"You're inside this clone. Open a different session first, then run /teardown."
3c. Check merge status
Try gh first (more reliable):
cd <target-clone>
BRANCH=$(git branch --show-current)
gh pr list --head "$BRANCH" --state merged --json number,title,url --limit 1If gh is not available or returns nothing, fall back to git:
git fetch origin main
git branch -r --merged origin/main | grep "$BRANCH"Classify as:
- Merged — safe to delete
- Open PR — warn, show PR URL
- Unmerged, no PR — warn strongly
3d. Check for uncommitted work
cd <target-clone>
git status --porcelain
git log --oneline @{upstream}..HEAD 2>/dev/null # unpushed commitsReport uncommitted changes and unpushed commits if any.
3e. Check dev server
PORT=$(grep '^PORT=' <target-clone>/.env.local <target-clone>/web/.env.local 2>/dev/null | head -1 | cut -d= -f2)
lsof -ti:$PORT 2>/dev/null4. Confirm deletion
Present a clear summary:
Teardown: <base-repo-name>--<name>
Branch: feat/<name>
Merge status: Merged (PR #42)
Uncommitted: none
Unpushed: none
Dev server: not running
Port: 3005
This will permanently delete <full-path>
Proceed? (yes/no)Use AskUserQuestion to confirm.
If the branch IS merged: Require "yes".
If the branch is NOT merged: Require the user to type the clone suffix name as confirmation:
"This branch has NOT been merged. Type the clone name '<name>' to confirm deletion:"
5. Delete
- Kill any running dev server:
kill $(lsof -ti:<port>) 2>/dev/null - Optionally delete the remote branch (ask first):
git push origin --delete feat/<name> 2>/dev/null - Delete the clone:
rm -rf <target-clone-path>
6. Update project docs (optional)
Check if any remaining clone's AGENTS.md has a port table with a row for the deleted clone.
If found, use AskUserQuestion: "Remove the row for --<name> from AGENTS.md? (y/n)"
If yes, edit the table in the appropriate clone.
7. Report
Torn down: <base-repo-name>--<name>
Deleted: <full-path>
Branch: feat/<name> (remote branch deleted)
Port <port> is now free.
Remaining clones:
--frontend-ui feat/frontend-ui port 3001
--infra feat/infra port 3003Rules
- NEVER delete the base clone (the one without a
--suffix). - NEVER delete without explicit confirmation from the user.
- NEVER delete if the user is inside the target clone.
- For unmerged branches, require typing the clone name as confirmation (not just "yes").
- Always check merge status before deleting — this is the primary safety check.
- Offer to delete the remote branch but don't require it.
- If
ghis not installed, fall back to git-only merge detection.
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.

