···11+---
22+name: brainstorming
33+description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
44+---
55+66+# Brainstorming Ideas Into Designs
77+88+Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
99+1010+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.
1111+1212+<HARD-GATE>
1313+Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
1414+</HARD-GATE>
1515+1616+## Anti-Pattern: "This Is Too Simple To Need A Design"
1717+1818+Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
1919+2020+## Checklist
2121+2222+You MUST create a task for each of these items and complete them in order:
2323+2424+1. **Explore project context** — check files, docs, recent commits
2525+2. **Offer the visual companion just-in-time** — NOT upfront. The first time a question would genuinely be clearer shown than described, offer it then (its own message); on approval its browser tab opens for you. If no visual question ever arises, never offer it. See the Visual Companion section below.
2626+3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
2727+4. **Propose 2-3 approaches** — with trade-offs and your recommendation
2828+5. **Present design** — in sections scaled to their complexity, get user approval after each section
2929+6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
3030+7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
3131+8. **User reviews written spec** — ask user to review the spec file before proceeding
3232+9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
3333+3434+## Process Flow
3535+3636+```dot
3737+digraph brainstorming {
3838+ "Explore project context" [shape=box];
3939+ "Ask clarifying questions" [shape=box];
4040+ "Propose 2-3 approaches" [shape=box];
4141+ "Present design sections" [shape=box];
4242+ "User approves design?" [shape=diamond];
4343+ "Write design doc" [shape=box];
4444+ "Spec self-review\n(fix inline)" [shape=box];
4545+ "User reviews spec?" [shape=diamond];
4646+ "Invoke writing-plans skill" [shape=doublecircle];
4747+4848+ "Explore project context" -> "Ask clarifying questions";
4949+ "Ask clarifying questions" -> "Propose 2-3 approaches";
5050+ "Propose 2-3 approaches" -> "Present design sections";
5151+ "Present design sections" -> "User approves design?";
5252+ "User approves design?" -> "Present design sections" [label="no, revise"];
5353+ "User approves design?" -> "Write design doc" [label="yes"];
5454+ "Write design doc" -> "Spec self-review\n(fix inline)";
5555+ "Spec self-review\n(fix inline)" -> "User reviews spec?";
5656+ "User reviews spec?" -> "Write design doc" [label="changes requested"];
5757+ "User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
5858+}
5959+```
6060+6161+**The terminal state is invoking writing-plans.** Do NOT invoke frontend-design, mcp-builder, or any other implementation skill. The ONLY skill you invoke after brainstorming is writing-plans.
6262+6363+## The Process
6464+6565+**Understanding the idea:**
6666+6767+- Check out the current project state first (files, docs, recent commits)
6868+- 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.
6969+- 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.
7070+- For appropriately-scoped projects, ask questions one at a time to refine the idea
7171+- Prefer multiple choice questions when possible, but open-ended is fine too
7272+- Only one question per message - if a topic needs more exploration, break it into multiple questions
7373+- Focus on understanding: purpose, constraints, success criteria
7474+7575+**Exploring approaches:**
7676+7777+- Propose 2-3 different approaches with trade-offs
7878+- Present options conversationally with your recommendation and reasoning
7979+- Lead with your recommended option and explain why
8080+8181+**Presenting the design:**
8282+8383+- Once you believe you understand what you're building, present the design
8484+- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
8585+- Ask after each section whether it looks right so far
8686+- Cover: architecture, components, data flow, error handling, testing
8787+- Be ready to go back and clarify if something doesn't make sense
8888+8989+**Design for isolation and clarity:**
9090+9191+- Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
9292+- For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
9393+- 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.
9494+- 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.
9595+9696+**Working in existing codebases:**
9797+9898+- Explore the current structure before proposing changes. Follow existing patterns.
9999+- 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.
100100+- Don't propose unrelated refactoring. Stay focused on what serves the current goal.
101101+102102+## After the Design
103103+104104+**Documentation:**
105105+106106+- Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
107107+ - (User preferences for spec location override this default)
108108+- Use elements-of-style:writing-clearly-and-concisely skill if available
109109+- Commit the design document to git
110110+111111+**Spec Self-Review:**
112112+After writing the spec document, look at it with fresh eyes:
113113+114114+1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
115115+2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
116116+3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
117117+4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
118118+119119+Fix any issues inline. No need to re-review — just fix and move on.
120120+121121+**User Review Gate:**
122122+After the spec review loop passes, ask the user to review the written spec before proceeding:
123123+124124+> "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."
125125+126126+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.
127127+128128+**Implementation:**
129129+130130+- Invoke the writing-plans skill to create a detailed implementation plan
131131+- Do NOT invoke any other skill. writing-plans is the next step.
132132+133133+## Key Principles
134134+135135+- **One question at a time** - Don't overwhelm with multiple questions
136136+- **Multiple choice preferred** - Easier to answer than open-ended when possible
137137+- **YAGNI ruthlessly** - Remove unnecessary features from all designs
138138+- **Explore alternatives** - Always propose 2-3 approaches before settling
139139+- **Incremental validation** - Present design, get approval before moving on
140140+- **Be flexible** - Go back and clarify when something doesn't make sense
141141+142142+## Visual Companion
143143+144144+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.
145145+146146+**Offering the companion (just-in-time):** Do NOT offer it upfront. Wait until a question would genuinely be clearer shown than told — a real mockup / layout / diagram question, not merely a UI *topic*. The first time that happens, offer it then, as its own message:
147147+> "This next part might be easier if I show you — I can put together mockups, diagrams, and comparisons in a browser tab as we go. It's still new and can be token-intensive. Want me to? I'll open it for you."
148148+149149+**This offer MUST be its own message.** Only the offer — no clarifying question, summary, or other content. Wait for the user's response. If they accept, start the server with `--open` so their browser opens to the first screen automatically. If they decline, continue text-only and don't offer again unless they raise it.
150150+151151+**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?**
152152+153153+- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
154154+- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
155155+156156+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.
157157+158158+If they agree to the companion, read the detailed guide before proceeding:
159159+`skills/brainstorming/visual-companion.md`
···11+# Spec Document Reviewer Prompt Template
22+33+Use this template when dispatching a spec document reviewer subagent.
44+55+**Purpose:** Verify the spec is complete, consistent, and ready for implementation planning.
66+77+**Dispatch after:** Spec document is written to docs/superpowers/specs/
88+99+```
1010+Subagent (general-purpose):
1111+ description: "Review spec document"
1212+ prompt: |
1313+ You are a spec document reviewer. Verify this spec is complete and ready for planning.
1414+1515+ **Spec to review:** [SPEC_FILE_PATH]
1616+1717+ ## What to Check
1818+1919+ | Category | What to Look For |
2020+ |----------|------------------|
2121+ | Completeness | TODOs, placeholders, "TBD", incomplete sections |
2222+ | Consistency | Internal contradictions, conflicting requirements |
2323+ | Clarity | Requirements ambiguous enough to cause someone to build the wrong thing |
2424+ | Scope | Focused enough for a single plan — not covering multiple independent subsystems |
2525+ | YAGNI | Unrequested features, over-engineering |
2626+2727+ ## Calibration
2828+2929+ **Only flag issues that would cause real problems during implementation planning.**
3030+ A missing section, a contradiction, or a requirement so ambiguous it could be
3131+ interpreted two different ways — those are issues. Minor wording improvements,
3232+ stylistic preferences, and "sections less detailed than others" are not.
3333+3434+ Approve unless there are serious gaps that would lead to a flawed plan.
3535+3636+ ## Output Format
3737+3838+ ## Spec Review
3939+4040+ **Status:** Approved | Issues Found
4141+4242+ **Issues (if any):**
4343+ - [Section X]: [specific issue] - [why it matters for planning]
4444+4545+ **Recommendations (advisory, do not block approval):**
4646+ - [suggestions for improvement]
4747+```
4848+4949+**Reviewer returns:** Status, Issues (if any), Recommendations
+291
.agents/skills/brainstorming/visual-companion.md
···11+# Visual Companion Guide
22+33+Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
44+55+## When to Use
66+77+Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
88+99+**Use the browser** when the content itself is visual:
1010+1111+- **UI mockups** — wireframes, layouts, navigation structures, component designs
1212+- **Architecture diagrams** — system components, data flow, relationship maps
1313+- **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
1414+- **Design polish** — when the question is about look and feel, spacing, visual hierarchy
1515+- **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
1616+1717+**Use the terminal** when the content is text or tabular:
1818+1919+- **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
2020+- **Conceptual A/B/C choices** — picking between approaches described in words
2121+- **Tradeoff lists** — pros/cons, comparison tables
2222+- **Technical decisions** — API design, data modeling, architectural approach selection
2323+- **Clarifying questions** — anything where the answer is words, not a visual preference
2424+2525+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.
2626+2727+## How It Works
2828+2929+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.
3030+3131+**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, connection status, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
3232+3333+## Starting a Session
3434+3535+```bash
3636+# Start AFTER the user approves the companion. --open auto-opens their browser on
3737+# the first screen; --project-dir persists mockups and enables same-port restart.
3838+scripts/start-server.sh --project-dir /path/to/project --open
3939+4040+# Returns: {"type":"server-started","port":52341,
4141+# "url":"http://localhost:52341/?key=ab12…",
4242+# "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
4343+# "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
4444+```
4545+4646+Save `screen_dir` and `state_dir` from the response. With `--open`, the browser opens itself when you push the first screen — you don't need to ask the user to open it, but still share the URL as a fallback (headless/remote setups won't auto-open).
4747+4848+**The URL contains a session key (`?key=…`).** The server rejects any request
4949+without it, so always give the user the **complete** URL from the `url` field —
5050+never strip the query string, and never hand out a bare `http://host:port`. The
5151+key gates HTTP and WebSocket access so a stray browser tab or another machine on
5252+the network can't read the screens or inject events. After the first load the
5353+browser remembers the key via a cookie, so reloads and `/files/*` assets work
5454+without repeating it.
5555+5656+**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.
5757+5858+**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.
5959+6060+**Launching the server by platform:**
6161+6262+**Claude Code:**
6363+```bash
6464+# Default mode works — the script backgrounds the server itself.
6565+scripts/start-server.sh --project-dir /path/to/project --open
6666+```
6767+6868+On Windows, the script auto-detects and switches to foreground mode (which blocks the tool call). Use `run_in_background: true` on the Bash tool call so the server survives across conversation turns, then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
6969+7070+**Codex:**
7171+```bash
7272+# Codex reaps background processes. The script auto-detects CODEX_CI and
7373+# switches to foreground mode. Run it normally — no extra flags needed.
7474+scripts/start-server.sh --project-dir /path/to/project --open
7575+```
7676+7777+**Copilot CLI:**
7878+```bash
7979+# Use --foreground and start the server via the bash tool with mode: "async"
8080+# so the process survives across turns. Capture the returned shellId for
8181+# read_bash / stop_bash if you need to interact with it later.
8282+scripts/start-server.sh --project-dir /path/to/project --open --foreground
8383+```
8484+8585+**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.
8686+8787+If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
8888+8989+```bash
9090+scripts/start-server.sh \
9191+ --project-dir /path/to/project \
9292+ --host 0.0.0.0 \
9393+ --url-host localhost
9494+```
9595+9696+Use `--url-host` to control what hostname is printed in the returned URL JSON.
9797+9898+## The Loop
9999+100100+1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
101101+ - **Required: confirm the server is alive before referring to the URL or pushing a screen.** Check that `$STATE_DIR/server-info` exists and `$STATE_DIR/server-stopped` does not. If it has shut down, restart it with `start-server.sh` using the **same `--project-dir`** — it reuses the same port, so the user's open tab reconnects on its own (it shows a "paused" overlay while the server is down) and you don't need to send a new URL. The server auto-exits after 4 hours idle (configurable with `--idle-timeout-minutes`).
102102+ - Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
103103+ - **Never reuse filenames** — each screen gets a fresh file
104104+ - Use your file-creation tool — **never use cat/heredoc** (dumps noise into terminal)
105105+ - Server automatically serves the newest file
106106+107107+2. **Tell user what to expect and end your turn:**
108108+ - Remind them of the URL (every step, not just first)
109109+ - Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
110110+ - 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."
111111+112112+3. **On your next turn** — after the user responds in the terminal:
113113+ - Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
114114+ - Merge with the user's terminal text to get the full picture
115115+ - The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
116116+117117+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.
118118+119119+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:
120120+121121+ ```html
122122+ <!-- filename: waiting.html (or waiting-2.html, etc.) -->
123123+ <div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
124124+ <p class="subtitle">Continuing in terminal...</p>
125125+ </div>
126126+ ```
127127+128128+ 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.
129129+130130+6. Repeat until done.
131131+132132+## Writing Content Fragments
133133+134134+Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, connection status, and all interactive infrastructure).
135135+136136+**Minimal example:**
137137+138138+```html
139139+<h2>Which layout works better?</h2>
140140+<p class="subtitle">Consider readability and visual hierarchy</p>
141141+142142+<div class="options">
143143+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
144144+ <div class="letter">A</div>
145145+ <div class="content">
146146+ <h3>Single Column</h3>
147147+ <p>Clean, focused reading experience</p>
148148+ </div>
149149+ </div>
150150+ <div class="option" data-choice="b" onclick="toggleSelect(this)">
151151+ <div class="letter">B</div>
152152+ <div class="content">
153153+ <h3>Two Column</h3>
154154+ <p>Sidebar navigation with main content</p>
155155+ </div>
156156+ </div>
157157+</div>
158158+```
159159+160160+That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
161161+162162+## CSS Classes Available
163163+164164+The frame template provides these CSS classes for your content:
165165+166166+### Options (A/B/C choices)
167167+168168+```html
169169+<div class="options">
170170+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
171171+ <div class="letter">A</div>
172172+ <div class="content">
173173+ <h3>Title</h3>
174174+ <p>Description</p>
175175+ </div>
176176+ </div>
177177+</div>
178178+```
179179+180180+**Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item's selected styling.
181181+182182+```html
183183+<div class="options" data-multiselect>
184184+ <!-- same option markup — users can select/deselect multiple -->
185185+</div>
186186+```
187187+188188+### Cards (visual designs)
189189+190190+```html
191191+<div class="cards">
192192+ <div class="card" data-choice="design1" onclick="toggleSelect(this)">
193193+ <div class="card-image"><!-- mockup content --></div>
194194+ <div class="card-body">
195195+ <h3>Name</h3>
196196+ <p>Description</p>
197197+ </div>
198198+ </div>
199199+</div>
200200+```
201201+202202+### Mockup container
203203+204204+```html
205205+<div class="mockup">
206206+ <div class="mockup-header">Preview: Dashboard Layout</div>
207207+ <div class="mockup-body"><!-- your mockup HTML --></div>
208208+</div>
209209+```
210210+211211+### Split view (side-by-side)
212212+213213+```html
214214+<div class="split">
215215+ <div class="mockup"><!-- left --></div>
216216+ <div class="mockup"><!-- right --></div>
217217+</div>
218218+```
219219+220220+### Pros/Cons
221221+222222+```html
223223+<div class="pros-cons">
224224+ <div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
225225+ <div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
226226+</div>
227227+```
228228+229229+### Mock elements (wireframe building blocks)
230230+231231+```html
232232+<div class="mock-nav">Logo | Home | About | Contact</div>
233233+<div style="display: flex;">
234234+ <div class="mock-sidebar">Navigation</div>
235235+ <div class="mock-content">Main content area</div>
236236+</div>
237237+<button class="mock-button">Action Button</button>
238238+<input class="mock-input" placeholder="Input field">
239239+<div class="placeholder">Placeholder area</div>
240240+```
241241+242242+### Typography and sections
243243+244244+- `h2` — page title
245245+- `h3` — section heading
246246+- `.subtitle` — secondary text below title
247247+- `.section` — content block with bottom margin
248248+- `.label` — small uppercase label text
249249+250250+## Browser Events Format
251251+252252+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.
253253+254254+```jsonl
255255+{"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
256256+{"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
257257+{"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
258258+```
259259+260260+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.
261261+262262+If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
263263+264264+## Design Tips
265265+266266+- **Scale fidelity to the question** — wireframes for layout, polish for polish questions
267267+- **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
268268+- **Iterate before advancing** — if feedback changes current screen, write a new version
269269+- **2-4 options max** per screen
270270+- **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
271271+- **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
272272+273273+## File Naming
274274+275275+- Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
276276+- Never reuse filenames — each screen must be a new file
277277+- For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
278278+- Server serves newest file by modification time
279279+280280+## Cleaning Up
281281+282282+```bash
283283+scripts/stop-server.sh $SESSION_DIR
284284+```
285285+286286+If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
287287+288288+## Reference
289289+290290+- Frame template (CSS reference): `scripts/frame-template.html`
291291+- Helper script (client-side): `scripts/helper.js`
+202
.agents/skills/using-git-worktrees/SKILL.md
···11+---
22+name: using-git-worktrees
33+description: Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback
44+---
55+66+# Using Git Worktrees
77+88+## Overview
99+1010+Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.
1111+1212+**Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.
1313+1414+**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
1515+1616+## Step 0: Detect Existing Isolation
1717+1818+**Before creating anything, check if you are already in an isolated workspace.**
1919+2020+```bash
2121+GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
2222+GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
2323+BRANCH=$(git branch --show-current)
2424+```
2525+2626+**Submodule guard:** `GIT_DIR != GIT_COMMON` is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule:
2727+2828+```bash
2929+# If this returns a path, you're in a submodule, not a worktree — treat as normal repo
3030+git rev-parse --show-superproject-working-tree 2>/dev/null
3131+```
3232+3333+**If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 2 (Project Setup). Do NOT create another worktree.
3434+3535+Report with branch state:
3636+- On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
3737+- Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
3838+3939+**If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout.
4040+4141+Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
4242+4343+> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
4444+4545+Honor any existing declared preference without asking. If the user declines consent, work in place and skip to Step 2.
4646+4747+## Step 1: Create Isolated Workspace
4848+4949+**You have two mechanisms. Try them in this order.**
5050+5151+### 1a. Native Worktree Tools (preferred)
5252+5353+The user has asked for an isolated workspace (Step 0 consent). Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to Step 2.
5454+5555+Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
5656+5757+Only proceed to Step 1b if you have no native worktree tool available.
5858+5959+### 1b. Git Worktree Fallback
6060+6161+**Only use this if Step 1a does not apply** — you have no native worktree tool available. Create a worktree manually using git.
6262+6363+#### Directory Selection
6464+6565+Follow this priority order. Explicit user preference always beats observed filesystem state.
6666+6767+1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
6868+6969+2. **Check for an existing project-local worktree directory:**
7070+ ```bash
7171+ ls -d .worktrees 2>/dev/null # Preferred (hidden)
7272+ ls -d worktrees 2>/dev/null # Alternative
7373+ ```
7474+ If found, use it. If both exist, `.worktrees` wins.
7575+7676+3. **If there is no other guidance available**, default to `.worktrees/` at the project root.
7777+7878+#### Safety Verification (project-local directories only)
7979+8080+**MUST verify directory is ignored before creating worktree:**
8181+8282+```bash
8383+git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
8484+```
8585+8686+**If NOT ignored:** Add to .gitignore, commit the change, then proceed.
8787+8888+**Why critical:** Prevents accidentally committing worktree contents to repository.
8989+9090+#### Create the Worktree
9191+9292+```bash
9393+# Determine path based on chosen location
9494+path="$LOCATION/$BRANCH_NAME"
9595+9696+git worktree add "$path" -b "$BRANCH_NAME"
9797+cd "$path"
9898+```
9999+100100+**Sandbox fallback:** If `git worktree add` fails with a permission error (sandbox denial), tell the user the sandbox blocked worktree creation and you're working in the current directory instead. Then run setup and baseline tests in place.
101101+102102+## Step 2: Project Setup
103103+104104+Auto-detect and run appropriate setup:
105105+106106+```bash
107107+# Node.js
108108+if [ -f package.json ]; then npm install; fi
109109+110110+# Rust
111111+if [ -f Cargo.toml ]; then cargo build; fi
112112+113113+# Python
114114+if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
115115+if [ -f pyproject.toml ]; then poetry install; fi
116116+117117+# Go
118118+if [ -f go.mod ]; then go mod download; fi
119119+```
120120+121121+## Step 3: Verify Clean Baseline
122122+123123+Run tests to ensure workspace starts clean:
124124+125125+```bash
126126+# Use project-appropriate command
127127+npm test / cargo test / pytest / go test ./...
128128+```
129129+130130+**If tests fail:** Report failures, ask whether to proceed or investigate.
131131+132132+**If tests pass:** Report ready.
133133+134134+### Report
135135+136136+```
137137+Worktree ready at <full-path>
138138+Tests passing (<N> tests, 0 failures)
139139+Ready to implement <feature-name>
140140+```
141141+142142+## Quick Reference
143143+144144+| Situation | Action |
145145+|-----------|--------|
146146+| Already in linked worktree | Skip creation (Step 0) |
147147+| In a submodule | Treat as normal repo (Step 0 guard) |
148148+| Native worktree tool available | Use it (Step 1a) |
149149+| No native tool | Git worktree fallback (Step 1b) |
150150+| `.worktrees/` exists | Use it (verify ignored) |
151151+| `worktrees/` exists | Use it (verify ignored) |
152152+| Both exist | Use `.worktrees/` |
153153+| Neither exists | Check instruction file, then default `.worktrees/` |
154154+| Directory not ignored | Add to .gitignore + commit |
155155+| Permission error on create | Sandbox fallback, work in place |
156156+| Tests fail during baseline | Report failures + ask |
157157+| No package.json/Cargo.toml | Skip dependency install |
158158+159159+## Common Mistakes
160160+161161+### Fighting the harness
162162+163163+- **Problem:** Using `git worktree add` when the platform already provides isolation
164164+- **Fix:** Step 0 detects existing isolation. Step 1a defers to native tools.
165165+166166+### Skipping detection
167167+168168+- **Problem:** Creating a nested worktree inside an existing one
169169+- **Fix:** Always run Step 0 before creating anything
170170+171171+### Skipping ignore verification
172172+173173+- **Problem:** Worktree contents get tracked, pollute git status
174174+- **Fix:** Always use `git check-ignore` before creating project-local worktree
175175+176176+### Assuming directory location
177177+178178+- **Problem:** Creates inconsistency, violates project conventions
179179+- **Fix:** Follow priority: explicit instructions > existing project-local directory > default
180180+181181+### Proceeding with failing tests
182182+183183+- **Problem:** Can't distinguish new bugs from pre-existing issues
184184+- **Fix:** Report failures, get explicit permission to proceed
185185+186186+## Red Flags
187187+188188+**Never:**
189189+- Create a worktree when Step 0 detects existing isolation
190190+- Use `git worktree add` when you have a native worktree tool (e.g., `EnterWorktree`). This is the #1 mistake — if you have it, use it.
191191+- Skip Step 1a by jumping straight to Step 1b's git commands
192192+- Create worktree without verifying it's ignored (project-local)
193193+- Skip baseline test verification
194194+- Proceed with failing tests without asking
195195+196196+**Always:**
197197+- Run Step 0 detection first
198198+- Prefer native tools over git fallback
199199+- Follow directory priority: explicit instructions > existing project-local directory > default
200200+- Verify directory is ignored for project-local
201201+- Auto-detect and run project setup
202202+- Verify clean test baseline
+62
.agents/skills/using-superpowers/SKILL.md
···11+---
22+name: using-superpowers
33+description: Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions
44+---
55+66+<SUBAGENT-STOP>
77+If you were dispatched as a subagent to execute a specific task, ignore this skill.
88+</SUBAGENT-STOP>
99+1010+<EXTREMELY-IMPORTANT>
1111+If you think there is even a 1% chance a skill might apply to what you are doing, you ABSOLUTELY MUST invoke the skill.
1212+1313+IF A SKILL APPLIES TO YOUR TASK, YOU DO NOT HAVE A CHOICE. YOU MUST USE IT.
1414+1515+This is not negotiable. You cannot rationalize your way out of this.
1616+</EXTREMELY-IMPORTANT>
1717+1818+## The Rule
1919+2020+**Invoke relevant or requested skills BEFORE any response or action** — including clarifying questions, exploring the codebase, or checking files. If it turns out wrong for the situation, you don't have to use it.
2121+2222+**Before entering plan mode:** if you haven't already brainstormed, invoke the brainstorming skill first.
2323+2424+Then announce "Using [skill] to [purpose]" and follow the skill exactly. If it has a checklist, create a todo per item.
2525+2626+## Skill Priority
2727+2828+When multiple skills apply, process skills come first — they set the approach, then implementation skills (frontend-design, etc.) carry it out. Brainstorming and systematic-debugging are Superpowers' most common process skills, but the rule holds for any of them.
2929+3030+- "Let's build X" → superpowers:brainstorming first, then implementation skills.
3131+- "Fix this bug" → superpowers:systematic-debugging first, then domain skills.
3232+3333+## Red Flags
3434+3535+These thoughts mean STOP—you're rationalizing:
3636+3737+| Thought | Reality |
3838+|---------|---------|
3939+| "This is just a simple question" | Questions are tasks. Check for skills. |
4040+| "I need more context first" | Skill check comes BEFORE clarifying questions. |
4141+| "Let me explore the codebase first" | Skills tell you HOW to explore. Check first. |
4242+| "I can check git/files quickly" | Files lack conversation context. Check for skills. |
4343+| "Let me gather information first" | Skills tell you HOW to gather information. |
4444+| "This doesn't need a formal skill" | If a skill exists, use it. |
4545+| "I remember this skill" | Skills evolve. Read current version. |
4646+| "This doesn't count as a task" | Action = task. Check for skills. |
4747+| "The skill is overkill" | Simple things become complex. Use it. |
4848+| "I'll just do this one thing first" | Check BEFORE doing anything. |
4949+| "This feels productive" | Undisciplined action wastes time. Skills prevent this. |
5050+| "I know what that means" | Knowing the concept ≠ using the skill. Invoke it. |
5151+5252+## Platform Adaptation
5353+5454+If your harness appears here, read its reference file for special instructions:
5555+5656+- Codex: `references/codex-tools.md`
5757+- Pi: `references/pi-tools.md`
5858+- Antigravity: `references/antigravity-tools.md`
5959+6060+## User Instructions
6161+6262+User instructions (CLAUDE.md, AGENTS.md, GEMINI.md, etc, direct requests) take precedence over skills, which in turn override default behavior. Only skip skill workflows or instructions when your human partner has explicitly told you to.
···11+# Antigravity CLI (`agy`) Tool Mapping
22+33+Skills speak in actions ("dispatch a subagent", "create a todo", "read a file"). On the Antigravity CLI (`agy`) these resolve to the tools below.
44+55+| Action skills request | Antigravity CLI equivalent |
66+|----------------------|----------------------|
77+| Dispatch a subagent (`Subagent (general-purpose):` template) | `invoke_subagent` with a built-in `TypeName` — `self` for full-capability work, `research` for read-only (see [Subagent support](#subagent-support)) |
88+| Task tracking ("create a todo", "mark complete") | a **task artifact** — `write_to_file` with `IsArtifact: true` and `ArtifactType: "task"` (see [Task tracking](#task-tracking)). **Not** `manage_task`, which manages background processes. |
99+1010+## Task tracking
1111+1212+Antigravity has **no todo tool** (`manage_task` manages background
1313+processes — `list`/`kill`/`status`/`send_input` — it is *not* a checklist). When a
1414+skill says to create a todo list or track tasks, maintain a **task artifact**: a
1515+markdown checklist saved with `write_to_file` (`IsArtifact: true`,
1616+`ArtifactMetadata.ArtifactType: "task"`), edited with `replace_file_content` /
1717+`multi_replace_file_content` as you go.
1818+1919+At the start of any multi-step task, create the task artifact listing every step of
2020+your plan. As you complete each step, edit the artifact to mark it done (`- [x]`).
2121+If the plan changes, update the checklist. Keep it current — it is your source of
2222+truth for what remains; once the conversation gets long, re-read it before starting
2323+each step.
···11+## Subagent dispatch requires multi-agent support
22+33+Add to your Codex config (`~/.codex/config.toml`):
44+55+```toml
66+[features]
77+multi_agent = true
88+```
99+1010+This enables `spawn_agent`, `wait_agent`, and `close_agent` for skills like `dispatching-parallel-agents` and `subagent-driven-development`. When using subagent-driven-development, you should always close implementer and reviewer subagents when they have finished all their work.
1111+1212+## Environment Detection
1313+1414+Skills that create worktrees or finish branches should detect their
1515+environment with read-only git commands before proceeding:
1616+1717+```bash
1818+GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
1919+GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
2020+BRANCH=$(git branch --show-current)
2121+```
2222+2323+- `GIT_DIR != GIT_COMMON` → already in a linked worktree (skip creation)
2424+- `BRANCH` empty → detached HEAD (cannot branch/push/PR from sandbox)
2525+2626+See `using-git-worktrees` Step 0 and `finishing-a-development-branch`
2727+Step 1 for how each skill uses these signals.
2828+2929+## Codex App Finishing
3030+3131+When the sandbox blocks branch/push operations (detached HEAD in an
3232+externally managed worktree), the agent commits all work and informs
3333+the user to use the App's native controls:
3434+3535+- **"Create branch"** — names the branch, then commit/push/PR via App UI
3636+- **"Hand off to local"** — transfers work to the user's local checkout
3737+3838+The agent can still run tests, stage files, and output suggested branch
3939+names, commit messages, and PR descriptions for the user to copy.
···11+# Pi Tool Mapping
22+33+Skills speak in actions ("dispatch a subagent", "create a todo", "read a file"). On Pi these resolve to the tools below.
44+55+| Action skills request | Pi equivalent |
66+| --- | --- |
77+| Dispatch a subagent (`Subagent (general-purpose):` template) | Use an installed subagent tool such as `subagent` from `pi-subagents` if available |
88+| Task tracking ("create a todo", "mark complete") | Use an installed todo/task tool if available, otherwise track tasks in the plan or `TODO.md` |
99+1010+## Subagents
1111+1212+Pi core does not ship a standard subagent tool. The `pi-subagents` package is a strong optional companion and provides a `subagent` tool with single-agent, chain, parallel, async, forked-context, and resume/status workflows. If no subagent tool is available, do not fabricate `Task` calls; execute sequentially in the current session or explain that the optional subagent capability is not installed.
1313+1414+## Task lists
1515+1616+Pi core does not ship a standard task-list tool. If a todo/task extension is installed, use its documented tool. Otherwise use Superpowers plan files, checklists in Markdown, or a repo-local `TODO.md` for task tracking. Older Superpowers docs may refer to `TodoWrite`; treat that as the task-tracking action above.
···11+---
22+name: verification-before-completion
33+description: Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
44+---
55+66+# Verification Before Completion
77+88+## Overview
99+1010+Claiming work is complete without verification is dishonesty, not efficiency.
1111+1212+**Core principle:** Evidence before claims, always.
1313+1414+**Violating the letter of this rule is violating the spirit of this rule.**
1515+1616+## The Iron Law
1717+1818+```
1919+NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
2020+```
2121+2222+If you haven't run the verification command in this message, you cannot claim it passes.
2323+2424+## The Gate Function
2525+2626+```
2727+BEFORE claiming any status or expressing satisfaction:
2828+2929+1. IDENTIFY: What command proves this claim?
3030+2. RUN: Execute the FULL command (fresh, complete)
3131+3. READ: Full output, check exit code, count failures
3232+4. VERIFY: Does output confirm the claim?
3333+ - If NO: State actual status with evidence
3434+ - If YES: State claim WITH evidence
3535+5. ONLY THEN: Make the claim
3636+3737+Skip any step = lying, not verifying
3838+```
3939+4040+## Common Failures
4141+4242+| Claim | Requires | Not Sufficient |
4343+|-------|----------|----------------|
4444+| Tests pass | Test command output: 0 failures | Previous run, "should pass" |
4545+| Linter clean | Linter output: 0 errors | Partial check, extrapolation |
4646+| Build succeeds | Build command: exit 0 | Linter passing, logs look good |
4747+| Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
4848+| Regression test works | Red-green cycle verified | Test passes once |
4949+| Agent completed | VCS diff shows changes | Agent reports "success" |
5050+| Requirements met | Line-by-line checklist | Tests passing |
5151+5252+## Red Flags - STOP
5353+5454+- Using "should", "probably", "seems to"
5555+- Expressing satisfaction before verification ("Great!", "Perfect!", "Done!", etc.)
5656+- About to commit/push/PR without verification
5757+- Trusting agent success reports
5858+- Relying on partial verification
5959+- Thinking "just this once"
6060+- Tired and wanting work over
6161+- **ANY wording implying success without having run verification**
6262+6363+## Rationalization Prevention
6464+6565+| Excuse | Reality |
6666+|--------|---------|
6767+| "Should work now" | RUN the verification |
6868+| "I'm confident" | Confidence ≠ evidence |
6969+| "Just this once" | No exceptions |
7070+| "Linter passed" | Linter ≠ compiler |
7171+| "Agent said success" | Verify independently |
7272+| "I'm tired" | Exhaustion ≠ excuse |
7373+| "Partial check is enough" | Partial proves nothing |
7474+| "Different words so rule doesn't apply" | Spirit over letter |
7575+7676+## Key Patterns
7777+7878+**Tests:**
7979+```
8080+✅ [Run test command] [See: 34/34 pass] "All tests pass"
8181+❌ "Should pass now" / "Looks correct"
8282+```
8383+8484+**Regression tests (TDD Red-Green):**
8585+```
8686+✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
8787+❌ "I've written a regression test" (without red-green verification)
8888+```
8989+9090+**Build:**
9191+```
9292+✅ [Run build] [See: exit 0] "Build passes"
9393+❌ "Linter passed" (linter doesn't check compilation)
9494+```
9595+9696+**Requirements:**
9797+```
9898+✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
9999+❌ "Tests pass, phase complete"
100100+```
101101+102102+**Agent delegation:**
103103+```
104104+✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
105105+❌ Trust agent report
106106+```
107107+108108+## Why This Matters
109109+110110+From 24 failure memories:
111111+- your human partner said "I don't believe you" - trust broken
112112+- Undefined functions shipped - would crash
113113+- Missing requirements shipped - incomplete features
114114+- Time wasted on false completion → redirect → rework
115115+- Violates: "Honesty is a core value. If you lie, you'll be replaced."
116116+117117+## When To Apply
118118+119119+**ALWAYS before:**
120120+- ANY variation of success/completion claims
121121+- ANY expression of satisfaction
122122+- ANY positive statement about work state
123123+- Committing, PR creation, task completion
124124+- Moving to next task
125125+- Delegating to agents
126126+127127+**Rule applies to:**
128128+- Exact phrases
129129+- Paraphrases and synonyms
130130+- Implications of success
131131+- ANY communication suggesting completion/correctness
132132+133133+## The Bottom Line
134134+135135+**No shortcuts for verification.**
136136+137137+Run the command. Read the output. THEN claim the result.
138138+139139+This is non-negotiable.