finishing-a-development-branch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Finishing a Development Branch

完成开发分支

Guard: Do NOT Use Mid-Epic

注意:切勿在史诗进行过程中使用

STOP. Before proceeding, check:
  1. Are you a subagent implementing a single task? -> This skill does NOT apply. Report your evidence and stop.
  2. Are there still open tasks in the epic? -> This skill does NOT apply. Only the orchestrator at COMPLETE state should invoke this.
  3. Is there an epic with a
    completion:*
    label?
    -> Read it and execute automatically (see Step 3 Auto below). No prompting needed.
This skill is ONLY for: The final integration step after ALL work is done. If even one task remains open, do not invoke this skill.
停止操作。在继续之前,请检查:
  1. 你是否是负责执行单个任务的子Agent? -> 本技能不适用。提交你的工作证据并停止操作。
  2. 该史诗中是否仍有未完成的任务? -> 本技能不适用。只有处于COMPLETE状态的协调者才能调用本技能。
  3. 该史诗是否带有
    completion:*
    标签?
    -> 阅读标签内容并自动执行(见下方步骤3 自动执行)。无需额外提示。
本技能仅适用于: 所有工作完成后的最终整合步骤。只要还有任何一个任务未完成,就不要调用本技能。

The Process

操作流程

Step 0: Check Epic Verification Tasks (If Applicable)

步骤0:检查史诗验证任务(如适用)

Skip if not working on a beads epic. Otherwise, run
bd list --parent <epic-id>
and check for verification tasks. Three outcomes: open verification tasks (STOP), no verification tasks/legacy (WARNING, proceed), all closed (proceed). See
references/epic-verification.md
.
如果不是处理beads类型的史诗则跳过。否则,运行
bd list --parent <epic-id>
并检查验证任务。有三种结果:存在未完成的验证任务(停止操作)、无验证任务/属于旧版(发出警告,继续操作)、所有验证任务已完成(继续操作)。详见
references/epic-verification.md

Step 1: Verify Tests (Task-Tracked)

步骤1:验证测试(任务追踪式)

Create a "Verify all tests pass" task. Run the project's full test suite.
ENFORCEMENT: Cannot mark completed unless test command was run fresh, output shows 0 failures, and exit code was 0. If tests fail, stop. See
references/test-verification.md
.
创建一个“验证所有测试通过”的任务。运行项目的完整测试套件。
强制要求: 只有在重新运行测试命令、输出显示0个失败且退出码为0的情况下,才能标记此任务完成。如果测试失败,停止操作。详见
references/test-verification.md

Step 1.5: Pre-Merge Simplification (Task-Tracked, Mandatory)

步骤1.5:合并前代码简化(任务追踪式,必填)

Create a "Pre-merge simplification" task blocked by test verification. Get changed files: first run
git merge-base HEAD main
to get the base SHA, then
git diff --name-only <base-sha>..HEAD
. Dispatch
code-simplifier:code-simplifier
on the full changeset. If changes made, re-run tests -- revert if they fail, commit if they pass. See
references/pre-merge-simplification.md
.
创建一个依赖于测试验证完成的“合并前代码简化”任务。获取变更文件:首先运行
git merge-base HEAD main
获取基准SHA,然后运行
git diff --name-only <base-sha>..HEAD
。对整个变更集调用
code-simplifier:code-simplifier
工具。如果有变更产生,重新运行测试——若测试失败则回退变更,若测试通过则提交变更。详见
references/pre-merge-simplification.md

Step 2: Determine Base Branch

步骤2:确定基准分支

bash
git merge-base HEAD main
If that fails, try
git merge-base HEAD master
instead.
Or ask: "This branch split from main - is that correct?"
bash
git merge-base HEAD main
如果该命令失败,尝试使用
git merge-base HEAD master
代替。
或者询问:“该分支是从main分支拆分出来的,是否正确?”

Step 3 Auto: Execute Pre-Chosen Strategy

步骤3 自动执行:执行预先选定的策略

