| name | finalizing |
| description | Complete work with merge, PR, or cleanup options. |
Finalizing
Announce at start: "I'm applying the finalizing skill to wrap up this branch."
Sequence
Verify tests -> Resolve base branch -> Present options -> Execute -> Clean up worktree.
Step 1: Verify Tests
Run the project's test suite. If tests fail, stop. Report failures and do not offer completion options until they pass.
Step 2: Resolve Base Branch
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
If ambiguous, confirm with the user: "This branch diverged from main — correct?"
Step 3: Present Options
Show exactly these four choices:
Implementation complete. How should this land?
1. Merge into <base-branch> locally
2. Push and open a Pull Request
3. Leave the branch as-is (I'll handle it)
4. Discard this work entirely
No elaboration. Wait for selection.
Step 4: Execute
Option 1 — Local Merge
git checkout <base-branch>
git pull
git merge <feature-branch>
git branch -d <feature-branch>
If post-merge tests fail, abort the merge and report.
Option 2 — Push + PR
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<2-3 bullets>
## Test Plan
- [ ] <verification steps>
EOF
)"
Option 3 — Keep As-Is
Report the branch name and worktree path. Do not clean up anything.
Option 4 — Discard
Require explicit confirmation before destroying work:
This permanently deletes:
- Branch <name> and all its commits
- Worktree at <path>
Type 'discard' to confirm.
Wait for the exact word. Then:
git checkout <base-branch>
git branch -D <feature-branch>
Step 5: Worktree Cleanup
| Option | Remove Worktree? |
|---|
| 1 — Merge | Yes |
| 2 — PR | Yes |
| 3 — Keep | No |
| 4 — Discard | Yes |
git worktree list
git worktree remove <worktree-path>
For Option 2, remove the worktree after pushing — the branch lives on the remote now.
Gotchas
- Merging without re-testing — The merge commit can introduce failures even if both branches passed independently. Always run tests on the merged result before considering it done.
- Auto-cleaning Option 3 worktrees — If the user chose "keep," they want it preserved. Do not remove the worktree.
- Discarding without confirmation — Deleted branches with unpushed commits are unrecoverable (absent reflog diving). The typed confirmation exists for a reason.
- Force-pushing during PR creation — Never force-push unless the user explicitly requests it. A regular push is always the default.
- Forgetting to pull before merge — Merging into a stale base branch creates unnecessary merge commits or conflicts. Always pull first.
Integration
Called by:
- orchestrating (Step 7) — after all subagent tasks complete
- executing (Step 5) — after all plan batches complete
Pairs with:
- isolating — this skill cleans up what isolating created