| name | ship-branch |
| description | Verify, deliver, and close a completed branch. Trigger: When implementation is done and ready to ship or close out. |
| license | Apache 2.0 |
| metadata | {"version":"1.0","type":"behavioral","skills":["verification-protocol"]} |
Ship Branch
Structured close-out for a completed development branch. Verifies tests, presents exactly four delivery options, executes the chosen one, and cleans up.
When to Use
- Implementation on a feature/fix branch is complete
- Ready to deliver or close out the work
- After plan execution finishes
Don't use for:
- Mid-implementation work (use writing-plans or subagent-orchestration)
- Ongoing branches not ready for delivery
Critical Patterns
โ
REQUIRED [CRITICAL]: Verify Before Any Delivery Action
Tests must pass before presenting delivery options. Never proceed with failing tests.
# โ WRONG โ skip verification
Branch is done. Pushing to origin.
# โ
CORRECT โ verify first
Ran: npm test โ 18/18 passed โ
Ran: npm run build โ dist/ created โ
Ready to present delivery options.
โ
REQUIRED [CRITICAL]: Present Exactly Four Options
Always present these four options โ no more, no fewer. Let the user decide.
Branch: feature/user-auth โ 18/18 tests passing โ
Delivery options:
1. Merge locally into main (no remote push)
2. Push branch + open PR
3. Keep branch as-is (do nothing)
4. Discard branch (delete all work)
โ
REQUIRED: Require Explicit "discard" Confirmation
Option 4 requires the user to type the word "discard" explicitly. Never delete work on a single confirmation click or ambiguous response.
# โ WRONG
User: "yeah go ahead"
Action: Deletes branch.
# โ
CORRECT
"Type 'discard' to confirm deletion of all work on this branch."
User: "discard"
Action: Deletes branch.
โ
REQUIRED: Clean Up Worktree After Delivery
After merge or discard, remove the worktree directory if one was used.
# After merge or discard:
git worktree remove .worktrees/feature-user-auth
# Verify:
ls .worktrees/ โ feature-user-auth no longer present โ
Decision Tree
Implementation complete?
โ Run full verification (tests + build)
โ Verification fails?
โ Stop. Report failures. Do not proceed to delivery.
Verification passes?
โ Present exactly 4 options: merge local / push+PR / keep / discard
User chooses option 1 (merge local)?
โ git checkout main โ git merge branch-name โ verify merge clean
User chooses option 2 (push + PR)?
โ git push origin branch-name โ open PR with summary of changes
User chooses option 3 (keep as-is)?
โ Do nothing. Confirm branch is preserved.
User chooses option 4 (discard)?
โ Require explicit "discard" typed โ delete branch โ clean up worktree
Worktree was used?
โ Remove worktree after option 1, 2, or 4.
Conventions
Delivery summary for PRs
When opening a PR (option 2), include:
- What was implemented (1-3 bullets)
- Tests added or modified
- Any known limitations or follow-up items
Branch naming in options
Always show the actual branch name in the options presentation so the user knows exactly what's being acted on.
Example
## Ship Branch: feature/password-reset
### Verification
Ran: npm test โ 24/24 passed โ
Ran: npm run lint โ 0 errors โ
Ran: npm run build โ dist/ created โ
### Delivery options
Branch: feature/password-reset
1. Merge locally into main
2. Push branch + open PR
3. Keep branch as-is
4. Discard branch (type "discard" to confirm)
---
[User selects option 2]
Pushed: git push origin feature/password-reset โ
PR opened: "Add password reset flow" โ 3 commits, 24 tests passing
Worktree removed: .worktrees/feature-password-reset โ
Edge Cases
Merge conflicts on option 1: Stop. Report conflicting files. Do not auto-resolve. Ask user how to proceed.
PR already exists: Notify user. Offer to update the existing PR or open a new one.
No worktree used: Skip cleanup step. Only clean up what was created.
Tests flaky on first run: Re-run once. If still failing, report as failing โ do not retry silently until green.
User types something other than "discard" for option 4: Treat as cancel. Return to options menu.