task-pipeline-skill 0.12.0 → 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.
Files changed (27) hide show
  1. package/CHANGELOG.md +477 -0
  2. package/LICENSE +47 -0
  3. package/README.md +369 -171
  4. package/cursor/rules/task-pipeline.mdc +125 -20
  5. package/package.json +8 -4
  6. package/plugins/task-pipeline/.claude-plugin/plugin.json +15 -4
  7. package/plugins/task-pipeline/commands/task-pipeline.md +20 -8
  8. package/plugins/task-pipeline/skills/task-pipeline/SKILL.md +112 -39
  9. package/plugins/task-pipeline/skills/task-pipeline/pipeline.example.json +35 -16
  10. package/plugins/task-pipeline/skills/task-pipeline/references/acceptance.md +119 -0
  11. package/plugins/task-pipeline/skills/task-pipeline/references/artifacts.md +47 -14
  12. package/plugins/task-pipeline/skills/task-pipeline/references/brainstorm.md +108 -0
  13. package/plugins/task-pipeline/skills/task-pipeline/references/build.md +365 -0
  14. package/plugins/task-pipeline/skills/task-pipeline/references/companion-skills.md +72 -31
  15. package/plugins/task-pipeline/skills/task-pipeline/references/conventions.md +27 -3
  16. package/plugins/task-pipeline/skills/task-pipeline/references/decomposition.md +139 -0
  17. package/plugins/task-pipeline/skills/task-pipeline/references/grill.md +78 -7
  18. package/plugins/task-pipeline/skills/task-pipeline/references/knowledge-sources.md +159 -0
  19. package/plugins/task-pipeline/skills/task-pipeline/references/loop-guard.md +100 -0
  20. package/plugins/task-pipeline/skills/task-pipeline/references/planning.md +195 -0
  21. package/plugins/task-pipeline/skills/task-pipeline/references/review.md +174 -0
  22. package/plugins/task-pipeline/skills/task-pipeline/references/spec.md +144 -0
  23. package/plugins/task-pipeline/skills/task-pipeline/references/stages.md +190 -35
  24. package/plugins/task-pipeline/skills/task-pipeline/references/tdd.md +110 -0
  25. package/plugins/task-pipeline/skills/task-pipeline/templates/README.md +5 -3
  26. package/plugins/task-pipeline/skills/task-pipeline/templates/brief.md +50 -2
  27. package/plugins/task-pipeline/skills/task-pipeline/templates/carryover.md +36 -0
