@nst173/superpowers-ccg 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/.agent/skills/brainstorming/SKILL.md +26 -0
  2. package/.agent/skills/coordinating-multi-model-work/SKILL.md +29 -0
  3. package/.agent/skills/executing-plans/SKILL.md +27 -0
  4. package/.agent/skills/using-superpowers/SKILL.md +29 -0
  5. package/.agent/skills/verifying-before-completion/SKILL.md +20 -0
  6. package/.agent/skills/writing-plans/SKILL.md +29 -0
  7. package/.cursor/agents/code-reviewer.md +22 -0
  8. package/.cursor/commands/brainstorm.md +11 -0
  9. package/.cursor/commands/execute-plan.md +12 -0
  10. package/.cursor/commands/write-plan.md +11 -0
  11. package/.cursor/hook-scripts/after-file-edit.mjs +3 -0
  12. package/.cursor/hook-scripts/before-shell-execution.mjs +3 -0
  13. package/.cursor/hook-scripts/session-end.mjs +3 -0
  14. package/.cursor/hooks.json +21 -0
  15. package/.cursor/mcp.json +20 -0
  16. package/.cursor/rules/checkpoint-protocol.mdc +11 -0
  17. package/.cursor/rules/orchestrator-routing.mdc +12 -0
  18. package/.cursor/rules/token-discipline.mdc +12 -0
  19. package/.cursor/skills/brainstorming/SKILL.md +26 -0
  20. package/.cursor/skills/coordinating-multi-model-work/SKILL.md +29 -0
  21. package/.cursor/skills/executing-plans/SKILL.md +27 -0
  22. package/.cursor/skills/using-superpowers/SKILL.md +29 -0
  23. package/.cursor/skills/verifying-before-completion/SKILL.md +20 -0
  24. package/.cursor/skills/writing-plans/SKILL.md +29 -0
  25. package/AGENTS.md +23 -0
  26. package/CLAUDE.md +78 -0
  27. package/GEMINI.md +27 -0
  28. package/LICENSE +21 -0
  29. package/README.md +171 -0
  30. package/agents/code-reviewer.md +54 -0
  31. package/cli/superpowers-ccg.mjs +8 -0
  32. package/commands/brainstorm.md +6 -0
  33. package/commands/execute-plan.md +6 -0
  34. package/commands/write-plan.md +6 -0
  35. package/config/antigravity/mcp_config.example.json +26 -0
  36. package/hooks/hooks.json +37 -0
  37. package/hooks/pre-tool-use-task.sh +4 -0
  38. package/hooks/run-hook.cmd +19 -0
  39. package/hooks/session-start.sh +72 -0
  40. package/hooks/user-prompt-submit.sh +31 -0
  41. package/package.json +56 -0
  42. package/skills/EVALUATION.md +201 -0
  43. package/skills/brainstorming/SKILL.md +120 -0
  44. package/skills/coordinating-multi-model-work/GATE.md +36 -0
  45. package/skills/coordinating-multi-model-work/INTEGRATION.md +51 -0
  46. package/skills/coordinating-multi-model-work/SKILL.md +51 -0
  47. package/skills/coordinating-multi-model-work/checkpoints.md +31 -0
  48. package/skills/coordinating-multi-model-work/cross-validation.md +37 -0
  49. package/skills/coordinating-multi-model-work/prompts/codex-base.md +40 -0
  50. package/skills/coordinating-multi-model-work/prompts/gemini-base.md +41 -0
  51. package/skills/coordinating-multi-model-work/review-chain.md +25 -0
  52. package/skills/coordinating-multi-model-work/routing-decision.md +50 -0
  53. package/skills/debugging-systematically/CREATION-LOG.md +119 -0
  54. package/skills/debugging-systematically/SKILL.md +325 -0
  55. package/skills/debugging-systematically/condition-based-waiting-example.ts +158 -0
  56. package/skills/debugging-systematically/condition-based-waiting.md +115 -0
  57. package/skills/debugging-systematically/defense-in-depth.md +122 -0
  58. package/skills/debugging-systematically/find-polluter.sh +63 -0
  59. package/skills/debugging-systematically/root-cause-tracing.md +169 -0
  60. package/skills/debugging-systematically/test-academic.md +14 -0
  61. package/skills/debugging-systematically/test-pressure-1.md +58 -0
  62. package/skills/debugging-systematically/test-pressure-2.md +68 -0
  63. package/skills/debugging-systematically/test-pressure-3.md +69 -0
  64. package/skills/developing-with-subagents/SKILL.md +51 -0
  65. package/skills/developing-with-subagents/code-quality-reviewer-prompt.md +30 -0
  66. package/skills/developing-with-subagents/implementer-prompt.md +41 -0
  67. package/skills/developing-with-subagents/spec-reviewer-prompt.md +25 -0
  68. package/skills/dispatching-parallel-agents/SKILL.md +195 -0
  69. package/skills/executing-plans/SKILL.md +67 -0
  70. package/skills/finishing-development-branches/SKILL.md +208 -0
  71. package/skills/practicing-test-driven-development/SKILL.md +346 -0
  72. package/skills/practicing-test-driven-development/testing-anti-patterns.md +299 -0
  73. package/skills/receiving-code-review/SKILL.md +221 -0
  74. package/skills/requesting-code-review/SKILL.md +127 -0
  75. package/skills/requesting-code-review/code-reviewer.md +146 -0
  76. package/skills/shared/multi-model-integration-section.md +32 -0
  77. package/skills/shared/protocol-threshold.md +46 -0
  78. package/skills/shared/supplementary-tools.md +132 -0
  79. package/skills/shared/task-format-reference.md +83 -0
  80. package/skills/using-git-worktrees/SKILL.md +225 -0
  81. package/skills/using-superpowers/SKILL.md +101 -0
  82. package/skills/verifying-before-completion/SKILL.md +159 -0
  83. package/skills/writing-plans/SKILL.md +55 -0
  84. package/skills/writing-skills/CHECKLIST.md +92 -0
  85. package/skills/writing-skills/SKILL.md +111 -0
  86. package/skills/writing-skills/STRUCTURE.md +208 -0
  87. package/skills/writing-skills/TESTING.md +155 -0
  88. package/skills/writing-skills/anthropic-best-practices.md +1150 -0
  89. package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  90. package/skills/writing-skills/graphviz-conventions.dot +172 -0
  91. package/skills/writing-skills/persuasion-principles.md +187 -0
  92. package/skills/writing-skills/render-graphs.js +168 -0
  93. package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
  94. package/src/cli.mjs +165 -0
  95. package/src/constants.mjs +7 -0
  96. package/src/install.mjs +186 -0
  97. package/src/io.mjs +81 -0
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: developing-with-subagents
3
+ description: "Executes plans in the current session by dispatching one worker-owned task at a time with spec review and Opus review. Use when: you want same-session execution without turning the main thread into a long narrative log."
4
+ ---
5
+
6
+ # Subagent-Driven Development
7
+
8
+ ## Overview
9
+
10
+ Execute one bounded task at a time by routing it to Codex or Gemini, then review the resulting artifact.
11
+
12
+ ## Process
13
+
14
+ 1. Read the plan once.
15
+ 2. Extract the current bounded task only.
16
+ 3. Route that task to one worker.
17
+ 4. Reuse the same worker session for follow-up fixes on that task.
18
+ 5. Run spec review.
19
+ 6. Run Opus quality review.
20
+ 7. Mark the task complete.
21
+ 8. Move to the next bounded task.
22
+
23
+ ## Rules
24
+
25
+ - Keep the controller thread small.
26
+ - Do not accumulate rich summaries for every step.
27
+ - Do not ask workers for draft-only outputs.
28
+ - Ask workers for `diff-or-questions`.
29
+ - `CROSS_VALIDATION` is for unresolved design conflicts, not routine implementation.
30
+
31
+ ## Model Strategy
32
+
33
+ | Role | Model | Selection Rule |
34
+ | ---- | ----- | -------------- |
35
+ | Backend and systems implementation | Codex MCP (`mcp__codex__codex`) | CODEX routing |
36
+ | Frontend implementation | Gemini MCP (`mcp__gemini__gemini`) | GEMINI routing |
37
+ | Spec Reviewer | Opus | Always Opus |
38
+ | Quality Reviewer | Opus | Always Opus |
39
+
40
+ ## Checkpoints
41
+
42
+ - CP1 before dispatching the worker
43
+ - CP2 only when the current bounded task stalls
44
+ - CP3 after implementation, before completion
45
+
46
+ ## Integration
47
+
48
+ - `superpowers:writing-plans`
49
+ - `superpowers:requesting-code-review`
50
+ - `superpowers:finishing-development-branches`
51
+ - `superpowers:coordinating-multi-model-work`
@@ -0,0 +1,30 @@
1
+ # Code Quality Review (Opus)
2
+
3
+ Use this template when dispatching code review after spec compliance passes.
4
+
5
+ ## Review Selection
6
+
7
+ **Rule:** `Reviewer = Opus`
8
+
9
+ | Implementer | Reviewer |
10
+ |-------------|----------|
11
+ | Codex (`mcp__codex__codex`) | Opus subagent |
12
+ | Gemini (`mcp__gemini__gemini`) | Opus subagent |
13
+
14
+ ## Invocation
15
+
16
+ Dispatch an Opus subagent using `superpowers-ccg:code-reviewer` for every code-changing path.
17
+
18
+ ```text
19
+ 1. Log: `[Quality Review] Dispatching Opus reviewer`
20
+ 2. Dispatch Opus subagent using `superpowers-ccg:code-reviewer`
21
+ 3. Use BASE_SHA/HEAD_SHA and task context
22
+ 4. Include diff and original task spec
23
+ ```
24
+
25
+ ## Review Loop
26
+
27
+ - If Opus returns issues: implementer fixes, then re-submit to Opus
28
+ - Standard tasks: max 3 fix-review loops
29
+ - Critical tasks: escalate after repeated review loops
30
+ - If Opus approves: mark task complete
@@ -0,0 +1,41 @@
1
+ # Implementer Prompt Template
2
+
3
+ Use this template when dispatching a worker for one bounded task.
4
+
5
+ ```text
6
+ Task tool:
7
+ model: sonnet
8
+ description: "Implement Task N: [task name]"
9
+ prompt: |
10
+ You own one bounded implementation task.
11
+
12
+ ## Task
13
+ [FULL TEXT of the current bounded task only]
14
+
15
+ ## Files
16
+ [explicit file set]
17
+
18
+ ## Acceptance
19
+ [acceptance criteria]
20
+
21
+ ## Verify
22
+ [exact verify command]
23
+
24
+ ## Rules
25
+ - If anything is unclear, stop and ask questions before coding.
26
+ - Do not redesign the task.
27
+ - Do not produce a reference prototype.
28
+ - Return either:
29
+ 1. changed hunks and verification notes
30
+ 2. blocking questions
31
+
32
+ ## Report Format
33
+ ## DIFF
34
+ [changed hunks only]
35
+
36
+ ## VERIFY
37
+ [what you ran / what remains]
38
+
39
+ ## ISSUES
40
+ [blocking questions or residual risks]
41
+ ```
@@ -0,0 +1,25 @@
1
+ # Spec Compliance Reviewer Prompt Template
2
+
3
+ Use this template when dispatching the spec reviewer.
4
+
5
+ ```text
6
+ Task tool:
7
+ description: "Review spec compliance for Task N"
8
+ prompt: |
9
+ Verify whether the artifact matches the bounded task.
10
+
11
+ ## Requested
12
+ [FULL TEXT of bounded task requirements]
13
+
14
+ ## Artifact
15
+ [diff / files changed / commit SHA]
16
+
17
+ ## Rules
18
+ - Read the code, do not trust any summary.
19
+ - Check for missing scope, extra scope, or wrong interpretation.
20
+ - Keep the output concise.
21
+
22
+ ## Output
23
+ - ✅ Spec compliant
24
+ - ❌ Issues found: [specific missing/extra items with file:line]
25
+ ```
@@ -0,0 +1,195 @@
1
+ ---
2
+ name: dispatching-parallel-agents
3
+ description: "Dispatches multiple agents concurrently for independent problem domains. Use when: facing 2+ independent tasks, multiple unrelated failures, or parallel investigations needed. Keywords: parallel, concurrent, multiple agents, batch processing"
4
+ ---
5
+
6
+ # Dispatching Parallel Agents
7
+
8
+ ## Overview
9
+
10
+ When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel.
11
+
12
+ **Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently.
13
+
14
+ ## When to Use
15
+
16
+ ```dot
17
+ digraph when_to_use {
18
+ "Multiple failures?" [shape=diamond];
19
+ "Are they independent?" [shape=diamond];
20
+ "Single agent investigates all" [shape=box];
21
+ "One agent per problem domain" [shape=box];
22
+ "Can they work in parallel?" [shape=diamond];
23
+ "Sequential agents" [shape=box];
24
+ "Parallel dispatch" [shape=box];
25
+
26
+ "Multiple failures?" -> "Are they independent?" [label="yes"];
27
+ "Are they independent?" -> "Single agent investigates all" [label="no - related"];
28
+ "Are they independent?" -> "Can they work in parallel?" [label="yes"];
29
+ "Can they work in parallel?" -> "Parallel dispatch" [label="yes"];
30
+ "Can they work in parallel?" -> "Sequential agents" [label="no - shared state"];
31
+ }
32
+ ```
33
+
34
+ **Use when:**
35
+ - 3+ test files failing with different root causes
36
+ - Multiple subsystems broken independently
37
+ - Each problem can be understood without context from others
38
+ - No shared state between investigations
39
+
40
+ **Don't use when:**
41
+ - Failures are related (fix one might fix others)
42
+ - Need to understand full system state
43
+ - Agents would interfere with each other
44
+
45
+ ## The Pattern
46
+
47
+ ### 1. Identify Independent Domains
48
+
49
+ Group failures by what's broken:
50
+ - File A tests: Tool approval flow
51
+ - File B tests: Batch completion behavior
52
+ - File C tests: Abort functionality
53
+
54
+ Each domain is independent - fixing tool approval doesn't affect abort tests.
55
+
56
+ ### 2. Create Focused Agent Tasks
57
+
58
+ Each agent gets:
59
+ - **Specific scope:** One test file or subsystem
60
+ - **Clear goal:** Make these tests pass
61
+ - **Constraints:** Don't change other code
62
+ - **Expected output:** Summary of what you found and fixed
63
+
64
+ ### 3. Dispatch in Parallel
65
+
66
+ ```typescript
67
+ // In Claude Code / AI environment
68
+ Task("Fix agent-tool-abort.test.ts failures")
69
+ Task("Fix batch-completion-behavior.test.ts failures")
70
+ Task("Fix tool-approval-race-conditions.test.ts failures")
71
+ // All three run concurrently
72
+ ```
73
+
74
+ ### 3.1 Model Selection for Parallel Agents
75
+
76
+ | Task Type | Model |
77
+ |-----------|-------|
78
+ | Code fixes, implementations | `model: sonnet` |
79
+ | Architecture review | Opus (default) |
80
+ | Codebase exploration | `model: haiku` |
81
+
82
+ ```typescript
83
+ // Sonnet for code, Haiku for search, Opus for review
84
+ Task("Fix test failures", model: "sonnet")
85
+ Task("Find deprecated API usages", model: "haiku")
86
+ Task("Review architecture") // Opus default
87
+ ```
88
+
89
+ ### 4. Review and Integrate
90
+
91
+ When agents return:
92
+ - Read each summary
93
+ - Verify fixes don't conflict
94
+ - Run full test suite
95
+ - Integrate all changes
96
+
97
+ ## Agent Prompt Structure
98
+
99
+ Good agent prompts are:
100
+ 1. **Focused** - One clear problem domain
101
+ 2. **Self-contained** - All context needed to understand the problem
102
+ 3. **Specific about output** - What should the agent return?
103
+
104
+ ```markdown
105
+ Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
106
+
107
+ 1. "should abort tool with partial output capture" - expects 'interrupted at' in message
108
+ 2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
109
+ 3. "should properly track pendingToolCount" - expects 3 results but gets 0
110
+
111
+ These are timing/race condition issues. Your task:
112
+
113
+ 1. Read the test file and understand what each test verifies
114
+ 2. Identify root cause - timing issues or actual bugs?
115
+ 3. Fix by:
116
+ - Replacing arbitrary timeouts with event-based waiting
117
+ - Fixing bugs in abort implementation if found
118
+ - Adjusting test expectations if testing changed behavior
119
+
120
+ Do NOT just increase timeouts - find the real issue.
121
+
122
+ Return: Summary of what you found and what you fixed.
123
+ ```
124
+
125
+ ## Common Mistakes
126
+
127
+ **❌ Too broad:** "Fix all the tests" - agent gets lost
128
+ **✅ Specific:** "Fix agent-tool-abort.test.ts" - focused scope
129
+
130
+ **❌ No context:** "Fix the race condition" - agent doesn't know where
131
+ **✅ Context:** Paste the error messages and test names
132
+
133
+ **❌ No constraints:** Agent might refactor everything
134
+ **✅ Constraints:** "Do NOT change production code" or "Fix tests only"
135
+
136
+ **❌ Vague output:** "Fix it" - you don't know what changed
137
+ **✅ Specific:** "Return summary of root cause and changes"
138
+
139
+ ## When NOT to Use
140
+
141
+ **Related failures:** Fixing one might fix others - investigate together first
142
+ **Need full context:** Understanding requires seeing entire system
143
+ **Exploratory debugging:** You don't know what's broken yet
144
+ **Shared state:** Agents would interfere (editing same files, using same resources)
145
+
146
+ ## Real Example from Session
147
+
148
+ **Scenario:** 6 test failures across 3 files after major refactoring
149
+
150
+ **Failures:**
151
+ - agent-tool-abort.test.ts: 3 failures (timing issues)
152
+ - batch-completion-behavior.test.ts: 2 failures (tools not executing)
153
+ - tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)
154
+
155
+ **Decision:** Independent domains - abort logic separate from batch completion separate from race conditions
156
+
157
+ **Dispatch:**
158
+ ```
159
+ Agent 1 → Fix agent-tool-abort.test.ts
160
+ Agent 2 → Fix batch-completion-behavior.test.ts
161
+ Agent 3 → Fix tool-approval-race-conditions.test.ts
162
+ ```
163
+
164
+ **Results:**
165
+ - Agent 1: Replaced timeouts with event-based waiting
166
+ - Agent 2: Fixed event structure bug (threadId in wrong place)
167
+ - Agent 3: Added wait for async tool execution to complete
168
+
169
+ **Integration:** All fixes independent, no conflicts, full suite green
170
+
171
+ **Time saved:** 3 problems solved in parallel vs sequentially
172
+
173
+ ## Key Benefits
174
+
175
+ 1. **Parallelization** - Multiple investigations happen simultaneously
176
+ 2. **Focus** - Each agent has narrow scope, less context to track
177
+ 3. **Independence** - Agents don't interfere with each other
178
+ 4. **Speed** - 3 problems solved in time of 1
179
+
180
+ ## Verification
181
+
182
+ After agents return:
183
+ 1. **Review each summary** - Understand what changed
184
+ 2. **Check for conflicts** - Did agents edit same code?
185
+ 3. **Run full suite** - Verify all fixes work together
186
+ 4. **Spot check** - Agents can make systematic errors
187
+
188
+ ## Real-World Impact
189
+
190
+ From a real debugging session:
191
+ - 6 failures across 3 files
192
+ - 3 agents dispatched in parallel
193
+ - All investigations completed concurrently
194
+ - All fixes integrated successfully
195
+ - Zero conflicts between agent changes
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: executing-plans
3
+ description: "Executes written implementation plans one bounded task at a time with checkpoint and review gates. Use when: executing a plan in a dedicated session without letting the main thread accumulate unnecessary context."
4
+ ---
5
+
6
+ # Executing Plans
7
+
8
+ ## Overview
9
+
10
+ Load the plan, then execute exactly one active task at a time.
11
+
12
+ **Core principle:** one bounded task, one worker owner, one artifact, one review.
13
+
14
+ ## Process
15
+
16
+ ### Step 0: Load Persisted Tasks
17
+
18
+ 1. Call `TaskList`.
19
+ 2. Load `<plan-path>.tasks.json` if present.
20
+ 3. Resume from the first `pending` or `in_progress` task.
21
+
22
+ ### Step 1: Read the Plan Once
23
+
24
+ 1. Read the plan file once.
25
+ 2. Validate the next task only.
26
+ 3. Do not keep a running narrative for completed tasks in the main thread.
27
+
28
+ ### Step 2: Execute One Task
29
+
30
+ For the current task only:
31
+
32
+ 1. Mark it `in_progress`.
33
+ 2. Extract `verifyCommand`, `acceptanceCriteria`, and file set.
34
+ 3. Apply CP1.
35
+ 4. Route to one worker.
36
+ 5. Reuse that worker `SESSION_ID` only for fixes on the same task.
37
+ 6. Apply CP2 only if the task stalls.
38
+ 7. Run verification.
39
+ 8. Apply CP3 and run Opus review.
40
+ 9. Mark the task `completed`.
41
+ 10. Persist a tiny handoff summary to `.tasks.json` or project memory:
42
+ - task id
43
+ - worker used
44
+ - files changed
45
+ - verify command result
46
+ - open follow-ups
47
+
48
+ ### Step 3: Report Briefly
49
+
50
+ After each completed task:
51
+ - what changed
52
+ - verification result
53
+ - next task
54
+
55
+ Do not dump prior task history back into the session.
56
+
57
+ ## Rules
58
+
59
+ - Default to one active task, not batches of three.
60
+ - Do not ask a worker for a prototype that Claude will later rewrite.
61
+ - Do not re-explain the whole plan to the worker. Send only the current bounded task.
62
+ - Use `CROSS_VALIDATION` only when the current task cannot be narrowed to one owner.
63
+
64
+ ## Completion
65
+
66
+ After all tasks complete:
67
+ - use `superpowers:finishing-development-branches`
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: finishing-development-branches
3
+ description: "Guides completion of development work by presenting structured options for merge, PR, or cleanup. Use when: implementation is complete, all tests pass, ready to integrate work. Keywords: merge, PR, pull request, branch completion, integration"
4
+ ---
5
+
6
+ # Finishing a Development Branch
7
+
8
+ ## Contents
9
+ - [Overview](#overview)
10
+ - [The Process](#the-process)
11
+ - [Option 1: Direct Merge](#option-1-direct-merge)
12
+ - [Option 2: Pull Request](#option-2-pull-request)
13
+ - [Option 3: Cleanup Only](#option-3-cleanup-only)
14
+ - [Related Skills](#related-skills)
15
+
16
+ ## Overview
17
+
18
+ Guide completion of development work by presenting clear options and handling chosen workflow.
19
+
20
+ **Core principle:** Verify tests → Present options → Execute choice → Clean up.
21
+
22
+ **Announce at start:** "I'm using the finishing-development-branches skill to complete this work."
23
+
24
+ ## The Process
25
+
26
+ ### Step 1: Verify Tests
27
+
28
+ **Before presenting options, verify tests pass:**
29
+
30
+ ```bash
31
+ # Run project's test suite
32
+ npm test / cargo test / pytest / go test ./...
33
+ ```
34
+
35
+ **If tests fail:**
36
+ ```
37
+ Tests failing (<N> failures). Must fix before completing:
38
+
39
+ [Show failures]
40
+
41
+ Cannot proceed with merge/PR until tests pass.
42
+ ```
43
+
44
+ Stop. Don't proceed to Step 2.
45
+
46
+ **If tests pass:** Continue to Step 2.
47
+
48
+ ### Step 2: Determine Base Branch
49
+
50
+ ```bash
51
+ # Try common base branches
52
+ git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
53
+ ```
54
+
55
+ Or ask: "This branch split from main - is that correct?"
56
+
57
+ ### Step 3: Present Options
58
+
59
+ Present exactly these 4 options:
60
+
61
+ ```
62
+ Implementation complete. What would you like to do?
63
+
64
+ 1. Merge back to <base-branch> locally
65
+ 2. Push and create a Pull Request
66
+ 3. Keep the branch as-is (I'll handle it later)
67
+ 4. Discard this work
68
+
69
+ Which option?
70
+ ```
71
+
72
+ **Don't add explanation** - keep options concise.
73
+
74
+ ### Step 4: Execute Choice
75
+
76
+ #### Option 1: Merge Locally
77
+
78
+ ```bash
79
+ # Switch to base branch
80
+ git checkout <base-branch>
81
+
82
+ # Pull latest
83
+ git pull
84
+
85
+ # Merge feature branch
86
+ git merge <feature-branch>
87
+
88
+ # Verify tests on merged result
89
+ <test command>
90
+
91
+ # If tests pass
92
+ git branch -d <feature-branch>
93
+ ```
94
+
95
+ Then: Cleanup worktree (Step 5)
96
+
97
+ #### Option 2: Push and Create PR
98
+
99
+ ```bash
100
+ # Push branch
101
+ git push -u origin <feature-branch>
102
+
103
+ # Create PR
104
+ gh pr create --title "<title>" --body "$(cat <<'EOF'
105
+ ## Summary
106
+ <2-3 bullets of what changed>
107
+
108
+ ## Test Plan
109
+ - [ ] <verification steps>
110
+ EOF
111
+ )"
112
+ ```
113
+
114
+ Then: Cleanup worktree (Step 5)
115
+
116
+ #### Option 3: Keep As-Is
117
+
118
+ Report: "Keeping branch <name>. Worktree preserved at <path>."
119
+
120
+ **Don't cleanup worktree.**
121
+
122
+ #### Option 4: Discard
123
+
124
+ **Confirm first:**
125
+ ```
126
+ This will permanently delete:
127
+ - Branch <name>
128
+ - All commits: <commit-list>
129
+ - Worktree at <path>
130
+
131
+ Type 'discard' to confirm.
132
+ ```
133
+
134
+ Wait for exact confirmation.
135
+
136
+ If confirmed:
137
+ ```bash
138
+ git checkout <base-branch>
139
+ git branch -D <feature-branch>
140
+ ```
141
+
142
+ Then: Cleanup worktree (Step 5)
143
+
144
+ ### Step 5: Cleanup Worktree
145
+
146
+ **For Options 1, 2, 4:**
147
+
148
+ Check if in worktree:
149
+ ```bash
150
+ git worktree list | grep $(git branch --show-current)
151
+ ```
152
+
153
+ If yes:
154
+ ```bash
155
+ git worktree remove <worktree-path>
156
+ ```
157
+
158
+ **For Option 3:** Keep worktree.
159
+
160
+ ## Quick Reference
161
+
162
+ | Option | Merge | Push | Keep Worktree | Cleanup Branch |
163
+ |--------|-------|------|---------------|----------------|
164
+ | 1. Merge locally | ✓ | - | - | ✓ |
165
+ | 2. Create PR | - | ✓ | ✓ | - |
166
+ | 3. Keep as-is | - | - | ✓ | - |
167
+ | 4. Discard | - | - | - | ✓ (force) |
168
+
169
+ ## Common Mistakes
170
+
171
+ **Skipping test verification**
172
+ - **Problem:** Merge broken code, create failing PR
173
+ - **Fix:** Always verify tests before offering options
174
+
175
+ **Open-ended questions**
176
+ - **Problem:** "What should I do next?" → ambiguous
177
+ - **Fix:** Present exactly 4 structured options
178
+
179
+ **Automatic worktree cleanup**
180
+ - **Problem:** Remove worktree when might need it (Option 2, 3)
181
+ - **Fix:** Only cleanup for Options 1 and 4
182
+
183
+ **No confirmation for discard**
184
+ - **Problem:** Accidentally delete work
185
+ - **Fix:** Require typed "discard" confirmation
186
+
187
+ ## Red Flags
188
+
189
+ **Never:**
190
+ - Proceed with failing tests
191
+ - Merge without verifying tests on result
192
+ - Delete work without confirmation
193
+ - Force-push without explicit request
194
+
195
+ **Always:**
196
+ - Verify tests before offering options
197
+ - Present exactly 4 options
198
+ - Get typed confirmation for Option 4
199
+ - Clean up worktree for Options 1 & 4 only
200
+
201
+ ## Integration
202
+
203
+ **Called by:**
204
+ - **developing-with-subagents** (Step 7) - After all tasks complete
205
+ - **executing-plans** (Step 5) - After all batches complete
206
+
207
+ **Pairs with:**
208
+ - **using-git-worktrees** - Cleans up worktree created by that skill