superpowers-mcp 4.3.2 → 5.1.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 (31) hide show
  1. package/README.md +8 -2
  2. package/README.zh-TW.md +8 -2
  3. package/out/server.js +12 -12
  4. package/package.json +1 -1
  5. package/skills/brainstorming/SKILL.md +79 -11
  6. package/skills/brainstorming/scripts/frame-template.html +1 -1
  7. package/skills/brainstorming/scripts/helper.js +3 -13
  8. package/skills/brainstorming/scripts/server.cjs +1 -1
  9. package/skills/brainstorming/scripts/start-server.sh +1 -1
  10. package/skills/brainstorming/scripts/stop-server.sh +1 -1
  11. package/skills/brainstorming/spec-document-reviewer-prompt.md +1 -1
  12. package/skills/brainstorming/visual-companion.md +1 -1
  13. package/skills/dispatching-parallel-agents/SKILL.md +2 -0
  14. package/skills/executing-plans/SKILL.md +7 -21
  15. package/skills/finishing-a-development-branch/SKILL.md +93 -42
  16. package/skills/requesting-code-review/SKILL.md +8 -10
  17. package/skills/requesting-code-review/code-reviewer.md +107 -85
  18. package/skills/subagent-driven-development/SKILL.md +39 -2
  19. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +8 -3
  20. package/skills/subagent-driven-development/implementer-prompt.md +36 -1
  21. package/skills/systematic-debugging/CREATION-LOG.md +1 -1
  22. package/skills/systematic-debugging/root-cause-tracing.md +1 -1
  23. package/skills/using-git-worktrees/SKILL.md +95 -98
  24. package/skills/using-superpowers/SKILL.md +22 -0
  25. package/skills/using-superpowers/references/codex-tools.md +59 -0
  26. package/skills/using-superpowers/references/copilot-tools.md +42 -0
  27. package/skills/using-superpowers/references/gemini-tools.md +51 -0
  28. package/skills/writing-plans/SKILL.md +54 -18
  29. package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  30. package/skills/writing-skills/SKILL.md +2 -2
  31. package/skills/writing-skills/anthropic-best-practices.md +2 -2
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "superpowers-mcp",
3
3
  "displayName": "Superpowers MCP",
4
4
  "description": "Superpowers skills library (TDD, debugging, collaboration workflows) as an MCP server for VSCode and Antigravity",
5
- "version": "4.3.2",
5
+ "version": "5.1.0",
6
6
  "publisher": "superpowers",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -5,8 +5,6 @@ description: "You MUST use this before any creative work - creating features, bu
5
5
 
6
6
  # Brainstorming Ideas Into Designs
7
7
 
8
- ## Overview
9
-
10
8
  Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
11
9
 
12
10
  Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
@@ -24,31 +22,44 @@ Every project goes through this process. A todo list, a single-function utility,
24
22
  You MUST create a task for each of these items and complete them in order:
25
23
 
26
24
  1. **Explore project context** — check files, docs, recent commits
27
- 2. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
28
- 3. **Propose 2-3 approaches** — with trade-offs and your recommendation
29
- 4. **Present design** — in sections scaled to their complexity, get user approval after each section
30
- 5. **Write design doc** — save to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit
31
- 6. **Transition to implementation** — invoke writing-plans skill to create implementation plan
25
+ 2. **Offer visual companion** (if topic will involve visual questions) — this is its own message, not combined with a clarifying question. See the Visual Companion section below.
26
+ 3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
27
+ 4. **Propose 2-3 approaches** — with trade-offs and your recommendation
28
+ 5. **Present design** — in sections scaled to their complexity, get user approval after each section
29
+ 6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
30
+ 7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
31
+ 8. **User reviews written spec** — ask user to review the spec file before proceeding
32
+ 9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
32
33
 
33
34
  ## Process Flow
34
35
 
