Branch completion workflow - guides merge/PR/cleanup decisions after implementation is verified complete.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
name: finishing-a-development-branch description: | Branch completion workflow - guides merge/PR/cleanup decisions after implementation is verified complete.
trigger: |
skip_when: |
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."
Run npm test / cargo test / pytest / go test ./... If tests fail: Show failures, stop. Cannot proceed until tests pass.
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
Present exactly these 4 options (no explanation):
| Option | Commands |
|---|---|
| 1. Merge Locally | git checkout <base> → git pull → git merge <feature> → verify tests → git branch -d <feature> → Cleanup worktree |
| 2. Create PR | git push -u origin <feature> → gh pr create --title "..." --body "## Summary..." → Cleanup worktree |
| 3. Keep As-Is | Report: "Keeping branch <name>. Worktree preserved at <path>." Don't cleanup. |
| 4. Discard | Confirm first: "Type 'discard' to confirm." → git checkout <base> → git branch -D <feature> → Cleanup worktree |
Options 1, 2, 4: git worktree list | grep $(git branch --show-current) → if in worktree: git worktree remove <path>
Option 3: Keep worktree.
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | ✓ | - | - | ✓ |
| 2. Create PR | - | ✓ | ✓ | - |
| 3. Keep as-is | - | - | ✓ | - |
| 4. Discard | - | - | - | ✓ (force) |
| Mistake | Problem | Fix |
|---|---|---|
| Skipping test verification | Merge broken code, create failing PR | Always verify tests before offering options |
| Open-ended questions | "What should I do next?" → ambiguous | Present exactly 4 structured options |
| Automatic worktree cleanup | Remove worktree when might need it | Only cleanup for Options 1 and 4 |
| No confirmation for discard | Accidentally delete work | Require typed "discard" confirmation |
Never:
Always:
Called by:
Pairs with: