finishing-a-development-branch by obra/superpowers
npx skills add https://github.com/obra/superpowers --skill finishing-a-development-branch通过呈现清晰的选项和处理所选工作流,指导开发工作的完成。
核心原则: 验证测试 → 呈现选项 → 执行选择 → 清理。
开始时声明: "我正在使用完成开发分支技能来完成这项工作。"
在呈现选项之前,验证测试是否通过:
# 运行项目的测试套件
npm test / cargo test / pytest / go test ./...
如果测试失败:
测试失败(<N> 个失败)。完成前必须修复:
[显示失败详情]
在测试通过之前无法进行合并/PR。
停止。不要继续步骤 2。
如果测试通过: 继续步骤 2。
# 尝试常见的基础分支
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
或者询问:"此分支是从 main 分支分出来的 - 是否正确?"
准确呈现以下 4 个选项:
实现完成。您希望做什么?
1. 在本地合并回 <base-branch>
2. 推送并创建 Pull Request
3. 保持分支原样(我稍后处理)
4. 丢弃此工作
选择哪个选项?
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
不要添加解释 - 保持选项简洁。
# 切换到基础分支
git checkout <base-branch>
# 拉取最新代码
git pull
# 合并功能分支
git merge <feature-branch>
# 验证合并后的测试结果
<test command>
# 如果测试通过
git branch -d <feature-branch>
然后:清理工作树(步骤 5)
# 推送分支
git push -u origin <feature-branch>
# 创建 PR
gh pr create --title "<title>" --body "$(cat <<'EOF'
## 摘要
<2-3 个更改要点>
## 测试计划
- [ ] <验证步骤>
EOF
)"
然后:清理工作树(步骤 5)
报告:"保持分支 。工作树保留在 。"
不要清理工作树。
首先确认:
这将永久删除:
- 分支 <name>
- 所有提交:<commit-list>
- 位于 <path> 的工作树
输入 'discard' 以确认。
等待准确的确认。
如果确认:
git checkout <base-branch>
git branch -D <feature-branch>
然后:清理工作树(步骤 5)
对于选项 1, 2, 4:
检查是否在工作树中:
git worktree list | grep $(git branch --show-current)
如果是:
git worktree remove <worktree-path>
对于选项 3: 保留工作树。
| 选项 | 合并 | 推送 | 保留工作树 | 清理分支 |
|---|---|---|---|---|
| 1. 本地合并 | ✓ | - | - | ✓ |
| 2. 创建 PR | - | ✓ | ✓ | - |
| 3. 保持原样 | - | - | ✓ | - |
| 4. 丢弃 | - | - | - | ✓ (强制) |
跳过测试验证
开放式问题
自动清理工作树
丢弃时没有确认
切勿:
始终:
由以下调用:
与以下配对:
每周安装量
20.8K
仓库
GitHub 星标数
107.7K
首次出现
Jan 19, 2026
安全审计
安装于
opencode17.6K
codex17.1K
gemini-cli17.0K
github-copilot16.1K
cursor15.7K
amp15.0K
Guide completion of development work by presenting clear options and handling chosen workflow.
Core principle: Verify tests → Present options → Execute choice → Clean up.
Announce at start: "I'm using the finishing-a-development-branch skill to complete this work."
Before presenting options, verify tests pass:
# Run project's test suite
npm test / cargo test / pytest / go test ./...
If tests fail:
Tests failing (<N> failures). Must fix before completing:
[Show failures]
Cannot proceed with merge/PR until tests pass.
Stop. Don't proceed to Step 2.
If tests pass: Continue to Step 2.
# Try common base branches
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
Or ask: "This branch split from main - is that correct?"
Present exactly these 4 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)
4. Discard this work
Which option?
Don't add explanation - keep options concise.
# Switch to base branch
git checkout <base-branch>
# Pull latest
git pull
# Merge feature branch
git merge <feature-branch>
# Verify tests on merged result
<test command>
# If tests pass
git branch -d <feature-branch>
Then: Cleanup worktree (Step 5)
# Push branch
git push -u origin <feature-branch>
# Create PR
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<2-3 bullets of what changed>
## Test Plan
- [ ] <verification steps>
EOF
)"
Then: Cleanup worktree (Step 5)
Report: "Keeping branch . Worktree preserved at ."
Don't cleanup worktree.
Confirm first:
This will permanently delete:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>
Type 'discard' to confirm.
Wait for exact confirmation.
If confirmed:
git checkout <base-branch>
git branch -D <feature-branch>
Then: Cleanup worktree (Step 5)
For Options 1, 2, 4:
Check if in worktree:
git worktree list | grep $(git branch --show-current)
If yes:
git worktree remove <worktree-path>
For Option 3: Keep worktree.
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | ✓ | - | - | ✓ |
| 2. Create PR | - | ✓ | ✓ | - |
| 3. Keep as-is | - | - | ✓ | - |
| 4. Discard | - | - | - | ✓ (force) |
Skipping test verification
Open-ended questions
Automatic worktree cleanup
No confirmation for discard
Never:
Always:
Called by:
Pairs with:
Weekly Installs
20.8K
Repository
GitHub Stars
107.7K
First Seen
Jan 19, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode17.6K
codex17.1K
gemini-cli17.0K
github-copilot16.1K
cursor15.7K
amp15.0K
97,600 周安装