35
36
  ```dot
36
37
  digraph brainstorming {
37
38
  "Explore project context" [shape=box];
39
+ "Visual questions ahead?" [shape=diamond];
40
+ "Offer Visual Companion\n(own message, no other content)" [shape=box];
38
41
  "Ask clarifying questions" [shape=box];
39
42
  "Propose 2-3 approaches" [shape=box];
40
43
  "Present design sections" [shape=box];
41
44
  "User approves design?" [shape=diamond];
42
45
  "Write design doc" [shape=box];
46
+ "Spec self-review\n(fix inline)" [shape=box];
47
+ "User reviews spec?" [shape=diamond];
43
48
  "Invoke writing-plans skill" [shape=doublecircle];
44
49
 
45
- "Explore project context" -> "Ask clarifying questions";
50
+ "Explore project context" -> "Visual questions ahead?";
51
+ "Visual questions ahead?" -> "Offer Visual Companion\n(own message, no other content)" [label="yes"];
52
+ "Visual questions ahead?" -> "Ask clarifying questions" [label="no"];
53
+ "Offer Visual Companion\n(own message, no other content)" -> "Ask clarifying questions";
46
54
  "Ask clarifying questions" -> "Propose 2-3 approaches";
47
55
  "Propose 2-3 approaches" -> "Present design sections";
48
56
  "Present design sections" -> "User approves design?";
49
57
  "User approves design?" -> "Present design sections" [label="no, revise"];
50
58
  "User approves design?" -> "Write design doc" [label="yes"];
51
- "Write design doc" -> "Invoke writing-plans skill";
59
+ "Write design doc" -> "Spec self-review\n(fix inline)";
60
+ "Spec self-review\n(fix inline)" -> "User reviews spec?";
61
+ "User reviews spec?" -> "Write design doc" [label="changes requested"];
62
+ "User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
52
63
  }
53
64
  ```
54
65
 
