Finishing a Development Branch
obra/superpowers
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 jnMetaCode/superpowers-zh --skill finishing-a-development-branch -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install jnMetaCode/superpowers-zh 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/jnMetaCode/superpowers-zh.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/jnMetaCode/superpowers-zh/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/jnMetaCode/superpowers-zh/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 jnMetaCode/superpowers-zh --skill finishing-a-development-branch -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install jnMetaCode/superpowers-zh 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/jnMetaCode/superpowers-zh.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/jnMetaCode/superpowers-zh/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 jnMetaCode/superpowers-zh --skill finishing-a-development-branch -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install jnMetaCode/superpowers-zh 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/jnMetaCode/superpowers-zh.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/jnMetaCode/superpowers-zh/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/jnMetaCode/superpowers-zh.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 jnMetaCode/superpowers-zh --skill finishing-a-development-branch -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install jnMetaCode/superpowers-zh 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/jnMetaCode/superpowers-zh.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/jnMetaCode/superpowers-zh/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 jnMetaCode/superpowers-zh 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 jnMetaCode/superpowers-zh --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/jnMetaCode/superpowers-zh.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/jnMetaCode/superpowers-zh/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 jnMetaCode/superpowers-zh --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 jnMetaCode/superpowers-zh 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/jnMetaCode/superpowers-zh.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/jnMetaCode/superpowers-zh/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-branchFinishing A Development Branch is a skill in jnMetaCode/superpowers-zh (8.3k stars). Its SKILL.md is about 1.1k tokens. Licence: MIT.
Read from SKILL.md and the folder at commit 2daf57c. 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.1k tokens when it runs. Until then it costs about 15 tokens; SKILL.md has 242 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 jnMetaCode/superpowers-zh at commit 2daf57c, republished under its MIT licence (© jnMetaCode). 242 words, ~1,125 tokens.
.claude/skills/finishing-a-development-branch/SKILL.md (or your agent's skills folder).核心原则: 验证测试 → 检测环境 → 展示选项 → 执行选择 → 清理。
开始时宣告: "我正在使用 finishing-a-development-branch 技能来收尾这份工作。"
运行项目的完整测试套件(npm test / cargo test / pytest / go test ./...)。
如果测试失败,报告失败并停下——菜单是在测试全绿之后才出现的:
测试失败(<N> 个)。完成之前必须先修:
[展示失败详情]如果测试通过: 继续步骤 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)
# 现在就捕获 —— 此刻还在工作区里面。步骤 5 会切换目录,
# 而清理(步骤 6)需要这个值
WORKTREE_PATH=$(git rev-parse --show-toplevel)这决定了展示哪种菜单、以及清理方式:
| 状态 | 菜单 | 清理 |
|---|---|---|
GIT_DIR == GIT_COMMON(普通仓库) | 标准 3 个选项 | 无 worktree 可清理 |
GIT_DIR != GIT_COMMON,命名分支 | 标准 3 个选项 | 按来源判断(见步骤 6) |
GIT_DIR != GIT_COMMON,分离 HEAD | 收敛为 2 个选项(不含合并) | 由外部管理——原地别动 |
基础分支就是这份工作从哪儿分出来的那个——通常在计划里、对话里,或者分支的 upstream 里已经写明了。如果还不知道,就问:"这个分支是从 <你的最佳猜测> 分出来的,对吗?"合并之前先确认:合并到错误的基础分支,代价很高。
普通仓库和命名分支 worktree——精确展示这 3 个选项:
实现已完成。你想怎么做?
1. 本地合并回 <base-branch>
2. 推送并创建 Pull Request
3. 保留分支不动(我稍后自己处理)
选哪个?分离 HEAD——精确展示这 2 个选项:
实现已完成。你当前处于分离 HEAD(由外部管理的工作区)。
1. 作为新分支推送并创建 Pull Request
2. 保持原样(我稍后自己处理)
选哪个?照原文展示菜单——简洁,每个选项都来自上面的列表。丢弃工作只在你的人类伙伴明确提出时才发生(见下方"如果你的人类伙伴要求丢弃这份工作")。等他们回答;集成与否是他们的决定。
# 切到主仓库根目录,保证 CWD 安全
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>
# 在合并结果上验证测试
<测试命令>如果测试在合并结果上失败:停下,把 worktree 和分支原地留着,去排查——什么都还没推送,所以这次合并是本地的、可恢复的。
一旦合并结果全绿:清理 worktree(步骤 6),然后删除分支:
git branch -d <feature-branch>git push -u origin <feature-branch>
# 从分离 HEAD 出发时,在远端指定新分支名:
# git push origin HEAD:refs/heads/<new-branch>然后用代码托管平台(forge)的工具针对 <base-branch> 创建 pull/merge request——有 CLI 就用它,没有就用推送时大多数平台会打印出来的创建 URL——遵循仓库里已有的 PR 模板与约定(如果有),并把 URL 报告给你的人类伙伴。
保留 worktree——你的人类伙伴要在那里根据 PR 反馈继续迭代。
报告:"保留分支 <name>。工作树保留在 <path>。"
这条路只作为对"明确要求把工作扔掉"的响应而存在。 先确认:
这将永久删除:
- 分支 <name>
- 所有 commit:<commit 列表>
- 位于 <path> 的工作树
输入 'discard' 以确认。等待这个精确的确认词。收到之后:
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"然后清理 worktree(步骤 6),再强制删除分支:
git branch -D <feature-branch>只对选项 1 和已确认的丢弃执行。 选项 2 和 3 始终保留 worktree。两个调用方都已经切到主仓库根目录了——移除 worktree 必须从 worktree 外面执行——因此这里使用步骤 2 里捕获的 GIT_DIR / GIT_COMMON / WORKTREE_PATH,也就是那次目录切换之前的值。
⚠️ 不要在这里重新计算这些值。 此刻
git rev-parse --show-toplevel返回的是主仓库根目录,不是 worktree 路径 —— 溯源判断会永远匹配不上,清理会静默空转,随后分支删除还会因为 worktree 仍挂着而失败。
如果 GIT_DIR == GIT_COMMON: 普通仓库,无 worktree 可清理。结束。
如果 WORKTREE_PATH 在 .worktrees/ 或 worktrees/ 之下: 这是 Superpowers 创建的 worktree——我们负责清理:
git worktree remove "$WORKTREE_PATH"
git worktree prune # 自愈:清理任何过期的注册记录如果删除被拒绝(contains modified or untracked files):这个 worktree 里存着别处都不存在的文件 —— 未提交的计划、笔记或草稿。绝不要自作主张加 --force。 把利害关系摆给你的人类伙伴看,然后问他:
git -C "$WORKTREE_PATH" status --porcelain -uallworktree 删除被拒绝 —— 这些文件从未被提交:
<文件列表>
1. 先把它们提交到 <branch>,再做清理
2. 把它们移到 <主仓库根目录>
3. 删掉它们(不可恢复)
选哪个?按他选的做完,再删除 worktree。
否则: 这个工作区归宿主环境所有——原地别动。如果你的平台提供了工作区退出工具,用它。
| 选项 | 合并 | 推送 | 保留工作树 | 清理分支 |
|---|---|---|---|---|
| 1. 本地合并 | 是 | - | - | 是 |
| 2. 创建 PR | - | 是 | 是 | - |
| 3. 保持原样 | - | - | 是 | - |
| 丢弃(仅在明确要求时) | - | - | - | 是(强制) |
| 借口 | 现实 |
|---|---|
| "测试这个会话早先通过过" | 在你即将集成的那棵树上跑测试套件。一次绿色运行只能证明它当时跑的那棵树。 |
| "他们显然是想合并的" | 集成是你人类伙伴的决定。把菜单摆出来,然后等。 |
| "他们看起来对这个功能收工了——我提议丢弃吧" | 菜单就是原文那样,不多不少。丢弃只在你的人类伙伴用明确的话提出时才发生。 |
| "'嗯,删掉吧'算确认了" | 只有输入 discard 这个词才授权删除。 |
| "PR 已经开了,worktree 现在是碍事的垃圾" | PR 反馈要在那个 worktree 里修。它得留到工作落地为止。 |
| "另外那个 worktree 看着像过期的——我顺手也清了" | 只清理 .worktrees/ 或 worktrees/ 之下的 worktree。其余的都属于宿主环境。 |
| "合并结果的失败大概是偶发的" | 合并结果失败会让一切停下。在你排查期间,分支和 worktree 原地不动。 |
| "基础分支明显就是 main" | 确认分叉点,或者直接问。合并到错误的基础分支,代价很高。 |
| "推送被拒了——force-push 一下就好" | 推送被拒意味着远端动过了。去排查;只有在你人类伙伴明确要求时才 force-push。 |
"删除被拒绝了 —— 加 --force 只是把清理做完而已" | 被拒绝恰恰说明有文件只存在于那个 worktree 里。--force 会不可恢复地删掉它们。先问你的人类伙伴。 |
© jnMetaCode, 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 jnMetaCode/superpowers-zh.
Open the folder on GitHubat commit 2daf57c
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 skilljnMetaCode/superpowers-zh | 8.3k | — | ~1.1k | Automated safety check: Pass | MIT | |
| Finishing a Development Branchobra/superpowers | 297k | 5 repos | ~1.9k | Automated safety check: Pass | MIT | |
| Finishing A Development Branchfarm-fe/farm | 5.6k | 35 repos | ~1.8k | Automated safety check: Pass | MIT | |
| Git Worktree Cleanuplobehub/lobehub | 83k | — | ~2.8k | Automated safety check: Pass | Custom licence | |
| Pre-Release PR Triagejamiepine/voicebox | 57k | — | ~3.1k | Automated safety check: Pass | MIT | |
| Ccmanager Configkbwo/ccmanager | 1.3k | — | ~1.5k | Automated safety check: Pass | MIT |
obra/superpowers
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.
farm-fe/farm
A skill your agent uses when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for…
lobehub/lobehub
Audits stale Git worktrees and branches with a bundled script, classifies each one, and deletes only after you approve the exact candidates.
jamiepine/voicebox
Sorts a backlog of open pull requests into must-merge, candidate, superseded and deferred, writes a triage doc and works the merge loop before a release.
kbwo/ccmanager
Set up, review, or repair a CCManager config — .ccmanager.json at a git repository root, or the global ~/.config/ccmanager/config.json.
CapSoftware/Cap
Builds a Cap feature in an isolated Git worktree with disposable dev resources, verification, a recorded demo and a neutral pull request, started with /building.
jnMetaCode/superpowers-zh
Turns a rough idea into an approved design before any code is written, sorting the request into spike, bounded or architectural and enforcing an approval gate.
jnMetaCode/superpowers-zh
Sets up an isolated workspace before feature work or plan execution, preferring native worktree tools and falling back to git worktree, with instructions in Chinese.
jnMetaCode/superpowers-zh
Executes a written implementation plan task by task in the current session, with a progress ledger, test-first gates and one fresh-context review at the end.
jnMetaCode/superpowers-zh
Gives Chinese-language templates and priority labels for code review feedback, plus guidance on bilingual comments, commit messages and common team anti-patterns.
jnMetaCode/superpowers-zh
Reference for Chinese-language git commits and changelogs: Conventional Commits adapted for Chinese teams, with templates, breaking-change notes and issue links for several platforms.
jnMetaCode/superpowers-zh
Reference rules for typesetting Chinese technical documents: spacing around English and digits, punctuation, term handling, bilingual API docs and README layout.
Works with
Categories
Run `npx skills add jnMetaCode/superpowers-zh --skill finishing-a-development-branch -a claude-code`. Or copy the skill folder (skills/finishing-a-development-branch in jnMetaCode/superpowers-zh) into .claude/skills/finishing-a-development-branch in your project. Claude Code loads it when a task matches its description.
Run `npx skills add jnMetaCode/superpowers-zh --skill finishing-a-development-branch -a codex`. Or copy the skill folder (skills/finishing-a-development-branch in jnMetaCode/superpowers-zh) 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 jnMetaCode/superpowers-zh --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).
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 (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.1k tokens (SKILL.md is roughly 4.5k 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: Finishing a Development Branch (obra/superpowers, 297k stars), Finishing A Development Branch (farm-fe/farm, 5.6k stars), Git Worktree Cleanup (lobehub/lobehub, 83k stars) and Pre-Release PR Triage (jamiepine/voicebox, 57k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
jnMetaCode (a GitHub user) maintains it in jnMetaCode/superpowers-zh, which has 8,285 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on October 8, 2026.
Source: jnMetaCode/superpowers-zh on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.