@runecraft/grimoire 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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -0
  3. package/catalog.json +9 -0
  4. package/dist/grimoire.js +1758 -0
  5. package/package.json +54 -0
  6. package/references/definition-of-done.md +67 -0
  7. package/references/testing-patterns.md +260 -0
  8. package/skills/code-review-and-quality/README.md +13 -0
  9. package/skills/code-review-and-quality/SKILL.md +389 -0
  10. package/skills/code-simplification/README.md +13 -0
  11. package/skills/code-simplification/SKILL.md +338 -0
  12. package/skills/debugging-and-error-recovery/README.md +13 -0
  13. package/skills/debugging-and-error-recovery/SKILL.md +343 -0
  14. package/skills/debugging-and-error-recovery/scripts/__pycache__/triage_state.cpython-314.pyc +0 -0
  15. package/skills/debugging-and-error-recovery/scripts/triage_state.py +206 -0
  16. package/skills/deprecation-and-migration/README.md +13 -0
  17. package/skills/deprecation-and-migration/SKILL.md +248 -0
  18. package/skills/deprecation-and-migration/scripts/__pycache__/migration_tracker.cpython-314.pyc +0 -0
  19. package/skills/deprecation-and-migration/scripts/migration_tracker.py +237 -0
  20. package/skills/doubt-driven-development/README.md +13 -0
  21. package/skills/doubt-driven-development/SKILL.md +251 -0
  22. package/skills/git-commit-learning/.skill-meta.json +14 -0
  23. package/skills/git-commit-learning/README.md +205 -0
  24. package/skills/git-commit-learning/SKILL.md +435 -0
  25. package/skills/git-commit-learning/references/commit-patterns.md +595 -0
  26. package/skills/git-worktree/README.md +13 -0
  27. package/skills/git-worktree/SKILL.md +220 -0
  28. package/skills/idea-refine/README.md +13 -0
  29. package/skills/idea-refine/SKILL.md +186 -0
  30. package/skills/interview-me/README.md +13 -0
  31. package/skills/interview-me/SKILL.md +233 -0
  32. package/skills/linkedin-audit/SKILL.md +98 -0
  33. package/skills/linkedin-audit/references/dashboard-spec.md +43 -0
  34. package/skills/memory-management/README.md +13 -0
  35. package/skills/memory-management/SKILL.md +198 -0
  36. package/skills/security-and-hardening/README.md +13 -0
  37. package/skills/security-and-hardening/SKILL.md +472 -0
  38. package/skills/shipping-and-launch/README.md +13 -0
  39. package/skills/shipping-and-launch/SKILL.md +317 -0
  40. package/skills/skill-forge/README.md +153 -0
  41. package/skills/skill-forge/SKILL.md +291 -0
  42. package/skills/skill-forge/assets/SKILL.template.md +73 -0
  43. package/skills/skill-forge/references/authoring-patterns.md +249 -0
  44. package/skills/skill-forge/references/description-optimization.md +171 -0
  45. package/skills/skill-forge/references/output-evaluation.md +276 -0
  46. package/skills/skill-forge/references/scripts-guide.md +232 -0
  47. package/skills/skill-forge/references/spec.md +175 -0
  48. package/skills/skill-forge/scripts/validate.py +536 -0
  49. package/skills/spec-driven/.skill-meta.json +14 -0
  50. package/skills/spec-driven/README.md +335 -0
  51. package/skills/spec-driven/SKILL.md +174 -0
  52. package/skills/spec-driven/references/code-analysis.md +98 -0
  53. package/skills/spec-driven/references/coding-principles.md +56 -0
  54. package/skills/spec-driven/references/context-limits.md +31 -0
  55. package/skills/spec-driven/references/design.md +199 -0
  56. package/skills/spec-driven/references/discuss.md +136 -0
  57. package/skills/spec-driven/references/implement.md +425 -0
  58. package/skills/spec-driven/references/lessons.md +113 -0
  59. package/skills/spec-driven/references/memory.md +126 -0
  60. package/skills/spec-driven/references/specify.md +210 -0
  61. package/skills/spec-driven/references/sub-agents.md +96 -0
  62. package/skills/spec-driven/references/tasks.md +484 -0
  63. package/skills/spec-driven/references/validate.md +350 -0
  64. package/skills/spec-driven/scripts/__pycache__/lessons.cpython-314.pyc +0 -0
  65. package/skills/spec-driven/scripts/lessons.py +370 -0
  66. package/skills/spec-loop/README.md +36 -0
  67. package/skills/spec-loop/SKILL.md +61 -0
  68. package/skills/test-driven-development/README.md +13 -0
  69. package/skills/test-driven-development/SKILL.md +388 -0
  70. package/skills/typescript-patterns/README.md +13 -0
  71. package/skills/typescript-patterns/SKILL.md +346 -0
  72. package/skills/using-agent-skills/README.md +13 -0
  73. package/skills/using-agent-skills/SKILL.md +187 -0
@@ -0,0 +1,484 @@
1
+ # Tasks
2
+
3
+ **Goal**: Break into GRANULAR, ATOMIC tasks. Clear dependencies. Right tools. Parallel execution plan.
4
+
5
+ **Skip this phase when:** There are ≤3 obvious steps. In that case, tasks are implicit — go straight to Execute and list them inline in your implementation plan.
6
+
7
+ ## Why Granular Tasks?
8
+
9
+ | Vague Task (BAD) | Granular Tasks (GOOD) |
10
+ | ---------------- | --------------------------------- |
11
+ | "Create form" | T1: Create email input component |
12
+ | | T2: Add email validation function |
13
+ | | T3: Create submit button |
14
+ | | T4: Add form state management |
15
+ | | T5: Connect form to API |
16
+ | "Implement auth" | T1: Create login form |
17
+ | | T2: Create register form |
18
+ | | T3: Add token storage utility |
19
+ | | T4: Create auth API service |
20
+ | | T5: Add route protection |
21
+
22
+ **Benefits of granular:**
23
+
24
+ - **Agents don't err** - Single focus, no ambiguity
25
+ - **Easy to test** - Each task = one verifiable outcome
26
+ - **Parallelizable** - Independent tasks run simultaneously
27
+ - **Errors isolated** - One failure doesn't block everything
28
+
29
+ **Rule**: One task = ONE of these:
30
+
31
+ - One component
32
+ - One function
33
+ - One API endpoint
34
+ - One file change
35
+
36
+ ---
37
+
38
+ ## Process
39
+
40
+ ### 1. Review Design
41
+
42
+ Read `.specs/features/[feature]/design.md` before creating tasks.
43
+
44
+ ### 1.5. Generate the Test Coverage Matrix (ALWAYS)
45
+
46
+ This step ALWAYS runs — there is no precondition. Decide which of two paths to take, then generate the three sections below.
47
+
48
+ **Step 0 — Read project quality/testing guidelines (ALWAYS, before anything else).**
49
+
50
+ Before sampling tests or inferring anything, scan the project for documented quality and testing standards. Stack-agnostic sources to check (illustrative, not exhaustive):
51
+
52
+ - Agent/AI instructions: `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/**`, `.github/copilot-instructions.md`
53
+ - Contributor guides: `CONTRIBUTING.md`, `docs/` (testing, quality, or standards subdocs), README testing section
54
+ - Tool configuration: coverage thresholds in the test runner config (e.g., `jest.config.*`, `vitest.config.*`, `pytest.ini`, `.nycrc`, `Makefile` coverage targets, CI coverage gates)
55
+
56
+ **If guidelines are found:** the Coverage Expectation (see matrix below) conforms to them. Existing test samples fill gaps in style/location/framework only. Cite the specific files found in the matrix provenance note.
57
+
58
+ **If no guidelines are found:** apply the strong default — cover every spec AC and every listed edge case; domain/business logic maps 1:1 to spec ACs; routes/e2e cover happy + edge + error paths. This default may exceed the current repo's depth, which is intentional.
59
+
60
+ **Decision:**
61
+
62
+ - **Existing tests in the repo** → infer the matrix, parallelism assessment, and gate commands by sampling the codebase.
63
+ - **No tests at all** → ask the user: "What test types will this project use (unit / integration / e2e / none)? What commands run them?"
64
+
65
+ **How to infer (path 1 — existing tests):**
66
+
67
+ 1. **Sample test files.** Locate 5–10 existing test files. Map each file's location relative to its source file to identify which code layers are exercised and at what level (unit, integration, e2e). Use these samples for style, location patterns, framework, and test type — and as a **floor** (never produce tests less thorough than existing ones for the same layer). Existing tests are NOT a ceiling on thoroughness; the thoroughness target comes from the spec ACs, listed edge cases, and guidelines (or strong default). The Coverage Expectation column captures the target per layer.
68
+ 2. **Discover commands from the repo.** Do NOT invent commands and do NOT assume an ecosystem. Read the project's own build/task manifests, test config, and CI workflows to extract the actual commands — for example: `package.json` / `project.json` (JS/TS), `Makefile`, `pyproject.toml` / `tox.ini` / `pytest` (Python), `Cargo.toml` (Rust), `go test` invocations (Go), `pom.xml` / `build.gradle` (Java/Kotlin), `Gemfile` / `Rakefile` (Ruby), `composer.json` (PHP), `.github/workflows` / `.gitlab-ci.yml`. The list is illustrative; detect what this repo actually uses.
69
+ 3. **Classify parallelism by behavior.** NOT parallel-safe = a shared backing store or connection across tests, global table/collection cleanup in setup/teardown (e.g., DELETE/TRUNCATE or ORM truncation helpers), or shared global/static mutable state. Parallel-safe = per-test isolation (per-test store/schema, data namespaced by a unique test ID) or fully mocked dependencies. If parallel-safety cannot be determined, default to sequential (strip `[P]`).
70
+
71
+ **Output contract — render these three sections verbatim into `tasks.md`** (the exact headings downstream phases reference):
72
+
73
+ ---
74
+
75
+ ## Test Coverage Matrix
76
+
77
+ > Generated from codebase, project guidelines, and spec — confirm before Execute. Guidelines found: [list files, e.g. `AGENTS.md`, `jest.config.ts` — or "none — strong defaults applied"].
78
+
79
+ | Code Layer | Required Test Type | Coverage Expectation | Location Pattern | Run Command |
80
+ | ---------- | ------------------ | -------------------- | ---------------- | ----------- |
81
+ | [layer] | [unit/integration/e2e/none] | [depth target for this layer] | [glob or path pattern] | [command] |
82
+
83
+ **Coverage Expectation values** — set from guidelines first; use strong defaults when no guideline applies:
84
+
85
+ | Layer type | Strong default (no guideline) |
86
+ | ---------- | ----------------------------- |
87
+ | Domain / business-logic (service, use-case, domain model) | All branches; 1:1 to spec ACs; every listed edge case has a test |
88
+ | Route / controller / e2e / integration | All routes in scope: happy path + every listed edge case + error/failure paths |
89
+ | Repository / data-access | Key query paths + error handling; infer from existing repo tests |
90
+ | Entity / config / schema | none — build gate only |
91
+
92
+ These defaults may exceed the current repo's depth. That is intentional — they are a **target**, not a reflection of what already exists.
93
+
94
+ *Example (filled in):*
95
+
96
+ | Code Layer | Required Test Type | Coverage Expectation | Location Pattern | Run Command |
97
+ | ---------- | ------------------ | -------------------- | ---------------- | ----------- |
98
+ | Service | unit | All branches; 1:1 to spec ACs; all listed edge cases | `src/**/__test__/*.spec.ts` | `yarn test:unit` |
99
+ | Repository | integration | Key query paths + error paths | `src/**/__test__/*.e2e-spec.ts` | `yarn test:e2e` |
100
+ | Controller/Resolver | e2e | All routes: happy + edge + error | `src/**/__test__/*.e2e-spec.ts` | `yarn test:e2e` |
101
+ | Entity / Config | none | — (build gate only) | — | build gate only |
102
+
103
+ ## Parallelism Assessment
104
+
105
+ > Generated from codebase — confirm before Execute.
106
+
107
+ | Test Type | Parallel-Safe? | Isolation Model | Evidence |
108
+ | --------- | -------------- | --------------- | -------- |
109
+ | [type] | [Yes/No] | [description] | [file/pattern that proves it] |
110
+
111
+ ## Gate Check Commands
112
+
113
+ > Generated from codebase — confirm before Execute.
114
+
115
+ | Gate Level | When to Use | Command |
116
+ | ---------- | ----------- | ------- |
117
+ | Quick | After tasks with unit tests only | [unit test command] |
118
+ | Full | After tasks with e2e/integration tests | [unit + e2e commands] |
119
+ | Build | After phase completion or config/entity-only tasks | [build + lint + all tests] |
120
+
121
+ ---
122
+
123
+ **Co-located tests:** Every task that creates or modifies a code layer with a required test type MUST include writing/updating those tests in the same task. Tests are NOT separate tasks. The tests must satisfy the layer's **Coverage Expectation** from the matrix — not merely exist.
124
+
125
+ | Task creates... | Done When must include... |
126
+ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
127
+ | Code layer with "unit" requirement | Unit tests written satisfying the layer's Coverage Expectation (e.g., 1:1 AC mapping for domain logic; all listed edge cases covered) + quick gate passes |
128
+ | Code layer with "e2e" requirement | E2E tests written satisfying the layer's Coverage Expectation (e.g., every route the task adds: happy path + edge + error paths) + full gate passes |
129
+ | Code layer with "integration" requirement | Integration tests written satisfying the layer's Coverage Expectation + full gate passes |
130
+ | Code layer with "none" requirement | Gate check at appropriate level |
131
+
132
+ **Parallelism flags:** Cross-reference the **Parallelism Assessment** generated above when marking tasks `[P]`:
133
+
134
+ - If a task's required test type is marked "Parallel-Safe: No" → strip `[P]` flag
135
+ - If a task's required test type is marked "Parallel-Safe: Yes" → `[P]` is allowed
136
+ - If a task has no tests → `[P]` depends only on code dependencies
137
+
138
+ ### 2. Break Into Atomic Tasks
139
+
140
+ **Task = ONE deliverable**. Examples:
141
+
142
+ - ✅ "Create UserService interface" (one file, one concept)
143
+ - ❌ "Implement user management" (too vague, multiple files)
144
+
145
+ ### 3. Define Dependencies
146
+
147
+ What MUST be done before this task can start?
148
+
149
+ ### 4. Create Execution Plan
150
+
151
+ Group tasks into phases. Identify what can run in parallel.
152
+
153
+ ### 5. Validate Before Presenting (MANDATORY)
154
+
155
+ Before showing tasks to the user, run ALL three pre-approval checks. These are NOT optional — they are gates. If any check fails, restructure the tasks and re-run until all pass.
156
+
157
+ **Check 1: Task Granularity** — verify each task is atomic (see Granularity Check section).
158
+
159
+ **Check 2: Diagram-Definition Cross-Check** — verify the execution diagram matches every task's `Depends on` field (see Diagram-Definition Cross-Check section). Build the cross-check table and include it in the output.
160
+
161
+ **Check 3: Test Co-location Validation** — verify every task's `Tests` field matches the **Test Coverage Matrix** generated above (see Test Co-location Validation section). Build the validation table and include it in the output.
162
+
163
+ **Output both tables with the tasks** so the user can see the validation results. Any ❌ means you MUST restructure before presenting — do not show failing tasks to the user and ask them to approve.
164
+
165
+ **Note on the generated matrix:** The three sections (`Test Coverage Matrix`, `Parallelism Assessment`, `Gate Check Commands`) are provisional — generated from codebase sampling or user input and included in this file for user confirmation as part of task approval. They become authoritative once the user approves the tasks.
166
+
167
+ ### 6. ASK About MCPs and Skills
168
+
169
+ **CRITICAL**: Before execution, ask the user:
170
+
171
+ > "For each task, which tools should I use?"
172
+ >
173
+ > **Available MCPs**: [list from project or user]
174
+ > **Available Skills**: [list from project or user]
175
+
176
+ ---
177
+
178
+ ## Template: `.specs/features/[feature]/tasks.md`
179
+
180
+ ```markdown
181
+ # [Feature] Tasks
182
+
183
+ ## Execution Protocol (MANDATORY -- do not skip)
184
+
185
+ Implement these tasks with the `spec-driven` skill: **activate it by name and follow its Execute flow and Critical Rules.** Do not search for skill files by filesystem path. The skill is the source of truth for the full flow (per-task cycle, sub-agent delegation, adequacy review, Verifier, discrimination sensor).
186
+
187
+ **If the skill cannot be activated, STOP and tell the user — do not proceed without it.**
188
+
189
+ ---
190
+
191
+ **Design**: `.specs/features/[feature]/design.md`
192
+ **Status**: Draft | Approved | In Progress | Done
193
+
194
+ ---
195
+
196
+ <!-- The three sections below are generated by step 1.5 of the Tasks process and filled in during task creation. Do not manually populate them — they are produced by the agent from codebase sampling. -->
197
+
198
+ ## Test Coverage Matrix
199
+
200
+ [Generated in step 1.5 — see process above]
201
+
202
+ ## Parallelism Assessment
203
+
204
+ [Generated in step 1.5 — see process above]
205
+
206
+ ## Gate Check Commands
207
+
208
+ [Generated in step 1.5 — see process above]
209
+
210
+ ---
211
+
212
+ ## Execution Plan
213
+
214
+ ### Phase 1: Foundation (Sequential)
215
+
216
+ Tasks that must be done first, in order.
217
+ ```
218
+
219
+ T1 → T2 → T3
220
+
221
+ ```
222
+
223
+ ### Phase 2: Core Implementation (Parallel OK)
224
+ After foundation, these can run in parallel.
225
+
226
+ ```
227
+
228
+ ┌→ T4 ─┐
229
+
230
+ T3 ──┼→ T5 ─┼──→ T8
231
+ └→ T6 ─┘
232
+ T7 ──────→
233
+
234
+ ```
235
+
236
+ ### Phase 3: Integration (Sequential)
237
+ Bringing it all together.
238
+
239
+ ```
240
+
241
+ T8 → T9
242
+
243
+ ---
244
+
245
+ ## Task Breakdown
246
+
247
+ ### T1: [Create X Interface]
248
+
249
+ **What**: [One sentence: exact deliverable]
250
+ **Where**: `src/path/to/file.ts`
251
+ **Depends on**: None
252
+ **Reuses**: `src/existing/BaseInterface.ts`
253
+ **Requirement**: [FEAT]-01
254
+
255
+ **Tools**:
256
+
257
+ - MCP: `filesystem` (or NONE)
258
+ - Skill: NONE
259
+
260
+ **Done when**:
261
+
262
+ - [ ] Interface defined with all methods from design
263
+ - [ ] Types exported correctly
264
+ - [ ] No TypeScript errors
265
+
266
+ **Tests**: [unit/e2e/integration/none — from coverage matrix]
267
+ **Gate**: [quick/full/build — from gate check commands]
268
+
269
+ ---
270
+
271
+ ### T2: [Implement Y Service] [P]
272
+
273
+ **What**: [Exact deliverable]
274
+ **Where**: `src/services/YService.ts`
275
+ **Depends on**: T1
276
+ **Reuses**: `src/services/BaseService.ts` patterns
277
+
278
+ **Tools**:
279
+
280
+ - MCP: `filesystem`, `context7`
281
+ - Skill: NONE
282
+
283
+ **Done when**:
284
+
285
+ - [ ] Implements interface from T1
286
+ - [ ] Handles error cases from design
287
+ - [ ] Gate check passes: `[quick gate command from the Gate Check Commands above]`
288
+ - [ ] Test count: [N] tests pass (no silent deletions)
289
+
290
+ **Tests**: unit
291
+ **Gate**: quick
292
+
293
+ ---
294
+
295
+ ### T3: [Create Z Component] [P]
296
+
297
+ **What**: [Exact deliverable]
298
+ **Where**: `src/components/ZComponent.tsx`
299
+ **Depends on**: T1
300
+ **Reuses**: `src/components/BaseComponent.tsx`
301
+
302
+ **Tools**:
303
+
304
+ - MCP: `filesystem`
305
+ - Skill: NONE
306
+
307
+ **Done when**:
308
+
309
+ - [ ] Component renders correctly
310
+ - [ ] Handles props from interface
311
+ - [ ] Follows existing component patterns
312
+ - [ ] Gate check passes: `[quick gate command from the Gate Check Commands above]`
313
+ - [ ] Test count: [N] tests pass (no silent deletions)
314
+
315
+ **Tests**: unit
316
+ **Gate**: quick
317
+
318
+ ---
319
+
320
+ ### T4: [Add A Feature to Y]
321
+
322
+ **What**: [Exact deliverable]
323
+ **Where**: `src/services/YService.ts` (modify)
324
+ **Depends on**: T2, T3
325
+ **Reuses**: Existing service patterns
326
+
327
+ **Tools**:
328
+
329
+ - MCP: `filesystem`, `github`
330
+ - Skill: `api-design`
331
+
332
+ **Done when**:
333
+
334
+ - [ ] Feature works per acceptance criteria
335
+ - [ ] Gate check passes: `[full gate command from the Gate Check Commands above]`
336
+ - [ ] Test count: [N] tests pass (no silent deletions)
337
+
338
+ **Tests**: integration
339
+ **Gate**: full
340
+
341
+ **Commit**: `feat([scope]): [description]`
342
+
343
+ ---
344
+
345
+ ## Parallel Execution Map
346
+
347
+ Visual representation of task ordering within phases (`[P]` = order-free, no inter-task dependency):
348
+
349
+ ```
350
+
351
+ Phase 1 (Sequential):
352
+ T1 ──→ T2 ──→ T3
353
+
354
+ Phase 2 (Parallel):
355
+ T3 complete, then:
356
+ ├── T4 [P]
357
+ ├── T5 [P] } Can run simultaneously
358
+ └── T6 [P]
359
+
360
+ Phase 3 (Sequential):
361
+ T4, T5, T6 complete, then:
362
+ T7 ──→ T8
363
+
364
+ ```
365
+
366
+ **Parallelism constraint:** A task marked `[P]` must have ALL of these:
367
+
368
+ - No unfinished dependencies
369
+ - Required test type is parallel-safe (per the **Parallelism Assessment** generated above)
370
+ - No shared mutable state with other `[P]` tasks in the same phase
371
+
372
+ If a task's tests are NOT parallel-safe, it MUST run sequentially even if its
373
+ implementation code has no dependencies. The test execution is the bottleneck.
374
+
375
+ `[P]` is ordering information — it tells the executing agent (or phase worker) that these
376
+ tasks have no inter-task dependency and can be done in any order within the phase. It is
377
+ NOT a directive to spawn a sub-agent per task.
378
+
379
+ **How phase-based execution works:**
380
+
381
+ When a feature has more than 3 phases, the agent offers to dispatch one sub-agent per phase
382
+ (sequential). Each phase worker executes ALL tasks in its assigned phase in order, then reports
383
+ a compact summary back to the orchestrator. See [sub-agents.md](sub-agents.md) for the
384
+ full model — trigger threshold, offer-then-confirm rule, worker payload, compact summary
385
+ contract, failure handling, and context sizing guidance.
386
+
387
+ For features with 3 or fewer phases, execution happens inline in the main window with no
388
+ sub-agents spawned.
389
+
390
+ `[P]` marks tasks that have no inter-task dependency within a phase (order-free). It is
391
+ informational — it tells the worker (or the main agent) those tasks can be done in any order.
392
+ It is NOT a directive to spawn a sub-agent per task.
393
+
394
+ **The orchestrating agent's role during Execute:**
395
+ 1. Assess phase count — offer sub-agents if >3 phases and user accepts
396
+ 2. Dispatch the next phase (to a worker, or execute inline)
397
+ 3. Receive the compact phase summary
398
+ 4. Update tasks.md with results
399
+ 5. If the phase summary shows all tasks complete: proceed to the next phase
400
+ 6. If a task failed: decide fix/escalate before dispatching the next phase
401
+
402
+ ---
403
+
404
+ ## Task Granularity Check
405
+
406
+ Before approving tasks, verify they are granular enough:
407
+
408
+ | Task | Scope | Status |
409
+ | ------------------------------- | ------------- | ------------ |
410
+ | T1: Create email input | 1 component | ✅ Granular |
411
+ | T2: Add validation function | 1 function | ✅ Granular |
412
+ | T3: Create form with all fields | 5+ components | ❌ Split it! |
413
+ | T4: Connect to API | 1 function | ✅ Granular |
414
+
415
+ **Granularity check**:
416
+
417
+ - ✅ 1 component / 1 function / 1 endpoint = Good
418
+ - ⚠️ 2-3 related things in same file = OK if cohesive
419
+ - ❌ Multiple components or files = MUST split
420
+
421
+ ---
422
+
423
+ ## Diagram-Definition Cross-Check
424
+
425
+ Before approving tasks, verify the execution diagram is consistent with the task definitions. These are independent artifacts that can drift — the diagram is drawn for visual clarity while task bodies are written for precision. Both must agree.
426
+
427
+ For each task, check:
428
+
429
+ | Task | Depends On (task body) | Diagram Shows | Status |
430
+ | ---- | ---------------------- | ------------- | ------ |
431
+ | T[N] | [deps from body] | [deps from diagram arrows] | ✅ Match or ❌ Mismatch |
432
+
433
+ **Rules:**
434
+
435
+ - Every `Depends on` in a task body must have a corresponding arrow in the diagram.
436
+ - Every arrow in the diagram must correspond to a `Depends on` in the target task's body.
437
+ - Tasks shown as parallel (`[P]`) in the diagram must not depend on each other.
438
+ - If a task depends on another task in the same parallel phase, they are NOT parallel — fix the diagram or remove the `[P]` flag.
439
+
440
+ ---
441
+
442
+ ## Test Co-location Validation
443
+
444
+ Before approving tasks, verify EVERY task's `Tests` field is consistent with the **Test Coverage Matrix** generated above. This is a hard gate — tasks that fail this check MUST be fixed.
445
+
446
+ For each task, check: does the task create or modify a code layer that has a required test type in the coverage matrix? If yes, the task's `Tests` field MUST match.
447
+
448
+ | Task | Code Layer Created/Modified | Matrix Requires | Task Says | Status |
449
+ | ---- | --------------------------- | --------------- | --------- | ------ |
450
+ | T[N]: [name] | [layer from coverage matrix] | [test type] | [task's Tests field] | ✅ OK or ❌ VIOLATION |
451
+
452
+ **Rules:**
453
+
454
+ - "Tested in another task" is NOT a valid justification for `Tests: none`. That is test deferral — the exact anti-pattern this validation prevents.
455
+ - `Tests: none` is only valid when the coverage matrix says "none" for that code layer.
456
+ - If a task creates MULTIPLE code layers (e.g., service + controller), use the HIGHEST test type required by any of them.
457
+ - Any ❌ VIOLATION → restructure the task to include its required tests before proceeding.
458
+
459
+ **Resolving compilation dependencies:**
460
+
461
+ When a task creates code that can't be tested until a later task completes (e.g., a controller that needs module wiring before its e2e tests can run), do NOT defer the tests to a separate task. Instead, restructure:
462
+
463
+ 1. **Merge forward:** Move the untestable task's tests into the earliest task where they become runnable (e.g., the wiring task includes wiring + e2e tests for the controller it enables).
464
+ 2. **Merge backward:** Absorb the blocking dependency into the current task so it becomes self-testable (e.g., controller task includes its own module registration).
465
+
466
+ Pick whichever option keeps tasks atomic and cohesive. The goal: no task produces unverified code. If code can't be tested in the task that creates it, the task boundaries are wrong.
467
+
468
+ ---
469
+
470
+ ## Tips
471
+
472
+ - **[P] = Order-free** — Mark tasks with no inter-task dependency (can run in any order within the phase)
473
+ - **Reuses = Token saver** — Always reference existing code
474
+ - **Tools per task** — MCPs and Skills prevent wrong approaches
475
+ - **Dependencies are gates** — Clear what blocks what
476
+ - **Done when = Testable** — If you can't verify it, rewrite it
477
+ - **Requirement ID = Traceable** — Every task traces back to a spec requirement
478
+ - **One commit per task** — Plan the commit message format in advance
479
+
480
+ ---
481
+
482
+ ## Task Verification Standards
483
+
484
+ Every task MUST follow the `Done when` + `Tests` + `Gate` fields defined in the **Task Breakdown** template above. Each `Done when` entry must be specific, testable (binary pass/fail), and reference the gate check command from the `Gate Check Commands` section. Include the expected test count to prevent silent deletions.