@@ -57,32 +68,70 @@ digraph brainstorming {
57
68
  ## The Process
58
69
 
59
70
  **Understanding the idea:**
71
+
60
72
  - Check out the current project state first (files, docs, recent commits)
61
- - Ask questions one at a time to refine the idea
73
+ - Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
74
+ - If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
75
+ - For appropriately-scoped projects, ask questions one at a time to refine the idea
62
76
  - Prefer multiple choice questions when possible, but open-ended is fine too
63
77
  - Only one question per message - if a topic needs more exploration, break it into multiple questions
64
78
  - Focus on understanding: purpose, constraints, success criteria
65
79
 
66
80
  **Exploring approaches:**
81
+
67
82
  - Propose 2-3 different approaches with trade-offs
68
83
  - Present options conversationally with your recommendation and reasoning
69
84
  - Lead with your recommended option and explain why
70
85
 
71
86
  **Presenting the design:**
87
+
72
88
  - Once you believe you understand what you're building, present the design
73
89
  - Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
74
90
  - Ask after each section whether it looks right so far
75
91
  - Cover: architecture, components, data flow, error handling, testing
76
92
  - Be ready to go back and clarify if something doesn't make sense
77
93
 
94
+ **Design for isolation and clarity:**
95
+
96
+ - Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
97
+ - For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
98
+ - Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
99
+ - Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
100
+
101
+ **Working in existing codebases:**
102
+
103
+ - Explore the current structure before proposing changes. Follow existing patterns.
104
+ - Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
105
+ - Don't propose unrelated refactoring. Stay focused on what serves the current goal.
106
+
78
107
  ## After the Design
79
108
 
80
109
  **Documentation:**
81
- - Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
110
+
111
+ - Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
112
+ - (User preferences for spec location override this default)
82
113
  - Use elements-of-style:writing-clearly-and-concisely skill if available
83
114
  - Commit the design document to git
84
115
 
116
+ **Spec Self-Review:**
117
+ After writing the spec document, look at it with fresh eyes:
118
+
119
+ 1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
120
+ 2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
121
+ 3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
122
+ 4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
123
+
124
+ Fix any issues inline. No need to re-review — just fix and move on.
125
+
126
+ **User Review Gate:**
127
+ After the spec review loop passes, ask the user to review the written spec before proceeding:
128
+
129
+ > "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
130
+
131
+ Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
132
+
85
133
  **Implementation:**
134
+
86
135
  - Invoke the writing-plans skill to create a detailed implementation plan
87
136
  - Do NOT invoke any other skill. writing-plans is the next step.
88
137
 
@@ -94,3 +143,22 @@ digraph brainstorming {
94
143
  - **Explore alternatives** - Always propose 2-3 approaches before settling
95
144
  - **Incremental validation** - Present design, get approval before moving on
96
145
  - **Be flexible** - Go back and clarify when something doesn't make sense
146
+
147
+ ## Visual Companion
148
+
149
+ A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
150
+
151
+ **Offering the companion:** When you anticipate that upcoming questions will involve visual content (mockups, layouts, diagrams), offer it once for consent:
152
+ > "Some of what we're working on might be easier to explain if I can show it to you in a web browser. I can put together mockups, diagrams, comparisons, and other visuals as we go. This feature is still new and can be token-intensive. Want to try it? (Requires opening a local URL)"
153
+
154
+ **This offer MUST be its own message.** Do not combine it with clarifying questions, context summaries, or any other content. The message should contain ONLY the offer above and nothing else. Wait for the user's response before continuing. If they decline, proceed with text-only brainstorming.
155
+
156
+ **Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
157
+
158
+ - **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
159
+ - **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
160
+
161
+ A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.
162
+
163
+ If they agree to the companion, read the detailed guide before proceeding:
164
+ `skills/brainstorming/visual-companion.md`
@@ -211,4 +211,4 @@
211
211
  </div>
212
212
 
213
213
  </body>
214
- </html>
214
+ </html>
@@ -54,19 +54,9 @@
54
54
  indicator.textContent = 'Click an option above, then return to the terminal';
55
55
  } else if (selected.length === 1) {
56
56
  const label = selected[0].querySelector('h3, .content h3, .card-body h3')?.textContent?.trim() || selected[0].dataset.choice;
57
- indicator.textContent = '';
58
- const span = document.createElement('span');
59
- span.className = 'selected-text';
60
- span.textContent = label + ' selected';
61
- indicator.appendChild(span);
62
- indicator.appendChild(document.createTextNode(' — return to terminal to continue'));
57
+ indicator.innerHTML = '<span class="selected-text">' + label + ' selected</span> — return to terminal to continue';
63
58
  } else {
64
- indicator.textContent = '';
65
- const span = document.createElement('span');
66
- span.className = 'selected-text';
67
- span.textContent = selected.length + ' selected';
68
- indicator.appendChild(span);
69
- indicator.appendChild(document.createTextNode(' — return to terminal to continue'));
59
+ indicator.innerHTML = '<span class="selected-text">' + selected.length + ' selected</span> — return to terminal to continue';
70
60
  }
71
61
  }, 0);
72
62
  });
@@ -95,4 +85,4 @@
95
85
  };
96
86
 
97
87
  connect();
98
- })();
88
+ })();
@@ -351,4 +351,4 @@ if (require.main === module) {
351
351
  startServer();
352
352
  }
353
353
 
354
- module.exports = { computeAcceptKey, encodeFrame, decodeFrame, OPCODES };
354
+ module.exports = { computeAcceptKey, encodeFrame, decodeFrame, OPCODES };
@@ -145,4 +145,4 @@ done
145
145
 
146
146
  # Timeout - server didn't start
147
147
  echo '{"error": "Server failed to start within 5 seconds"}'
148
- exit 1
148
+ exit 1
@@ -53,4 +53,4 @@ if [[ -f "$PID_FILE" ]]; then
53
53
  echo '{"status": "stopped"}'
54
54
  else
55
55
  echo '{"status": "not_running"}'
56
- fi
56
+ fi
@@ -46,4 +46,4 @@ Task tool (general-purpose):
46
46
  - [suggestions for improvement]
47
47
  ```
48
48
 
49
- **Reviewer returns:** Status, Issues (if any), Recommendations
49
+ **Reviewer returns:** Status, Issues (if any), Recommendations
@@ -284,4 +284,4 @@ If the session used `--project-dir`, mockup files persist in `.superpowers/brain
284
284
  ## Reference
