Complete Development Branch
Overview
Guides the completion of development work by providing clear options and handling the selected workflow.
Core Principles: Verify Tests → Present Options → Execute Selection → Cleanup.
Announce at start: "I am using the Complete Development Branch skill to finish this work."
Process
Step 1: Verify Tests
Verify tests pass before offering options:
bash
# 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. Do not proceed to Step 2.
If tests pass: Proceed to Step 2.
Step 2: Identify Base Branch
bash
# Try common base branches
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
Alternatively ask: "This branch was branched off <base-branch> - is that correct?"
Step 3: Present Options
Present these 4 options exactly:
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?
Do NOT add explanations - keep options concise.
Step 4: Execute Selection
Option 1: Merge Locally
bash
# 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: Clean up worktree (Step 5)
Option 2: Push and Create Pull Request
bash
# 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: Clean up worktree (Step 5)
Option 3: Keep As-Is
Report: "Branch <name> retained. Worktree remains at <path>."
Do NOT clean up worktree.
Option 4: Discard
First confirm:
This will permanently delete:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>
Type 'discard' to confirm.
Wait for explicit confirmation.
If confirmed:
bash
git checkout <base-branch>
git branch -D <feature-branch>
Then: Clean up worktree (Step 5)
Step 5: Clean Up Worktree
For Options 1, 2, 4:
Check if in worktree:
bash
git worktree list | grep $(git branch --show-current)
If yes:
bash
git worktree remove <worktree-path>
For Option 3: Keep worktree.
Quick Reference
| Option | Merge | Push | Keep Worktree | Clean Up Branch |
|---|
| 1. Merge Locally | ✓ | - | - | ✓ |
| 2. Create PR | - | ✓ | ✓ | - |
| 3. Keep As-Is | - | - | ✓ | - |
| 4. Discard | - | - | - | ✓ (force) |
Common Mistakes
Skipping Test Verification
- Problem: Merging broken code, creating failing PRs
- Fix: Always verify tests before offering options
Open-Ended Questions
- Problem: "What should I do next?" → Ambiguous
- Fix: Present exactly 4 structured options
Automatic Worktree Cleanup
- Problem: Deleting worktree when it might be needed (Options 2, 3)
- Fix: Only clean up for Options 1 and 4
No Confirmation for Discard
- Problem: Accidentally deleting work
- Fix: Require 'discard' input confirmation
Red Flags
Never:
- Proceed with failing tests
- Merge without verifying post-merge tests
- Delete work without confirmation
- Force push without explicit request
Always:
- Verify tests before offering options
- Give exactly 4 options
- Get typed confirmation for Option 4
- Only clean up worktrees for Options 1 and 4
Integration
Callers:
- Sub-Agent Driven Development (Step 7) - After all tasks are complete
- Execute Plan (Step 5) - After all batches are complete
Works With:
- using-git-worktrees - Worktrees created via this skill are cleaned up