Verifies tests pass, then presents structured options to merge branch locally, push and create GitHub PR, keep as-is, or discard; executes choice and cleans up worktree.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codexai-agentic-workflow:codex-branch-finisherThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Verify tests → Present 4 options (merge, PR, keep, discard) → Execute choice → Clean up worktree. Never leave work in limbo.
Verify tests → Present 4 options (merge, PR, keep, discard) → Execute choice → Clean up worktree. Never leave work in limbo.
$codex-branch-finisher, $finish, or $finish-branch.codex-subagent-execution completes all tasks.codex-execution-quality-gate passes.codex-workflow-autopilot reaches ship mode.Announce at start: "I'm using codex-branch-finisher to complete this work."
NO COMPLETION WITHOUT TEST VERIFICATION
NO OPEN-ENDED "WHAT NEXT?" — PRESENT STRUCTURED OPTIONS
Before presenting options, verify tests pass:
# Bash
npm test # or: cargo test / pytest / go test ./...
# PowerShell
npm test # or equivalent for your stack
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: Continue to Step 2.
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
git merge-base HEAD main 2>$null; if ($LASTEXITCODE -ne 0) { git merge-base HEAD master 2>$null }
Or ask: "This branch split from main — is that correct?"
Present exactly these 4 options — no more, no less, no open-ended questions:
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?
Don't add explanation — keep options concise.
git checkout <base-branch>
git pull
git merge <feature-branch>
<test command> # Verify on merged result
git branch -d <feature-branch> # Only after merge success
Then: Cleanup worktree (Step 5).
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "## Summary
- <bullet 1>
- <bullet 2>
## Test Plan
- [ ] All tests pass
- [ ] Manual verification complete"
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "## Summary`n- <bullet 1>`n`n## Test Plan`n- [ ] All tests pass"
Then: Cleanup worktree (Step 5).
Report: "Keeping branch <name>. Worktree preserved at <path>."
Don't cleanup worktree.
Confirm first:
This will permanently delete:
- Branch <name>
- All commits: <commit-list>
- Worktree at <path>
Type 'discard' to confirm.
Wait for exact confirmation. Then:
git checkout <base-branch>
git branch -D <feature-branch>
Then: Cleanup worktree (Step 5).
For Options 1, 2, 4:
Check if in worktree:
git worktree list | grep $(git branch --show-current)
git worktree list | Select-String (git branch --show-current)
If yes:
git worktree remove <worktree-path>
For Option 3: Keep worktree.
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | ✓ | — | — | ✓ |
| 2. Create PR | — | ✓ | ✓ | — |
| 3. Keep as-is | — | — | ✓ | — |
| 4. Discard | — | — | — | ✓ (force) |
| Mistake | Fix |
|---|---|
| Skipping test verification | Always verify tests before offering options |
| Open-ended "What should I do?" | Present exactly 4 structured options |
| Auto worktree cleanup | Only cleanup for Options 1 and 4 |
| No confirmation for discard | Require typed "discard" confirmation |
| Force-push without explicit request | Never force-push unless user explicitly asks |
| Called By | When |
|---|---|
codex-subagent-execution | After all tasks complete |
codex-workflow-autopilot | After ship mode completes |
codex-execution-quality-gate | After gate passes |
| Direct invocation | $finish or $finish-branch |
| Pairs With | Purpose |
|---|---|
codex-git-worktrees | Cleans up worktree created by that skill |
codex-verification-discipline | Tests must PASS before presenting options |
--help first.npx claudepluginhub bang-isme/codexai---skillsCreates, edits, and verifies skills using a test-driven development approach with pressure scenarios and subagents.