帮助开发者规范完成开发分支收尾,支持合并、提 PR 或清理流程。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "Finishing a Development Branch" 技能: 1. 下载 https://raw.githubusercontent.com/obra/clank/main/skills/collaboration/finishing-a-development-branch/SKILL.md 2. 保存为 ~/.claude/skills/finishing-a-development-branch/SKILL.md 3. 装好后重载技能,告诉我可以用了
我已经完成 feature/login-refactor 分支开发。请给我一个安全的收尾流程:先检查工作区状态、同步主分支、处理可能的冲突,然后将分支合并到 main,并在最后删除本地和远程分支。请按步骤列出命令并说明每步作用。
一套清晰的 Git 收尾步骤,包含检查、同步、合并、冲突处理与分支清理命令说明。
我想结束 feature/payment-retry 分支,但不直接合并。请帮我整理一个适合发起 Pull Request 的收尾清单,包括提交整理、推送分支、补充变更说明、建议的 PR 标题和描述模板。
一个适合提交 PR 的完整清单,附带推荐命令、PR 标题和描述模板。
我在 experiment/cache-test 分支做了试验,现在决定不保留。请告诉我如何确认没有未保存改动、如何备份需要的提交,然后安全删除这个本地分支;如果远程也存在,请一起清理。
一个安全的废弃分支清理方案,涵盖检查改动、备份提交和删除本地远程分支。
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 <name>. Worktree preserved at <path>."
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:
先用伪代码梳理方案与迭代思路,再高效转成可执行代码。
帮助开发者用早返回或表驱动方式简化嵌套条件分支,提升代码可读性。
帮助你为变量选择清晰准确、易维护的命名,提升代码可读性。
帮助开发者保持类接口抽象一致,避免混杂序列化、持久化等无关职责。
帮助你撰写不过时的代码注释,聚焦做什么与为什么而非时序背景。
帮助用户检索过往 Claude Code 对话,快速找回事实、决策与上下文线索。
在开发分支完成并通过测试后,帮助选择合并、提 PR 或清理收尾方案。
在实现完成后协助提交代码、推送分支并发起拉取请求与自动审查。
帮助你创建、切换并检查代码分支,确保实现前遵循正确分支策略。
基于代码差异生成规范化 Git 提交信息,并支持按逻辑分组提交
将当前会话分支的修改合并回基础分支,便于整合开发成果。
帮助开发者在提交代码或生成 diff 时套用正确的提交前缀、审阅人和测试计划。