superpowers-mcp 4.3.1 → 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.
- package/README.md +22 -0
- package/README.zh-TW.md +22 -0
- package/out/server.js +12 -12
- package/package.json +2 -2
- package/skills/brainstorming/SKILL.md +79 -11
- package/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/brainstorming/scripts/server.cjs +354 -0
- package/skills/brainstorming/scripts/start-server.sh +148 -0
- package/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +287 -0
- package/skills/dispatching-parallel-agents/SKILL.md +2 -0
- package/skills/executing-plans/SKILL.md +7 -21
- package/skills/finishing-a-development-branch/SKILL.md +93 -42
- package/skills/requesting-code-review/SKILL.md +8 -10
- package/skills/requesting-code-review/code-reviewer.md +107 -85
- package/skills/subagent-driven-development/SKILL.md +39 -2
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +8 -3
- package/skills/subagent-driven-development/implementer-prompt.md +36 -1
- package/skills/systematic-debugging/CREATION-LOG.md +1 -1
- package/skills/systematic-debugging/root-cause-tracing.md +1 -1
- package/skills/using-git-worktrees/SKILL.md +95 -98
- package/skills/using-superpowers/SKILL.md +22 -0
- package/skills/using-superpowers/references/codex-tools.md +59 -0
- package/skills/using-superpowers/references/copilot-tools.md +42 -0
- package/skills/using-superpowers/references/gemini-tools.md +51 -0
- package/skills/writing-plans/SKILL.md +54 -18
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-skills/SKILL.md +2 -2
- package/skills/writing-skills/anthropic-best-practices.md +2 -2
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Visual Companion Guide
|
|
2
|
+
|
|
3
|
+
Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
|
|
8
|
+
|
|
9
|
+
**Use the browser** when the content itself is visual:
|
|
10
|
+
|
|
11
|
+
- **UI mockups** — wireframes, layouts, navigation structures, component designs
|
|
12
|
+
- **Architecture diagrams** — system components, data flow, relationship maps
|
|
13
|
+
- **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
|
|
14
|
+
- **Design polish** — when the question is about look and feel, spacing, visual hierarchy
|
|
15
|
+
- **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
|
|
16
|
+
|
|
17
|
+
**Use the terminal** when the content is text or tabular:
|
|
18
|
+
|
|
19
|
+
- **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
|
|
20
|
+
- **Conceptual A/B/C choices** — picking between approaches described in words
|
|
21
|
+
- **Tradeoff lists** — pros/cons, comparison tables
|
|
22
|
+
- **Technical decisions** — API design, data modeling, architectural approach selection
|
|
23
|
+
- **Clarifying questions** — anything where the answer is words, not a visual preference
|
|
24
|
+
|
|
25
|
+
A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
|
|
26
|
+
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content to `screen_dir`, the user sees it in their browser and can click to select options. Selections are recorded to `state_dir/events` that you read on your next turn.
|
|
30
|
+
|
|
31
|
+
**Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, selection indicator, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
|
|
32
|
+
|
|
33
|
+
## Starting a Session
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Start server with persistence (mockups saved to project)
|
|
37
|
+
scripts/start-server.sh --project-dir /path/to/project
|
|
38
|
+
|
|
39
|
+
# Returns: {"type":"server-started","port":52341,"url":"http://localhost:52341",
|
|
40
|
+
# "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
|
|
41
|
+
# "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Save `screen_dir` and `state_dir` from the response. Tell user to open the URL.
|
|
45
|
+
|
|
46
|
+
**Finding connection info:** The server writes its startup JSON to `$STATE_DIR/server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.superpowers/brainstorm/` for the session directory.
|
|
47
|
+
|
|
48
|
+
**Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
|
|
49
|
+
|
|
50
|
+
**Launching the server by platform:**
|
|
51
|
+
|
|
52
|
+
**Claude Code (macOS / Linux):**
|
|
53
|
+
```bash
|
|
54
|
+
# Default mode works — the script backgrounds the server itself
|
|
55
|
+
scripts/start-server.sh --project-dir /path/to/project
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Claude Code (Windows):**
|
|
59
|
+
```bash
|
|
60
|
+
# Windows auto-detects and uses foreground mode, which blocks the tool call.
|
|
61
|
+
# Use run_in_background: true on the Bash tool call so the server survives
|
|
62
|
+
# across conversation turns.
|
|
63
|
+
scripts/start-server.sh --project-dir /path/to/project
|
|
64
|
+
```
|
|
65
|
+
When calling this via the Bash tool, set `run_in_background: true`. Then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
|
|
66
|
+
|
|
67
|
+
**Codex:**
|
|
68
|
+
```bash
|
|
69
|
+
# Codex reaps background processes. The script auto-detects CODEX_CI and
|
|
70
|
+
# switches to foreground mode. Run it normally — no extra flags needed.
|
|
71
|
+
scripts/start-server.sh --project-dir /path/to/project
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Gemini CLI:**
|
|
75
|
+
```bash
|
|
76
|
+
# Use --foreground and set is_background: true on your shell tool call
|
|
77
|
+
# so the process survives across turns
|
|
78
|
+
scripts/start-server.sh --project-dir /path/to/project --foreground
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
|
|
82
|
+
|
|
83
|
+
If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
scripts/start-server.sh \
|
|
87
|
+
--project-dir /path/to/project \
|
|
88
|
+
--host 0.0.0.0 \
|
|
89
|
+
--url-host localhost
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Use `--url-host` to control what hostname is printed in the returned URL JSON.
|
|
93
|
+
|
|
94
|
+
## The Loop
|
|
95
|
+
|
|
96
|
+
1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
|
|
97
|
+
- Before each write, check that `$STATE_DIR/server-info` exists. If it doesn't (or `$STATE_DIR/server-stopped` exists), the server has shut down — restart it with `start-server.sh` before continuing. The server auto-exits after 30 minutes of inactivity.
|
|
98
|
+
- Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
|
|
99
|
+
- **Never reuse filenames** — each screen gets a fresh file
|
|
100
|
+
- Use Write tool — **never use cat/heredoc** (dumps noise into terminal)
|
|
101
|
+
- Server automatically serves the newest file
|
|
102
|
+
|
|
103
|
+
2. **Tell user what to expect and end your turn:**
|
|
104
|
+
- Remind them of the URL (every step, not just first)
|
|
105
|
+
- Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
|
|
106
|
+
- Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
|
|
107
|
+
|
|
108
|
+
3. **On your next turn** — after the user responds in the terminal:
|
|
109
|
+
- Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
|
|
110
|
+
- Merge with the user's terminal text to get the full picture
|
|
111
|
+
- The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
|
|
112
|
+
|
|
113
|
+
4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
|
|
114
|
+
|
|
115
|
+
5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<!-- filename: waiting.html (or waiting-2.html, etc.) -->
|
|
119
|
+
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
|
|
120
|
+
<p class="subtitle">Continuing in terminal...</p>
|
|
121
|
+
</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
|
|
125
|
+
|
|
126
|
+
6. Repeat until done.
|
|
127
|
+
|
|
128
|
+
## Writing Content Fragments
|
|
129
|
+
|
|
130
|
+
Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, selection indicator, and all interactive infrastructure).
|
|
131
|
+
|
|
132
|
+
**Minimal example:**
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<h2>Which layout works better?</h2>
|
|
136
|
+
<p class="subtitle">Consider readability and visual hierarchy</p>
|
|
137
|
+
|
|
138
|
+
<div class="options">
|
|
139
|
+
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
140
|
+
<div class="letter">A</div>
|
|
141
|
+
<div class="content">
|
|
142
|
+
<h3>Single Column</h3>
|
|
143
|
+
<p>Clean, focused reading experience</p>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="option" data-choice="b" onclick="toggleSelect(this)">
|
|
147
|
+
<div class="letter">B</div>
|
|
148
|
+
<div class="content">
|
|
149
|
+
<h3>Two Column</h3>
|
|
150
|
+
<p>Sidebar navigation with main content</p>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
|
|
157
|
+
|
|
158
|
+
## CSS Classes Available
|
|
159
|
+
|
|
160
|
+
The frame template provides these CSS classes for your content:
|
|
161
|
+
|
|
162
|
+
### Options (A/B/C choices)
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<div class="options">
|
|
166
|
+
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
167
|
+
<div class="letter">A</div>
|
|
168
|
+
<div class="content">
|
|
169
|
+
<h3>Title</h3>
|
|
170
|
+
<p>Description</p>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item. The indicator bar shows the count.
|
|
177
|
+
|
|
178
|
+
```html
|
|
179
|
+
<div class="options" data-multiselect>
|
|
180
|
+
<!-- same option markup — users can select/deselect multiple -->
|
|
181
|
+
</div>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Cards (visual designs)
|
|
185
|
+
|
|
186
|
+
```html
|
|
187
|
+
<div class="cards">
|
|
188
|
+
<div class="card" data-choice="design1" onclick="toggleSelect(this)">
|
|
189
|
+
<div class="card-image"><!-- mockup content --></div>
|
|
190
|
+
<div class="card-body">
|
|
191
|
+
<h3>Name</h3>
|
|
192
|
+
<p>Description</p>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Mockup container
|
|
199
|
+
|
|
200
|
+
```html
|
|
201
|
+
<div class="mockup">
|
|
202
|
+
<div class="mockup-header">Preview: Dashboard Layout</div>
|
|
203
|
+
<div class="mockup-body"><!-- your mockup HTML --></div>
|
|
204
|
+
</div>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Split view (side-by-side)
|
|
208
|
+
|
|
209
|
+
```html
|
|
210
|
+
<div class="split">
|
|
211
|
+
<div class="mockup"><!-- left --></div>
|
|
212
|
+
<div class="mockup"><!-- right --></div>
|
|
213
|
+
</div>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Pros/Cons
|
|
217
|
+
|
|
218
|
+
```html
|
|
219
|
+
<div class="pros-cons">
|
|
220
|
+
<div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
|
|
221
|
+
<div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
|
|
222
|
+
</div>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Mock elements (wireframe building blocks)
|
|
226
|
+
|
|
227
|
+
```html
|
|
228
|
+
<div class="mock-nav">Logo | Home | About | Contact</div>
|
|
229
|
+
<div style="display: flex;">
|
|
230
|
+
<div class="mock-sidebar">Navigation</div>
|
|
231
|
+
<div class="mock-content">Main content area</div>
|
|
232
|
+
</div>
|
|
233
|
+
<button class="mock-button">Action Button</button>
|
|
234
|
+
<input class="mock-input" placeholder="Input field">
|
|
235
|
+
<div class="placeholder">Placeholder area</div>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Typography and sections
|
|
239
|
+
|
|
240
|
+
- `h2` — page title
|
|
241
|
+
- `h3` — section heading
|
|
242
|
+
- `.subtitle` — secondary text below title
|
|
243
|
+
- `.section` — content block with bottom margin
|
|
244
|
+
- `.label` — small uppercase label text
|
|
245
|
+
|
|
246
|
+
## Browser Events Format
|
|
247
|
+
|
|
248
|
+
When the user clicks options in the browser, their interactions are recorded to `$STATE_DIR/events` (one JSON object per line). The file is cleared automatically when you push a new screen.
|
|
249
|
+
|
|
250
|
+
```jsonl
|
|
251
|
+
{"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
|
|
252
|
+
{"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
|
|
253
|
+
{"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
|
|
257
|
+
|
|
258
|
+
If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
|
|
259
|
+
|
|
260
|
+
## Design Tips
|
|
261
|
+
|
|
262
|
+
- **Scale fidelity to the question** — wireframes for layout, polish for polish questions
|
|
263
|
+
- **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
|
|
264
|
+
- **Iterate before advancing** — if feedback changes current screen, write a new version
|
|
265
|
+
- **2-4 options max** per screen
|
|
266
|
+
- **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
|
|
267
|
+
- **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
|
|
268
|
+
|
|
269
|
+
## File Naming
|
|
270
|
+
|
|
271
|
+
- Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
|
|
272
|
+
- Never reuse filenames — each screen must be a new file
|
|
273
|
+
- For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
|
|
274
|
+
- Server serves newest file by modification time
|
|
275
|
+
|
|
276
|
+
## Cleaning Up
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
scripts/stop-server.sh $SESSION_DIR
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
|
|
283
|
+
|
|
284
|
+
## Reference
|
|
285
|
+
|
|
286
|
+
- Frame template (CSS reference): `scripts/frame-template.html`
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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** -
|
|
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:
|
|
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
|
|
66
|
+
### Step 4: Present Options
|
|
50
67
|
|
|
51
|
-
|
|
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
|
|
95
|
+
### Step 5: Execute Choice
|
|
67
96
|
|
|
68
97
|
#### Option 1: Merge Locally
|
|
69
98
|
|
|
70
99
|
```bash
|
|
71
|
-
#
|
|
72
|
-
git
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
|
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
|
-
|
|
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
|
|
131
|
-
|
|
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
|
|
166
|
+
Then: Cleanup worktree (Step 6), then force-delete branch:
|
|
167
|
+
```bash
|
|
168
|
+
git branch -D <feature-branch>
|
|
169
|
+
```
|
|
135
170
|
|
|
136
|
-
### Step
|
|
171
|
+
### Step 6: Cleanup Workspace
|
|
137
172
|
|
|
138
|
-
**
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
**
|
|
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 | - | - | - |
|
|
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?"
|
|
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
|
-
**
|
|
172
|
-
- **Problem:** Remove worktree
|
|
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
|
-
-
|
|
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
|
-
|
|
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
|
|
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
|
|
32
|
+
**2. Dispatch code reviewer subagent:**
|
|
33
33
|
|
|
34
|
-
Use Task tool with
|
|
34
|
+
Use Task tool with `general-purpose` type, fill template at `code-reviewer.md`
|
|
35
35
|
|
|
36
36
|
**Placeholders:**
|
|
37
|
-
- `{
|
|
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
|
|
60
|
-
|
|
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
|
|
83
|
+
- Review after each task or at natural checkpoints
|
|
86
84
|
- Get feedback, apply, continue
|
|
87
85
|
|
|
88
86
|
**Ad-Hoc Development:**
|