If the epic has a
completion:*
label, execute automatically:
LabelAction
completion:commit-only
Verify clean tree. Done.
completion:push
Verify clean, push.
completion:push-pr
Push, create PR.
completion:merge-local
Merge to base locally.
Skip to Step 5 if applicable. See
references/completion-strategies.md
.
如果史诗带有
completion:*
标签,自动执行以下操作:
标签操作
completion:commit-only
验证工作区干净。操作完成。
completion:push
验证工作区干净,推送分支。
completion:push-pr
推送分支,创建Pull Request。
completion:merge-local
在本地合并到基准分支。
若适用则跳至步骤5。详见
references/completion-strategies.md

Step 3 Manual: Present Options

步骤3 手动选择:提供选项

If no
completion:*
label, present exactly 4 choices:
  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
Keep options concise. See
references/completion-strategies.md
.
如果没有
completion:*
标签,提供以下4个明确选项:
  1. 在本地合并回<基准分支>
  2. 推送分支并创建Pull Request
  3. 保留分支不变(我稍后再处理)
  4. 丢弃本次工作
选项描述需简洁。详见
references/completion-strategies.md

Step 4: Execute Chosen Option

步骤4:执行选定的选项

Execute the user's chosen option. Each option has specific bash commands and confirmation requirements. Option 4 (Discard) requires typed "discard" confirmation. See
references/option-workflows.md
.
执行用户选择的操作。每个选项都有对应的bash命令和确认要求。选项4(丢弃)需要用户输入“discard”进行确认。详见
references/option-workflows.md

Step 5: Cleanup Worktree

步骤5:清理工作区

Options 1, 2, 4: Check if in worktree (
git worktree list
), remove if yes. Option 3: Keep worktree. See
references/worktree-cleanup.md
.
选项1、2、4: 检查是否处于worktree中(运行
git worktree list
),若是则移除。 选项3: 保留worktree。详见
references/worktree-cleanup.md

Quick Reference

快速参考

OptionMergePushKeep WorktreeCleanup Branch
1. Merge locallyY--Y
2. Create PR-YY-
3. Keep as-is--Y-
4. Discard---Y (force)
选项合并推送保留Worktree清理分支
1. 本地合并--
2. 创建PR--
3. 保留不变---
4. 丢弃工作---是(强制)

Common Mistakes

常见错误

  • Skip test verification -> merge broken code. Always verify tests first.
  • Open-ended questions -> present exactly 4 options, not "what should I do?"
  • Auto-cleanup worktree -> only for Options 1 & 4, not 2 & 3.
  • No discard confirmation -> require typed "discard" before Option 4.
See
references/red-flags.md
for detailed Never/Always lists.
  • 跳过测试验证 -> 合并存在问题的代码。务必先验证测试。
  • 提出开放式问题 -> 必须提供恰好4个选项,而不是问“我该怎么做?”
  • 自动清理Worktree -> 仅适用于选项1和4,不适用于选项2和3。
  • 未要求丢弃确认 -> 在执行选项4前,必须要求用户输入“discard”进行确认。
详见
references/red-flags.md
中的详细“禁止/必须”列表。

Integration

集成说明

Called by: subagent-driven-development (Step 7), executing-plans (Step 5) Pairs with: using-git-worktrees (cleans up worktree created by that skill)
调用者: subagent-driven-development(步骤7)、executing-plans(步骤5) 搭配技能: using-git-worktrees(清理该技能创建的worktree)

Reference Files

参考文件

  • references/epic-verification.md
    : checking beads epic verification tasks
  • references/test-verification.md
    : task-tracked test verification protocol
  • references/pre-merge-simplification.md
    : code simplifier dispatch protocol
  • references/completion-strategies.md
    : auto/manual completion strategy details
  • references/option-workflows.md
    : execution details for all 4 options
  • references/worktree-cleanup.md
    : worktree cleanup procedures
  • references/red-flags.md
    : detailed red flags and common mistakes
<!-- compressed: 2026-02-11, original: 797 words, compressed: 679 words -->
  • references/epic-verification.md
    :检查beads史诗的验证任务
  • references/test-verification.md
    :任务追踪式测试验证协议
  • references/pre-merge-simplification.md
    :代码简化工具调用协议
  • references/completion-strategies.md
    :自动/手动完成策略详情
  • references/option-workflows.md
    :所有4个选项的执行详情
  • references/worktree-cleanup.md
    :Worktree清理流程
  • references/red-flags.md
    :详细的注意事项和常见错误
<!-- compressed: 2026-02-11, original: 797 words, compressed: 679 words -->