Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Add this skill
npx mdskills install sickn33/finishing-a-development-branchClear step-by-step workflow with structured options, test verification, and integration points
1---2name: finishing-a-development-branch3description: Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup4---56# Finishing a Development Branch78## Overview910Guide completion of development work by presenting clear options and handling chosen workflow.1112**Core principle:** Verify tests → Present options → Execute choice → Clean up.1314**Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."1516## The Process1718### Step 1: Verify Tests1920**Before presenting options, verify tests pass:**2122```bash23# Run project's test suite24npm test / cargo test / pytest / go test ./...25```2627**If tests fail:**28```29Tests failing (<N> failures). Must fix before completing:3031[Show failures]3233Cannot proceed with merge/PR until tests pass.34```3536Stop. Don't proceed to Step 2.3738**If tests pass:** Continue to Step 2.3940### Step 2: Determine Base Branch4142```bash43# Try common base branches44git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null45```4647Or ask: "This branch split from main - is that correct?"4849### Step 3: Present Options5051Present exactly these 4 options:5253```54Implementation complete. What would you like to do?55561. Merge back to <base-branch> locally572. Push and create a Pull Request583. Keep the branch as-is (I'll handle it later)594. Discard this work6061Which option?62```6364**Don't add explanation** - keep options concise.6566### Step 4: Execute Choice6768#### Option 1: Merge Locally6970```bash71# Switch to base branch72git checkout <base-branch>7374# Pull latest75git pull7677# Merge feature branch78git merge <feature-branch>7980# Verify tests on merged result81<test command>8283# If tests pass84git branch -d <feature-branch>85```8687Then: Cleanup worktree (Step 5)8889#### Option 2: Push and Create PR9091```bash92# Push branch93git push -u origin <feature-branch>9495# Create PR96gh pr create --title "<title>" --body "$(cat <<'EOF'97## Summary98<2-3 bullets of what changed>99100## Test Plan101- [ ] <verification steps>102EOF103)"104```105106Then: Cleanup worktree (Step 5)107108#### Option 3: Keep As-Is109110Report: "Keeping branch <name>. Worktree preserved at <path>."111112**Don't cleanup worktree.**113114#### Option 4: Discard115116**Confirm first:**117```118This will permanently delete:119- Branch <name>120- All commits: <commit-list>121- Worktree at <path>122123Type 'discard' to confirm.124```125126Wait for exact confirmation.127128If confirmed:129```bash130git checkout <base-branch>131git branch -D <feature-branch>132```133134Then: Cleanup worktree (Step 5)135136### Step 5: Cleanup Worktree137138**For Options 1, 2, 4:**139140Check if in worktree:141```bash142git worktree list | grep $(git branch --show-current)143```144145If yes:146```bash147git worktree remove <worktree-path>148```149150**For Option 3:** Keep worktree.151152## Quick Reference153154| Option | Merge | Push | Keep Worktree | Cleanup Branch |155|--------|-------|------|---------------|----------------|156| 1. Merge locally | ✓ | - | - | ✓ |157| 2. Create PR | - | ✓ | ✓ | - |158| 3. Keep as-is | - | - | ✓ | - |159| 4. Discard | - | - | - | ✓ (force) |160161## Common Mistakes162163**Skipping test verification**164- **Problem:** Merge broken code, create failing PR165- **Fix:** Always verify tests before offering options166167**Open-ended questions**168- **Problem:** "What should I do next?" → ambiguous169- **Fix:** Present exactly 4 structured options170171**Automatic worktree cleanup**172- **Problem:** Remove worktree when might need it (Option 2, 3)173- **Fix:** Only cleanup for Options 1 and 4174175**No confirmation for discard**176- **Problem:** Accidentally delete work177- **Fix:** Require typed "discard" confirmation178179## Red Flags180181**Never:**182- Proceed with failing tests183- Merge without verifying tests on result184- Delete work without confirmation185- Force-push without explicit request186187**Always:**188- Verify tests before offering options189- Present exactly 4 options190- Get typed confirmation for Option 4191- Clean up worktree for Options 1 & 4 only192193## Integration194195**Called by:**196- **subagent-driven-development** (Step 7) - After all tasks complete197- **executing-plans** (Step 5) - After all batches complete198199**Pairs with:**200- **using-git-worktrees** - Cleans up worktree created by that skill201
Full transparency — inspect the skill content before installing.