Agent skill

Finishing A Development Branch

by jnMetaCode in jnMetaCode/superpowers-zh

“当实现完成、所有测试通过、需要决定如何集成这份工作时使用”

— description from SKILL.md by jnMetaCode
MITAuto-check passedDevelopment

Install Finishing A Development Branch

skills CLI
$ npx skills add jnMetaCode/superpowers-zh --skill finishing-a-development-branch -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jnMetaCode/superpowers-zh finishing-a-development-branch --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ 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-src

Use ~/.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/

Facts

Skill name
finishing-a-development-branch
GitHub stars
8.3k
Token cost
~1.1k tokens
SKILL.md length
242 words
Files
1
Skills in repo
21
Repo updated
First seen
Licence
MIT

At a glance

  • SKILL.md covers 概述, 步骤 1:验证测试, 步骤 2:检测环境 and 步骤 3:确定基础分支, plus 5 more sections
  • Calls git, npm and cargo

About this skill

Finishing A Development Branch is a skill in jnMetaCode/superpowers-zh (8.3k stars). Its SKILL.md is about 1.1k tokens. Licence: MIT.

What it can do on your machine

Read from SKILL.md and the folder at commit 2daf57c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • npm
    • cargo
    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    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.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

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.

Always · name and description, kept in context so the agent knows when to use it
~15
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from jnMetaCode/superpowers-zh at commit 2daf57c, republished under its MIT licence (© jnMetaCode). 242 words, ~1,125 tokens.

