finishing-a-branch
Use when implementation is complete and all tests pass — guides branch completion by presenting structured options for merge, PR, or cleanup.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when implementation is complete and all tests pass — guides branch completion by presenting structured options for merge, PR, or cleanup.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use before any creative work — features, components, changes, or modifications. Guides structured design through collaborative dialogue before implementation. Triggers: "brainstorm", "design", "think through", "explore approaches", ambiguous requests, or requests with multiple valid interpretations.
Use after a problem has been solved and the solution verified working — captures the lesson as categorized documentation in docs/solutions/ with YAML frontmatter so future sessions can find it. Triggers: "compound", "capture learning", "document solution", "that worked", "it's fixed", "working now", "problem solved", "that did it", "doc-fix".
Use for extended multi-agent review with 14+ agents including conditional and language-specific reviewers. Appropriate for large changes, architectural shifts, migrations, or when standard review is not thorough enough. Triggers: "deep review", "thorough review", "full review", "extended review", "review everything", "maximum coverage".
Use to review brainstorm or plan documents before proceeding to the next workflow step. Applies structured self-review for completeness, clarity, consistency, feasibility, and YAGNI.
Use when performing multi-agent code review after implementing features, before merging, or when reviewing PRs. Runs 5 core review agents in parallel plus a learnings researcher. Produces prioritized findings (P1/P2/P3) with todo files for tracking and resolution. Triggers: "review", "code review", "check before merge", "review PR", "run reviewers", "catch issues".
Enhance an existing plan with parallel research agents per section. Adds best practices, edge cases, code examples, and learnings references. Does not rewrite -- only enriches. Triggers: "deepen", "enhance plan", "add research to plan", or after initial planning when more depth is needed.
| name | finishing-a-branch |
| description | Use when implementation is complete and all tests pass — guides branch completion by presenting structured options for merge, PR, or cleanup. |
Core principle: Verify tests -> Present options -> Execute choice -> Clean up.
Invoke the flowstate:verification-before-completion skill. Run the full test suite. Read output. Confirm zero failures.
If tests fail: Stop. Report failures. Do NOT proceed to Step 2.
Use AskUserQuestion to present exactly these 4 options:
Implementation complete. All tests pass. 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?
Determine <base-branch> first:
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
git checkout <base-branch>
git pull
git merge <feature-branch>
# Verify tests on merged result
<test command>
# If tests pass
git branch -d <feature-branch>
See the requesting-code-review skill for what to include in the PR description.
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<what was built and why>
## Testing
<tests added, pass evidence, coverage summary>
## Post-Deploy Monitoring
<what to monitor, healthy signals, rollback triggers>
EOF
)"
Report the PR URL.
Report: "Keeping branch <name>. Worktree preserved at <path>."
Do NOT clean up worktree or branch.
Require typed confirmation. Show what will be deleted (branch, commits, worktree). Wait for exact "discard" confirmation, then:
git checkout <base-branch>
git branch -D <feature-branch>
Option 3 preserves the worktree. For all others:
git worktree list # check if in a worktree
git worktree remove <worktree-path> # if applicable
For Option 2 (PR created), ask: "Delete local feature branch, or keep it?"
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | yes | - | - | yes |
| 2. Create PR | - | yes | - | ask |
| 3. Keep as-is | - | - | yes | - |
| 4. Discard | - | - | - | yes (force) |