finishing-a-development-branch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFinishing a Development Branch
完成开发分支
Guard: Do NOT Use Mid-Epic
注意:切勿在史诗进行过程中使用
STOP. Before proceeding, check:
- Are you a subagent implementing a single task? -> This skill does NOT apply. Report your evidence and stop.
- Are there still open tasks in the epic? -> This skill does NOT apply. Only the orchestrator at COMPLETE state should invoke this.
- Is there an epic with a label? -> Read it and execute automatically (see Step 3 Auto below). No prompting needed.
completion:*
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.
停止操作。在继续之前,请检查:
- 你是否是负责执行单个任务的子Agent? -> 本技能不适用。提交你的工作证据并停止操作。
- 该史诗中是否仍有未完成的任务? -> 本技能不适用。只有处于COMPLETE状态的协调者才能调用本技能。
- 该史诗是否带有标签? -> 阅读标签内容并自动执行(见下方步骤3 自动执行)。无需额外提示。
completion:*
本技能仅适用于: 所有工作完成后的最终整合步骤。只要还有任何一个任务未完成,就不要调用本技能。
The Process
操作流程
Step 0: Check Epic Verification Tasks (If Applicable)
步骤0:检查史诗验证任务(如适用)
Skip if not working on a beads epic. Otherwise, run and check for verification tasks. Three outcomes: open verification tasks (STOP), no verification tasks/legacy (WARNING, proceed), all closed (proceed). See .
bd list --parent <epic-id>references/epic-verification.md如果不是处理beads类型的史诗则跳过。否则,运行并检查验证任务。有三种结果:存在未完成的验证任务(停止操作)、无验证任务/属于旧版(发出警告,继续操作)、所有验证任务已完成(继续操作)。详见。
bd list --parent <epic-id>references/epic-verification.mdStep 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.mdStep 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 to get the base SHA, then . Dispatch on the full changeset. If changes made, re-run tests -- revert if they fail, commit if they pass. See .
git merge-base HEAD maingit diff --name-only <base-sha>..HEADcode-simplifier:code-simplifierreferences/pre-merge-simplification.md创建一个依赖于测试验证完成的“合并前代码简化”任务。获取变更文件:首先运行获取基准SHA,然后运行。对整个变更集调用工具。如果有变更产生,重新运行测试——若测试失败则回退变更,若测试通过则提交变更。详见。
git merge-base HEAD maingit diff --name-only <base-sha>..HEADcode-simplifier:code-simplifierreferences/pre-merge-simplification.mdStep 2: Determine Base Branch
步骤2:确定基准分支
bash
git merge-base HEAD mainIf that fails, try instead.
git merge-base HEAD masterOr 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 label, execute automatically:
completion:*| Label | Action |
|---|---|
| Verify clean tree. Done. |
| Verify clean, push. |
| Push, create PR. |
| Merge to base locally. |
Skip to Step 5 if applicable. See .
references/completion-strategies.md如果史诗带有标签,自动执行以下操作:
completion:*| 标签 | 操作 |
|---|---|
| 验证工作区干净。操作完成。 |
| 验证工作区干净,推送分支。 |
| 推送分支,创建Pull Request。 |
| 在本地合并到基准分支。 |
若适用则跳至步骤5。详见。
references/completion-strategies.mdStep 3 Manual: Present Options
步骤3 手动选择:提供选项
If no label, present exactly 4 choices:
completion:*- Merge back to <base-branch> locally
- Push and create a Pull Request
- Keep the branch as-is (I'll handle it later)
- Discard this work
Keep options concise. See .
references/completion-strategies.md如果没有标签,提供以下4个明确选项:
completion:*- 在本地合并回<基准分支>
- 推送分支并创建Pull Request
- 保留分支不变(我稍后再处理)
- 丢弃本次工作
选项描述需简洁。详见。
references/completion-strategies.mdStep 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.mdStep 5: Cleanup Worktree
步骤5:清理工作区
Options 1, 2, 4: Check if in worktree (), remove if yes.
Option 3: Keep worktree. See .
git worktree listreferences/worktree-cleanup.md选项1、2、4: 检查是否处于worktree中(运行),若是则移除。
选项3: 保留worktree。详见。
git worktree listreferences/worktree-cleanup.mdQuick Reference
快速参考
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | Y | - | - | Y |
| 2. Create PR | - | Y | Y | - |
| 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 for detailed Never/Always lists.
references/red-flags.md- 跳过测试验证 -> 合并存在问题的代码。务必先验证测试。
- 提出开放式问题 -> 必须提供恰好4个选项,而不是问“我该怎么做?”
- 自动清理Worktree -> 仅适用于选项1和4,不适用于选项2和3。
- 未要求丢弃确认 -> 在执行选项4前,必须要求用户输入“discard”进行确认。
详见中的详细“禁止/必须”列表。
references/red-flags.mdIntegration
集成说明
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
参考文件
- : checking beads epic verification tasks
references/epic-verification.md - : task-tracked test verification protocol
references/test-verification.md - : code simplifier dispatch protocol
references/pre-merge-simplification.md - : auto/manual completion strategy details
references/completion-strategies.md - : execution details for all 4 options
references/option-workflows.md - : worktree cleanup procedures
references/worktree-cleanup.md - : detailed red flags and common mistakes
references/red-flags.md
- :检查beads史诗的验证任务
references/epic-verification.md - :任务追踪式测试验证协议
references/test-verification.md - :代码简化工具调用协议
references/pre-merge-simplification.md - :自动/手动完成策略详情
references/completion-strategies.md - :所有4个选项的执行详情
references/option-workflows.md - :Worktree清理流程
references/worktree-cleanup.md - :详细的注意事项和常见错误
references/red-flags.md