Download SKILL.mdSave it as .claude/skills/finishing-a-development-branch/SKILL.md (or your agent's skills folder).
name
finishing-a-development-branch
description
当实现完成、所有测试通过、需要决定如何集成这份工作时使用
version
1.0.0
license
MIT

收尾一个开发分支

概述

核心原则: 验证测试 → 检测环境 → 展示选项 → 执行选择 → 清理。

开始时宣告: "我正在使用 finishing-a-development-branch 技能来收尾这份工作。"

步骤 1:验证测试

运行项目的完整测试套件(npm test / cargo test / pytest / go test ./...)。

如果测试失败,报告失败并停下——菜单是在测试全绿之后才出现的:

测试失败(<N> 个)。完成之前必须先修:

[展示失败详情]

如果测试通过: 继续步骤 2。

步骤 2:检测环境

bash
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 个选项(不含合并)由外部管理——原地别动

步骤 3:确定基础分支

基础分支就是这份工作从哪儿分出来的那个——通常在计划里、对话里,或者分支的 upstream 里已经写明了。如果还不知道,就问:"这个分支是从 <你的最佳猜测> 分出来的,对吗?"合并之前先确认:合并到错误的基础分支,代价很高。

步骤 4:展示选项

普通仓库和命名分支 worktree——精确展示这 3 个选项:

实现已完成。你想怎么做?

1. 本地合并回 <base-branch>
2. 推送并创建 Pull Request
3. 保留分支不动(我稍后自己处理)

选哪个?

分离 HEAD——精确展示这 2 个选项:

实现已完成。你当前处于分离 HEAD(由外部管理的工作区)。

1. 作为新分支推送并创建 Pull Request
2. 保持原样(我稍后自己处理)

选哪个?

照原文展示菜单——简洁,每个选项都来自上面的列表。丢弃工作只在你的人类伙伴明确提出时才发生(见下方"如果你的人类伙伴要求丢弃这份工作")。等他们回答;集成与否是他们的决定。

步骤 5:执行选择

选项 1:本地合并
bash
# 切到主仓库根目录,保证 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),然后删除分支:

bash
git branch -d <feature-branch>
选项 2:推送并创建 PR
bash
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 反馈继续迭代。

选项 3:保持原样

报告:"保留分支 <name>。工作树保留在 <path>。"

如果你的人类伙伴要求丢弃这份工作

这条路只作为对"明确要求把工作扔掉"的响应而存在。 先确认:

这将永久删除:
- 分支 <name>
- 所有 commit:<commit 列表>
- 位于 <path> 的工作树

输入 'discard' 以确认。

等待这个精确的确认词。收到之后:

bash
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"

然后清理 worktree(步骤 6),再强制删除分支:

bash
git branch -D <feature-branch>

步骤 6:清理工作区

只对选项 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——我们负责清理:

bash
git worktree remove "$WORKTREE_PATH"
git worktree prune  # 自愈:清理任何过期的注册记录

如果删除被拒绝(contains modified or untracked files):这个 worktree 里存着别处都不存在的文件 —— 未提交的计划、笔记或草稿。绝不要自作主张加 --force。 把利害关系摆给你的人类伙伴看,然后问他:

bash
git -C "$WORKTREE_PATH" status --porcelain -uall
worktree 删除被拒绝 —— 这些文件从未被提交:

<文件列表>

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

Files

Just SKILL.md in skills/finishing-a-development-branch of jnMetaCode/superpowers-zh.

Open the folder on GitHubat commit 2daf57c

Compare with similar skills

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.

Finishing A Development Branch compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Finishing A Development Branch this skilljnMetaCode/superpowers-zh8.3k—~1.1kAutomated safety check: PassMIT
Finishing a Development Branchobra/superpowers297k5 repos~1.9kAutomated safety check: PassMIT
Finishing A Development Branchfarm-fe/farm5.6k35 repos~1.8kAutomated safety check: PassMIT
Git Worktree Cleanuplobehub/lobehub83k—~2.8kAutomated safety check: PassCustom licence
Pre-Release PR Triagejamiepine/voicebox57k—~3.1kAutomated safety check: PassMIT
Ccmanager Configkbwo/ccmanager1.3k—~1.5kAutomated safety check: PassMIT

Similar skills

  • 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.

    297k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • 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…

    5.6k GitHub starsUsed in 35 repos~1.8k tokens
    DevelopmentAuto-check passed
  • Git Worktree Cleanup

    lobehub/lobehub

    Audits stale Git worktrees and branches with a bundled script, classifies each one, and deletes only after you approve the exact candidates.

    83k GitHub stars~2.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Pre-Release PR Triage

    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.

    57k GitHub stars~3.1k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Ccmanager Config

    kbwo/ccmanager

    Set up, review, or repair a CCManager config — .ccmanager.json at a git repository root, or the global ~/.config/ccmanager/config.json.

    1.3k GitHub stars~1.5k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • 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.

    23k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check: warnings

More from jnMetaCode/superpowers-zh

All 21 skills in this repo
  • Brainstorming Before 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.

    8.3k GitHub stars~1.8k tokensUpdated 3 days ago
    Auto-check passed
  • Git Worktree Isolation

    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.

    8.3k GitHub starsUsed in 1 repo~982 tokens
    Auto-check passed
  • Inline Plan Execution

    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.

    8.3k GitHub stars~2.5k tokensUpdated 3 days ago
    Auto-check passed
  • Chinese Code Review Etiquette

    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.

    8.3k GitHub stars~1.2k tokensUpdated 3 days ago
    Auto-check passed
  • Chinese Commit Conventions

    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.

    8.3k GitHub stars~1.6k tokensUpdated 3 days ago
    Auto-check passed
  • Chinese Documentation Style Guide

    jnMetaCode/superpowers-zh

    Reference rules for typesetting Chinese technical documents: spacing around English and digits, punctuation, term handling, bilingual API docs and README layout.

    8.3k GitHub stars~1.6k tokensUpdated 3 days ago
    Auto-check passed

Works with

Categories

Questions about Finishing A Development Branch

How do I install Finishing A Development Branch in Claude Code?

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.

How do I install Finishing A Development Branch in Codex?

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.

Can I use Finishing A Development Branch in Cursor, Gemini CLI or GitHub Copilot?

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.

What does Finishing A Development Branch need to run?

Going by SKILL.md and its folder, Finishing A Development Branch needs the command-line tools its instructions call (git, npm, cargo and go).

Does Finishing A Development Branch access the network?

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.

Is Finishing A Development Branch safe to install?

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.

What licence does Finishing A Development Branch use?

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.

How many tokens does Finishing A Development Branch use?

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.

What are the alternatives to Finishing A Development Branch?

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.

Who maintains Finishing A Development Branch?

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.