Clean Complete Branches
jtenniswood/espcontrol
Clean up completed Git branches and worktrees for this repository both locally and on GitHub.
Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.
$ npx skills add obra/superpowers --skill finishing-a-development-branch -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install obra/superpowers finishing-a-development-branch --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/obra/superpowers.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/finishing-a-development-branch .claude/skills/finishing-a-development-branch && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "finishing-a-development-branch" agent skill from https://github.com/obra/superpowers/tree/main/skills/finishing-a-development-branch into .claude/skills/finishing-a-development-branch/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "finishing-a-development-branch", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/obra/superpowers/tree/main/skills/finishing-a-development-branchType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add obra/superpowers --skill finishing-a-development-branch -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install obra/superpowers finishing-a-development-branch --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/obra/superpowers.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/finishing-a-development-branch .agents/skills/finishing-a-development-branch && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "finishing-a-development-branch" agent skill from https://github.com/obra/superpowers/tree/main/skills/finishing-a-development-branch into .agents/skills/finishing-a-development-branch/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "finishing-a-development-branch", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add obra/superpowers --skill finishing-a-development-branch -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install obra/superpowers finishing-a-development-branch --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/obra/superpowers.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/finishing-a-development-branch .cursor/skills/finishing-a-development-branch && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "finishing-a-development-branch" agent skill from https://github.com/obra/superpowers/tree/main/skills/finishing-a-development-branch into .cursor/skills/finishing-a-development-branch/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "finishing-a-development-branch", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/obra/superpowers.git --path skills/finishing-a-development-branch--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add obra/superpowers --skill finishing-a-development-branch -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install obra/superpowers finishing-a-development-branch --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/obra/superpowers.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/finishing-a-development-branch .gemini/skills/finishing-a-development-branch && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "finishing-a-development-branch" agent skill from https://github.com/obra/superpowers/tree/main/skills/finishing-a-development-branch into .gemini/skills/finishing-a-development-branch/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "finishing-a-development-branch", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install obra/superpowers finishing-a-development-branchInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add obra/superpowers --skill finishing-a-development-branch -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/obra/superpowers.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/finishing-a-development-branch .github/skills/finishing-a-development-branch && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "finishing-a-development-branch" agent skill from https://github.com/obra/superpowers/tree/main/skills/finishing-a-development-branch into .github/skills/finishing-a-development-branch/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "finishing-a-development-branch", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add obra/superpowers --skill finishing-a-development-branch -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install obra/superpowers finishing-a-development-branch --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/obra/superpowers.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/finishing-a-development-branch .opencode/skills/finishing-a-development-branch && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "finishing-a-development-branch" agent skill from https://github.com/obra/superpowers/tree/main/skills/finishing-a-development-branch into .opencode/skills/finishing-a-development-branch/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "finishing-a-development-branch", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
finishing-a-development-branchWalks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.
The sequence is verify tests, detect the environment, present options, execute the choice and clean up. The agent runs the project's full test suite (`npm test`, `cargo test`, `pytest` or `go test`) and stops with the failures if anything is red, so the options menu appears only after a green run. Git directory checks then tell whether this is a normal repository, a worktree on a named branch, or a worktree on a detached HEAD.
Normal repositories and named-branch worktrees get a standard three-option menu, while a detached HEAD gets a reduced two-option menu without a merge, since the workspace is managed elsewhere. The base branch is confirmed before any merge, because merging into the wrong one is costly to undo, and discarding work happens only when you explicitly ask for it. Worktree cleanup depends on where the worktree came from.
6 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit bb92a77. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
gitnpmcargogoFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use git and npm, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Finishing a Development Branch loads about 1.9k tokens when it runs. Until then it costs about 33 tokens; SKILL.md has 821 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from obra/superpowers at commit bb92a77, republished under its MIT licence (© obra). 821 words, ~1,933 tokens.
.claude/skills/finishing-a-development-branch/SKILL.md (or your agent's skills folder).Core principle: Verify tests → Detect environment → Present options → Execute choice → Clean up.
Announce at start: "I'm using the finishing-a-development-branch skill to complete this work."
Run the project's full test suite (npm test / cargo test / pytest / go test ./...).
If tests fail, report the failures and stop — the menu comes after a green suite:
Tests failing (<N> failures). Must fix before completing:
[Show failures]If tests pass: continue to Step 2.
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)
# Capture now, while still inside the workspace — Step 5 changes directory
# before cleanup (Step 6) needs this value
WORKTREE_PATH=$(git rev-parse --show-toplevel)This determines which menu to show and how cleanup works:
| State | Menu | Cleanup |
|---|---|---|
GIT_DIR == GIT_COMMON (normal repo) | Standard 3 options | No worktree to clean up |
GIT_DIR != GIT_COMMON, named branch | Standard 3 options | Provenance-based (see Step 6) |
GIT_DIR != GIT_COMMON, detached HEAD | Reduced 2 options (no merge) | Externally managed — leave in place |
The base branch is whatever this work forked from — usually named in the
plan, the conversation, or the branch's upstream. If it is not already
known, ask: "This branch split from <your best guess> - is that correct?"
Confirm before merging: merging into the wrong base is expensive to undo.
Normal repo and named-branch worktree — present exactly these 3 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)
Which option?Detached HEAD — present exactly these 2 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)
Which option?Present the menu exactly as written — concise, with every option coming from the list above. Discarding the work happens only in response to your human partner explicitly asking for it (see "If your human partner asks to discard the work" below). Wait for their answer; the integration decision is theirs.
# Get main repo root for CWD safety
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"
# Merge first — verify success before removing anything
git checkout <base-branch>
git pull
git merge <feature-branch>
# Verify tests on merged result
<test command>If tests fail on the merged result: stop, leave the worktree and branch in place, and investigate — nothing has been pushed, so the merge is local and recoverable.
Once the merged result is green: clean up the worktree (Step 6), then delete the branch:
git branch -d <feature-branch>git push -u origin <feature-branch>
# From a detached HEAD, name the new branch on the remote:
# git push origin HEAD:refs/heads/<new-branch>Then create the pull/merge request against <base-branch> with the forge's
tooling — its CLI if one is available, or the creation URL most forges
print when you push — following the repo's PR template and conventions if
present, and report the URL to your human partner.
Keep the worktree — your human partner iterates on PR feedback there.
Report: "Keeping branch <name>. Worktree preserved at <path>."
This path exists only as a response to an explicit request to throw the work away. Confirm first:
This will permanently delete:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>
Type 'discard' to confirm.Wait for that exact confirmation. When it arrives:
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"Then clean up the worktree (Step 6) and force-delete the branch:
git branch -D <feature-branch>Runs for Option 1 and confirmed discards. Options 2 and 3 always
preserve the worktree. Both callers have already changed directory to the
main repo root — worktree removal must run from outside the worktree —
and use the GIT_DIR/GIT_COMMON/WORKTREE_PATH values captured in
Step 2, from before that directory change.
If GIT_DIR == GIT_COMMON: Normal repo, no worktree to clean up. Done.
If WORKTREE_PATH is under .worktrees/ or worktrees/: Superpowers
created this worktree — we own cleanup:
git worktree remove "$WORKTREE_PATH"
git worktree prune # Self-healing: clean up any stale registrationsIf removal is refused (contains modified or untracked files): the
worktree holds files that exist nowhere else — uncommitted plans, notes,
or scratch work. Never --force on your own initiative. Show your human
partner what is 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: The host environment owns this workspace — leave it in place. If your platform provides a workspace-exit tool, use it.
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | yes | - | - | yes |
| 2. Create PR | - | yes | yes | - |
| 3. Keep as-is | - | - | yes | - |
| Discard (explicit request only) | - | - | - | yes (force) |
| Excuse | Reality |
|---|---|
| "Tests passed earlier this session" | Run the suite on the tree you are about to integrate. A green run only proves the tree it ran on. |
| "They obviously want it merged" | Integration is your human partner's decision. Present the menu and wait. |
| "They seem done with this feature — I'll offer to discard it" | The menu is complete as written. Discard happens only when your human partner asks for it in so many words. |
| "'Yeah, get rid of it' counts as confirmation" | Only the typed word discard authorizes deletion. |
| "The PR is up, so the worktree is clutter now" | PR feedback gets fixed in that worktree. It stays until the work lands. |
| "This other worktree looks stale — I'll clean it too" | Clean up only worktrees under .worktrees/ or worktrees/. Everything else belongs to the host. |
"Removal refused — --force is just finishing the cleanup" | The refusal means files exist only in that worktree. --force destroys them permanently. Show your human partner and ask. |
| "The merged-result failure is probably flaky" | A failing merged result stops everything. Branch and worktree stay put while you investigate. |
| "The base branch is obviously main" | Confirm the fork point or ask. Merging into the wrong base is expensive to undo. |
| "The push was rejected — force-push will fix it" | A rejected push means the remote moved. Investigate; force-push only on your human partner's explicit request. |
© obra, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/finishing-a-development-branch of obra/superpowers.
Open the folder on GitHubat commit bb92a77
We found 6 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 5 other GitHub owners. This page covers the copy in obra/superpowers, which our catalogue first saw on October 7, 2026.
Finishing a Development Branch next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Finishing a Development Branch this skillobra/superpowers | 297k | 5 repos | ~1.9k | Automated safety check: Pass | MIT | |
| Clean Complete Branchesjtenniswood/espcontrol | 1.1k | — | ~820 | Automated safety check: Pass | Custom licence | |
| Squad Git Branching Workflowmicrosoft/waza | 1.4k | 4 repos | ~1.5k | Automated safety check: Pass | MIT | |
| Git WorkflowEliasOulkadi/shokunin | 114 | — | ~2.4k | Automated safety check: Notes | MIT | |
| Contributor-First PR MergeHKUDS/OpenHarness | 16k | 1 repos | ~847 | Automated safety check: Pass | MIT | |
| Create Pull Requestcline/cline | 70k | 1 repos | ~1.6k | Automated safety check: Pass | Apache-2.0 |
jtenniswood/espcontrol
Clean up completed Git branches and worktrees for this repository both locally and on GitHub.
microsoft/waza
Dev-first branching model for the Squad project: feature work branches from dev, issue branches follow a naming rule and parallel issues use git worktrees.
EliasOulkadi/shokunin
Automate the complete Git development workflow — create feature branches with conventional naming, atomic commits with conventional commit messages, interactive rebase, squash merges, PR body…
HKUDS/OpenHarness
Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.
cline/cline
Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.
makeplane/plane
Names a new Git branch with a type prefix, the lowercased work item ID and a short kebab-case description, so the ID can be extracted later from the branch name.
obra/superpowers
Has the agent carry out an implementation plan itself, task by task in the current session, keeping a ledger, proving each step with a test and ending with one whole-branch review.
obra/superpowers
Investigates a session where Superpowers went wrong, reads the transcripts on disk and produces an evidence-cited report, optionally prepared as a bug report for the maintainers.
obra/superpowers
Makes the agent clarify intent and agree on a design with you before writing any code, scaling the process from a quick spike to a written spec.
Works with
Categories
Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree. The sequence is verify tests, detect the environment, present options, execute the choice and clean up. The agent runs the project's full test suite (`npm test`, `cargo test`, `pytest` or `go test`) and stops with the failures if anything is red, so the options menu appears only after a green run.
Finishing a Development Branch fits situations like: implementation is finished and tests pass, and you need to decide how to integrate; merging a feature branch back or pushing it for a pull request; cleaning up a git worktree after the work is merged or abandoned.
Run `npx skills add obra/superpowers --skill finishing-a-development-branch -a claude-code`. Or copy the skill folder (skills/finishing-a-development-branch in obra/superpowers) into .claude/skills/finishing-a-development-branch in your project. Claude Code loads it when a task matches its description.
Run `npx skills add obra/superpowers --skill finishing-a-development-branch -a codex`. Or copy the skill folder (skills/finishing-a-development-branch in obra/superpowers) into .agents/skills/finishing-a-development-branch in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add obra/superpowers --skill finishing-a-development-branch -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/finishing-a-development-branch, .gemini/skills/finishing-a-development-branch, .github/skills/finishing-a-development-branch and .opencode/skills/finishing-a-development-branch in your project.
Going by SKILL.md and its folder, Finishing a Development Branch needs the command-line tools its instructions call (git, npm, cargo and go). Our summary lists: Git; A project test suite the agent can run.
SKILL.md contains no URLs. Its commands use git and npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Finishing a Development Branch is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Finishing a Development Branch: Clean Complete Branches (jtenniswood/espcontrol, 1.1k stars), Squad Git Branching Workflow (microsoft/waza, 1.4k stars), Git Workflow (EliasOulkadi/shokunin, 114 stars) and Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
obra (a GitHub user) maintains it in obra/superpowers, which has 296,980 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on October 10, 2026.
Source: obra/superpowers on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.