@complexthings/superpowers-agent 8.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/.agents/docs/SUPERPOWERS.md +108 -0
- package/.agents/prompts/001-copilot-tool-mapping-do/001-copilot-tool-mapping-do.md +116 -0
- package/.agents/prompts/001-copilot-tool-mapping-do/SUMMARY.md +72 -0
- package/.agents/prompts/001-copilot-tool-mapping-do/copilot-tool-mapping-do-output.md +83 -0
- package/.agents/prompts/001-release-management-do/001-release-management-do.md +161 -0
- package/.agents/prompts/001-release-management-do/SUMMARY.md +19 -0
- package/.agents/prompts/001-release-management-do/completed/001-release-management-do.md +161 -0
- package/.agents/prompts/002-pull-command-do/SUMMARY.md +28 -0
- package/.agents/prompts/002-pull-command-do/completed/002-pull-command-do.md +122 -0
- package/.agents/prompts/002-pull-command-do/pull-command-do-output.md +174 -0
- package/.agents/prompts/command_updates_prompt.md +69 -0
- package/.agents/prompts/current_prompt.md +8 -0
- package/.agents/prompts/refactor.prompt.md +57 -0
- package/.agents/skills/.gitkeep +0 -0
- package/.agents/superpowers-agent +355 -0
- package/.agents/superpowers-bootstrap.md +42 -0
- package/.agents/templates/AGENTS.md.template +40 -0
- package/.agents/templates/SUPERPOWERS.md.template +108 -0
- package/.agents/templates/TOOLS.md.template +15 -0
- package/.github/workflows/main.yaml +32 -0
- package/AGENTS.md +60 -0
- package/LICENSE +21 -0
- package/README.md +724 -0
- package/hooks/hooks.json +15 -0
- package/hooks/session-start.sh +27 -0
- package/package.json +51 -0
- package/skills/architecture/ABOUT.md +20 -0
- package/skills/architecture/preserving-productive-tensions/SKILL.md +146 -0
- package/skills/architecture/preserving-productive-tensions/skill.json +9 -0
- package/skills/collaboration/brainstorming/SKILL.md +166 -0
- package/skills/collaboration/brainstorming/skill.json +9 -0
- package/skills/collaboration/brainstorming/spec-document-reviewer-prompt.md +50 -0
- package/skills/collaboration/brainstorming/visual-companion.md +277 -0
- package/skills/collaboration/dispatching-parallel-agents/SKILL.md +174 -0
- package/skills/collaboration/dispatching-parallel-agents/skill.json +9 -0
- package/skills/collaboration/executing-plans/SKILL.md +130 -0
- package/skills/collaboration/executing-plans/skill.json +9 -0
- package/skills/collaboration/finishing-a-development-branch/SKILL.md +261 -0
- package/skills/collaboration/finishing-a-development-branch/skill.json +9 -0
- package/skills/collaboration/leveraging-cli-tools/SKILL.md +132 -0
- package/skills/collaboration/leveraging-cli-tools/skill.json +9 -0
- package/skills/collaboration/receiving-code-review/SKILL.md +233 -0
- package/skills/collaboration/receiving-code-review/skill.json +9 -0
- package/skills/collaboration/requesting-code-review/SKILL.md +110 -0
- package/skills/collaboration/requesting-code-review/code-reviewer.md +146 -0
- package/skills/collaboration/requesting-code-review/skill.json +12 -0
- package/skills/collaboration/subagent-driven-development/SKILL.md +255 -0
- package/skills/collaboration/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/collaboration/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/collaboration/subagent-driven-development/skill.json +15 -0
- package/skills/collaboration/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/collaboration/using-git-worktrees/SKILL.md +366 -0
- package/skills/collaboration/using-git-worktrees/skill.json +9 -0
- package/skills/collaboration/writing-plans/SKILL.md +121 -0
- package/skills/collaboration/writing-plans/plan-document-reviewer-prompt.md +52 -0
- package/skills/collaboration/writing-plans/skill.json +9 -0
- package/skills/debugging/defense-in-depth/SKILL.md +380 -0
- package/skills/debugging/defense-in-depth/skill.json +9 -0
- package/skills/debugging/root-cause-tracing/SKILL.md +361 -0
- package/skills/debugging/root-cause-tracing/find-polluter.sh +63 -0
- package/skills/debugging/root-cause-tracing/skill.json +12 -0
- package/skills/debugging/systematic-debugging/SKILL.md +299 -0
- package/skills/debugging/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/debugging/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/debugging/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/debugging/systematic-debugging/find-polluter.sh +63 -0
- package/skills/debugging/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/debugging/systematic-debugging/skill.json +9 -0
- package/skills/debugging/systematic-debugging/test-academic.md +14 -0
- package/skills/debugging/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/debugging/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/debugging/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/debugging/verification-before-completion/SKILL.md +143 -0
- package/skills/debugging/verification-before-completion/skill.json +9 -0
- package/skills/finding-skills/SKILL.md +101 -0
- package/skills/finding-skills/skill.json +8 -0
- package/skills/meta/create-skill-json/SKILL.md +370 -0
- package/skills/meta/create-skill-json/skill.json +9 -0
- package/skills/meta/create-skill-json/test-scenarios.md +29 -0
- package/skills/meta/creating-prompts/SKILL.md +349 -0
- package/skills/meta/creating-prompts/examples/do-example.md +65 -0
- package/skills/meta/creating-prompts/examples/plan-example.md +75 -0
- package/skills/meta/creating-prompts/examples/refine-example.md +65 -0
- package/skills/meta/creating-prompts/examples/research-example.md +63 -0
- package/skills/meta/creating-prompts/scripts/get-next-number.sh +27 -0
- package/skills/meta/creating-prompts/skill.json +20 -0
- package/skills/meta/creating-prompts/templates/do-template.md +59 -0
- package/skills/meta/creating-prompts/templates/plan-template.md +58 -0
- package/skills/meta/creating-prompts/templates/refine-template.md +54 -0
- package/skills/meta/creating-prompts/templates/research-template.md +56 -0
- package/skills/meta/using-superpowers/SKILL.md +122 -0
- package/skills/meta/using-superpowers/skill.json +5 -0
- package/skills/meta/writing-prompts/SKILL.md +345 -0
- package/skills/meta/writing-prompts/skill.json +9 -0
- package/skills/problem-solving/ABOUT.md +40 -0
- package/skills/problem-solving/collision-zone-thinking/SKILL.md +188 -0
- package/skills/problem-solving/collision-zone-thinking/references/historical-examples.md +393 -0
- package/skills/problem-solving/collision-zone-thinking/skill.json +9 -0
- package/skills/problem-solving/inversion-exercise/SKILL.md +174 -0
- package/skills/problem-solving/inversion-exercise/skill.json +9 -0
- package/skills/problem-solving/meta-pattern-recognition/SKILL.md +116 -0
- package/skills/problem-solving/meta-pattern-recognition/skill.json +9 -0
- package/skills/problem-solving/scale-game/SKILL.md +222 -0
- package/skills/problem-solving/scale-game/skill.json +9 -0
- package/skills/problem-solving/simplification-cascades/SKILL.md +113 -0
- package/skills/problem-solving/simplification-cascades/skill.json +9 -0
- package/skills/problem-solving/when-stuck/SKILL.md +69 -0
- package/skills/problem-solving/when-stuck/skill.json +9 -0
- package/skills/research/ABOUT.md +20 -0
- package/skills/research/tracing-knowledge-lineages/SKILL.md +241 -0
- package/skills/research/tracing-knowledge-lineages/skill.json +9 -0
- package/skills/setup-skills/SKILL.md +47 -0
- package/skills/testing/condition-based-waiting/SKILL.md +359 -0
- package/skills/testing/condition-based-waiting/example.ts +158 -0
- package/skills/testing/condition-based-waiting/skill.json +12 -0
- package/skills/testing/test-driven-development/SKILL.md +434 -0
- package/skills/testing/test-driven-development/skill.json +9 -0
- package/skills/testing/testing-anti-patterns/SKILL.md +298 -0
- package/skills/testing/testing-anti-patterns/skill.json +9 -0
- package/skills/testing/verification-before-completion/SKILL.md +246 -0
- package/skills/testing/verification-before-completion/skill.json +10 -0
- package/skills/using-a-skill/SKILL.md +101 -0
- package/skills/using-a-skill/skill.json +8 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Spec Compliance Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching a spec compliance reviewer subagent.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Verify implementer built what was requested (nothing more, nothing less)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Task tool (general-purpose):
|
|
9
|
+
description: "Review spec compliance for Task N"
|
|
10
|
+
prompt: |
|
|
11
|
+
You are reviewing whether an implementation matches its specification.
|
|
12
|
+
|
|
13
|
+
## What Was Requested
|
|
14
|
+
|
|
15
|
+
[FULL TEXT of task requirements]
|
|
16
|
+
|
|
17
|
+
## What Implementer Claims They Built
|
|
18
|
+
|
|
19
|
+
[From implementer's report]
|
|
20
|
+
|
|
21
|
+
## CRITICAL: Do Not Trust the Report
|
|
22
|
+
|
|
23
|
+
The implementer finished suspiciously quickly. Their report may be incomplete,
|
|
24
|
+
inaccurate, or optimistic. You MUST verify everything independently.
|
|
25
|
+
|
|
26
|
+
**DO NOT:**
|
|
27
|
+
- Take their word for what they implemented
|
|
28
|
+
- Trust their claims about completeness
|
|
29
|
+
- Accept their interpretation of requirements
|
|
30
|
+
|
|
31
|
+
**DO:**
|
|
32
|
+
- Read the actual code they wrote
|
|
33
|
+
- Compare actual implementation to requirements line by line
|
|
34
|
+
- Check for missing pieces they claimed to implement
|
|
35
|
+
- Look for extra features they didn't mention
|
|
36
|
+
|
|
37
|
+
## Your Job
|
|
38
|
+
|
|
39
|
+
Read the implementation code and verify:
|
|
40
|
+
|
|
41
|
+
**Missing requirements:**
|
|
42
|
+
- Did they implement everything that was requested?
|
|
43
|
+
- Are there requirements they skipped or missed?
|
|
44
|
+
- Did they claim something works but didn't actually implement it?
|
|
45
|
+
|
|
46
|
+
**Extra/unneeded work:**
|
|
47
|
+
- Did they build things that weren't requested?
|
|
48
|
+
- Did they over-engineer or add unnecessary features?
|
|
49
|
+
- Did they add "nice to haves" that weren't in spec?
|
|
50
|
+
|
|
51
|
+
**Misunderstandings:**
|
|
52
|
+
- Did they interpret requirements differently than intended?
|
|
53
|
+
- Did they solve the wrong problem?
|
|
54
|
+
- Did they implement the right feature but wrong way?
|
|
55
|
+
|
|
56
|
+
**Verify by reading code, not by trusting report.**
|
|
57
|
+
|
|
58
|
+
Report:
|
|
59
|
+
- ✅ Spec compliant (if everything matches after code inspection)
|
|
60
|
+
- ❌ Issues found: [list specifically what's missing or extra, with file:line references]
|
|
61
|
+
```
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-git-worktrees
|
|
3
|
+
description: Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
|
|
4
|
+
metadata:
|
|
5
|
+
when_to_use: when starting feature work that needs isolation from current workspace, before executing implementation plans
|
|
6
|
+
version: 1.2.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Using Git Worktrees
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
|
|
14
|
+
|
|
15
|
+
**Core principle:** Systematic directory selection + safety verification = reliable isolation.
|
|
16
|
+
|
|
17
|
+
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
|
|
18
|
+
|
|
19
|
+
## Pre-Flight Check
|
|
20
|
+
|
|
21
|
+
### Detect Current Context
|
|
22
|
+
|
|
23
|
+
Before creating a worktree, confirm you're in a git repo and know where you are:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Verify git repo
|
|
27
|
+
git rev-parse --show-toplevel 2>/dev/null || { echo "Not a git repo"; exit 1; }
|
|
28
|
+
|
|
29
|
+
# Check if already inside a linked worktree (vs main worktree)
|
|
30
|
+
git_dir=$(git rev-parse --absolute-git-dir 2>/dev/null)
|
|
31
|
+
# In a linked worktree, $git_dir points to .git/worktrees/<name>/, not .git/
|
|
32
|
+
# This is informational — git worktree add works from either location
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Check for Submodules
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
[ -f .gitmodules ] && echo "WARNING: This repo has submodules — git worktree support is incomplete. Multiple checkouts of a superproject are not recommended."
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Directory Selection Process
|
|
42
|
+
|
|
43
|
+
Follow this priority order:
|
|
44
|
+
|
|
45
|
+
### 1. Check Existing Directories
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Use POSIX test, not ls -d (more reliable)
|
|
49
|
+
[ -d .worktrees ] && echo "found: .worktrees"
|
|
50
|
+
[ -d worktrees ] && echo "found: worktrees"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**If found:** Use that directory. If both exist, `.worktrees` wins.
|
|
54
|
+
|
|
55
|
+
### 2. Check AGENTS.md / CLAUDE.md
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
grep -i "worktree.*director" AGENTS.md 2>/dev/null
|
|
59
|
+
grep -i "worktree.*director" CLAUDE.md 2>/dev/null
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**If preference specified:** Use it without asking.
|
|
63
|
+
|
|
64
|
+
### 3. Ask User
|
|
65
|
+
|
|
66
|
+
If no directory exists and no config preference:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
No worktree directory found. Where should I create worktrees?
|
|
70
|
+
|
|
71
|
+
1. .worktrees/ (project-local, hidden)
|
|
72
|
+
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)
|
|
73
|
+
|
|
74
|
+
Which would you prefer?
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Safety Verification
|
|
78
|
+
|
|
79
|
+
### For Project-Local Directories (.worktrees or worktrees)
|
|
80
|
+
|
|
81
|
+
**MUST verify directory is ignored before creating worktree.** Note the trailing slash — required for `git check-ignore` to recognize directory patterns:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Note: trailing slash required for directory pattern matching
|
|
85
|
+
git check-ignore -q .worktrees/ 2>/dev/null && echo "ignored" || echo "NOT ignored"
|
|
86
|
+
git check-ignore -q worktrees/ 2>/dev/null && echo "ignored" || echo "NOT ignored"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**If NOT ignored:**
|
|
90
|
+
|
|
91
|
+
1. Add appropriate line to `.gitignore` (e.g., `.worktrees/` or `worktrees/`)
|
|
92
|
+
2. Commit the change
|
|
93
|
+
3. Proceed with worktree creation
|
|
94
|
+
|
|
95
|
+
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
96
|
+
|
|
97
|
+
### For Global Directory (~/.config/superpowers/worktrees)
|
|
98
|
+
|
|
99
|
+
No `.gitignore` verification needed — outside project entirely.
|
|
100
|
+
|
|
101
|
+
## Branch Name Handling
|
|
102
|
+
|
|
103
|
+
Branch names with `/` (e.g., `feature/add-auth`) create nested subdirectories inside the worktree location. This works but produces `feature/add-auth` → `.worktrees/feature/add-auth/`. If you want a flat layout, sanitize slashes:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Sanitize slashes to dashes for flat directory names
|
|
107
|
+
safe_name=$(echo "$BRANCH_NAME" | tr '/' '-')
|
|
108
|
+
# Use $safe_name for the path, $BRANCH_NAME for the git branch
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Creation Steps
|
|
112
|
+
|
|
113
|
+
### 1. Detect Project Name
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
project=$(basename "$(git rev-parse --show-toplevel)")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 2. Determine Full Path
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
case $LOCATION in
|
|
123
|
+
.worktrees|worktrees)
|
|
124
|
+
path="$LOCATION/$safe_name"
|
|
125
|
+
;;
|
|
126
|
+
~/.config/superpowers/worktrees/*)
|
|
127
|
+
path="$HOME/.config/superpowers/worktrees/$project/$safe_name"
|
|
128
|
+
;;
|
|
129
|
+
esac
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 3. Check for Existing Worktree or Path Conflicts
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Check if target path is already a registered worktree
|
|
136
|
+
if git worktree list --porcelain | awk '/^worktree /{print $2}' | grep -qx "$path"; then
|
|
137
|
+
echo "Worktree already exists at $path — switching to it instead"
|
|
138
|
+
# Just cd to it
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
# Check if path exists as a regular directory (failed previous run)
|
|
142
|
+
if [ -d "$path" ]; then
|
|
143
|
+
echo "Directory $path already exists but is not a registered worktree — choose a different name or remove it"
|
|
144
|
+
fi
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 4. Handle Branch Existence
|
|
148
|
+
|
|
149
|
+
The correct command depends on whether the branch already exists:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Check if branch exists
|
|
153
|
+
if git show-ref --verify --quiet "refs/heads/$BRANCH_NAME"; then
|
|
154
|
+
# Branch exists — check if it's already checked out somewhere
|
|
155
|
+
if git worktree list --porcelain | grep -q "^branch refs/heads/${BRANCH_NAME}$"; then
|
|
156
|
+
echo "Branch '$BRANCH_NAME' is already checked out in another worktree — cannot create duplicate"
|
|
157
|
+
echo "Use --force only if you know what you're doing (rare edge case)"
|
|
158
|
+
else
|
|
159
|
+
# Branch exists, not checked out — use it as-is (no -b flag)
|
|
160
|
+
git worktree add "$path" "$BRANCH_NAME"
|
|
161
|
+
fi
|
|
162
|
+
else
|
|
163
|
+
# Branch doesn't exist — create it
|
|
164
|
+
git worktree add "$path" -b "$BRANCH_NAME"
|
|
165
|
+
fi
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Note:** Avoid `-B` (capital B) — it silently resets an existing branch to HEAD, destroying unpushed commits.
|
|
169
|
+
|
|
170
|
+
### 5. Run Project Setup
|
|
171
|
+
|
|
172
|
+
Auto-detect and run appropriate setup. Prefer lockfile-respecting commands to avoid modifying lockfiles and creating dirty state:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Node.js — prefer npm ci (deterministic) over npm install (may modify lockfile)
|
|
176
|
+
if [ -f package-lock.json ]; then
|
|
177
|
+
npm ci
|
|
178
|
+
elif [ -f yarn.lock ]; then
|
|
179
|
+
yarn install --frozen-lockfile
|
|
180
|
+
elif [ -f pnpm-lock.yaml ]; then
|
|
181
|
+
pnpm install --frozen-lockfile
|
|
182
|
+
elif [ -f bun.lockb ]; then
|
|
183
|
+
bun install
|
|
184
|
+
elif [ -f package.json ]; then
|
|
185
|
+
npm install # no lockfile — fallback only
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
# Rust
|
|
189
|
+
if [ -f Cargo.toml ]; then cargo build; fi
|
|
190
|
+
|
|
191
|
+
# Python
|
|
192
|
+
if [ -f pyproject.toml ]; then
|
|
193
|
+
poetry install
|
|
194
|
+
elif [ -f requirements.txt ]; then
|
|
195
|
+
pip install -r requirements.txt
|
|
196
|
+
fi
|
|
197
|
+
|
|
198
|
+
# Go
|
|
199
|
+
if [ -f go.mod ]; then go mod download; fi
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 6. Verify Clean Baseline
|
|
203
|
+
|
|
204
|
+
Run tests to ensure worktree starts clean:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Use project-appropriate command
|
|
208
|
+
npm test
|
|
209
|
+
cargo test
|
|
210
|
+
pytest
|
|
211
|
+
go test ./...
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**If tests fail:** Report failures, ask whether to proceed or investigate.
|
|
215
|
+
|
|
216
|
+
**If tests pass:** Report ready.
|
|
217
|
+
|
|
218
|
+
### 7. Report Location
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
Worktree ready at <full-path>
|
|
222
|
+
Branch: <branch-name>
|
|
223
|
+
Tests passing (<N> tests, 0 failures)
|
|
224
|
+
Ready to implement <feature-name>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Listing & Managing Worktrees
|
|
228
|
+
|
|
229
|
+
Always use `--porcelain` for scripting — the human-readable output format is not stable:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# List all worktrees (machine-readable)
|
|
233
|
+
git worktree list --porcelain
|
|
234
|
+
|
|
235
|
+
# List all worktrees (human-readable overview)
|
|
236
|
+
git worktree list
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Cleanup & Removal
|
|
240
|
+
|
|
241
|
+
When work is complete (typically called by the `finishing-a-development-branch` skill):
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Remove a clean worktree
|
|
245
|
+
git worktree remove .worktrees/my-feature
|
|
246
|
+
|
|
247
|
+
# Remove even if uncommitted changes exist
|
|
248
|
+
git worktree remove --force .worktrees/my-feature
|
|
249
|
+
|
|
250
|
+
# Prune stale admin files after manual directory deletion
|
|
251
|
+
git worktree prune
|
|
252
|
+
|
|
253
|
+
# Dry-run to see what would be pruned
|
|
254
|
+
git worktree prune -n -v
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Note:** `git gc` auto-prunes stale worktree admin files after 3 months (`gc.worktreePruneExpire`). For short-lived agent tasks, call `git worktree prune` explicitly rather than waiting.
|
|
258
|
+
|
|
259
|
+
## Repairing Worktrees
|
|
260
|
+
|
|
261
|
+
If the repo or worktree directory moves (Docker, CI, symlink changes), repair the links:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Run from main worktree after a linked worktree was moved
|
|
265
|
+
git worktree repair
|
|
266
|
+
|
|
267
|
+
# Specify new path if auto-detection fails
|
|
268
|
+
git worktree repair /new/path/to/worktree
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Locking (Long-Running Tasks)
|
|
272
|
+
|
|
273
|
+
Lock a worktree to prevent `git gc` from pruning it during long agent tasks:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Atomically create and lock (prevents gc from cleaning up)
|
|
277
|
+
git worktree add --lock --reason "agent task in progress" "$path" -b "$BRANCH_NAME"
|
|
278
|
+
|
|
279
|
+
# Unlock when done
|
|
280
|
+
git worktree unlock "$path"
|
|
281
|
+
git worktree remove "$path"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Quick Reference
|
|
285
|
+
|
|
286
|
+
| Situation | Action |
|
|
287
|
+
|-----------|--------|
|
|
288
|
+
| `.worktrees/` exists | Use it (verify ignored) |
|
|
289
|
+
| `worktrees/` exists | Use it (verify ignored) |
|
|
290
|
+
| Both exist | Use `.worktrees/` |
|
|
291
|
+
| Neither exists | Check AGENTS.md/CLAUDE.md → Ask user |
|
|
292
|
+
| Directory not ignored | Add to `.gitignore` + commit |
|
|
293
|
+
| Branch doesn't exist | `git worktree add "$path" -b "$branch"` |
|
|
294
|
+
| Branch exists, not checked out | `git worktree add "$path" "$branch"` (no `-b`) |
|
|
295
|
+
| Branch checked out elsewhere | Error — ask user before using `--force` |
|
|
296
|
+
| Worktree already at path | Switch to it instead of re-creating |
|
|
297
|
+
| Tests fail during baseline | Report failures + ask |
|
|
298
|
+
| No package.json/Cargo.toml | Skip dependency install |
|
|
299
|
+
| Submodules present | Warn — limited worktree support |
|
|
300
|
+
| Long-running task | Use `--lock` when creating |
|
|
301
|
+
|
|
302
|
+
## Common Mistakes
|
|
303
|
+
|
|
304
|
+
### Trailing slash missing in git check-ignore
|
|
305
|
+
|
|
306
|
+
- **Problem:** `git check-ignore -q .worktrees` always exits 1 (not ignored), even when the directory IS ignored
|
|
307
|
+
- **Fix:** Always use `git check-ignore -q .worktrees/` — trailing slash required for directory matching
|
|
308
|
+
|
|
309
|
+
### Using `npm install` instead of `npm ci`
|
|
310
|
+
|
|
311
|
+
- **Problem:** `npm install` may modify `package-lock.json`, creating a dirty worktree from the start
|
|
312
|
+
- **Fix:** Use `npm ci` when a lockfile exists — it's deterministic and won't modify the lockfile
|
|
313
|
+
|
|
314
|
+
### Using `-b` when branch already exists
|
|
315
|
+
|
|
316
|
+
- **Problem:** `git worktree add "$path" -b "$branch"` fails if `$branch` already exists
|
|
317
|
+
- **Fix:** Check with `git show-ref --verify --quiet "refs/heads/$branch"` first; omit `-b` for existing branches
|
|
318
|
+
|
|
319
|
+
### Using `-B` (capital B)
|
|
320
|
+
|
|
321
|
+
- **Problem:** Silently resets an existing branch to HEAD, destroying unpushed commits
|
|
322
|
+
- **Fix:** Never use `-B` unless explicitly requested by the user
|
|
323
|
+
|
|
324
|
+
### Skipping ignore verification
|
|
325
|
+
|
|
326
|
+
- **Problem:** Worktree contents get tracked, pollute git status
|
|
327
|
+
- **Fix:** Always use `git check-ignore` (with trailing slash) before creating project-local worktrees
|
|
328
|
+
|
|
329
|
+
### Assuming directory location
|
|
330
|
+
|
|
331
|
+
- **Problem:** Creates inconsistency, violates project conventions
|
|
332
|
+
- **Fix:** Follow priority: existing > AGENTS.md/CLAUDE.md > ask
|
|
333
|
+
|
|
334
|
+
### Proceeding with failing tests
|
|
335
|
+
|
|
336
|
+
- **Problem:** Can't distinguish new bugs from pre-existing issues
|
|
337
|
+
- **Fix:** Report failures, get explicit permission to proceed
|
|
338
|
+
|
|
339
|
+
## Example Workflow
|
|
340
|
+
|
|
341
|
+
```
|
|
342
|
+
You: I'm using the using-git-worktrees skill to set up an isolated workspace.
|
|
343
|
+
|
|
344
|
+
[Check .worktrees/ — exists, verify with git check-ignore -q .worktrees/ → ignored]
|
|
345
|
+
[Check branch: git show-ref --verify --quiet refs/heads/feature/auth → not found]
|
|
346
|
+
[Sanitize path: feature/auth → feature-auth]
|
|
347
|
+
[Create: git worktree add .worktrees/feature-auth -b feature/auth]
|
|
348
|
+
[Run: npm ci (package-lock.json found)]
|
|
349
|
+
[Run: npm test — 47 passing]
|
|
350
|
+
|
|
351
|
+
Worktree ready at /Users/jesse/myproject/.worktrees/feature-auth
|
|
352
|
+
Branch: feature/auth
|
|
353
|
+
Tests passing (47 tests, 0 failures)
|
|
354
|
+
Ready to implement auth feature
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Integration
|
|
358
|
+
|
|
359
|
+
**Called by:**
|
|
360
|
+
- **brainstorming** (Phase 4) — REQUIRED when design is approved and implementation follows
|
|
361
|
+
- **subagent-driven-development** — REQUIRED before executing any tasks
|
|
362
|
+
- **executing-plans** — REQUIRED before executing any tasks
|
|
363
|
+
- Any skill needing isolated workspace
|
|
364
|
+
|
|
365
|
+
**Pairs with:**
|
|
366
|
+
- **finishing-a-development-branch** — REQUIRED for cleanup after work complete
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-plans
|
|
3
|
+
description: Use when you have a spec or requirements for a multi-step task, before touching code. Trigger this whenever a user says "write a plan", "create an implementation plan", "plan this out", "spec this task", or is about to implement something with multiple moving parts. Also use proactively when brainstorming has just completed and the next step is implementation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing Plans
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Write comprehensive implementation plans assuming the engineer has zero context for the codebase and questionable taste. Document everything they need to know: which files to touch for each task, code, testing, docs they might need to check, how to test it. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.
|
|
11
|
+
|
|
12
|
+
Assume they are a skilled developer, but know almost nothing about the toolset or problem domain. Assume they don't know good test design very well.
|
|
13
|
+
|
|
14
|
+
**Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
|
|
15
|
+
|
|
16
|
+
**Context:** This should be run in a dedicated worktree (created by brainstorming skill).
|
|
17
|
+
|
|
18
|
+
**Save plans to:** `.agents/superpowers/specs/YYYY-MM-DD-<feature-name>.md`
|
|
19
|
+
- (User preferences for plan location override this default)
|
|
20
|
+
|
|
21
|
+
## Scope Check
|
|
22
|
+
|
|
23
|
+
If the spec covers multiple independent subsystems, it should have been broken into sub-project specs during brainstorming. If it wasn't, suggest breaking this into separate plans — one per subsystem. Each plan should produce working, testable software on its own.
|
|
24
|
+
|
|
25
|
+
## File Structure
|
|
26
|
+
|
|
27
|
+
Before defining tasks, map out which files will be created or modified and what each one is responsible for. This is where decomposition decisions get locked in.
|
|
28
|
+
|
|
29
|
+
- Design units with clear boundaries and well-defined interfaces. Each file should have one clear responsibility.
|
|
30
|
+
- You reason best about code you can hold in context at once, and your edits are more reliable when files are focused. Prefer smaller, focused files over large ones that do too much.
|
|
31
|
+
- Files that change together should live together. Split by responsibility, not by technical layer.
|
|
32
|
+
- In existing codebases, follow established patterns. If a file you're modifying has grown unwieldy, including a split in the plan is reasonable.
|
|
33
|
+
|
|
34
|
+
This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.
|
|
35
|
+
|
|
36
|
+
## Bite-Sized Task Granularity
|
|
37
|
+
|
|
38
|
+
**Each step is one action (2-5 minutes):**
|
|
39
|
+
- "Write the failing test" - step
|
|
40
|
+
- "Run it to make sure it fails" - step
|
|
41
|
+
- "Implement the minimal code to make the test pass" - step
|
|
42
|
+
- "Run the tests and make sure they pass" - step
|
|
43
|
+
- "Commit" - step
|
|
44
|
+
|
|
45
|
+
## Plan Document Header
|
|
46
|
+
|
|
47
|
+
**Every plan MUST start with this header:**
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
# [Feature Name] Implementation Plan
|
|
51
|
+
|
|
52
|
+
> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
53
|
+
|
|
54
|
+
**Goal:** [One sentence describing what this builds]
|
|
55
|
+
|
|
56
|
+
**Architecture:** [2-3 sentences about approach]
|
|
57
|
+
|
|
58
|
+
**Tech Stack:** [Key technologies/libraries]
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Task Structure
|
|
64
|
+
|
|
65
|
+
Each task follows the TDD pattern with exact file paths, complete code, and exact commands:
|
|
66
|
+
|
|
67
|
+
````markdown
|
|
68
|
+
### Task N: [Component Name]
|
|
69
|
+
|
|
70
|
+
**Files:**
|
|
71
|
+
- Create: `exact/path/to/file.py`
|
|
72
|
+
- Modify: `exact/path/to/existing.py:123-145`
|
|
73
|
+
- Test: `tests/exact/path/to/test.py`
|
|
74
|
+
|
|
75
|
+
- [ ] **Step 1: Write the failing test**
|
|
76
|
+
```python
|
|
77
|
+
def test_specific_behavior():
|
|
78
|
+
result = function(input)
|
|
79
|
+
assert result == expected
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- [ ] **Step 2: Run test to verify it fails**
|
|
83
|
+
Run: `pytest tests/path/test.py::test_name -v`
|
|
84
|
+
Expected: FAIL with "function not defined"
|
|
85
|
+
|
|
86
|
+
- [ ] **Step 3: Write minimal implementation**
|
|
87
|
+
```python
|
|
88
|
+
def function(input):
|
|
89
|
+
return expected
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- [ ] **Step 4: Run test to verify it passes**
|
|
93
|
+
Run: `pytest tests/path/test.py::test_name -v`
|
|
94
|
+
Expected: PASS
|
|
95
|
+
|
|
96
|
+
- [ ] **Step 5: Commit**
|
|
97
|
+
```bash
|
|
98
|
+
git add tests/path/test.py src/path/file.py
|
|
99
|
+
git commit -m "feat: add specific feature"
|
|
100
|
+
```
|
|
101
|
+
````
|
|
102
|
+
|
|
103
|
+
Steps use `- [ ]` checkbox syntax so agents and humans can track progress.
|
|
104
|
+
|
|
105
|
+
## Plan Review Loop
|
|
106
|
+
|
|
107
|
+
After completing each chunk, dispatch the plan-document-reviewer subagent using the template in `plan-document-reviewer-prompt.md`. Fix any issues, re-review until approved. Chunk boundaries use `## Chunk N: <name>` headings (≤1000 lines each). Loop cap: 5 iterations before surfacing to human.
|
|
108
|
+
|
|
109
|
+
## Remember
|
|
110
|
+
- Exact file paths always
|
|
111
|
+
- Complete code in plan (not "add validation")
|
|
112
|
+
- Exact commands with expected output
|
|
113
|
+
- Reference relevant skills with @ syntax
|
|
114
|
+
- DRY, YAGNI, TDD, frequent commits
|
|
115
|
+
|
|
116
|
+
## Execution Handoff
|
|
117
|
+
|
|
118
|
+
After saving the plan, prompt: **"Plan complete and saved to `.agents/superpowers/specs/<filename>.md`. Ready to execute?"**
|
|
119
|
+
|
|
120
|
+
- **With subagents** → Use `superpowers:subagent-driven-development` (required, not optional)
|
|
121
|
+
- **Without subagents** → Use `superpowers:executing-plans` in current session
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Plan Document Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching a plan document reviewer subagent.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Verify the plan chunk is complete, matches the spec, and has proper task decomposition.
|
|
6
|
+
|
|
7
|
+
**Dispatch after:** Each plan chunk is written
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Task tool (general-purpose):
|
|
11
|
+
description: "Review plan chunk N"
|
|
12
|
+
prompt: |
|
|
13
|
+
You are a plan document reviewer. Verify this plan chunk is complete and ready for implementation.
|
|
14
|
+
|
|
15
|
+
**Plan chunk to review:** [PLAN_FILE_PATH] - Chunk N only
|
|
16
|
+
**Spec for reference:** [SPEC_FILE_PATH]
|
|
17
|
+
|
|
18
|
+
## What to Check
|
|
19
|
+
|
|
20
|
+
| Category | What to Look For |
|
|
21
|
+
|----------|------------------|
|
|
22
|
+
| Completeness | TODOs, placeholders, incomplete tasks, missing steps |
|
|
23
|
+
| Spec Alignment | Chunk covers relevant spec requirements, no scope creep |
|
|
24
|
+
| Task Decomposition | Tasks atomic, clear boundaries, steps actionable |
|
|
25
|
+
| File Structure | Files have clear single responsibilities, split by responsibility not layer |
|
|
26
|
+
| File Size | Would any new or modified file likely grow large enough to be hard to reason about as a whole? |
|
|
27
|
+
| Task Syntax | Checkbox syntax (`- [ ]`) on steps for tracking |
|
|
28
|
+
| Chunk Size | Each chunk under 1000 lines |
|
|
29
|
+
|
|
30
|
+
## CRITICAL
|
|
31
|
+
|
|
32
|
+
Look especially hard for:
|
|
33
|
+
- Any TODO markers or placeholder text
|
|
34
|
+
- Steps that say "similar to X" without actual content
|
|
35
|
+
- Incomplete task definitions
|
|
36
|
+
- Missing verification steps or expected outputs
|
|
37
|
+
- Files planned to hold multiple responsibilities or likely to grow unwieldy
|
|
38
|
+
|
|
39
|
+
## Output Format
|
|
40
|
+
|
|
41
|
+
## Plan Review - Chunk N
|
|
42
|
+
|
|
43
|
+
**Status:** Approved | Issues Found
|
|
44
|
+
|
|
45
|
+
**Issues (if any):**
|
|
46
|
+
- [Task X, Step Y]: [specific issue] - [why it matters]
|
|
47
|
+
|
|
48
|
+
**Recommendations (advisory):**
|
|
49
|
+
- [suggestions that don't block approval]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Reviewer returns:** Status, Issues (if any), Recommendations
|