285
285
 
286
286
  - Frame template (CSS reference): `scripts/frame-template.html`
287
- - Helper script (client-side): `scripts/helper.js`
287
+ - Helper script (client-side): `scripts/helper.js`
@@ -7,6 +7,8 @@ description: Use when facing 2+ independent tasks that can be worked on without
7
7
 
8
8
  ## Overview
9
9
 
10
+ You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.
11
+
10
12
  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
13
 
12
14
  **Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently.
@@ -7,12 +7,12 @@ description: Use when you have a written implementation plan to execute in a sep
7
7
 
8
8
  ## Overview
9
9
 
10
- Load plan, review critically, execute tasks in batches, report for review between batches.
11
-
12
- **Core principle:** Batch execution with checkpoints for architect review.
10
+ Load plan, review critically, execute all tasks, report when complete.
13
11
 
14
12
  **Announce at start:** "I'm using the executing-plans skill to implement this plan."
15
13
 
14
+ **Note:** Tell your human partner that Superpowers works much better with access to subagents. The quality of its work will be significantly higher if run on a platform with subagent support (such as Claude Code or Codex). If subagents are available, use superpowers:subagent-driven-development instead of this skill.
15
+
16
16
  ## The Process
17
17
 
18
18
  ### Step 1: Load and Review Plan
@@ -21,8 +21,7 @@ Load plan, review critically, execute tasks in batches, report for review betwee
21
21
  3. If concerns: Raise them with your human partner before starting
22
22
  4. If no concerns: Create TodoWrite and proceed
23
23
 
24
- ### Step 2: Execute Batch
25
- **Default: First 3 tasks**
24
+ ### Step 2: Execute Tasks
26
25
 
27
26
  For each task:
28
27
  1. Mark as in_progress
@@ -30,19 +29,7 @@ For each task:
30
29
  3. Run verifications as specified
31
30
  4. Mark as completed
32
31
 
33
- ### Step 3: Report
34
- When batch complete:
35
- - Show what was implemented
36
- - Show verification output
37
- - Say: "Ready for feedback."
38
-
39
- ### Step 4: Continue
40
- Based on feedback:
41
- - Apply changes if needed
42
- - Execute next batch
43
- - Repeat until complete
44
-
45
- ### Step 5: Complete Development
32
+ ### Step 3: Complete Development
46
33
 
47
34
  After all tasks complete and verified:
48
35
  - Announce: "I'm using the finishing-a-development-branch skill to complete this work."
@@ -52,7 +39,7 @@ After all tasks complete and verified:
52
39
  ## When to Stop and Ask for Help
53
40
 
54
41
  **STOP executing immediately when:**
55
- - Hit a blocker mid-batch (missing dependency, test fails, instruction unclear)
42
+ - Hit a blocker (missing dependency, test fails, instruction unclear)
56
43
  - Plan has critical gaps preventing starting
57
44
  - You don't understand an instruction
58
45
  - Verification fails repeatedly
@@ -72,13 +59,12 @@ After all tasks complete and verified:
72
59
  - Follow plan steps exactly
73
60
  - Don't skip verifications
74
61
  - Reference skills when plan says to
75
- - Between batches: just report and wait
76
62
  - Stop when blocked, don't guess
77
63
  - Never start implementation on main/master branch without explicit user consent
78
64
 
79
65
  ## Integration
80
66
 
81
67
  **Required workflow skills:**
82
- - **superpowers:using-git-worktrees** - REQUIRED: Set up isolated workspace before starting
68
+ - **superpowers:using-git-worktrees** - Ensures isolated workspace (creates one or verifies existing)
83
69
  - **superpowers:writing-plans** - Creates the plan this skill executes
84
70
  - **superpowers:finishing-a-development-branch** - Complete development after all tasks
@@ -9,7 +9,7 @@ description: Use when implementation is complete, all tests pass, and you need t
9
9
 