@@ -0,0 +1,195 @@
1
+ # Plan — stage 4, built in
2
+
3
+ Turning the spec into an implementation plan a **zero-context implementer** can
4
+ execute task by task without reading the spec, the chat, or the rest of the plan.
5
+ Built into this skill; nothing to install.
6
+
7
+ > Ported from the `writing-plans` skill in
8
+ > [obra/superpowers](https://github.com/obra/superpowers) (MIT — see `LICENSE` →
9
+ > *Third-party*), extended with the dependency graph, parallel groups and
10
+ > file-ownership rules this pipeline's stage-5 subagent build depends on.
11
+
12
+ ## Audience
13
+
14
+ Assume a skilled developer who knows nothing about this codebase, this domain or
15
+ this toolset, has questionable taste, and will read **only their own task**.
16
+ Everything they need is in that task: exact paths, complete code, exact commands,
17
+ expected output. DRY. YAGNI. TDD. Frequent commits.
18
+
19
+ Path: `docs/superpowers/plans/YYYY-MM-DD-<topic>.md` — same `<topic>` slug as the
20
+ brief and the spec.
21
+
22
+ ## Before writing tasks
23
+
24
+ **Scope check.** A plan covers exactly **one** spec — for a decomposed platform,
25
+ one module's dossier ([`decomposition.md`](decomposition.md)). If the spec in front
26
+ of you covers several independent subsystems, the decomposition was missed at stage
27
+ 2: say so and go back there for a module map, rather than inventing the split here.
28
+ Whatever this plan covers must produce working, testable software on its own.
29
+
30
+ **Map the file structure.** List every file that will be created or modified and
31
+ what each one owns. This is where decomposition gets locked in:
32
+
33
+ - One clear responsibility per file; clear boundaries, defined interfaces.
34
+ - Files that change together live together. Split by responsibility, not by
35
+ technical layer.
36
+ - Follow the existing codebase's patterns. Don't unilaterally restructure — but if
37
+ a file you're modifying has grown unwieldy, planning its split is fair.
38
+
39
+ **Draw the dependency graph.** Which task needs what from which. Then group tasks
40
+ into **parallel groups** in topological order, and tag each task
41
+ `depends: [task ids]`.
42
+
43
+ **File ownership is exclusive within a group.** No two tasks in the same parallel
44
+ group write the same file — that is the rule that makes stage-5 fan-out safe.
45
+ Sequential integration/glue tasks sit *between* groups.
46
+
47
+ ## Task right-sizing
48
+
49
+ A task is the smallest unit that carries its own test cycle and is worth a fresh
50
+ reviewer's gate. Fold setup, configuration, scaffolding and docs into the task
51
+ whose deliverable needs them. Split only where a reviewer could meaningfully reject
52
+ one task while approving its neighbor. Every task ends with an independently
53
+ testable deliverable.
54
+
55
+ Each **step** inside a task is one action, 2–5 minutes: write the failing test →
56
+ run it and watch it fail → minimal implementation → run it and watch it pass →
57
+ commit.
58
+
59
+ ## Plan header — required
60
+
61
+ ```markdown
62
+ # <Feature> — implementation plan
63
+
64
+ > **For agentic workers:** execute this plan task-by-task under the task-pipeline
65
+ > stage-5 build doctrine — isolated workspace, one implementer per task, a review
66
+ > with all three verdicts after each (spec compliance, REQ satisfied, code
67
+ > quality). Steps use `- [ ]` checkboxes.
68
+
69
+ **Goal:** <one sentence>
70
+
71
+ **Architecture:** <2–3 sentences>
72
+
73
+ **Tech stack:** <key technologies>
74
+
75
+ **Spec:** docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
76
+
77
+ ## Global constraints
78
+
79
+ <the spec's project-wide requirements — version floors, dependency limits, naming
80
+ and copy rules, platform requirements — one line each, exact values copied
81
+ verbatim from the spec. Every task's requirements implicitly include this section.>
82
+
83
+ ## Execution order
84
+
85
+ | Group | Tasks | Runs after |
86
+ |---|---|---|
87
+ | A | 1, 2 | — |
88
+ | B | 3 | A |
89
+
90
+ ---
91
+ ```
92
+
93
+ ## Task structure — required
94
+
95
+ ````markdown
96
+ ### Task N: <component>
97
+
98
+ **Depends:** [task ids, or —]
99
+
100
+ **Implements:** REQ-003, REQ-007 — *(the brief's requirement ids this task
101
+ delivers, or `—` for pure glue/infrastructure tasks. Quote each REQ's one-line
102
+ statement under the DoD so the zero-context implementer sees the intent, not just
103
+ the instruction.)*
104
+
105
+ **Files:**
106
+ - Create: `exact/path/to/file.py`
107
+ - Modify: `exact/path/to/existing.py:123-145`
108
+ - Test: `tests/exact/path/to/test_file.py`
109
+
110
+ **Interfaces:**
111
+ - Consumes: <what this task uses from earlier tasks — exact signatures>
112
+ - Produces: <what later tasks rely on — exact names, parameter and return types.
113
+ The implementer sees only this task; this block is how they learn the names
114
+ neighboring tasks use.>
115
+
116
+ **Definition of done:** <observable, verifiable conditions — tests green, behavior
117
+ demonstrated, docs updated in this same change>
118
+
119
+ - [ ] **Step 1: write the failing test**
120
+
121
+ ```python
122
+ def test_specific_behavior():
123
+ assert function(input) == expected
124
+ ```
125
+
126
+ - [ ] **Step 2: run it and confirm it fails**
127
+
128
+ Run: `pytest tests/path/test_file.py::test_specific_behavior -v`
129
+ Expected: FAIL — `NameError: name 'function' is not defined`
130
+
131
+ - [ ] **Step 3: minimal implementation**
132
+
133
+ ```python
134
+ def function(value):
135
+ return expected
136
+ ```
137
+
138
+ - [ ] **Step 4: run it and confirm it passes**
139
+
140
+ Run: `pytest tests/path/test_file.py::test_specific_behavior -v`
141
+ Expected: PASS
142
+
143
+ - [ ] **Step 5: commit**
144
+
145
+ ```bash
146
+ git add tests/path/test_file.py src/path/file.py
147
+ git commit -m "feat: <what changed>"
148
+ ```
149
+ ````
150
+
151
+ For UI tasks, every task that builds user-facing behavior names the **scenario
152
+ ID(s)** and `SCR-` screen(s) it implements, and its DoD includes satisfying them
153
+ **and** updating the affected super-ux layers in the same change.
154
+
155
+ ## No placeholders
156
+
157
+ These are plan failures. Never write them:
158
+
159
+ - "TBD", "TODO", "implement later", "fill in details"
160
+ - "Add appropriate error handling" / "add validation" / "handle edge cases"
161
+ - "Write tests for the above" without the actual test code
162
+ - "Similar to Task N" — repeat the code; tasks get read out of order
163
+ - A step that says what to do without showing how (code steps need code blocks)
164
+ - References to types, functions or methods no task defines
165
+
166
+ ## Self-review — before handing off
167
+
168
+ A checklist you run yourself, inline. No subagent:
169
+
170
+ 1. **REQ coverage — set equality, not a feeling.** Collect every `Implements:` id
171
+ across all tasks and compare it to the brief's REQ table. The two sets must be
172
+ **equal**: a REQ with no task is scope silently lost; an `Implements:` id that
173
+ isn't in the brief is either a typo or work nobody asked for. Print the
174
+ difference and fix it before anything else — this seam is where scope leaks.
175
+ 2. **Spec coverage:** walk each spec requirement. Point at the task that implements
176
+ it. A requirement with no task → add the task.
177
+ 3. **Placeholder scan:** search the plan for every pattern above. Fix.
178
+ 4. **Name and type consistency:** signatures, property names and types used in
179
+ later tasks match what earlier tasks defined. `clearLayers()` in Task 3 and
180
+ `clearFullLayers()` in Task 7 is a bug, not a style difference.
181
+ 5. **Parallel safety:** no two tasks in the same group write the same file; every
182
+ `depends:` points at a task that really produces what's consumed.
183
+ 6. **DoD present and verifiable** on every task.
184
+
185
+ ## GATE (auto)
186
+
187
+ **Set equality first:** the REQ ids in the brief equal the union of `Implements:`
188
+ across the plan's tasks. A non-empty difference fails the gate and is reported as
189
+ the explicit list of dropped (or invented) requirements — this seam is where scope
190
+ leaks, so the check is mechanical, never a judgement call.
191
+
192
+ Then: every spec requirement maps to a task; no placeholders; names and types
193
+ consistent across tasks; parallel-group tasks share no files; each task has a
194
+ verifiable DoD. UI tasks carry their scenario IDs and `SCR-` screens. Verify all of
195
+ it yourself and stop on failure — this gate has no operator in it.
@@ -0,0 +1,174 @@
1
+ # Review — the rubric and the prompts, built in
2
+
3
+ Used by stage 5's per-task reviews, its scoped re-reviews and its final
4
+ whole-branch review ([`build.md`](build.md)). Built into this skill; nothing to
5
+ install.
6
+
7
+ > Ported from the `requesting-code-review` skill and the reviewer prompts in
8
+ > [obra/superpowers](https://github.com/obra/superpowers) (MIT — see `LICENSE` →
9
+ > *Third-party*), condensed into one rubric plus three copy-paste prompts, with the
10
+ > external helper scripts replaced by plain git commands so the doctrine works on
11
+ > any agent.
12
+
13
+ ## The diff package
14
+
15
+ A reviewer never re-derives the diff with a dozen git calls, and the diff never
16
+ enters **your** context. Write it to one file and pass the path (`$WORKSPACE` is
17
+ this plan's git-ignored directory, `.task-pipeline/build/<plan-basename>/` — see
18
+ [`build.md`](build.md)):
19
+
20
+ ```bash
21
+ { git log --oneline "$BASE..$HEAD"
22
+ echo
23
+ git diff --stat "$BASE..$HEAD"
24
+ echo
25
+ git diff -U10 "$BASE..$HEAD"
26
+ } > "$WORKSPACE/review-task-$N-$(git rev-parse --short "$HEAD").md"
27
+ ```
28
+
29
+ `BASE` is the commit you recorded **before** dispatching the implementer — never
30
+ `HEAD~1`, which silently drops every commit but the last of a multi-commit task.
31
+ For a scoped re-review, `BASE` is the head the previous review saw. For the final
32
+ review, `BASE` is `git merge-base "$BASE_BRANCH" HEAD` — the base branch recorded
33
+ in the stage-0 brief, which is not always `main`.
34
+
35
+ Never dispatch a reviewer without a diff file.
36
+
37
+ ## Reviewer inputs
38
+
39
+ Four things, three of them paths:
40
+
41
+ 1. The **task brief** file — what was required.
42
+ 2. The **implementer report** file — what was done, with the test evidence.
43
+ 3. The **diff package** path.
44
+ 4. The **Global Constraints** that bind this task — copied **verbatim** from the
45
+ plan: exact values, exact formats, stated relationships ("same layout as X",
46
+ "matches Y"). This block is the reviewer's attention lens.
47
+
48
+ ## Controller rules
49
+
50
+ - **Never pre-judge.** Don't tell a reviewer to ignore something, don't cap a
51
+ severity, don't explain why a finding would be a false positive. If your prompt
52
+ contains "don't flag", "at most Minor", or "the plan chose this" — stop: you're
53
+ buying yourself a shorter loop with an unreviewed defect. Let the finding come and
54
+ adjudicate it in the loop.
55
+ - **Don't ask a reviewer to re-run tests** the implementer already ran on the same
56
+ code; the report carries the evidence.
57
+ - **No open-ended directives** ("check all uses", "run race tests if useful")
58
+ without a concrete, task-specific reason.
59
+
60
+ ## The rubric
61
+
62
+ Review in this order; stop reading the diff only when you've covered all of it.
63
+
64
+ 1. **Spec compliance.** Every requirement in the brief: met, partially met, or
65
+ missing. Anything built that the brief did *not* ask for is scope creep — flag
66
+ it, even when it's nice.
67
+ 2. **REQ satisfaction.** Read the task's `Implements:` requirement statements, not
68
+ just its instructions, and judge the diff against **those**. A task can satisfy
69
+ every line of its brief and still miss the requirement it exists to deliver —
70
+ that gap is invisible one level down, which is why it is asked for here.
71
+ 3. **Correctness.** Logic errors, off-by-one, wrong operator, unhandled `None`/nil,
72
+ race conditions, resource leaks, wrong error propagation. State the concrete
73
+ input or state that produces the wrong output — a finding without a failure
74
+ scenario is an opinion.
75
+ 4. **Global constraints.** Exact values, formats and relationships from the
76
+ constraints block. Approximations are failures.
77
+ 5. **Test honesty.** Tests assert on real behavior, not on mocks. No test that
78
+ passes regardless of the production code. No `skip`/`xfail`/commented assertion
79
+ smuggling a red suite past a gate. New behavior has a covering test; the failure
80
+ path has one too.
81
+ 6. **Error handling and degradation.** Every external call (network, DB, file, MCP,
82
+ API) handles failure, and the failure is reported honestly rather than swallowed.
83
+ 7. **Boundaries and clarity.** One responsibility per unit; names that say what the
84
+ thing is; no duplication of a logic block that should be shared; nothing left
85
+ dead.
86
+ 8. **Security.** No secrets in code, logs or fixtures; input validated at the
87
+ boundary; no new injection or path-traversal surface.
88
+ 9. **Docs in the same change.** Module docs, runbooks and (for UI work) the
89
+ super-ux layers updated alongside the code, not deferred.
90
+
91
+ **Severities:**
92
+
93
+ - **Critical** — wrong behavior, data loss, security hole, a red or dishonest test
94
+ suite. Blocks.
95
+ - **Important** — a real defect or spec gap that will bite: missing requirement,
96
+ unhandled failure path, a magic value the constraints named. Blocks.
97
+ - **Minor** — style, naming, a nit with no behavioral consequence. Never blocks;
98
+ goes to the ledger.
99
+ - **⚠️ Cannot verify from diff** — the requirement lives in unchanged code or spans
100
+ tasks. Not a blocker for the reviewer; the controller resolves it.
101
+
102
+ Formatting nits that don't change meaning are not findings. Praise is not a
103
+ finding either.
104
+
105
+ ## Prompt — task review
106
+
107
+ > You are reviewing one task of an implementation plan. Read, in order:
108
+ > `<brief path>` (the requirements), `<report path>` (what the implementer did and
109
+ > the test evidence), `<diff package path>` (commits, stat, full diff).
110
+ >
111
+ > Global constraints binding this task:
112
+ > ```
113
+ > <verbatim block>
114
+ > ```
115
+ >
116
+ > Produce three verdicts, all required:
117
+ > 1. **Spec compliance:** ✅ or ❌. List every requirement as met / partial /
118
+ > missing, and list anything implemented that was not asked for.
119
+ > 2. **REQ satisfied:** ✅ or ❌ per `Implements:` id. The brief quotes each
120
+ > requirement's statement — judge the diff against **that statement**, not
121
+ > against the task's instructions. A task can follow every instruction and still
122
+ > miss the requirement it exists to deliver; say so when it does.
123
+ > 3. **Code quality:** approved or not. Findings only, each as
124
+ > `severity — file:line — the defect — the failure scenario (concrete input or
125
+ > state → wrong result)`. Severities: Critical, Important, Minor. Use
126
+ > `⚠️ cannot verify from diff` for anything you can't judge from the diff alone.
127
+ >
128
+ > Review against the rubric: correctness, global constraints, test honesty (tests
129
+ > assert real behavior, not mocks; no skipped/empty assertions), error handling and
130
+ > honest degradation, boundaries and naming, security and secrets, docs updated in
131
+ > the same change. No praise, no formatting nits that don't change meaning. Do not
132
+ > re-run the tests the report already covers. Return the verdicts and findings as
133
+ > your final message — nothing else.
134
+
135
+ ## Prompt — scoped re-review
136
+
137
+ > A previous review of this task raised the findings below. The implementer has
138
+ > since pushed fixes. Read `<brief path>`, `<report path>` (its fix report is
139
+ > appended at the end) and `<fix diff package path>` — the fix diff **only**.
140
+ >
141
+ > Open findings:
142
+ > ```
143
+ > 1. <finding>
144
+ > 2. <finding>
145
+ > ```
146
+ >
147
+ > For each finding return `ADDRESSED` (with the `file:line` that resolves it) or
148
+ > `NOT ADDRESSED` (with what's still wrong). Then flag any **new** Critical or
149
+ > Important breakage introduced by this fix diff. Out-of-scope observations about
150
+ > code this diff didn't touch: list them separately as deferred minors — they are
151
+ > not part of this verdict. End with: all findings addressed / N still open.
152
+
153
+ ## Prompt — final whole-branch review
154
+
155
+ > Review this entire branch before merge. Read `<diff package path>` (merge-base to
156
+ > HEAD) and `<spec path>`.
157
+ >
158
+ > Findings deferred or parked during implementation:
159
+ > ```
160
+ > <the ledger's minor + parked lines>
161
+ > ```
162
+ >
163
+ > Judge the branch as a whole: does it deliver the spec; do the pieces fit; is
164
+ > anything half-migrated, duplicated across tasks, or left dead; are the tests
165
+ > honest and the suite genuinely green; is error handling consistent; are docs in
166
+ > sync. Triage the deferred/parked list: which of those must be fixed before merge,
167
+ > which can stand and why. Findings only, with severity and a concrete failure
168
+ > scenario each. Return the findings as your final message.
169
+
170
+ Run the final review on the **run's confirmed model** like everything else
171
+ ([`model-tiering.md`](model-tiering.md)). It is the one review that sees the whole
172
+ change, so if the run is on a tier below the most capable one available, say so and
173
+ offer to escalate just this dispatch — a recommendation stated out loud, never a
174
+ silent switch (`build.md` → *Models*).
@@ -0,0 +1,144 @@
1
+ # Spec — stage 3, built in
2
+
3
+ Writing the approved design down so a zero-context implementer — human or subagent
4
+ — can build from it without asking. Built into this skill; nothing to install.
5
+
6
+ > The spec write-up, its self-review pass and the operator-review gate are ported
7
+ > from the tail of the `brainstorming` skill in
8
+ > [obra/superpowers](https://github.com/obra/superpowers) (MIT — see `LICENSE` →
9
+ > *Third-party*), extended here with the UX track and the Global Constraints block
10
+ > that stages 4–5 depend on.
11
+
12
+ ## Order of operations
13
+
14
+ For a **user-facing task** (stage-2 UI verdict = yes) the UX chain runs **first** —
15
+ scenarios before interface, always. For everything else, go straight to *Write the
16
+ spec*.
17
+
18
+ ## UX track (user-facing tasks only)
19
+
20
+ Runs on **super-ux** — the one companion this pipeline recommends by name
21
+ ([`companion-skills.md`](companion-skills.md)). If it isn't installed on a UI task,
22
+ give the install line and stop; don't improvise a half-chain.
23
+
24
+ 1. `/ux` — the single super-ux entry: reports which `docs/ux/` layers exist,
25
+ repairs the skeleton, records the Figma on/off choice, recommends the next
26
+ action. Never make the operator pick skills.
27
+ 2. `ux-foundation` → `docs/ux/foundation.md` — the **WHY**: personas, Jobs to Be
28
+ Done, customer journey maps, user stories (Given/When/Then).
29
+ 3. `ux-flows` → `docs/ux/flows.md` + `docs/ux/screens.md` — the **HOW + UI map**:
30
+ task analysis, user-flow diagrams (branches, error paths), every screen and
31
+ state with a wireframe and, when Figma is on, a frame link.
32
+ 4. `ux-scenarios` → `docs/ux/scenarios.md` — the **WHAT**, the source of truth for
33
+ user-facing behavior: scenarios validated against super-ux's format contract —
34
+ IDs, statuses, `Traces:` to stories / journey stages / flows, edge and error
35
+ states enumerated.
36
+ 5. **Run the linter** (`/ux-lint`, i.e. `python3 docs/ux/lint.py`). It must pass:
37
+ no drift, no orphans, no broken traces, no stale Figma links.
38
+
39
+ These skills are **idempotent** — extend the existing `docs/ux/` layers, never
40
+ rebuild them. If the chain already exists and is validated (typically when the run
41
+ entered from super-ux), verify it and embed it; build only what's missing.
42
+
43
+ ## Write the spec
44
+
45
+ Path: `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`, committed, **same
46
+ `<topic>` slug as the brief** so brief → design → plan is traceable at a glance.
47
+ (The directory name is this pipeline's historical convention, not a dependency on
48
+ anything; a host project may relocate the root via its `CLAUDE.md` — keep the
49
+ shape. See [`artifacts.md`](artifacts.md).)
50
+
51
+ **Every section carries `covers: REQ-…`** — the brief's requirement ids it serves.
52
+ This is what makes the brief→spec seam checkable instead of a re-telling: at the
53
+ gate, every REQ must appear in at least one section, and a section that covers no
54
+ REQ is either scope creep or a missing REQ. Say which.
55
+
56
+ The spec **locks every shared contract**, because from here on people and subagents
57
+ work from it in parallel and can't renegotiate:
58
+
59
+ - **Types, schemas, signatures** — exact names, exact parameter and return types.
60
+ - **File layout** — which files exist, what each one owns.
61
+ - **Global Constraints** — the project-wide requirements every task inherits:
62
+ version floors, dependency limits, naming and copy rules, platform requirements,
63
+ exact values. Stage 4 copies this block verbatim into the plan and stage 5 hands
64
+ it to every reviewer, so write it as literal values, never as prose.
65
+ - **Error handling and degradation** — what fails how, what the user sees, what
66
+ gets logged.
67
+ - **Testing approach** — what proves this works.
68
+
69
+ For UI tasks the spec **embeds the UX layer**: the validated scenario IDs, the
70
+ flows and `SCR-` screens, the CJM stages the feature serves, and the applicable
71
+ super-ux patterns and principles. Every user-facing requirement traces to a
72
+ scenario ID.
73
+
74
+ ## Module dossier — when the run is one brick of a platform
75
+
76
+ If stage 2 produced a module map ([`decomposition.md`](decomposition.md)), this
77
+ spec is that module's **dossier**, and it is the only document the module's build
78
+ gets. Cover all of it, in this order, each section carrying its `covers: REQ-…`:
79
+
80
+ 1. **Purpose and boundary** — what this module delivers, and what it explicitly
81
+ does not (naming the module that does).
82
+ 2. **Architecture** — the module's internal shape: units, responsibilities, the
83
+ flow of a request or event through it, and where it sits in the platform.
84
+ 3. **Entities and data** — the entities this module **owns** (it is their source of
85
+ truth), their fields and invariants, their lifecycle/state transitions, storage
86
+ and migrations. Entities owned elsewhere are referenced by id, never copied into
87
+ a second source of truth.
88
+ 4. **Contracts — in and out.** For every inbound API/event this module serves and
89
+ every outbound one it consumes: exact signature or schema, auth, idempotency,
90
+ versioning, and **the behavior when the other side is unavailable or wrong**.
91
+ These are the seams the map named; here they get their shapes.
92
+ 5. **Business logic and rules** — the rules in the domain's language, each with the
93
+ condition that triggers it and the outcome. Rules that only exist as code are
94
+ rules nobody can review.
95
+ 6. **Edge and failure cases** — the boundaries (empty, first, last, maximum,
96
+ concurrent), the failure modes (timeout, partial write, duplicate delivery,
97
+ downstream down) and the honest degradation for each. This is the section that
98
+ decides whether the module survives contact with production, so it is not a
99
+ bullet list of "handle errors".
100
+ 7. **UI / Figma** — for a module with a surface: the super-ux chain (foundation →
101
+ flows → screens → scenarios), the `SCR-` screens and their Figma frame links,
102
+ and the states each screen has (loading, empty, error, partial).
103
+ 8. **Non-functional** — limits, expected volumes, latency budget, security and
104
+ privacy constraints that bind this module specifically.
105
+ 9. **Open questions** — anything still undecided, with the latest moment it can be
106
+ decided and who decides. An open question that reaches the plan becomes an
107
+ implementer's guess.
108
+
109
+ A dossier that skips a section says why in one line (`no UI surface`, `owns no
110
+ entities`). Silence is not a skip.
111
+
112
+ Anything the stage-1 docs study could not ground (a library context7 can't resolve,
113
+ a private API) is **flagged in the spec** as an assumption, not silently assumed.
114
+
115
+ ## Self-review — before showing it
116
+
117
+ Read what you wrote with fresh eyes and fix inline. No subagent, no second pass:
118
+
119
+ 1. **REQ coverage:** does every REQ in the brief appear in at least one section's
120
+ `covers:` line, and does every section cover at least one REQ? A missing REQ is
121
+ scope lost here; a section covering none is scope creep or a missing REQ.
122
+ 2. **Placeholders:** any TBD / TODO / "handle edge cases" / unfinished section? Fix.
123
+ 3. **Internal consistency:** do sections contradict each other? Does the
124
+ architecture match the feature descriptions and the locked signatures?
125
+ 4. **Scope:** is this one implementable plan, or does it need decomposition?
126
+ 5. **Ambiguity:** can any requirement be read two ways? Pick one and say it.
127
+ 6. **Traceability (UI):** does every user-facing requirement name its scenario ID?
128
+
129
+ ## GATE (manual)
130
+
131
+ > "Spec written and committed to `<path>`. Review it and tell me if anything should
132
+ > change before I write the implementation plan."
133
+
134
+ Wait for the operator. Changes requested → apply, re-run the self-review, ask
135
+ again.
136
+
137
+ The gate is not only the operator's word: **every section carries `covers: REQ-…`
138
+ and every REQ in the brief appears in at least one section.** For UI tasks it
139
+ additionally requires: the chain (foundation → flows → screens → scenarios)
140
+ designed, validated and approved; `/ux-lint` green; every user-facing requirement
141
+ traced to a scenario ID — or an explicit waiver from the operator recorded in the
142
+ spec.
143
+
144
+ No plan starts before this gate passes.