superpowers-finishing-a-development-branch
Skill101 starsChanged 31 days agoMITView on GitHub
Branch finished, tests green? Load first to merge, PR, or clean up.
- Commits and pushes
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- EvovexAI/EvoFlowedited, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- EvovexAI/EvoFlow★ 61240% same
Wrote their own version · 0
None found.
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.
- AGENTS.mdAGENTS.md
- superpowers-brainstormingSkill
- superpowers-diagnosing-superpowersSkill
- superpowers-executing-plansSkill
- superpowers-receiving-code-reviewSkill
- superpowers-sync-upstreamSkill
- superpowers-systematic-debuggingSkill
- superpowers-test-driven-developmentSkill
- superpowers-using-git-worktreesSkill
- superpowers-verification-before-completionSkill
- superpowers-writing-plansSkill
- superpowers-writing-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Core principle: Verify tests → detect environment → present options → execute choice → clean up.
- Distinctive: line 79
Don't add explanation: Keep options concise.
- Very specific: line 94
After merge succeeds: cleanup worktree (Step 6), then git branch -d <feature-branch>.
- Very specific: line 181
Always: verify tests before options.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Finishing a Development Branch
Overview
Present clear options. Handle chosen workflow.
Core principle: Verify tests → detect environment → present options → execute choice → clean up.
Announce at start: "I'm using the superpowers-finishing-a-development-branch skill to complete this work."
The Process
Step 1: Verify Tests
Verify tests pass before options (use superpowers-verification-before-completion):
npm test / cargo test / pytest / go test ./...Tests fail: report failures. Cannot merge/PR until they pass. Stop. Tests pass: continue.
Step 2: Detect Environment
Capture all three up front, before any later step changes directory — WORKTREE_PATH must reflect where you are now, not after Step 5 has cd'd to the main repo root:
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
WORKTREE_PATH=$(git rev-parse --show-toplevel)| State | Menu | Cleanup |
GIT_DIR == GIT_COMMON (normal repo) | Standard 4 options | No worktree to clean up |
GIT_DIR != GIT_COMMON, named branch | Standard 4 options | Provenance-based (Step 6) |
GIT_DIR != GIT_COMMON, detached HEAD | Reduced 3 options (no merge) | No cleanup (externally managed) |
Step 3: Determine Base Branch
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/nullOr ask: "Branch split from main — correct?"
Step 4: Present Options
Normal repo or named-branch worktree — present exactly these 4 options:
Implementation complete. What would you like to do?
1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is (I'll handle it later)
4. Discard this work
Which option?Detached HEAD — present exactly these 3 options:
Implementation complete. You're on a detached HEAD (externally managed workspace).
1. Push as new branch and create a Pull Request
2. Keep as-is (I'll handle it later)
3. Discard this work
Which option?Don't add explanation. Keep options concise.
Step 5: Execute Choice
Option 1: Merge Locally
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"
git checkout <base-branch>
git pull
git merge <feature-branch>
<test command> # Verify tests on merged resultAfter merge succeeds: cleanup worktree (Step 6), then git branch -d <feature-branch>.
Option 2: Push and Create PR
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<2-3 bullets of what changed>
## Test Plan
- [ ] <verification steps>
EOF
)"Do NOT clean up the worktree — needed alive for PR feedback.
Option 3: Keep As-Is
Report: "Keeping branch <name>. Worktree preserved at <path>." No cleanup.
Option 4: Discard
Confirm first — require typed discard:
This will permanently delete:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>
Type 'discard' to confirm.Confirmed: cd to main repo root, cleanup worktree (Step 6), then git branch -D <feature-branch>.
Step 6: Cleanup Workspace
Runs for Options 1 and 4 only. Options 2 and 3 preserve worktree.
Reuse the GIT_DIR, GIT_COMMON, and WORKTREE_PATH captured in Step 2 — do NOT recompute them here. Step 5 (Options 1 and 4) has already cd'd to the main repo root, so a fresh git rev-parse --show-toplevel would return the main repo, not the worktree, and remove the wrong path. Removal must run from outside the worktree.
If GIT_DIR == GIT_COMMON: normal repo, nothing to clean up.
If WORKTREE_PATH under .worktrees/, worktrees/, or ~/.config/reasonix/worktrees/: we created it — we own cleanup:
git worktree remove "$WORKTREE_PATH"
git worktree pruneIf removal is refused (contains modified or untracked files): worktree holds files that exist nowhere else — uncommitted plans, notes, scratch work. Never --force on your own initiative. Show the user what's at stake and ask:
git -C "$WORKTREE_PATH" status --porcelain -uallWorktree removal refused — these files were never committed:
<file list>
1. Commit them to <branch> before cleanup
2. Move them into <main repo root>
3. Delete them (unrecoverable)
Which?Carry out the choice, then remove the worktree.
Otherwise: harness owns workspace. Do NOT remove it. Workspace-exit tool available? Use it. Else leave in place.
Quick Reference
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
| 1. Merge locally | yes | - | - | yes |
| 2. Create PR | - | yes | yes | - |
| 3. Keep as-is | - | - | yes | - |
| 4. Discard | - | - | - | yes (force) |
Red Flags
Never: proceed on failing tests; merge without verifying tests on result; delete work without typed confirmation; force-push without explicit request; remove worktree before merge confirmed; clean up worktrees you didn't create; git worktree remove from inside the worktree; treat a removal-refused error as "just add --force" — it means files exist only there, so show the user and ask.
Always: verify tests before options; detect environment before menu; present exactly 4 options (3 detached HEAD); typed confirmation for Option 4; clean up worktree for Options 1 & 4 only; cd to main repo root before removal; git worktree prune after.
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.