10
10
  Guide completion of development work by presenting clear options and handling chosen workflow.
11
11
 
12
- **Core principle:** Verify tests → Present options → Execute choice → Clean up.
12
+ **Core principle:** Verify tests → Detect environment → Present options → Execute choice → Clean up.
13
13
 
14
14
  **Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."
15
15
 
@@ -37,7 +37,24 @@ Stop. Don't proceed to Step 2.
37
37
 
38
38
  **If tests pass:** Continue to Step 2.
39
39
 
40
- ### Step 2: Determine Base Branch
40
+ ### Step 2: Detect Environment
41
+
42
+ **Determine workspace state before presenting options:**
43
+
44
+ ```bash
45
+ GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
46
+ GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
47
+ ```
48
+
49
+ This determines which menu to show and how cleanup works:
50
+
51
+ | State | Menu | Cleanup |
52
+ |-------|------|---------|
53
+ | `GIT_DIR == GIT_COMMON` (normal repo) | Standard 4 options | No worktree to clean up |
54
+ | `GIT_DIR != GIT_COMMON`, named branch | Standard 4 options | Provenance-based (see Step 6) |
55
+ | `GIT_DIR != GIT_COMMON`, detached HEAD | Reduced 3 options (no merge) | No cleanup (externally managed) |
56
+
57
+ ### Step 3: Determine Base Branch
41
58
 
42
59
  ```bash
43
60
  # Try common base branches
@@ -46,9 +63,9 @@ git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
46
63
 
47
64
  Or ask: "This branch split from main - is that correct?"
48
65
 
49
- ### Step 3: Present Options
66
+ ### Step 4: Present Options
50
67
 
51
- Present exactly these 4 options:
68
+ **Normal repo and named-branch worktree — present exactly these 4 options:**
52
69
 
53
70
  ```
54
71
  Implementation complete. What would you like to do?
@@ -61,30 +78,45 @@ Implementation complete. What would you like to do?
61
78
  Which option?
