Use when implementation complete and tests pass - closes bd epic, presents integration options (merge/PR/keep/discard), executes choice
/plugin marketplace add withzombies/hyperpowers/plugin install withzombies-hyper@withzombies-hyperThis skill inherits all available tools. When active, it can use any tool Claude has access to.
<skill_overview> Close bd epic, verify tests pass, present 4 integration options, execute choice, cleanup worktree appropriately. </skill_overview>
<rigidity_level> LOW FREEDOM - Follow the 6-step process exactly. Present exactly 4 options. Never skip test verification. Must confirm before discarding. </rigidity_level>
<quick_reference>
| Step | Action | If Blocked |
|---|---|---|
| 1 | Close bd epic | Tasks still open → STOP |
| 2 | Verify tests pass (test-runner agent) | Tests fail → STOP |
| 3 | Determine base branch | Ask if needed |
| 4 | Present exactly 4 options | Wait for choice |
| 5 | Execute choice | Follow option workflow |
| 6 | Cleanup worktree (options 1,2,4 only) | Option 3 keeps worktree |
Options: 1=Merge locally, 2=PR, 3=Keep as-is, 4=Discard (confirm) </quick_reference>
<when_to_use>
Don't use for:
<the_process>
Announce: "I'm using hyperpowers:finishing-a-development-branch to complete this work."
Verify all tasks closed:
bd dep tree bd-1 # Show task tree
bd list --status open --parent bd-1 # Check for open tasks
If any tasks still open:
Cannot close epic bd-1: N tasks still open:
- bd-3: Task Name (status: in_progress)
- bd-5: Task Name (status: open)
Complete all tasks before finishing.
STOP. Do not proceed.
If all tasks closed:
bd close bd-1
IMPORTANT: Use hyperpowers:test-runner agent to avoid context pollution.
Dispatch hyperpowers:test-runner agent:
Run: cargo test
(or: npm test / pytest / go test ./...)
Agent returns summary + failures only.
If tests fail:
Tests failing (N failures). Must fix before completing:
[Show failures]
Cannot proceed until tests pass.
STOP. Do not proceed.
If tests pass: Continue to Step 3.
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
Or ask: "This branch split from main - is that correct?"
Present exactly these 4 options:
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 concise.
git checkout <base-branch>
git pull
git merge <feature-branch>
# Verify tests on merged result
Dispatch hyperpowers:test-runner: "Run: <test command>"
# If tests pass
git branch -d <feature-branch>
Then: Step 6 (cleanup worktree)
Get epic info:
bd show bd-1
bd dep tree bd-1
Create PR:
git push -u origin <feature-branch>
gh pr create --title "feat: <epic-name>" --body "$(cat <<'EOF'
## Epic
Closes bd-<N>: <Epic Title>
## Summary
<2-3 bullets from epic implementation>
## Tasks Completed
- bd-2: <Task Name>
- bd-3: <Task Name>
## Test Plan
- [ ] All tests passing
- [ ] <verification steps from epic>
EOF
)"
Then: Step 6 (cleanup worktree)
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 "discard" confirmation.
If confirmed:
git checkout <base-branch>
git branch -D <feature-branch>
Then: Step 6 (cleanup worktree)
For Options 1, 2, 4 only:
# Check if in worktree
git worktree list | grep $(git branch --show-current)
# If yes
git worktree remove <worktree-path>
For Option 3: Keep worktree (don't cleanup). </the_process>
<examples> <example> <scenario>Developer skips test verification before presenting options</scenario> <code> # Step 1: Epic closed ✓ bd close bd-1"Implementation complete. What would you like to do?
User selects Option 1
git checkout main git merge feature-branch
<why_it_fails>
# After closing epic
bd close bd-1 ✓
# MANDATORY: Verify tests BEFORE presenting options
Dispatch hyperpowers:test-runner agent: "Run: cargo test"
# Agent reports
"Test suite passed (127 tests, 0 failures, 2.3s)"
# NOW present options
"Implementation complete. What would you like to do?
1. Merge back to main locally
..."
What you gain:
git worktree remove ../feature-auth-worktree
git worktree add ../feature-auth-worktree feature-auth
<why_it_fails>
git push -u origin feature-auth
gh pr create --title "feat: Add OAuth" --body "..."
# Report PR created
"Pull request created: https://github.com/user/repo/pull/42
Keeping worktree at ../feature-auth-worktree for PR updates."
# NO worktree cleanup
# User can address PR feedback in same worktree
Cleanup happens later when:
What you gain:
git checkout main git branch -D feature-experimental git worktree remove ../feature-experimental-worktree
<why_it_fails>
User: "Discard this work"
"This will permanently delete:
- Branch feature-experimental
- All commits:
* a1b2c3d Add OAuth integration
* d4e5f6g Add rate limiting
* g7h8i9j Update tests
... (47 more commits)
- Worktree at ../feature-experimental-worktree
Type 'discard' to confirm."
# WAIT for exact confirmation
User types: "discard"
# NOW execute
git checkout main
git branch -D feature-experimental
git worktree remove ../feature-experimental-worktree
"Branch feature-experimental deleted."
What you gain:
<option_matrix>
| Option | Merge | Push | Keep Worktree | Cleanup Branch | Cleanup Worktree |
|---|---|---|---|---|---|
| 1. Merge locally | ✓ | - | - | ✓ | ✓ |
| 2. Create PR | - | ✓ | ✓ | - | - |
| 3. Keep as-is | - | - | ✓ | - | - |
| 4. Discard | - | - | - | ✓ (force) | ✓ |
| </option_matrix> |
<critical_rules>
All of these mean: STOP. Follow the process.
<verification_checklist> Before completing:
Can't check all boxes? Return to process and complete missing steps. </verification_checklist>
<integration> **This skill is called by:** - hyperpowers:review-implementation (final step after approval)Call chain:
hyperpowers:executing-plans → hyperpowers:review-implementation → hyperpowers:finishing-a-development-branch
↓
(if gaps found: STOP)
This skill calls:
CRITICAL: Never read .beads/issues.jsonl directly. Always use bd CLI commands.
</integration>
When stuck:
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.