@xynogen/pix-skills 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -22
- package/package.json +1 -1
- package/skills/ask-user.md +34 -43
- package/skills/audit.md +27 -30
- package/skills/bootstrap.md +19 -43
- package/skills/brainstorm.md +10 -51
- package/skills/cicd.md +17 -30
- package/skills/clone.md +19 -18
- package/skills/command-runner.md +7 -15
- package/skills/commit.md +22 -65
- package/skills/composio-mcp.md +24 -34
- package/skills/debug.md +18 -53
- package/skills/diff.md +8 -19
- package/skills/environment.md +21 -43
- package/skills/explain.md +27 -28
- package/skills/finish.md +24 -57
- package/skills/format.md +1 -1
- package/skills/handoff.md +24 -99
- package/skills/harden.md +18 -22
- package/skills/human/SKILL.md +177 -0
- package/skills/{human.md → human/references/patterns.md} +58 -252
- package/skills/human/references/profiles.md +86 -0
- package/skills/lint.md +1 -1
- package/skills/lsp.md +7 -11
- package/skills/readme.md +19 -25
- package/skills/review.md +30 -40
- package/skills/runner/SKILL.md +130 -0
- package/skills/runner/references/justfile.md +47 -0
- package/skills/runner/references/makefile.md +33 -0
- package/skills/runner/references/mise.md +88 -0
- package/skills/runner/references/npm-scripts.md +27 -0
- package/skills/runner/references/run-sh.md +46 -0
- package/skills/runner/references/taskfile.md +50 -0
- package/skills/search.md +22 -32
- package/skills/subagent.md +37 -353
- package/skills/suggest.md +10 -38
- package/skills/task.md +17 -37
- package/skills/tdd.md +1 -1
- package/skills/test.md +13 -46
- package/skills/tldr.md +12 -22
- package/skills/toon-json.md +11 -35
- package/skills/ui.md +8 -19
- package/skills/verify.md +14 -44
- package/skills/runner.md +0 -419
package/skills/subagent.md
CHANGED
|
@@ -1,376 +1,60 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: subagent
|
|
3
|
-
description:
|
|
3
|
+
description: Plans a task, splits it into independent units, and fans them out in parallel to cheaper subagent models with the agent tool, then integrates and verifies the result. Use when a task splits into 2+ parts that do not depend on each other and a strong model is more than each part needs.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
+
# Subagent fan-out
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
The scarce resource is the orchestrator's context and attention, not raw speed. Send mechanical units to cheap workers in parallel. Keep the plan, the seams, and the final check on the strong model. Workers do not plan, split further, or spawn their own agents.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
**cheaper** subagent models running **in parallel**. A capable orchestrator (you)
|
|
11
|
-
keeps the plan, the decisions, and the final integration. Cheap workers do the
|
|
12
|
-
bulk grunt work concurrently.
|
|
10
|
+
## Use only when all hold
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
budget on work that does not need it. Offloading those units to cheap workers
|
|
18
|
-
keeps the smart model's context clean and reserved for the hard 10% — the plan,
|
|
19
|
-
the seams, the integration. Faster wall-clock and lower cost are byproducts; the
|
|
20
|
-
point is preserving the expensive model's intelligence for where it actually
|
|
21
|
-
matters.
|
|
12
|
+
- The task has 2+ units, and no unit needs another unit's output.
|
|
13
|
+
- Each unit is mechanical given a precise spec (repetitive edits, boilerplate, test scaffolds, format conversion, per-module refactors, read-only surveys).
|
|
14
|
+
- You can fix the shared decisions (contracts, names, paths) before the split.
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
self-contained tasks — they do not plan, do not decompose further, and do not
|
|
25
|
-
launch their own subagents.
|
|
16
|
+
Do not use when units write the same file or region, the work is hard reasoning end to end, or the units form a chain (B needs A's output). For a chain, run it yourself or in one agent.
|
|
26
17
|
|
|
27
|
-
##
|
|
18
|
+
## Tools
|
|
28
19
|
|
|
29
|
-
|
|
20
|
+
- `agent_control({ action: "info", kind: "models" })` — list models with score, context, and price. `kind: "types"` lists agent types.
|
|
21
|
+
- `agent({ type, model, prompt, description, thinking, allowed_tools?, turns?, background? })` — start one worker. `background` defaults to `true`.
|
|
22
|
+
- `agent_control({ action: "result" | "steer" | "stop", agent_id })` — collect, redirect, or stop a worker.
|
|
30
23
|
|
|
31
|
-
-
|
|
32
|
-
needs another unit's output mid-flight).
|
|
33
|
-
- Each unit is **mechanical enough** that a smaller model can do it reliably
|
|
34
|
-
given a precise spec (boilerplate, repetitive edits across files, test
|
|
35
|
-
scaffolding, format conversions, doc stubs, per-module refactors).
|
|
36
|
-
- The shared decisions (architecture, contracts, naming) can be **fixed up
|
|
37
|
-
front** by the orchestrator so workers don't have to make them.
|
|
24
|
+
Type and model are separate. `type` sets tools and persona (`Explore` read-only search, `Plan` read-only design, `general` full tools). It never picks the model. Set `model` on every call.
|
|
38
25
|
|
|
39
|
-
|
|
26
|
+
## Steps
|
|
40
27
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
28
|
+
1. **Plan** — Fix the exact paths, shared contracts (types, signatures), names, and acceptance checks. For a large task, get a plan first from `agent({ type: "Plan", thinking: "high", ... })`.
|
|
29
|
+
2. **Split** — Each unit must pass three tests: no dependency on another unit, no shared write target, and a self-contained spec. A unit that fails goes back to the orchestrator.
|
|
30
|
+
3. **Pick the model at call time** — Use the model the user named. Else pick a clearly cheaper model from `info` (lower price, adequate score). If none is clearly cheaper, ask. Never hardcode a model name. Omit `model` only to inherit the parent on purpose.
|
|
31
|
+
4. **Fan out in one turn** — Launch every unit in the same turn: N `agent` calls with `background: true`, or one `codemode` script with `Promise.allSettled`. One-by-one launches that wait for each result are serial: you lose the speed and the quality, and keep the context cost.
|
|
32
|
+
5. **Supervise** — Results arrive on completion. Do not poll or sleep-wait. If a worker runs much longer than its size suggests or goes off track, inspect it once and `steer` with a concrete fix (missing fact, right path, narrower goal). If that fails, `stop` it and relaunch with a better prompt.
|
|
33
|
+
6. **Integrate** — Read the real diff of every worker that wrote files. A worker's "done" is a claim, not evidence. Fix contract drift and seams yourself. Fix small misses inline instead of a re-spawn.
|
|
34
|
+
7. **Verify** — Run the repo's full gate (lint → typecheck → tests) on the combined result. Green units do not prove a green whole.
|
|
46
35
|
|
|
47
|
-
##
|
|
36
|
+
## Worker prompt contract
|
|
48
37
|
|
|
49
|
-
|
|
50
|
-
1. PLAN → decide architecture, contracts, naming, acceptance up front
|
|
51
|
-
2. DECOMPOSE → split into N independent, fully-specified units
|
|
52
|
-
3. FAN OUT → subagent({ tasks:[...], concurrency }) with a cheap model per task
|
|
53
|
-
4. INTEGRATE → orchestrator wires units together, resolves seams, runs the gate
|
|
54
|
-
5. VERIFY → lint + typecheck + tests; fix seams the cheap workers couldn't
|
|
55
|
-
```
|
|
38
|
+
A cheaper model needs a tighter spec, not a looser one. The worker sees none of your conversation. Every prompt carries:
|
|
56
39
|
|
|
57
|
-
|
|
40
|
+
- **Goal** — the one artifact this unit produces.
|
|
41
|
+
- **Contract** — the exact types, signatures, and paths, copied in.
|
|
42
|
+
- **Constraints** — "edit only `<paths>`"; what not to touch.
|
|
43
|
+
- **Validation** — the local command to run and the expected result.
|
|
44
|
+
- **Output** — the exact shape of the reply (for example, a file list plus the command output).
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
exact file paths, the shared contracts (types, function signatures, interfaces),
|
|
61
|
-
the naming, and the acceptance criteria **before** splitting. The whole point is
|
|
62
|
-
that workers receive explicitly stated decisions instead of inventing them.
|
|
46
|
+
Example for one unit of a 6-handler change:
|
|
63
47
|
|
|
64
|
-
For large/complex tasks, delegate planning to the builtin `Plan` agent first, get
|
|
65
|
-
the plan, then decompose it:
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
subagent({ subagent_type: "Plan", thinking: "high", prompt: "Plan: <task>. Emphasize independent, parallelizable units." })
|
|
69
48
|
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Split the plan into units that satisfy the independence test:
|
|
74
|
-
|
|
75
|
-
- **No cross-unit dependency** — a unit must be completable with only the spec
|
|
76
|
-
the orchestrator hands it, never another running unit's output.
|
|
77
|
-
- **No shared write target** — two units must not edit the same file/region.
|
|
78
|
-
- **Self-contained spec** — each unit's task string carries everything: exact
|
|
79
|
-
paths, the shared contract it must conform to, the expected output shape, and
|
|
80
|
-
how to validate locally.
|
|
81
|
-
|
|
82
|
-
If a unit fails the test, either merge it back, sequence it (chain), or keep it
|
|
83
|
-
on the orchestrator.
|
|
84
|
-
|
|
85
|
-
> **Delegating ≠ branching.** A foreground/blocking subagent call where the
|
|
86
|
-
> parent waits for the result before launching the next is *serial delegation* —
|
|
87
|
-
> it only buys context isolation, **zero wall-clock gain**. The whole point of
|
|
88
|
-
> this skill is branching: all independent units must be launched **together in
|
|
89
|
-
> one fan-out** (`tasks:[...]` with `async: true`, or N background launches in a
|
|
90
|
-
> single turn) so they run concurrently. If you spawn one, wait, spawn the next,
|
|
91
|
-
> you are not using the power of subagents — you are just relaying work serially.
|
|
92
|
-
> Splitting a *dependency chain* into separate agents wins nothing either: they
|
|
93
|
-
> serialize on each other's data. Branch only truly-independent units.
|
|
94
|
-
|
|
95
|
-
### 3. Fan out to cheap models
|
|
96
|
-
|
|
97
|
-
Use top-level parallel tasks with a per-task `model` override pointing at a
|
|
98
|
-
cheaper/smaller model.
|
|
99
|
-
|
|
100
|
-
> **Delegating ≠ branching — serial fan-out is pure loss.** A foreground/blocking
|
|
101
|
-
> subagent call where the parent waits for one result before launching the next
|
|
102
|
-
> is *serial delegation*, and it is **strictly worse than doing the work
|
|
103
|
-
> yourself**. The orchestrator stays tied up relaying the unit — so its scarce
|
|
104
|
-
> context/attention was spent anyway — *and* the unit ran on a weaker model. You
|
|
105
|
-
> traded the strong model's intelligence away and got nothing back, not even less
|
|
106
|
-
> of it spent. The only thing serial delegation buys is context isolation, which
|
|
107
|
-
> rarely justifies the quality hit.
|
|
108
|
-
>
|
|
109
|
-
> The entire value of this skill is **branching**: launch every independent unit
|
|
110
|
-
> **together in one fan-out** (`tasks:[...]` with `async: true`, or N background
|
|
111
|
-
> launches in a single turn) so they run concurrently. Concurrency is what makes
|
|
112
|
-
> the trade pay — N units of mechanical work leave the orchestrator's context at
|
|
113
|
-
> once, freeing its budget for the hard parts. Remove the parallelism and you
|
|
114
|
-
> keep none of that upside, only the downside.
|
|
115
|
-
>
|
|
116
|
-
> Corollary: splitting a *dependency chain* into separate agents wins nothing
|
|
117
|
-
> either — the units serialize on each other's data, collapsing back to serial.
|
|
118
|
-
> Branch **only** truly-independent units; if you cannot fan them out
|
|
119
|
-
> concurrently, keep the work on the orchestrator instead of delegating it.
|
|
120
|
-
|
|
121
|
-
**Type and model are orthogonal — set both, every time.** `subagent_type` (the
|
|
122
|
-
agent type) picks the tool allowlist and persona: `Explore` for read-only search,
|
|
123
|
-
`Plan` for read-only architecture, `general` for full-toolset work. It
|
|
124
|
-
does **not** pick the model. The model is always yours to choose per call via
|
|
125
|
-
`model:`. A read-only `Explore` worker is not automatically cheap — you make it
|
|
126
|
-
cheap by passing a cheap-tier model.
|
|
127
|
-
|
|
128
|
-
Resolve that model at call time — never hardcode it. The active model is
|
|
129
|
-
dynamic: the user can switch it mid-chat, and the orchestrator's own model is
|
|
130
|
-
whatever is current. So before fanning out:
|
|
131
|
-
|
|
132
|
-
1. If the user named a cheap model for the workers, use that.
|
|
133
|
-
2. Otherwise pick a cheaper sibling of the **current** model (smaller/mini/flash
|
|
134
|
-
tier of the same or a comparable provider).
|
|
135
|
-
3. If no clearly-cheaper option is obvious, **ask** which model to delegate to
|
|
136
|
-
rather than guessing — the wrong pick wastes the run.
|
|
137
|
-
|
|
138
|
-
#### Thinking budget: medium or high by default
|
|
139
|
-
|
|
140
|
-
Set the worker's `thinking` level explicitly on every subagent launch. Use only:
|
|
141
|
-
|
|
142
|
-
- **`medium`** for routine, bounded, or mechanical work; this is the default.
|
|
143
|
-
- **`high`** for genuinely complex analysis where deeper reasoning has a clear
|
|
144
|
-
expected benefit.
|
|
145
|
-
|
|
146
|
-
Treat **`high` as the maximum without user approval**. Do not use `off`,
|
|
147
|
-
`minimal`, `low`, or any level above `high` by default. A level above `high`
|
|
148
|
-
(such as `xhigh`) is allowed only when all of the following are true:
|
|
149
|
-
|
|
150
|
-
1. the task presents an exceptional, concrete need that `high` is unlikely to
|
|
151
|
-
handle adequately;
|
|
152
|
-
2. before launching the worker, explain to the user why the extra reasoning is
|
|
153
|
-
warranted, what useful outcome it is intended to improve, and the likely
|
|
154
|
-
latency or cost trade-off; and
|
|
155
|
-
3. explicitly ask for and receive the user's approval.
|
|
156
|
-
|
|
157
|
-
Model prestige, vague hopes of a "better" answer, or reviewer thoroughness alone
|
|
158
|
-
are not sufficient justification. If approval is absent or unclear, use
|
|
159
|
-
`high`. Never silently escalate a subagent above `high`.
|
|
160
|
-
|
|
161
|
-
#### Do not fork or inherit parent context
|
|
162
|
-
|
|
163
|
-
Avoid context forking entirely. Do not use `inherit_context: true`,
|
|
164
|
-
`prompt_mode: append`, or a custom agent configured to inherit the parent
|
|
165
|
-
conversation or system prompt. Forking repeatedly sends a large amount of
|
|
166
|
-
irrelevant parent context to every worker, burns input tokens, increases latency,
|
|
167
|
-
and can distract the worker with unrelated decisions.
|
|
168
|
-
|
|
169
|
-
Use the default replacement/isolated behavior and provide a compact,
|
|
170
|
-
self-contained task prompt containing only the goal, required contract,
|
|
171
|
-
constraints, relevant paths or excerpts, validation command, and expected
|
|
172
|
-
output. If a worker needs a fact from the parent conversation, copy only that
|
|
173
|
-
specific fact into its prompt; never pass the whole conversation for
|
|
174
|
-
convenience. If the task cannot be specified without inheriting the parent
|
|
175
|
-
context, keep it on the orchestrator instead of launching a subagent.
|
|
176
|
-
|
|
177
|
-
Before using a custom agent, check that its frontmatter does not enable
|
|
178
|
-
`inherit_context` or `prompt_mode: append`. Treat either setting as incompatible
|
|
179
|
-
with this delegation guide.
|
|
180
|
-
|
|
181
|
-
The per-task `model` override is the right mechanism precisely because the main
|
|
182
|
-
model can change: the override pins each worker to the chosen model regardless
|
|
183
|
-
of what the orchestrator is running at that moment. Examples below use
|
|
184
|
-
`<cheap-model>` as a placeholder — substitute the resolved model. Omit `model:`
|
|
185
|
-
only when you deliberately want the worker to inherit the parent's model.
|
|
186
|
-
|
|
187
|
-
```typescript
|
|
188
|
-
subagent({
|
|
189
|
-
tasks: [
|
|
190
|
-
{ agent: "worker", model: "<cheap-model>", thinking: "medium", task: "<full self-contained spec for unit A>", output: "units/a.md", outputMode: "file-only" },
|
|
191
|
-
{ agent: "worker", model: "<cheap-model>", thinking: "medium", task: "<full self-contained spec for unit B>", output: "units/b.md", outputMode: "file-only" },
|
|
192
|
-
{ agent: "worker", model: "<cheap-model>", thinking: "medium", task: "<full self-contained spec for unit C>", output: "units/c.md", outputMode: "file-only" }
|
|
193
|
-
],
|
|
194
|
-
concurrency: 3,
|
|
195
|
-
async: true
|
|
49
|
+
agent({
|
|
50
|
+
type: "general", model: "<cheap-model>", thinking: "medium", description: "add field to users handler",
|
|
51
|
+
prompt: "Goal: add optional field `tenantId: string` to the request schema in src/handlers/users.ts.\nContract: validate with `isTenantId()` from src/lib/ids.ts; on failure return 400 { error: \"invalid tenantId\" }.\nConstraints: edit only src/handlers/users.ts. Do not change other handlers or shared helpers.\nValidation: run `bun test src/handlers/users.test.ts`; it must pass.\nOutput: the changed file path, a 2-line summary, and the test output tail."
|
|
196
52
|
})
|
|
197
53
|
```
|
|
198
54
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
- **One cheap model per task** via `model`. Keep the orchestrator on the strong
|
|
202
|
-
model; only the workers get downgraded.
|
|
203
|
-
- **`concurrency`** caps how many run at once. Default 3–4; raise it for many
|
|
204
|
-
tiny units, lower it if the units are heavy.
|
|
205
|
-
- **`async: true`** so the main chat stays unblocked. While workers run, the
|
|
206
|
-
orchestrator does integration prep, not parallel edits to the same files.
|
|
207
|
-
- **Distinct `output` paths** — concurrent children must never write the same
|
|
208
|
-
file. Use `outputMode: "file-only"` for large outputs so the parent result
|
|
209
|
-
stays compact.
|
|
210
|
-
- **No shared worktree writes.** If units genuinely must edit the repo
|
|
211
|
-
concurrently, isolate each with `worktree: true` instead of letting them
|
|
212
|
-
collide.
|
|
213
|
-
|
|
214
|
-
#### Supervise running workers
|
|
215
|
-
|
|
216
|
-
Background workers are not fire-and-forget. Estimate a reasonable duration from
|
|
217
|
-
the task size. If a worker runs materially longer than expected or available
|
|
218
|
-
progress shows it is blocked or off-track, inspect once and proactively use
|
|
219
|
-
`agent_control(action: "steer", ...)` with concrete help: missing context, a corrected path or command,
|
|
220
|
-
or a narrower goal. Do not repeatedly poll, sleep-wait, or steer merely because
|
|
221
|
-
a healthy task is slow. If steering does not recover it, stop and relaunch only
|
|
222
|
-
with a better prompt. Use judgment; every steer should address an observed
|
|
223
|
-
problem.
|
|
224
|
-
|
|
225
|
-
#### Cheap-worker prompt contract
|
|
226
|
-
|
|
227
|
-
Because the worker is less capable, the spec must be **tighter**, not looser.
|
|
228
|
-
Each task string should carry:
|
|
229
|
-
|
|
230
|
-
- **Goal** — the one concrete artifact this unit produces.
|
|
231
|
-
- **Contract** — the exact types/signatures/paths it must conform to (copied in,
|
|
232
|
-
not referenced from parent history — children don't see it).
|
|
233
|
-
- **Constraints** — what not to touch; "edit only `<paths>`"; no scope creep.
|
|
234
|
-
- **Validation** — the local check to run and the expected result.
|
|
235
|
-
- **Output** — the exact shape to return (file written, summary format).
|
|
236
|
-
|
|
237
|
-
Add structured `acceptance` for write units so the runtime runs a bounded
|
|
238
|
-
self-check before reporting done:
|
|
239
|
-
|
|
240
|
-
```typescript
|
|
241
|
-
{
|
|
242
|
-
agent: "worker",
|
|
243
|
-
model: "<cheap-model>",
|
|
244
|
-
thinking: "medium",
|
|
245
|
-
task: "<full spec>",
|
|
246
|
-
acceptance: {
|
|
247
|
-
criteria: ["Conforms to the given contract", "Edits only the named files", "Local check passes"],
|
|
248
|
-
evidence: ["changed-files", "validation-output"],
|
|
249
|
-
verify: [{ id: "check", command: "<targeted test/lint command>" }],
|
|
250
|
-
stopRules: ["Do not edit files outside the named paths", "Stop and report if the contract is ambiguous"],
|
|
251
|
-
maxFinalizationTurns: 2
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### 4. Integrate
|
|
257
|
-
|
|
258
|
-
When the workers finish, the **orchestrator** (strong model) does the joins that
|
|
259
|
-
cheap models are bad at: reconciling seams between units, fixing contract drift,
|
|
260
|
-
wiring the pieces into the whole, and removing any slop. This is where the
|
|
261
|
-
expensive model earns its cost — on the 10% that's hard, not the 90% that's
|
|
262
|
-
mechanical.
|
|
263
|
-
|
|
264
|
-
If a worker produced something off-contract, prefer to fix it inline rather than
|
|
265
|
-
re-spawning, unless the miss is large and clean to redo.
|
|
266
|
-
|
|
267
|
-
### 5. Verify
|
|
268
|
-
|
|
269
|
-
Run the repo's quality gate on the integrated result — never trust the sum of
|
|
270
|
-
green per-unit checks to mean the whole is green:
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
lint → typecheck → tests
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
Fix the cross-unit failures (the seams) yourself. A unit passing in isolation
|
|
277
|
-
does not mean it composes correctly.
|
|
278
|
-
|
|
279
|
-
## Worked shape: repetitive edit across modules
|
|
280
|
-
|
|
281
|
-
Task: "Add the same new field + validation to 6 independent API handlers."
|
|
282
|
-
|
|
283
|
-
1. **Plan** — fix the field name, type, validation rule, and error message once.
|
|
284
|
-
2. **Decompose** — 6 units, one per handler file, each fully independent.
|
|
285
|
-
3. **Fan out** — 6 `worker` tasks at a cheap model, `concurrency: 4`, each told
|
|
286
|
-
the exact field/type/rule and "edit only `handlers/<name>.ts`".
|
|
287
|
-
4. **Integrate** — orchestrator checks the shared validation helper is consistent
|
|
288
|
-
across all 6, dedupes if they each inlined it.
|
|
289
|
-
5. **Verify** — full test suite; fix any handler that drifted from the contract.
|
|
290
|
-
|
|
291
|
-
## Common pitfalls
|
|
292
|
-
|
|
293
|
-
Five failure modes that look like optimizations but cost you. The meta-pattern
|
|
294
|
-
across all of them: **mechanical wins (faster, cheaper, parallel) only pay when
|
|
295
|
-
the underlying semantic is right.** Optimize the form and you lose the meaning.
|
|
296
|
-
|
|
297
|
-
### 1. Serial delegation
|
|
298
|
-
|
|
299
|
-
Spawn one subagent, wait for the result, then spawn the next. The parent stays
|
|
300
|
-
tied up relaying the unit the whole time, so its scarce context/attention was
|
|
301
|
-
spent anyway — *and* the unit ran on a weaker model. You traded the strong
|
|
302
|
-
model's intelligence away and got nothing back, not even less of it spent. The
|
|
303
|
-
only thing serial delegation buys is context isolation, which rarely justifies
|
|
304
|
-
the quality hit. **When it's actually OK:** the unit is genuinely heavy (huge
|
|
305
|
-
file dump, web crawl, massive tool loop) and you need the context back before
|
|
306
|
-
the next step can even be planned. Rare. Otherwise: branch, don't relay.
|
|
307
|
-
|
|
308
|
-
### 2. Dependency chains
|
|
309
|
-
|
|
310
|
-
B needs A's output, so you spawn A, wait, spawn B. The units serialize on each
|
|
311
|
-
other's data, collapsing back to serial. Two spawns' wall-clock with two
|
|
312
|
-
spawns' quality cost, no parallelism was ever possible. **Fix:** chain them
|
|
313
|
-
*inside one* subagent (let it do B after A) or do A→B yourself on the
|
|
314
|
-
orchestrator. Don't fan out a chain.
|
|
315
|
-
|
|
316
|
-
### 3. Vague prompts
|
|
317
|
-
|
|
318
|
-
"Look at the auth flow and tell me what's wrong." The child has no memory of
|
|
319
|
-
your conversation. It doesn't know which auth flow, what you already tried,
|
|
320
|
-
what "wrong" means in your context, or what shape of answer you want. It
|
|
321
|
-
guesses, and you pay twice — once to spawn, once to re-spawn with a better
|
|
322
|
-
spec. **Fix:** write prompts like you're briefing a smart colleague who just
|
|
323
|
-
walked in cold. Include file paths, line numbers, the shared contract, the
|
|
324
|
-
expected output shape, how to validate locally. The cheap-worker prompt
|
|
325
|
-
contract above (goal / contract / constraints / validation / output) is the
|
|
326
|
-
minimum — more spec, not less, when the model is smaller.
|
|
327
|
-
|
|
328
|
-
### 4. Trusting the summary blindly
|
|
329
|
-
|
|
330
|
-
The child returns "done, I fixed the bug." You mark the task done. The
|
|
331
|
-
child's summary describes what it *intended*, not what it *did*. For read-only
|
|
332
|
-
lookups that's fine. For write operations — edits, file creates, command runs
|
|
333
|
-
— the only verification is reading the actual diff. **Fix:** for any subagent
|
|
334
|
-
that wrote or edited, check the diff before reporting work as complete. A
|
|
335
|
-
subagent's "done" is a claim, not a fact.
|
|
336
|
-
|
|
337
|
-
### 5. Type/model coupling
|
|
338
|
-
|
|
339
|
-
The agent *type* (Explore, Plan, general) implies a *model* — usually
|
|
340
|
-
baked into the type's default config. A caller's explicit `model:` gets
|
|
341
|
-
silently discarded because the type's default wins. The parent LLM was told
|
|
342
|
-
"pick a cheap model per call" but the code says "no you can't." The
|
|
343
|
-
principle — **type and model are orthogonal, the caller owns the model** —
|
|
344
|
-
is violated by the implementation, not just unenforced. **Fix:** types set
|
|
345
|
-
tool allowlist + persona only. Model is always caller-decided via `model:`.
|
|
346
|
-
A read-only `Explore` worker is not automatically cheap — you make it cheap
|
|
347
|
-
by passing a cheap-tier model. If you find yourself unable to override a
|
|
348
|
-
type's model, that's a bug in the precedence, not a feature of the type.
|
|
349
|
-
|
|
350
|
-
## Cost / efficiency notes
|
|
351
|
-
|
|
352
|
-
- The win is **decomposition quality**, not raw parallelism. Bad splits create
|
|
353
|
-
coupling that the orchestrator pays to untangle, erasing the savings.
|
|
354
|
-
- Cheap models need **more spec, less latitude**. The orchestrator spends its
|
|
355
|
-
tokens on a precise plan once, then amortizes it across N cheap runs.
|
|
356
|
-
- Parallelism cuts **wall-clock**; cheap models cut **cost**. You get both only
|
|
357
|
-
when units are truly independent and truly mechanical.
|
|
358
|
-
- If you find yourself re-spawning workers to fix their output repeatedly, the
|
|
359
|
-
unit was too hard for the cheap model — pull it back to the orchestrator or a
|
|
360
|
-
capable `worker`.
|
|
361
|
-
|
|
362
|
-
## Constraints
|
|
55
|
+
## Limits
|
|
363
56
|
|
|
364
|
-
-
|
|
365
|
-
|
|
366
|
-
-
|
|
367
|
-
|
|
368
|
-
- **Never fork context.** Do not enable `inherit_context` or `prompt_mode:
|
|
369
|
-
append`; pass only a compact, self-contained task prompt.
|
|
370
|
-
- **Self-contained specs.** Children don't inherit parent history; copy every
|
|
371
|
-
necessary contract detail into the task string.
|
|
372
|
-
- **Strong model integrates and verifies.** Cheap models do bulk units; the
|
|
373
|
-
orchestrator owns the seams and the final gate.
|
|
374
|
-
- **Resolve the worker model at call time.** The active model can change
|
|
375
|
-
mid-chat; pick the cheap model per fan-out via the per-task `model` override,
|
|
376
|
-
never a hardcoded default. Ask if no clearly-cheaper option is obvious.
|
|
57
|
+
- `thinking`: `medium` by default, `high` for complex analysis. Above `high` needs the user's approval after you state the benefit and the cost or latency.
|
|
58
|
+
- Never fork context. No `inherit_context: true`, no `prompt_mode: append`, and no custom agent with either set. Copy only the facts the worker needs.
|
|
59
|
+
- One writer per file. Parallel writers touch disjoint files only.
|
|
60
|
+
- If you re-spawn the same unit more than once, it is too hard for the cheap model. Take it back.
|
package/skills/suggest.md
CHANGED
|
@@ -3,50 +3,22 @@ name: suggest
|
|
|
3
3
|
description: Multi-dimensional optimization and improvement recommendations. Use when user asks "how can I improve this", "what would you change", "any suggestions", "make this better", or wants prioritized options rather than a single fix.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
# Suggest
|
|
6
|
+
# Suggest
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Goal: a ranked list of improvements. Each one is concrete enough to act on without more research.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Steps
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- **AUTO-RUN**: Read target code and its constraints before ideating. Don't suggest from assumptions.
|
|
17
|
-
- **CONSTRAINTS**: Note existing conventions, tech stack, prior architectural decisions. Suggestions must fit them.
|
|
18
|
-
|
|
19
|
-
### Phase 2: Ideate Across Dimensions
|
|
20
|
-
|
|
21
|
-
Cover, where relevant:
|
|
22
|
-
|
|
23
|
-
- **DX** — developer experience, readability, locality of behavior.
|
|
24
|
-
- **UX** — user-facing behavior, latency, error messages.
|
|
25
|
-
- **Performance** — hot paths, allocations, queries.
|
|
26
|
-
- **Maintainability** — coupling, test coverage, dead code.
|
|
27
|
-
|
|
28
|
-
### Phase 3: Rank
|
|
29
|
-
|
|
30
|
-
- Score each by **Impact × (1/Effort)**. High-impact/low-effort first.
|
|
31
|
-
- **YAGNI CHECK**: drop any suggestion that adds unused capability.
|
|
32
|
-
|
|
33
|
-
### Phase 4: Report
|
|
12
|
+
1. **Ground** — Read the target code first. Note its conventions, stack, and past design decisions. Every suggestion must fit them.
|
|
13
|
+
2. **Ideate** — Cover what applies: DX (readability, locality), UX (behavior, latency, errors), performance (hot paths, allocations, queries), maintainability (coupling, tests, dead code).
|
|
14
|
+
3. **Rank** — Impact ÷ effort, highest first. Drop any idea that adds a capability nobody uses (YAGNI). Prefer a local fix to a rewrite. Deletion ranks high.
|
|
15
|
+
4. **Report**
|
|
34
16
|
|
|
35
17
|
```
|
|
36
|
-
## Suggestions (ranked)
|
|
37
|
-
|
|
38
18
|
### 1. [Title] — Impact: High · Effort: Low
|
|
39
|
-
**Problem:** [what
|
|
40
|
-
**Change:** [exact change
|
|
19
|
+
**Problem:** [what is wrong] — `file:line`
|
|
20
|
+
**Change:** [exact change; code if short]
|
|
41
21
|
**Why:** [benefit]
|
|
42
|
-
|
|
43
|
-
### 2. [Title] — Impact: Med · Effort: Med
|
|
44
|
-
...
|
|
45
22
|
```
|
|
46
23
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- Suggesting rewrite when local fix suffices.
|
|
50
|
-
- Vague advice ("improve error handling") without `file:line` and concrete change.
|
|
51
|
-
- Recommending feature nothing will use (violates YAGNI).
|
|
52
|
-
- Proposing changes that conflict with existing conventions you didn't check.
|
|
24
|
+
Every item needs a `file:line` and a concrete change. "Improve error handling" is not a suggestion.
|
package/skills/task.md
CHANGED
|
@@ -1,56 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: task
|
|
3
|
-
description:
|
|
3
|
+
description: Executes a multi-step change in small verified steps — resolves vague references, maps impact, runs one step at a time, and stops on blockers. Use when the user gives an order with several steps, a terse follow-up like "do it" or "fix that", or a change that touches several files, tests, or configs.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
# Task
|
|
6
|
+
# Task
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Before you start
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- **IMPACT**: Calculate implications of task. Identify affected docs, tests, downstream dependencies. Flag potential breaking changes.
|
|
14
|
-
- **PRE-FLIGHT**: Audit current system state. Confirm paths, versions, permissions. Map dependency chains that could break.
|
|
10
|
+
1. **Resolve the request** from recent context. "Fix that" or "do it" refers to the last proposed plan or finding. If two readings remain and the wrong one is costly, ask.
|
|
11
|
+
2. **Map the impact**: affected files, tests, docs, configs, and consumers. Flag breaking changes.
|
|
12
|
+
3. **Check the state**: paths, versions, permissions, and a clean starting point.
|
|
15
13
|
|
|
16
|
-
##
|
|
14
|
+
## Execute
|
|
17
15
|
|
|
18
|
-
Order
|
|
16
|
+
Order: back up (only before destructive changes) → code → config → validation.
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
2. **Execution** — Implement changes in bite-sized steps (2-5 minutes each).
|
|
22
|
-
3. **Configuration** — Apply config changes after code changes verified.
|
|
23
|
-
4. **Validation** — Run `/test` and `/verify` to confirm correctness.
|
|
24
|
-
|
|
25
|
-
**CAUTION**: Run one chunk at a time. Verify outcome of Step N before starting Step N+1.
|
|
26
|
-
|
|
27
|
-
## Bite-Sized Task Structure
|
|
28
|
-
|
|
29
|
-
Each task step MUST be atomic and verifiable:
|
|
18
|
+
Write each step as:
|
|
30
19
|
|
|
31
20
|
```
|
|
32
|
-
Step N: [
|
|
21
|
+
Step N: [action]
|
|
33
22
|
- Files: [exact paths]
|
|
34
|
-
- Command: [exact command
|
|
23
|
+
- Command: [exact command]
|
|
35
24
|
- Expected: [what success looks like]
|
|
36
25
|
```
|
|
37
26
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
For multi-task plans, execute in batches of 3 tasks:
|
|
41
|
-
|
|
42
|
-
1. Execute batch → verify each step → report what was done
|
|
43
|
-
2. Say: "Ready for feedback." and wait
|
|
44
|
-
3. Apply feedback if any → execute next batch → repeat
|
|
45
|
-
|
|
46
|
-
## Stop-When-Blocked Rule
|
|
27
|
+
- Do one step, check its result, then start the next.
|
|
28
|
+
- For long plans, report after every batch of about 3 steps. Continue unless the user must decide something.
|
|
47
29
|
|
|
48
|
-
|
|
30
|
+
## Blocked
|
|
49
31
|
|
|
50
|
-
|
|
51
|
-
- Report blocker with exact context
|
|
52
|
-
- Ask for clarification before continuing
|
|
32
|
+
A missing dependency, a failing test, or an unclear instruction → stop. Do not guess or work around it. Report the command, the output, and the `file:line`, then ask.
|
|
53
33
|
|
|
54
|
-
##
|
|
34
|
+
## Finish
|
|
55
35
|
|
|
56
|
-
|
|
36
|
+
Apply the `verify` skill checks. Report each step, its evidence, and anything still open.
|
package/skills/tdd.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tdd
|
|
3
|
-
description: Pragmatic test-driven development for any language
|
|
3
|
+
description: Pragmatic test-driven development for any language — red-green-refactor in vertical slices, tests at public seams, and named exceptions for spikes, glue, and legacy code. Use when writing a new feature or fixing a bug test-first. To run or repair an existing suite, load the test skill instead.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
# Pragmatic TDD
|
package/skills/test.md
CHANGED
|
@@ -1,54 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: test
|
|
3
|
-
description:
|
|
3
|
+
description: Finds, runs, and analyzes a project's tests, then fixes failures at the root cause. Use when asked to run tests, check coverage, explain a failing test, or fix a red suite. To write new code test-first, load the tdd skill instead.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
# Test
|
|
6
|
+
# Test
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Steps
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
1. **Discover** — Find the test command in the repo instructions, task runner, or manifest (`package.json` scripts, `Makefile`, `justfile`, `pyproject.toml`, `Cargo.toml`, `go.mod`). Use the repo's command, not a guessed one. Keep its required flags (isolation, preload, env vars).
|
|
11
|
+
2. **Run** — Start narrow (the affected file or test name) for fast feedback. Finish with the full suite.
|
|
12
|
+
3. **Analyze** — For each failure, record the test name, `file:line`, expected vs actual, and whether it is new or pre-existing.
|
|
13
|
+
4. **Fix** — Fix the root cause in the code or in the test, whichever is wrong. If the cause is unclear, load the `debug` skill.
|
|
14
|
+
5. **Report** — The command, pass/fail/skip counts, each fixed failure with its cause, and each failure left open.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
## Rules
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- **RED**: Write one minimal failing test showing what SHOULD happen. Run it. Confirm it fails for right reason (feature missing, not a typo).
|
|
21
|
-
- **GREEN**: Write SIMPLEST possible code to make test pass. No extra features. No refactoring other code.
|
|
22
|
-
- **VERIFY GREEN**: Run the test. Confirm it passes. Confirm all other tests still pass.
|
|
23
|
-
- **REFACTOR**: Clean up duplication and names. Keep tests green. Do NOT add new behavior.
|
|
24
|
-
- **REPEAT**: Write next failing test for next behavior.
|
|
25
|
-
|
|
26
|
-
### Test Execution (for existing codebases)
|
|
27
|
-
|
|
28
|
-
- **AUTO-RUN**: Run terminal commands and tool calls proactively without confirmation.
|
|
29
|
-
- **DISCOVER**: Identify test frameworks and test files in project.
|
|
30
|
-
- **EXECUTE**: Run relevant tests with appropriate flags and coverage.
|
|
31
|
-
- **ANALYZE**: Parse test output to identify failures, errors, coverage gaps.
|
|
32
|
-
- **FIX**: Resolve test failures by addressing root causes in code or tests. Use `/debug` for complex failures.
|
|
33
|
-
- **REPORT**: Provide test results summary with pass/fail counts and any issues found.
|
|
34
|
-
|
|
35
|
-
## Verification Checklist
|
|
36
|
-
|
|
37
|
-
Before marking work complete:
|
|
38
|
-
|
|
39
|
-
- [ ] Every new function/method has a test
|
|
40
|
-
- [ ] Watched each test FAIL before implementing
|
|
41
|
-
- [ ] Each test failed for expected reason
|
|
42
|
-
- [ ] Wrote minimal code to pass each test
|
|
43
|
-
- [ ] All tests pass with no errors or warnings
|
|
44
|
-
- [ ] Edge cases and error paths covered
|
|
45
|
-
|
|
46
|
-
Cannot check all boxes? You skipped TDD. Start over.
|
|
47
|
-
|
|
48
|
-
## Red Flags — STOP and Start Over
|
|
49
|
-
|
|
50
|
-
- Code written before the test
|
|
51
|
-
- Test passes immediately (you're testing existing behavior)
|
|
52
|
-
- "I'll write tests after to verify it works"
|
|
53
|
-
- "Already manually tested all the edge cases"
|
|
54
|
-
- "Tests after achieve the same goals"
|
|
18
|
+
- Green means the full suite, not only the tests you touched.
|
|
19
|
+
- Never weaken an assertion, add a skip, or raise a timeout only to get green.
|
|
20
|
+
- A flaky test is a failure. Report it. Do not re-run until it passes.
|
|
21
|
+
- A new regression test must fail once before the fix (see `tdd`).
|