62
79
  ```
63
80
 
81
+ **Detached HEAD — present exactly these 3 options:**
82
+
83
+ ```
84
+ Implementation complete. You're on a detached HEAD (externally managed workspace).
85
+
86
+ 1. Push as new branch and create a Pull Request
87
+ 2. Keep as-is (I'll handle it later)
88
+ 3. Discard this work
89
+
90
+ Which option?
91
+ ```
92
+
64
93
  **Don't add explanation** - keep options concise.
65
94
 
66
- ### Step 4: Execute Choice
95
+ ### Step 5: Execute Choice
67
96
 
68
97
  #### Option 1: Merge Locally
69
98
 
70
99
  ```bash
71
- # Switch to base branch
72
- git checkout <base-branch>
100
+ # Get main repo root for CWD safety
101
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
102
+ cd "$MAIN_ROOT"
73
103
 
74
- # Pull latest
104
+ # Merge first — verify success before removing anything
105
+ git checkout <base-branch>
75
106
  git pull
76
-
77
- # Merge feature branch
78
107
  git merge <feature-branch>
79
108
 
80
109
  # Verify tests on merged result
81
110
  <test command>
82
111
 
83
- # If tests pass
84
- git branch -d <feature-branch>
112
+ # Only after merge succeeds: cleanup worktree (Step 6), then delete branch
85
113
  ```
86
114
 
87
- Then: Cleanup worktree (Step 5)
115
+ Then: Cleanup worktree (Step 6), then delete branch:
116
+
117
+ ```bash
118
+ git branch -d <feature-branch>
119
+ ```
88
120
 
89
121
  #### Option 2: Push and Create PR
90
122
 
@@ -103,7 +135,7 @@ EOF
103
135
  )"
104
136
  ```
105
137
 
106
- Then: Cleanup worktree (Step 5)
138
+ **Do NOT clean up worktree** — user needs it alive to iterate on PR feedback.
107
139
 
108
140
  #### Option 3: Keep As-Is
109
141
 
@@ -127,36 +159,46 @@ Wait for exact confirmation.
127
159
 
128
160
  If confirmed:
129
161
  ```bash
130
- git checkout <base-branch>
131
- git branch -D <feature-branch>
162
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
163
+ cd "$MAIN_ROOT"
132
164
  ```
133
165
 
134
- Then: Cleanup worktree (Step 5)
166
+ Then: Cleanup worktree (Step 6), then force-delete branch:
167
+ ```bash
168
+ git branch -D <feature-branch>
169
+ ```
135
170
 
136
- ### Step 5: Cleanup Worktree
171
+ ### Step 6: Cleanup Workspace
137
172
 
138
- **For Options 1, 2, 4:**
173
+ **Only runs for Options 1 and 4.** Options 2 and 3 always preserve the worktree.
139
174
 
140
- Check if in worktree:
141
175
  ```bash
142
- git worktree list | grep $(git branch --show-current)
176
+ GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
177
+ GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
178
+ WORKTREE_PATH=$(git rev-parse --show-toplevel)
143
179
  ```
144
180
 
145
- If yes:
181
+ **If `GIT_DIR == GIT_COMMON`:** Normal repo, no worktree to clean up. Done.
182
+
183
+ **If worktree path is under `.worktrees/`, `worktrees/`, or `~/.config/superpowers/worktrees/`:** Superpowers created this worktree — we own cleanup.
184
+
146
185
  ```bash
147
- git worktree remove <worktree-path>
186
+ MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
187
+ cd "$MAIN_ROOT"
188
+ git worktree remove "$WORKTREE_PATH"
189
+ git worktree prune # Self-healing: clean up any stale registrations
148
190
  ```
149
191
 
150
- **For Option 3:** Keep worktree.
192
+ **Otherwise:** The host environment (harness) owns this workspace. Do NOT remove it. If your platform provides a workspace-exit tool, use it. Otherwise, leave the workspace in place.
151
193
 
152
194
  ## Quick Reference
153
195
 
154
196
  | Option | Merge | Push | Keep Worktree | Cleanup Branch |
155
197
  |--------|-------|------|---------------|----------------|
156
- | 1. Merge locally | ✓ | - | - | ✓ |
157
- | 2. Create PR | - | ✓ | ✓ | - |
158
- | 3. Keep as-is | - | - | ✓ | - |
159
- | 4. Discard | - | - | - | ✓ (force) |
198
+ | 1. Merge locally | yes | - | - | yes |
199
+ | 2. Create PR | - | yes | yes | - |
200
+ | 3. Keep as-is | - | - | yes | - |
201
+ | 4. Discard | - | - | - | yes (force) |
160
202
 
161
203
  ## Common Mistakes
162
204
 
@@ -165,13 +207,25 @@ git worktree remove <worktree-path>
165
207
  - **Fix:** Always verify tests before offering options
166
208
 
167
209
  **Open-ended questions**
168
- - **Problem:** "What should I do next?" → ambiguous
169
- - **Fix:** Present exactly 4 structured options
210
+ - **Problem:** "What should I do next?" is ambiguous
211
+ - **Fix:** Present exactly 4 structured options (or 3 for detached HEAD)
170
212
 
171
- **Automatic worktree cleanup**
172
- - **Problem:** Remove worktree when might need it (Option 2, 3)
213
+ **Cleaning up worktree for Option 2**
214
+ - **Problem:** Remove worktree user needs for PR iteration
173
215
  - **Fix:** Only cleanup for Options 1 and 4
174
216
 
217
+ **Deleting branch before removing worktree**
218
+ - **Problem:** `git branch -d` fails because worktree still references the branch
219
+ - **Fix:** Merge first, remove worktree, then delete branch
220
+
221
+ **Running git worktree remove from inside the worktree**
222
+ - **Problem:** Command fails silently when CWD is inside the worktree being removed
223
+ - **Fix:** Always `cd` to main repo root before `git worktree remove`
224
+
225
+ **Cleaning up harness-owned worktrees**
226
+ - **Problem:** Removing a worktree the harness created causes phantom state
227
+ - **Fix:** Only clean up worktrees under `.worktrees/`, `worktrees/`, or `~/.config/superpowers/worktrees/`
228
+
175
229
  **No confirmation for discard**
176
230
  - **Problem:** Accidentally delete work
177
231
  - **Fix:** Require typed "discard" confirmation
@@ -183,18 +237,15 @@ git worktree remove <worktree-path>
183
237
  - Merge without verifying tests on result
184
238
  - Delete work without confirmation
185
239
  - Force-push without explicit request
240
+ - Remove a worktree before confirming merge success
241
+ - Clean up worktrees you didn't create (provenance check)
242
+ - Run `git worktree remove` from inside the worktree
186
243
 
187
244
  **Always:**
188
245
  - Verify tests before offering options
189
- - Present exactly 4 options
246
+ - Detect environment before presenting menu
247
+ - Present exactly 4 options (or 3 for detached HEAD)
190
248
  - Get typed confirmation for Option 4
191
249
  - Clean up worktree for Options 1 & 4 only
192
-
193
- ## Integration
194
-
195
- **Called by:**
196
- - **subagent-driven-development** (Step 7) - After all tasks complete
197
- - **executing-plans** (Step 5) - After all batches complete
198
-
199
- **Pairs with:**
200
- - **using-git-worktrees** - Cleans up worktree created by that skill
250
+ - `cd` to main repo root before worktree removal
251
+ - Run `git worktree prune` after removal
@@ -5,7 +5,7 @@ description: Use when completing tasks, implementing major features, or before m
5
5
 
6
6
  # Requesting Code Review
7
7
 
8
- Dispatch superpowers:code-reviewer subagent to catch issues before they cascade.
8
+ Dispatch a code reviewer subagent to catch issues before they cascade. The reviewer gets precisely crafted context for evaluation — never your session's history. This keeps the reviewer focused on the work product, not your thought process, and preserves your own context for continued work.
9
9
 
10
10
  **Core principle:** Review early, review often.
11
11
 
@@ -29,16 +29,15 @@ BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
29
29
  HEAD_SHA=$(git rev-parse HEAD)
30
30
  ```
31
31
 
32
- **2. Dispatch code-reviewer subagent:**
32
+ **2. Dispatch code reviewer subagent:**
33
33
 
34
- Use Task tool with superpowers:code-reviewer type, fill template at `code-reviewer.md`
34
+ Use Task tool with `general-purpose` type, fill template at `code-reviewer.md`
35
35
 
36
36
  **Placeholders:**
37
- - `{WHAT_WAS_IMPLEMENTED}` - What you just built
37
+ - `{DESCRIPTION}` - Brief summary of what you built
38
38
  - `{PLAN_OR_REQUIREMENTS}` - What it should do
39
39
  - `{BASE_SHA}` - Starting commit
40
40
  - `{HEAD_SHA}` - Ending commit
41
- - `{DESCRIPTION}` - Brief summary
42
41
 
43
42
  **3. Act on feedback:**
44
43
  - Fix Critical issues immediately
@@ -56,12 +55,11 @@ You: Let me request code review before proceeding.
56
55
  BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
57
56
  HEAD_SHA=$(git rev-parse HEAD)
58
57
 
59
- [Dispatch superpowers:code-reviewer subagent]
60
- WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
61
- PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
58
+ [Dispatch code reviewer subagent]
59
+ DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
60
+ PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md
62
61
  BASE_SHA: a7981ec
63
62
  HEAD_SHA: 3df7661
64
- DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
65
63
 
66
64
  [Subagent returns]:
67
65
  Strengths: Clean architecture, real tests
@@ -82,7 +80,7 @@ You: [Fix progress indicators]
82
80
  - Fix before moving to next task
83
81
 
84
82
  **Executing Plans:**
85
- - Review after each batch (3 tasks)
83
+ - Review after each task or at natural checkpoints
86
84
  - Get feedback, apply, continue
87
85
 
88
86
  **Ad-Hoc Development:**