$npx -y skills add jamditis/claude-skills-journalism --skill finishing-a-development-branchUse 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
| 1 | <!-- |
| 2 | Adapted from obra/superpowers finishing-a-development-branch skill (v5.0.7), |
| 3 | MIT-licensed, copyright 2025 Jesse Vincent. Modifications copyright 2026 Joe Amditis. |
| 4 | Pure consumer port — no research phase per the v0.2.0 architecture, since |
| 5 | branch finishing is a downstream wrap-up of work whose strategic decisions |
| 6 | were already made upstream. SKILL.md byte-identical to upstream after the |
| 7 | attribution block strip. |
| 8 | See CREDITS.md. |
| 9 | --> |
| 10 | |
| 11 | # Finishing a Development Branch |
| 12 | |
| 13 | ## Overview |
| 14 | |
| 15 | Guide completion of development work by presenting clear options and handling chosen workflow. |
| 16 | |
| 17 | **Core principle:** Verify tests → Present options → Execute choice → Clean up. |
| 18 | |
| 19 | **Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work." |
| 20 | |
| 21 | ## The Process |
| 22 | |
| 23 | ### Step 1: Verify Tests |
| 24 | |
| 25 | **Before presenting options, verify tests pass:** |
| 26 | |
| 27 | ```bash |
| 28 | # Run project's test suite |
| 29 | npm test / cargo test / pytest / go test ./... |
| 30 | ``` |
| 31 | |
| 32 | **If tests fail:** |
| 33 | ``` |
| 34 | Tests failing (<N> failures). Must fix before completing: |
| 35 | |
| 36 | [Show failures] |
| 37 | |
| 38 | Cannot proceed with merge/PR until tests pass. |
| 39 | ``` |
| 40 | |
| 41 | Stop. Don't proceed to Step 2. |
| 42 | |
| 43 | **If tests pass:** Continue to Step 2. |
| 44 | |
| 45 | ### Step 2: Determine Base Branch |
| 46 | |
| 47 | ```bash |
| 48 | # Try common base branches |
| 49 | git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null |
| 50 | ``` |
| 51 | |
| 52 | Or ask: "This branch split from main - is that correct?" |
| 53 | |
| 54 | ### Step 3: Present Options |
| 55 | |
| 56 | Present exactly these 4 options: |
| 57 | |
| 58 | ``` |
| 59 | Implementation complete. What would you like to do? |
| 60 | |
| 61 | 1. Merge back to <base-branch> locally |
| 62 | 2. Push and create a Pull Request |
| 63 | 3. Keep the branch as-is (I'll handle it later) |
| 64 | 4. Discard this work |
| 65 | |
| 66 | Which option? |
| 67 | ``` |
| 68 | |
| 69 | **Don't add explanation** - keep options concise. |
| 70 | |
| 71 | ### Step 4: Execute Choice |
| 72 | |
| 73 | #### Option 1: Merge Locally |
| 74 | |
| 75 | ```bash |
| 76 | # Switch to base branch |
| 77 | git checkout <base-branch> |
| 78 | |
| 79 | # Pull latest |
| 80 | git pull |
| 81 | |
| 82 | # Merge feature branch |
| 83 | git merge <feature-branch> |
| 84 | |
| 85 | # Verify tests on merged result |
| 86 | <test command> |
| 87 | |
| 88 | # If tests pass |
| 89 | git branch -d <feature-branch> |
| 90 | ``` |
| 91 | |
| 92 | Then: Cleanup worktree (Step 5) |
| 93 | |
| 94 | #### Option 2: Push and Create PR |
| 95 | |
| 96 | ```bash |
| 97 | # Push branch |
| 98 | git push -u origin <feature-branch> |
| 99 | |
| 100 | # Create PR |
| 101 | gh pr create --title "<title>" --body "$(cat <<'EOF' |
| 102 | ## Summary |
| 103 | <2-3 bullets of what changed> |
| 104 | |
| 105 | ## Test Plan |
| 106 | - [ ] <verification steps> |
| 107 | EOF |
| 108 | )" |
| 109 | ``` |
| 110 | |
| 111 | Then: Cleanup worktree (Step 5) |
| 112 | |
| 113 | #### Option 3: Keep As-Is |
| 114 | |
| 115 | Report: "Keeping branch <name>. Worktree preserved at <path>." |
| 116 | |
| 117 | **Don't cleanup worktree.** |
| 118 | |
| 119 | #### Option 4: Discard |
| 120 | |
| 121 | **Confirm first:** |
| 122 | ``` |
| 123 | This will permanently delete: |
| 124 | - Branch <name> |
| 125 | - All commits: <commit-list> |
| 126 | - Worktree at <path> |
| 127 | |
| 128 | Type 'discard' to confirm. |
| 129 | ``` |
| 130 | |
| 131 | Wait for exact confirmation. |
| 132 | |
| 133 | If confirmed: |
| 134 | ```bash |
| 135 | git checkout <base-branch> |
| 136 | git branch -D <feature-branch> |
| 137 | ``` |
| 138 | |
| 139 | Then: Cleanup worktree (Step 5) |
| 140 | |
| 141 | ### Step 5: Cleanup Worktree |
| 142 | |
| 143 | **For Options 1, 2, 4:** |
| 144 | |
| 145 | Check if in worktree: |
| 146 | ```bash |
| 147 | git worktree list | grep $(git branch --show-current) |
| 148 | ``` |
| 149 | |
| 150 | If yes: |
| 151 | ```bash |
| 152 | git worktree remove <worktree-path> |
| 153 | ``` |
| 154 | |
| 155 | **For Option 3:** Keep worktree. |
| 156 | |
| 157 | ## Quick Reference |
| 158 | |
| 159 | | Option | Merge | Push | Keep Worktree | Cleanup Branch | |
| 160 | |--------|-------|------|---------------|----------------| |
| 161 | | 1. Merge locally | ✓ | - | - | ✓ | |
| 162 | | 2. Create PR | - | ✓ | ✓ | - | |
| 163 | | 3. Keep as-is | - | - | ✓ | - | |
| 164 | | 4. Discard | - | - | - | ✓ (force) | |
| 165 | |
| 166 | ## Common Mistakes |
| 167 | |
| 168 | **Skipping test verification** |
| 169 | - **Problem:** Merge broken code, create failing PR |
| 170 | - **Fix:** Always verify tests before offering options |
| 171 | |
| 172 | **Open-ended questions** |
| 173 | - **Problem:** "What should I do next?" → ambiguous |
| 174 | - **Fix:** Present exactly 4 structured options |
| 175 | |
| 176 | **Automatic worktree cleanup** |
| 177 | - **Problem:** Remove worktree when might need it (Option 2, 3) |
| 178 | - **Fix:** Only cleanup for Options 1 and 4 |
| 179 | |
| 180 | **No confirmation for discard** |
| 181 | - **Problem:** Accidentally delete work |
| 182 | - **Fix:** Require typed "discard" confirmation |
| 183 | |
| 184 | ## Red Flags |
| 185 | |
| 186 | **Never:** |
| 187 | - Proceed with failing tests |
| 188 | - Merge without verifying tests on result |
| 189 | - Delete work without confirmation |
| 190 | - Force-push without explicit request |
| 191 | |
| 192 | **Always:** |
| 193 | - Verify tests before offering options |
| 194 | - Present exactly 4 options |
| 195 | - Get typed confirmation for Option 4 |
| 196 | - Clean up worktree for Options 1 & 4 only |
| 197 | |
| 198 | ## Integration |
| 199 | |
| 200 | **Called by:** |
| 201 | - **subagent-driven-development** (Step 7) - After all tasks complete |
| 202 | - **executing-plans** (Step 5) - After all batches complete |
| 203 | |
| 204 | **Pairs with:** |
| 205 | - **using-git-worktrees** - Cleans up worktree created by that skill |