@flavor-code/superharness 1.0.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/HARNESS.md +56 -0
- package/flavor-plugin.json +25 -0
- package/index.js +238 -0
- package/package.json +23 -0
- package/scripts/ralph-lib.ps1 +297 -0
- package/scripts/ralph-lib.sh +366 -0
- package/skills/brainstorm/SKILL.md +179 -0
- package/skills/brainstorm/scripts/layout.js +76 -0
- package/skills/brainstorm/scripts/mindmap.html +249 -0
- package/skills/brainstorm/scripts/server.cjs +208 -0
- package/skills/brainstorm/scripts/start-server.ps1 +57 -0
- package/skills/brainstorm/scripts/stop-server.ps1 +17 -0
- package/skills/finishing-a-development-branch/SKILL.md +112 -0
- package/skills/go/SKILL.md +169 -0
- package/skills/light/SKILL.md +85 -0
- package/skills/requesting-code-review/SKILL.md +103 -0
- package/skills/requesting-code-review/code-reviewer.md +168 -0
- package/skills/subagent-driven-development/SKILL.md +125 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/using-git-worktrees/SKILL.md +91 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/writing-plans/SKILL.md +138 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: go
|
|
3
|
+
description: Use when the user gives a task goal to complete end-to-end under superharness discipline - drives the full autonomous workflow from goal to verified, reviewed, committed result
|
|
4
|
+
argument-hint: [task goal]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Superharness Go — Autonomous Task Workflow
|
|
8
|
+
|
|
9
|
+
**Task goal:** $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
If the goal above is empty, ask your human partner for the task goal and stop.
|
|
12
|
+
|
|
13
|
+
**Announce at start:** "Superharness engaged. Working on: <goal>."
|
|
14
|
+
|
|
15
|
+
You will now drive this goal to completion under the constraints in `HARNESS.md`
|
|
16
|
+
(in this plugin's root directory — read it now if it is not already in your context).
|
|
17
|
+
Work autonomously: only stop to ask when a decision genuinely belongs to your human
|
|
18
|
+
partner (destructive actions, ambiguous product choices). Everything else, decide and proceed.
|
|
19
|
+
|
|
20
|
+
**State root:** the superharness state root follows the host — `.claude/superharness/`
|
|
21
|
+
under Claude Code, `.flavor/superharness/` under flavor-code. Everywhere below,
|
|
22
|
+
`.claude/superharness/` stands for whichever state root applies to your host.
|
|
23
|
+
|
|
24
|
+
## Phase 0 — Understand
|
|
25
|
+
|
|
26
|
+
1. Restate the goal in one sentence.
|
|
27
|
+
2. Explore the relevant code (Glob/Grep/Read) until you can name the files involved.
|
|
28
|
+
3. If the goal is ambiguous in a way that changes the architecture, ask ONE round of
|
|
29
|
+
clarifying questions. Otherwise proceed with the most reasonable interpretation and
|
|
30
|
+
note your assumptions in the plan.
|
|
31
|
+
|
|
32
|
+
## Phase 0.5 — Isolate
|
|
33
|
+
|
|
34
|
+
**REQUIRED SUB-SKILL:** `superharness:using-git-worktrees`
|
|
35
|
+
|
|
36
|
+
Set up an isolated workspace before changing anything. In a git project this
|
|
37
|
+
creates a worktree on a new branch **by default** (no consent prompt) so a run
|
|
38
|
+
that goes wrong can be discarded cleanly. If the project is not a git repo, or
|
|
39
|
+
worktree creation fails, work in place — never block. Everything after this
|
|
40
|
+
(plan, trace, implementation, commits) happens in whatever workspace this leaves.
|
|
41
|
+
|
|
42
|
+
## Phase 1 — Plan
|
|
43
|
+
|
|
44
|
+
**REQUIRED SUB-SKILL:** `superharness:writing-plans`
|
|
45
|
+
|
|
46
|
+
- For any goal needing 3+ steps, write the plan to `.claude/superharness/plans/YYYY-MM-DD-<slug>.md`
|
|
47
|
+
(create the folder if missing).
|
|
48
|
+
- Bite-sized tasks, 2–5 minutes each. Every code step shows the actual code.
|
|
49
|
+
Every task follows the TDD step sequence: failing test → verify RED → minimal
|
|
50
|
+
implementation → verify GREEN → commit.
|
|
51
|
+
- Trivial goals (1–2 steps) may skip the plan file but NOT the TDD cycle.
|
|
52
|
+
- Create one TodoWrite/Task item per plan task and keep statuses current.
|
|
53
|
+
- **Ralph tracking is already auto-started — you only enrich it.** The moment this
|
|
54
|
+
`/superharness:go` prompt was submitted, the UserPromptSubmit hook bootstrapped the
|
|
55
|
+
ralph state under `.claude/superharness/ralph/`: it ran `Set-RalphCurrentTask` to
|
|
56
|
+
write the `.current-task` pointer (the single active-task marker), seeded an empty
|
|
57
|
+
`task.json`, and opened `trace.jsonl` with a `task:started` event. Dot-source the
|
|
58
|
+
ralph library first: `.claude/superharness/plugins/superharness/scripts/ralph-lib.ps1`
|
|
59
|
+
(Claude Code) or `.flavor/plugins/superharness/scripts/ralph-lib.ps1` (flavor-code);
|
|
60
|
+
on macOS/Linux use the `ralph-lib.sh` counterpart at the same location.
|
|
61
|
+
- **Fallback — guarantee the files exist.** Check `Get-RalphCurrentTask -Root <project>`.
|
|
62
|
+
If it returns `$null` the hook did NOT fire (a brand-new session is needed to register
|
|
63
|
+
hooks, or this runner skips UserPromptSubmit for slash commands). In that case
|
|
64
|
+
bootstrap it yourself NOW, as the very first action, so the runtime files appear under
|
|
65
|
+
`.claude/superharness/ralph/` regardless:
|
|
66
|
+
`Start-RalphTask -Root <project> -TaskId '<YYYY-MM-DD-slug>' -Goal '<goal>'`.
|
|
67
|
+
If it already returns a task id, the hook handled it — do not recreate.
|
|
68
|
+
- Then **enrich** the (now-present) state:
|
|
69
|
+
- `Initialize-RalphTasks -Root <project> -Tasks @(@{ id=1; name='scaffold lib' }, @{ id=2; name='add ledger' }) -Phase 'plan' -SprintTotal <N>`
|
|
70
|
+
— replace the empty list in `.claude/superharness/ralph/task.json` with the plan's
|
|
71
|
+
task list (each `pending`). **Each entry MUST be a hashtable with `id` and `name`
|
|
72
|
+
keys** — one per plan task. Passing bare strings (e.g. `@('scaffold','ledger')`)
|
|
73
|
+
silently produces empty `{id:null, name:""}` rows, because the function reads
|
|
74
|
+
`$t.id` / `$t.name` off each element. Set `-SprintTotal` to the task count.
|
|
75
|
+
- `Add-RalphTrace -Root <project> -Phase 'plan' -Event 'plan:done' -Detail '<one-line plan summary>'`
|
|
76
|
+
— append to the `.claude/superharness/ralph/trace.jsonl` execution ledger.
|
|
77
|
+
The Stop hook records a `round` heartbeat each round while `.current-task` exists.
|
|
78
|
+
Track **one active go task per project** at a time: `.current-task` is the single
|
|
79
|
+
active-task marker, so do not run concurrent `go` tasks in the same project (a new
|
|
80
|
+
go invocation auto-repoints the pointer to a new task).
|
|
81
|
+
|
|
82
|
+
## Phase 2 — Implement (TDD, no exceptions)
|
|
83
|
+
|
|
84
|
+
**REQUIRED SUB-SKILLS:** `superharness:subagent-driven-development` (for plans
|
|
85
|
+
with multiple independent tasks) and `superharness:test-driven-development`.
|
|
86
|
+
|
|
87
|
+
- **Multi-task plan:** delegate to `superharness:subagent-driven-development` —
|
|
88
|
+
it dispatches a fresh subagent per task so this main context stays on plan and
|
|
89
|
+
review. Each subagent does TDD and commits; you coordinate and handle BLOCKED.
|
|
90
|
+
- **Trivial goal (1–2 steps) or tightly-coupled tasks:** implement inline here
|
|
91
|
+
with `superharness:test-driven-development` (no subagent overhead).
|
|
92
|
+
|
|
93
|
+
Either way, every task follows TDD with no exceptions:
|
|
94
|
+
|
|
95
|
+
1. **RED** — write the failing test first. Run it. Confirm it fails for the expected reason.
|
|
96
|
+
2. **GREEN** — write the minimal implementation. Run the test. Confirm it passes.
|
|
97
|
+
3. **REFACTOR** — clean up while keeping tests green.
|
|
98
|
+
4. **Commit** with a descriptive message.
|
|
99
|
+
|
|
100
|
+
If implementation code was written before its test: delete it, write the test, start over.
|
|
101
|
+
If anything behaves unexpectedly, switch to `superharness:systematic-debugging` —
|
|
102
|
+
no guess-and-patch fixes.
|
|
103
|
+
|
|
104
|
+
> Ralph trace note: at each task boundary, record execution events with
|
|
105
|
+
> `Add-RalphTrace -Root <project> -Phase 'implement' -Event '<task-id>:<red|green|commit>' -Detail '<short>'`,
|
|
106
|
+
> and flip status with `Set-RalphTaskStatus -Root <project> -Id <task-id> -Status in_progress|done`.
|
|
107
|
+
> Implementer subagents do not write trace markers; the main agent records them. The
|
|
108
|
+
> Stop hook independently appends a `round` heartbeat each round as a backstop.
|
|
109
|
+
|
|
110
|
+
## Phase 3 — Verify
|
|
111
|
+
|
|
112
|
+
**REQUIRED SUB-SKILL:** `superharness:verification-before-completion`
|
|
113
|
+
|
|
114
|
+
- Run the FULL test suite, not just the new tests. Paste actual output.
|
|
115
|
+
- **Record the verification + auto-retry (cap 5).** After running the FULL suite:
|
|
116
|
+
- All green → `Add-RalphTrace -Root <project> -Phase 'verify' -Event 'verify:success' -Detail '<test cmd>'`,
|
|
117
|
+
then `Set-RalphTaskStatus` the task to `done` and `Reset-RalphRetry -Root <project>`.
|
|
118
|
+
- One or more failing → `Add-RalphTrace -Root <project> -Phase 'verify' -Event 'verify:failure' -Detail '<failing test + assertion>'`,
|
|
119
|
+
then `Add-RalphRetry -Root <project>`. If `Test-RalphRetryExhausted -Root <project>`
|
|
120
|
+
is true (the counter hit the cap of 5), **stop and report** — do not loop forever.
|
|
121
|
+
Otherwise **automatically retry in this same run**: go back to Phase 2 via
|
|
122
|
+
`superharness:systematic-debugging` (reproduce → root cause → fix → re-verify). This
|
|
123
|
+
is an autonomous retry loop, not a blind re-run, and it does not pause to ask.
|
|
124
|
+
- Run linters/builds the project defines.
|
|
125
|
+
- Never report partial success as success.
|
|
126
|
+
|
|
127
|
+
## Phase 4 — Review
|
|
128
|
+
|
|
129
|
+
**REQUIRED SUB-SKILL:** `superharness:requesting-code-review`
|
|
130
|
+
|
|
131
|
+
- Dispatch a code-reviewer subagent over the change (base SHA → head SHA) using the
|
|
132
|
+
template in `superharness:requesting-code-review`.
|
|
133
|
+
- Fix Critical and Important issues (each fix goes through the TDD cycle again).
|
|
134
|
+
Note Minor issues in the final report.
|
|
135
|
+
|
|
136
|
+
## Phase 5 — Finish & Report
|
|
137
|
+
|
|
138
|
+
**REQUIRED SUB-SKILL:** `superharness:finishing-a-development-branch`
|
|
139
|
+
|
|
140
|
+
If Phase 0.5 created a worktree or branch, close it out now: merge the branch
|
|
141
|
+
back, remove the worktree, delete the branch — follow
|
|
142
|
+
`superharness:finishing-a-development-branch`. If the project is not a git repo
|
|
143
|
+
or work was done in place, there is nothing to finish; proceed to the report.
|
|
144
|
+
Never push to a remote as part of finishing — pushing stays with your human
|
|
145
|
+
partner.
|
|
146
|
+
|
|
147
|
+
Deliver a final summary containing:
|
|
148
|
+
|
|
149
|
+
- What was built/changed and where (file paths)
|
|
150
|
+
- Evidence: test commands run and their actual results
|
|
151
|
+
- Review outcome and what was fixed
|
|
152
|
+
- Assumptions made and any noted Minor issues / follow-ups
|
|
153
|
+
- How the work was finished (merge + worktree cleanup, or in-place)
|
|
154
|
+
|
|
155
|
+
**Close the trace.** On final completion, record the terminal event and clear the
|
|
156
|
+
active marker: `Add-RalphTrace -Root <project> -Phase 'done' -Event 'task:completed' -Detail '<summary>'`
|
|
157
|
+
(or `task:failed` / `task:abandoned`), mark the remaining tasks `done` via
|
|
158
|
+
`Set-RalphTaskStatus`, and remove `.claude/superharness/ralph/.current-task` so the Stop hook
|
|
159
|
+
stops recording. The full execution history stays in `.claude/superharness/ralph/trace.jsonl`
|
|
160
|
+
(plus the per-round Stop-hook heartbeats) for cold-start resume via `Get-RalphResumeContext`.
|
|
161
|
+
|
|
162
|
+
## Red Flags
|
|
163
|
+
|
|
164
|
+
| Thought | Reality |
|
|
165
|
+
|---------|---------|
|
|
166
|
+
| "The goal is simple, skip the plan" | Fine — but never skip TDD or verification. |
|
|
167
|
+
| "Tests after coding just this once" | No. RED first, always. |
|
|
168
|
+
| "Full suite takes too long" | Run it anyway. That's the evidence. |
|
|
169
|
+
| "Review is overkill here" | Multi-file or behavior-changing work gets reviewed. |
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: light
|
|
3
|
+
description: Use when the user gives a small, focused task goal that needs discipline without the full go machinery - quick fixes, small features, config or docs tweaks, prototypes, or when go feels too heavy. Keeps TDD (with explicit exemptions), real-output verification, and root-cause debugging while dropping worktrees, plan files, parallel dispatch, formal code review, and ralph tracking. For heavy multi-file work use superharness:go instead.
|
|
4
|
+
argument-hint: [task goal]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Superharness Light — lightweight autonomous tasks
|
|
8
|
+
|
|
9
|
+
**Task goal:** $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
If the goal above is empty, ask your human partner for the task goal and stop.
|
|
12
|
+
|
|
13
|
+
**Announce at start:** "Superharness light engaged. Working on: <goal>."
|
|
14
|
+
|
|
15
|
+
`light` is the lightweight tier of `/superharness:go`. Core discipline is kept (TDD, real-output verification, root-cause debugging); the heavy machinery is dropped. If the task turns out bigger than expected (touches multiple subsystems, needs formal review), proactively switch back to `/superharness:go` and explain why.
|
|
16
|
+
|
|
17
|
+
## When to use which
|
|
18
|
+
|
|
19
|
+
| Scenario | Command |
|
|
20
|
+
|----------|---------|
|
|
21
|
+
| Small bug fixes, small features, config/copy tweaks, prototype validation, when go feels too heavy | `/superharness:light` |
|
|
22
|
+
| Multi-file work, behavior changes, needs an isolated workspace / resumable runs / formal code review | `/superharness:go` |
|
|
23
|
+
|
|
24
|
+
## What light does NOT do
|
|
25
|
+
|
|
26
|
+
- No worktree/branch — works in place by default
|
|
27
|
+
- No plan file — the task list is managed with TodoWrite, nothing is written to disk
|
|
28
|
+
- No subagent dispatch for implementation or review — everything is done inline in the current session, closed out with a self-check list
|
|
29
|
+
- No ralph tracking — no `.current-task` / `task.json` / `trace.jsonl` are written, the Stop hook automatically no-ops, zero bookkeeping overhead; if interrupted, just re-run
|
|
30
|
+
|
|
31
|
+
> Note: if the project already has an active go task (`.claude/superharness/ralph/.current-task` exists — `.flavor/superharness/ralph/.current-task` under flavor-code), tell the user first — light will not take over or finish that task. Recommend closing out the go task before running light, to avoid the two flows crossing.
|
|
32
|
+
|
|
33
|
+
## Phase 1 — Understand
|
|
34
|
+
|
|
35
|
+
1. Restate the goal in one sentence.
|
|
36
|
+
2. Quickly locate the relevant files (Glob/Grep/Read) until you can say which files need to change.
|
|
37
|
+
3. Ask one round of clarifying questions if there is ambiguity; otherwise proceed with the most reasonable interpretation and record the assumptions in the final report.
|
|
38
|
+
|
|
39
|
+
## Phase 2 — Implement (TDD with explicit exemptions)
|
|
40
|
+
|
|
41
|
+
**Strict TDD by default**, see `superharness:test-driven-development`: failing test first (RED) → minimal implementation (GREEN) → refactor → commit.
|
|
42
|
+
|
|
43
|
+
**TDD Exemptions (no need to ask, but Phase 3 verification is still required):**
|
|
44
|
+
- Pure config: dependency manifests, build config, environment variables
|
|
45
|
+
- Pure copy/docs/comments
|
|
46
|
+
- Generated code / scaffolding
|
|
47
|
+
- One-off prototypes (not entering the main code path)
|
|
48
|
+
|
|
49
|
+
Exemptions still require: minimal, explainable changes, and verification after completion.
|
|
50
|
+
|
|
51
|
+
**Branch strategy:** work in place by default. Only create a one-off branch (no worktree) when the change heavily modifies existing code and the project is a git repo; merge or discard it when done.
|
|
52
|
+
|
|
53
|
+
**Commits:** one commit per cohesive unit; not every TDD cycle needs its own commit.
|
|
54
|
+
|
|
55
|
+
## Phase 3 — Verification (non-negotiable)
|
|
56
|
+
|
|
57
|
+
- Run the affected tests plus the project's test command (if the project defines one, run the full suite), and paste the real output.
|
|
58
|
+
- On failure → follow the `superharness:systematic-debugging` root-cause flow: reproduce → locate root cause → fix (with a regression test) → re-verify.
|
|
59
|
+
- "Should be fine" is not an acceptable way to close out.
|
|
60
|
+
|
|
61
|
+
## Phase 4 — Self-check list (replaces formal review)
|
|
62
|
+
|
|
63
|
+
Go through this once the change is complete:
|
|
64
|
+
|
|
65
|
+
- [ ] No debug leftovers in the diff (console.log / debugger / temp code)
|
|
66
|
+
- [ ] No dead code / unused imports
|
|
67
|
+
- [ ] Naming consistent with existing code
|
|
68
|
+
- [ ] Tests actually failed (RED evidence), or the change falls under an exemption category
|
|
69
|
+
- [ ] Edge cases quickly reviewed
|
|
70
|
+
|
|
71
|
+
Does the change touch multiple modules or a public API? Proactively suggest running `/superharness:go` afterwards for the full flow.
|
|
72
|
+
|
|
73
|
+
## Phase 5 — Report
|
|
74
|
+
|
|
75
|
+
Report concisely: what changed (file paths), what commands were run, real results, assumptions.
|
|
76
|
+
No trace, no `.current-task` — light leaves no runtime footprint.
|
|
77
|
+
|
|
78
|
+
## Red Flags
|
|
79
|
+
|
|
80
|
+
| Thought | Reality |
|
|
81
|
+
|---------|---------|
|
|
82
|
+
| "This change is too simple, no need to verify" | Verification is non-negotiable: run tests, paste output. |
|
|
83
|
+
| "Change the code first, add tests later" | TDD by default: failing test first. Exemptions only cover config/copy/scaffolding. |
|
|
84
|
+
| "It failed, just try a different approach" | Follow root-cause debugging; no guess-and-patch. |
|
|
85
|
+
| "The task is bigger than expected, keep pushing through" | Switch back to `/superharness:go`. |
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requesting-code-review
|
|
3
|
+
description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requesting Code Review
|
|
7
|
+
|
|
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
|
+
|
|
10
|
+
**Core principle:** Review early, review often.
|
|
11
|
+
|
|
12
|
+
## When to Request Review
|
|
13
|
+
|
|
14
|
+
**Mandatory:**
|
|
15
|
+
- After each task in subagent-driven development
|
|
16
|
+
- After completing major feature
|
|
17
|
+
- Before merge to main
|
|
18
|
+
|
|
19
|
+
**Optional but valuable:**
|
|
20
|
+
- When stuck (fresh perspective)
|
|
21
|
+
- Before refactoring (baseline check)
|
|
22
|
+
- After fixing complex bug
|
|
23
|
+
|
|
24
|
+
## How to Request
|
|
25
|
+
|
|
26
|
+
**1. Get git SHAs:**
|
|
27
|
+
```bash
|
|
28
|
+
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
|
|
29
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**2. Dispatch code reviewer subagent:**
|
|
33
|
+
|
|
34
|
+
Use Task tool with `general-purpose` type, fill template at `code-reviewer.md`
|
|
35
|
+
|
|
36
|
+
**Placeholders:**
|
|
37
|
+
- `{DESCRIPTION}` - Brief summary of what you built
|
|
38
|
+
- `{PLAN_OR_REQUIREMENTS}` - What it should do
|
|
39
|
+
- `{BASE_SHA}` - Starting commit
|
|
40
|
+
- `{HEAD_SHA}` - Ending commit
|
|
41
|
+
|
|
42
|
+
**3. Act on feedback:**
|
|
43
|
+
- Fix Critical issues immediately
|
|
44
|
+
- Fix Important issues before proceeding
|
|
45
|
+
- Note Minor issues for later
|
|
46
|
+
- Push back if reviewer is wrong (with reasoning)
|
|
47
|
+
|
|
48
|
+
## Example
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
[Just completed Task 2: Add verification function]
|
|
52
|
+
|
|
53
|
+
You: Let me request code review before proceeding.
|
|
54
|
+
|
|
55
|
+
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
|
|
56
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
57
|
+
|
|
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
|
|
61
|
+
BASE_SHA: a7981ec
|
|
62
|
+
HEAD_SHA: 3df7661
|
|
63
|
+
|
|
64
|
+
[Subagent returns]:
|
|
65
|
+
Strengths: Clean architecture, real tests
|
|
66
|
+
Issues:
|
|
67
|
+
Important: Missing progress indicators
|
|
68
|
+
Minor: Magic number (100) for reporting interval
|
|
69
|
+
Assessment: Ready to proceed
|
|
70
|
+
|
|
71
|
+
You: [Fix progress indicators]
|
|
72
|
+
[Continue to Task 3]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Integration with Workflows
|
|
76
|
+
|
|
77
|
+
**Subagent-Driven Development:**
|
|
78
|
+
- Review after EACH task
|
|
79
|
+
- Catch issues before they compound
|
|
80
|
+
- Fix before moving to next task
|
|
81
|
+
|
|
82
|
+
**Executing Plans:**
|
|
83
|
+
- Review after each task or at natural checkpoints
|
|
84
|
+
- Get feedback, apply, continue
|
|
85
|
+
|
|
86
|
+
**Ad-Hoc Development:**
|
|
87
|
+
- Review before merge
|
|
88
|
+
- Review when stuck
|
|
89
|
+
|
|
90
|
+
## Red Flags
|
|
91
|
+
|
|
92
|
+
**Never:**
|
|
93
|
+
- Skip review because "it's simple"
|
|
94
|
+
- Ignore Critical issues
|
|
95
|
+
- Proceed with unfixed Important issues
|
|
96
|
+
- Argue with valid technical feedback
|
|
97
|
+
|
|
98
|
+
**If reviewer wrong:**
|
|
99
|
+
- Push back with technical reasoning
|
|
100
|
+
- Show code/tests that prove it works
|
|
101
|
+
- Request clarification
|
|
102
|
+
|
|
103
|
+
See template at: requesting-code-review/code-reviewer.md
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Code Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching a code reviewer subagent.
|
|
4
|
+
|
|
5
|
+
**Purpose:** Review completed work against requirements and code quality standards before it cascades into more work.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Task tool (general-purpose):
|
|
9
|
+
description: "Review code changes"
|
|
10
|
+
prompt: |
|
|
11
|
+
You are a Senior Code Reviewer with expertise in software architecture,
|
|
12
|
+
design patterns, and best practices. Your job is to review completed work
|
|
13
|
+
against its plan or requirements and identify issues before they cascade.
|
|
14
|
+
|
|
15
|
+
## What Was Implemented
|
|
16
|
+
|
|
17
|
+
{DESCRIPTION}
|
|
18
|
+
|
|
19
|
+
## Requirements / Plan
|
|
20
|
+
|
|
21
|
+
{PLAN_OR_REQUIREMENTS}
|
|
22
|
+
|
|
23
|
+
## Git Range to Review
|
|
24
|
+
|
|
25
|
+
**Base:** {BASE_SHA}
|
|
26
|
+
**Head:** {HEAD_SHA}
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git diff --stat {BASE_SHA}..{HEAD_SHA}
|
|
30
|
+
git diff {BASE_SHA}..{HEAD_SHA}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What to Check
|
|
34
|
+
|
|
35
|
+
**Plan alignment:**
|
|
36
|
+
- Does the implementation match the plan / requirements?
|
|
37
|
+
- Are deviations justified improvements, or problematic departures?
|
|
38
|
+
- Is all planned functionality present?
|
|
39
|
+
|
|
40
|
+
**Code quality:**
|
|
41
|
+
- Clean separation of concerns?
|
|
42
|
+
- Proper error handling?
|
|
43
|
+
- Type safety where applicable?
|
|
44
|
+
- DRY without premature abstraction?
|
|
45
|
+
- Edge cases handled?
|
|
46
|
+
|
|
47
|
+
**Architecture:**
|
|
48
|
+
- Sound design decisions?
|
|
49
|
+
- Reasonable scalability and performance?
|
|
50
|
+
- Security concerns?
|
|
51
|
+
- Integrates cleanly with surrounding code?
|
|
52
|
+
|
|
53
|
+
**Testing:**
|
|
54
|
+
- Tests verify real behavior, not mocks?
|
|
55
|
+
- Edge cases covered?
|
|
56
|
+
- Integration tests where they matter?
|
|
57
|
+
- All tests passing?
|
|
58
|
+
|
|
59
|
+
**Production readiness:**
|
|
60
|
+
- Migration strategy if schema changed?
|
|
61
|
+
- Backward compatibility considered?
|
|
62
|
+
- Documentation complete?
|
|
63
|
+
- No obvious bugs?
|
|
64
|
+
|
|
65
|
+
## Calibration
|
|
66
|
+
|
|
67
|
+
Categorize issues by actual severity. Not everything is Critical.
|
|
68
|
+
Acknowledge what was done well before listing issues — accurate praise
|
|
69
|
+
helps the implementer trust the rest of the feedback.
|
|
70
|
+
|
|
71
|
+
If you find significant deviations from the plan, flag them specifically
|
|
72
|
+
so the implementer can confirm whether the deviation was intentional.
|
|
73
|
+
If you find issues with the plan itself rather than the implementation,
|
|
74
|
+
say so.
|
|
75
|
+
|
|
76
|
+
## Output Format
|
|
77
|
+
|
|
78
|
+
### Strengths
|
|
79
|
+
[What's well done? Be specific.]
|
|
80
|
+
|
|
81
|
+
### Issues
|
|
82
|
+
|
|
83
|
+
#### Critical (Must Fix)
|
|
84
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
85
|
+
|
|
86
|
+
#### Important (Should Fix)
|
|
87
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
88
|
+
|
|
89
|
+
#### Minor (Nice to Have)
|
|
90
|
+
[Code style, optimization opportunities, documentation polish]
|
|
91
|
+
|
|
92
|
+
For each issue:
|
|
93
|
+
- File:line reference
|
|
94
|
+
- What's wrong
|
|
95
|
+
- Why it matters
|
|
96
|
+
- How to fix (if not obvious)
|
|
97
|
+
|
|
98
|
+
### Recommendations
|
|
99
|
+
[Improvements for code quality, architecture, or process]
|
|
100
|
+
|
|
101
|
+
### Assessment
|
|
102
|
+
|
|
103
|
+
**Ready to merge?** [Yes | No | With fixes]
|
|
104
|
+
|
|
105
|
+
**Reasoning:** [1-2 sentence technical assessment]
|
|
106
|
+
|
|
107
|
+
## Critical Rules
|
|
108
|
+
|
|
109
|
+
**DO:**
|
|
110
|
+
- Categorize by actual severity
|
|
111
|
+
- Be specific (file:line, not vague)
|
|
112
|
+
- Explain WHY each issue matters
|
|
113
|
+
- Acknowledge strengths
|
|
114
|
+
- Give a clear verdict
|
|
115
|
+
|
|
116
|
+
**DON'T:**
|
|
117
|
+
- Say "looks good" without checking
|
|
118
|
+
- Mark nitpicks as Critical
|
|
119
|
+
- Give feedback on code you didn't actually read
|
|
120
|
+
- Be vague ("improve error handling")
|
|
121
|
+
- Avoid giving a clear verdict
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Placeholders:**
|
|
125
|
+
- `{DESCRIPTION}` — brief summary of what was built
|
|
126
|
+
- `{PLAN_OR_REQUIREMENTS}` — what it should do (plan file path, task text, or requirements)
|
|
127
|
+
- `{BASE_SHA}` — starting commit
|
|
128
|
+
- `{HEAD_SHA}` — ending commit
|
|
129
|
+
|
|
130
|
+
**Reviewer returns:** Strengths, Issues (Critical / Important / Minor), Recommendations, Assessment
|
|
131
|
+
|
|
132
|
+
## Example Output
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
### Strengths
|
|
136
|
+
- Clean database schema with proper migrations (db.ts:15-42)
|
|
137
|
+
- Comprehensive test coverage (18 tests, all edge cases)
|
|
138
|
+
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
139
|
+
|
|
140
|
+
### Issues
|
|
141
|
+
|
|
142
|
+
#### Important
|
|
143
|
+
1. **Missing help text in CLI wrapper**
|
|
144
|
+
- File: index-conversations:1-31
|
|
145
|
+
- Issue: No --help flag, users won't discover --concurrency
|
|
146
|
+
- Fix: Add --help case with usage examples
|
|
147
|
+
|
|
148
|
+
2. **Date validation missing**
|
|
149
|
+
- File: search.ts:25-27
|
|
150
|
+
- Issue: Invalid dates silently return no results
|
|
151
|
+
- Fix: Validate ISO format, throw error with example
|
|
152
|
+
|
|
153
|
+
#### Minor
|
|
154
|
+
1. **Progress indicators**
|
|
155
|
+
- File: indexer.ts:130
|
|
156
|
+
- Issue: No "X of Y" counter for long operations
|
|
157
|
+
- Impact: Users don't know how long to wait
|
|
158
|
+
|
|
159
|
+
### Recommendations
|
|
160
|
+
- Add progress reporting for user experience
|
|
161
|
+
- Consider config file for excluded projects (portability)
|
|
162
|
+
|
|
163
|
+
### Assessment
|
|
164
|
+
|
|
165
|
+
**Ready to merge: With fixes**
|
|
166
|
+
|
|
167
|
+
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
|
168
|
+
```
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: subagent-driven-development
|
|
3
|
+
description: Use when executing an implementation plan whose tasks are mostly independent - dispatches a fresh subagent per task to keep the controller's context clean, with per-task self-review and a single final review
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Subagent-Driven Development
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Execute a plan by dispatching a **fresh subagent per task**. The controller (you)
|
|
11
|
+
keeps only plan + coordination context; each implementer subagent gets exactly
|
|
12
|
+
the task it needs and nothing else. This preserves your context for the long run
|
|
13
|
+
and keeps each task focused.
|
|
14
|
+
|
|
15
|
+
**Announce at start:** "Executing the plan with subagent-driven-development."
|
|
16
|
+
|
|
17
|
+
**Core principle:** Fresh subagent per task + per-task self-review + one final
|
|
18
|
+
review = focused context, fast iteration.
|
|
19
|
+
|
|
20
|
+
**superharness scope:** Per-task review is **self-review only** — there are no
|
|
21
|
+
per-task reviewer subagents. Whole-change quality is gated once, by the caller's
|
|
22
|
+
final `superharness:requesting-code-review` pass (`go` Phase 4).
|
|
23
|
+
|
|
24
|
+
## When to use
|
|
25
|
+
|
|
26
|
+
- You have a written plan (from `superharness:writing-plans`).
|
|
27
|
+
- Its tasks are **mostly independent** (not tightly coupled).
|
|
28
|
+
- You are staying in this session.
|
|
29
|
+
|
|
30
|
+
If tasks are tightly coupled, or the goal is trivial (1–2 steps), skip subagents
|
|
31
|
+
and implement inline with `superharness:test-driven-development`.
|
|
32
|
+
|
|
33
|
+
## Process
|
|
34
|
+
|
|
35
|
+
1. **Read the plan once.** Extract every task with its full text and surrounding
|
|
36
|
+
context (where it fits, files involved). Create one TodoWrite item per task.
|
|
37
|
+
2. **Per task, in order** (never dispatch two implementers in parallel — they
|
|
38
|
+
would fight over the working tree):
|
|
39
|
+
- Dispatch a fresh implementer subagent with the **complete task text +
|
|
40
|
+
scene-setting context**. The subagent does NOT read the plan file — you
|
|
41
|
+
hand it everything.
|
|
42
|
+
- The implementer follows `superharness:test-driven-development`
|
|
43
|
+
(RED → GREEN → REFACTOR → commit), runs that task's tests, self-reviews,
|
|
44
|
+
and commits.
|
|
45
|
+
- Handle the returned status (below). When DONE and clean, mark the TodoWrite
|
|
46
|
+
item complete and move on.
|
|
47
|
+
3. **After all tasks**, return control to the caller (`go` Phase 3/4) for the
|
|
48
|
+
full-suite verification and the single final code review.
|
|
49
|
+
|
|
50
|
+
```dot
|
|
51
|
+
digraph sdd {
|
|
52
|
+
"Read plan, extract all tasks, TodoWrite" [shape=box];
|
|
53
|
+
"More tasks?" [shape=diamond];
|
|
54
|
+
"Dispatch fresh implementer subagent (full task text + context)" [shape=box];
|
|
55
|
+
"Status?" [shape=diamond];
|
|
56
|
+
"Supply context / stronger model / split / escalate" [shape=box];
|
|
57
|
+
"Mark task complete" [shape=box];
|
|
58
|
+
"Return to caller for verify + final review" [shape=box];
|
|
59
|
+
|
|
60
|
+
"Read plan, extract all tasks, TodoWrite" -> "More tasks?";
|
|
61
|
+
"More tasks?" -> "Dispatch fresh implementer subagent (full task text + context)" [label="yes"];
|
|
62
|
+
"More tasks?" -> "Return to caller for verify + final review" [label="no"];
|
|
63
|
+
"Dispatch fresh implementer subagent (full task text + context)" -> "Status?";
|
|
64
|
+
"Status?" -> "Mark task complete" [label="DONE"];
|
|
65
|
+
"Status?" -> "Supply context / stronger model / split / escalate" [label="NEEDS_CONTEXT / BLOCKED"];
|
|
66
|
+
"Supply context / stronger model / split / escalate" -> "Dispatch fresh implementer subagent (full task text + context)";
|
|
67
|
+
"Mark task complete" -> "More tasks?";
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Implementer dispatch template
|
|
72
|
+
|
|
73
|
+
Fill this in and send it as the subagent's prompt (do not point it at the plan
|
|
74
|
+
file — hand it the full text):
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
You are implementing ONE task under superharness discipline. Use
|
|
78
|
+
superharness:test-driven-development — write the failing test first, watch it
|
|
79
|
+
fail (RED), write the minimal code to pass (GREEN), refactor, then commit.
|
|
80
|
+
|
|
81
|
+
Task: <full task text, verbatim from the plan>
|
|
82
|
+
|
|
83
|
+
Context you need:
|
|
84
|
+
- Where this fits: <one or two sentences>
|
|
85
|
+
- Files involved: <exact paths>
|
|
86
|
+
- Conventions/patterns to follow: <as needed>
|
|
87
|
+
|
|
88
|
+
When done, self-review your diff, then report ONE status:
|
|
89
|
+
- DONE — implemented, tests green, committed
|
|
90
|
+
- DONE_WITH_CONCERNS — done, but I flag: <concern>
|
|
91
|
+
- NEEDS_CONTEXT — I need: <what>
|
|
92
|
+
- BLOCKED — I cannot proceed because: <why>
|
|
93
|
+
Report the test command you ran and its actual result.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Handling implementer status
|
|
97
|
+
|
|
98
|
+
- **DONE** — mark complete, next task.
|
|
99
|
+
- **DONE_WITH_CONCERNS** — read the concern. If it affects correctness or scope,
|
|
100
|
+
resolve it before moving on; if it's an observation, note it and proceed.
|
|
101
|
+
- **NEEDS_CONTEXT** — supply exactly what's missing and re-dispatch.
|
|
102
|
+
- **BLOCKED** — assess: more context? re-dispatch with it. Needs more reasoning?
|
|
103
|
+
re-dispatch with a more capable model. Too large? split it. Plan wrong?
|
|
104
|
+
escalate to your human partner. Never re-dispatch the same model unchanged.
|
|
105
|
+
|
|
106
|
+
## Model selection
|
|
107
|
+
|
|
108
|
+
Use the cheapest model that fits: mechanical 1–2 file tasks with a complete spec
|
|
109
|
+
→ a fast model; multi-file integration → a standard model; design judgment or
|
|
110
|
+
broad codebase understanding → the most capable model.
|
|
111
|
+
|
|
112
|
+
## Continuous execution
|
|
113
|
+
|
|
114
|
+
Do not check in with your human partner between tasks. Stop only for an
|
|
115
|
+
unresolvable BLOCKED, genuine ambiguity, or when all tasks are complete.
|
|
116
|
+
|
|
117
|
+
## Red Flags
|
|
118
|
+
|
|
119
|
+
| Thought | Reality |
|
|
120
|
+
|---------|---------|
|
|
121
|
+
| "I'll let the subagent read the plan" | No. Hand it the full task text + context. |
|
|
122
|
+
| "Run two implementers at once to go faster" | They'll corrupt the working tree. One at a time. |
|
|
123
|
+
| "Skip self-review, the final review will catch it" | Self-review is the per-task gate. Always do it. |
|
|
124
|
+
| "BLOCKED — I'll just retry the same way" | Change something: context, model, or task size. |
|
|
125
|
+
| "Tasks are coupled but I'll force subagents" | Fall back to inline TDD for coupled work. |
|