@mohammadhprp/system-prompt 0.11.1 → 0.11.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.
Files changed (95) hide show
  1. package/framework/agents/backend-architect.md +1 -1
  2. package/framework/mcps/figma-mcp-go/README.md +0 -1
  3. package/framework/mcps/gitlab-mcp/README.md +0 -1
  4. package/framework/mcps/jira-mcp/README.md +0 -1
  5. package/framework/mcps/laravel-boost/README.md +0 -1
  6. package/framework/mcps/notion-mcp/README.md +0 -1
  7. package/framework/mcps/supabase-mcp/README.md +0 -1
  8. package/framework/plugins/opencode-goal-plugin/README.md +0 -1
  9. package/framework/references/standards/api.md +0 -1
  10. package/framework/references/standards/architecture.md +0 -1
  11. package/framework/references/standards/database.md +0 -1
  12. package/framework/references/standards/debugging.md +0 -1
  13. package/framework/references/standards/documentation.md +0 -2
  14. package/framework/references/standards/logging.md +0 -1
  15. package/framework/references/standards/naming.md +0 -1
  16. package/framework/references/standards/observability.md +0 -1
  17. package/framework/references/standards/performance.md +0 -1
  18. package/framework/references/standards/pull-requests.md +0 -1
  19. package/framework/references/standards/security.md +0 -1
  20. package/framework/references/standards/testing.md +0 -1
  21. package/framework/skills/README.md +15 -3
  22. package/framework/skills/codenavi/SKILL.md +306 -0
  23. package/framework/skills/codenavi/examples.md +33 -0
  24. package/framework/skills/codenavi/references/coding-principles.md +143 -0
  25. package/framework/skills/codenavi/references/notebook-spec.md +171 -0
  26. package/framework/skills/create-adr/SKILL.md +429 -0
  27. package/framework/skills/create-adr/examples.md +35 -0
  28. package/framework/skills/docs-writer/SKILL.md +39 -0
  29. package/framework/skills/docs-writer/examples.md +34 -0
  30. package/framework/skills/docs-writer/references/style-guide.md +72 -0
  31. package/framework/skills/frontend-design/SKILL.md +55 -0
  32. package/framework/skills/frontend-design/examples.md +45 -0
  33. package/framework/skills/humanizer/SKILL.md +412 -0
  34. package/framework/skills/humanizer/examples.md +46 -0
  35. package/framework/skills/learning-opportunities/SKILL.md +140 -0
  36. package/framework/skills/learning-opportunities/examples.md +34 -0
  37. package/framework/skills/learning-opportunities/references/PRINCIPLES.md +42 -0
  38. package/framework/skills/perf-web-optimization/SKILL.md +163 -0
  39. package/framework/skills/perf-web-optimization/examples.md +35 -0
  40. package/framework/skills/perf-web-optimization/references/bundle-optimization.md +180 -0
  41. package/framework/skills/perf-web-optimization/references/core-web-vitals.md +154 -0
  42. package/framework/skills/perf-web-optimization/references/image-optimization.md +170 -0
  43. package/framework/skills/security-best-practices/LICENSE.txt +201 -0
  44. package/framework/skills/security-best-practices/SKILL.md +89 -0
  45. package/framework/skills/security-best-practices/examples.md +35 -0
  46. package/framework/skills/security-best-practices/references/golang-general-backend-security.md +988 -0
  47. package/framework/skills/security-best-practices/references/javascript-express-web-server-security.md +1151 -0
  48. package/framework/skills/security-best-practices/references/javascript-general-web-frontend-security.md +725 -0
  49. package/framework/skills/security-best-practices/references/javascript-jquery-web-frontend-security.md +672 -0
  50. package/framework/skills/security-best-practices/references/javascript-typescript-nextjs-web-server-security.md +1138 -0
  51. package/framework/skills/security-best-practices/references/javascript-typescript-react-web-frontend-security.md +975 -0
  52. package/framework/skills/security-best-practices/references/javascript-typescript-vue-web-frontend-security.md +789 -0
  53. package/framework/skills/security-best-practices/references/python-django-web-server-security.md +880 -0
  54. package/framework/skills/security-best-practices/references/python-fastapi-web-server-security.md +1030 -0
  55. package/framework/skills/security-best-practices/references/python-flask-web-server-security.md +835 -0
  56. package/framework/skills/sentry/SKILL.md +127 -0
  57. package/framework/skills/sentry/examples.md +34 -0
  58. package/framework/skills/sentry/scripts/sentry_api.py +238 -0
  59. package/framework/skills/show-me/SKILL.md +127 -0
  60. package/framework/skills/show-me/examples.md +78 -0
  61. package/framework/skills/spec-driven-eval/SKILL.md +341 -0
  62. package/framework/skills/spec-driven-eval/examples.md +35 -0
  63. package/framework/skills/spec-driven-eval/references/quickstart.md +118 -0
  64. package/framework/skills/spec-driven-eval/references/reference.md +295 -0
  65. package/framework/skills/technical-design-doc-creator/README.md +411 -0
  66. package/framework/skills/technical-design-doc-creator/SKILL.md +1484 -0
  67. package/framework/skills/technical-design-doc-creator/examples.md +35 -0
  68. package/framework/skills/tlc-spec-driven/SKILL.md +184 -0
  69. package/framework/skills/tlc-spec-driven/examples.md +34 -0
  70. package/framework/skills/tlc-spec-driven/references/code-analysis.md +98 -0
  71. package/framework/skills/tlc-spec-driven/references/coding-principles.md +72 -0
  72. package/framework/skills/tlc-spec-driven/references/context-limits.md +31 -0
  73. package/framework/skills/tlc-spec-driven/references/design.md +199 -0
  74. package/framework/skills/tlc-spec-driven/references/discuss.md +159 -0
  75. package/framework/skills/tlc-spec-driven/references/implement.md +436 -0
  76. package/framework/skills/tlc-spec-driven/references/lessons.md +115 -0
  77. package/framework/skills/tlc-spec-driven/references/memory.md +144 -0
  78. package/framework/skills/tlc-spec-driven/references/specify.md +228 -0
  79. package/framework/skills/tlc-spec-driven/references/sub-agents.md +147 -0
  80. package/framework/skills/tlc-spec-driven/references/tasks.md +451 -0
  81. package/framework/skills/tlc-spec-driven/references/validate.md +355 -0
  82. package/framework/skills/tlc-spec-driven/scripts/check_commit.py +115 -0
  83. package/framework/skills/tlc-spec-driven/scripts/lessons.py +412 -0
  84. package/framework/skills/tlc-spec-driven/scripts/validate_spec.py +260 -0
  85. package/framework/skills/tlc-spec-driven/scripts/validate_state.py +162 -0
  86. package/framework/skills/tlc-spec-driven/scripts/validate_tasks.py +251 -0
  87. package/framework/skills/web-design-guidelines/SKILL.md +65 -0
  88. package/framework/skills/web-design-guidelines/examples.md +32 -0
  89. package/framework/skills/web-design-guidelines/references/guideline.md +174 -0
  90. package/package.json +1 -1
  91. package/src/catalog.js +15 -3
  92. package/framework/skills/backend-engineer/SKILL.md +0 -76
  93. package/framework/skills/backend-engineer/examples.md +0 -31
  94. package/framework/skills/documentation/SKILL.md +0 -74
  95. package/framework/skills/documentation/examples.md +0 -31
@@ -0,0 +1,451 @@
1
+ # Tasks
2
+
3
+ **Goal**: Break into GRANULAR, ATOMIC tasks. Clear dependencies. Right tools. Sequential phase 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
+ - **Clean commits** - Each task = one atomic, revertable commit
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 convention files, if the repo has any: `AGENTS.md` (the vendor-neutral standard) and any tool-specific rules file or rules directory the project happens to use
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 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. Capture the **linter/formatter** command too (e.g. the configured `lint`/`format`/`typecheck` script, or a `.pre-commit-config`, `.golangci.yml`, `ruff`/`eslint`/`biome` config) - the Build gate runs it alongside the tests.
69
+
70
+ **Output contract - render these two sections verbatim into `tasks.md`** (the exact headings downstream phases reference):
71
+
72
+ ---
73
+
74
+ ## Test Coverage Matrix
75
+
76
+ > 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"].
77
+
78
+ | Code Layer | Required Test Type | Coverage Expectation | Location Pattern | Run Command |
79
+ | ---------- | ------------------ | -------------------- | ---------------- | ----------- |
80
+ | [layer] | [unit/integration/e2e/none] | [depth target for this layer] | [glob or path pattern] | [command] |
81
+
82
+ **Coverage Expectation values** - set from guidelines first; use strong defaults when no guideline applies:
83
+
84
+ | Layer type | Strong default (no guideline) |
85
+ | ---------- | ----------------------------- |
86
+ | Domain / business-logic (service, use-case, domain model) | All branches; 1:1 to spec ACs; every listed edge case has a test |
87
+ | Route / controller / e2e / integration | All routes in scope: happy path + every listed edge case + error/failure paths |
88
+ | Repository / data-access | Key query paths + error handling; infer from existing repo tests |
89
+ | Entity / config / schema | none - build gate only |
90
+
91
+ These defaults may exceed the current repo's depth. That is intentional - they are a **target**, not a reflection of what already exists.
92
+
93
+ *Example (filled in):*
94
+
95
+ | Code Layer | Required Test Type | Coverage Expectation | Location Pattern | Run Command |
96
+ | ---------- | ------------------ | -------------------- | ---------------- | ----------- |
97
+ | Service | unit | All branches; 1:1 to spec ACs; all listed edge cases | `src/**/__test__/*.spec.ts` | `yarn test:unit` |
98
+ | Repository | integration | Key query paths + error paths | `src/**/__test__/*.e2e-spec.ts` | `yarn test:e2e` |
99
+ | Controller/Resolver | e2e | All routes: happy + edge + error | `src/**/__test__/*.e2e-spec.ts` | `yarn test:e2e` |
100
+ | Entity / Config | none | - (build gate only) | - | build gate only |
101
+
102
+ ## Gate Check Commands
103
+
104
+ > Generated from codebase - confirm before Execute.
105
+
106
+ | Gate Level | When to Use | Command |
107
+ | ---------- | ----------- | ------- |
108
+ | Quick | After tasks with unit tests only | [unit test command] |
109
+ | Full | After tasks with e2e/integration tests | [unit + e2e commands] |
110
+ | Build | After phase completion or config/entity-only tasks | [build + lint + all tests] |
111
+
112
+ ---
113
+
114
+ **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.
115
+
116
+ | Task creates... | Done When must include... |
117
+ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
118
+ | 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 |
119
+ | 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 |
120
+ | Code layer with "integration" requirement | Integration tests written satisfying the layer's Coverage Expectation + full gate passes |
121
+ | Code layer with "none" requirement | Gate check at appropriate level |
122
+
123
+ ### 2. Break Into Atomic Tasks
124
+
125
+ **Task = ONE deliverable**. Examples:
126
+
127
+ - ✅ "Create UserService interface" (one file, one concept)
128
+ - ❌ "Implement user management" (too vague, multiple files)
129
+
130
+ ### 3. Define Dependencies
131
+
132
+ What MUST be done before this task can start?
133
+
134
+ ### 4. Create Execution Plan
135
+
136
+ Group tasks into ordered phases. Each phase depends on the ones before it; tasks execute sequentially within a phase.
137
+
138
+ **Size phases near the worker budget.** During Execute, phases are packed into task-budgeted batches (~7 tasks per sub-agent, whole phases - see [sub-agents.md](sub-agents.md)). Because a batch cut may only land on a phase boundary, a phase that is much larger than the budget forces an over-sized worker. Keep each phase from greatly exceeding the budget:
139
+
140
+ - If a phase would hold **more than ~10 tasks (≈1.5× the budget)**, split it into cohesive sub-phases at a genuine dependency/cohesion seam - not at an arbitrary task index.
141
+ - Only leave a phase over-sized when its tasks are one tight dependency chain that genuinely cannot be split. That is a legitimate (if fat) single-worker phase, not a smell.
142
+
143
+ This keeps phase boundaries meaningful while letting the packing hit its target worker count.
144
+
145
+ ### 5. Validate Before Presenting (MANDATORY)
146
+
147
+ 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.
148
+
149
+ **Deterministic backing (run it, do not eyeball it).** `python3 <skill-dir>/scripts/validate_tasks.py <tasks-path-or-feature>` enforces the structural half of these checks so they cannot drift: it flags a `Where` that names multiple files (granularity smell, Check 1), a diagram edge with no matching `Depends on` within a phase and vice-versa (Check 2), a task missing its `Tests` or `Gate` field, a `Tests: none` to confirm against the matrix (Check 3), and any dependency pointing to a later phase. A non-zero exit means restructure before presenting. The script checks structure; you still build the two tables below (the layer-to-test co-location judgment is yours). If no code-execution tool is available, run the checks by reading `tasks.md`.
150
+
151
+ **Check 1: Task Granularity** - verify each task is atomic (see Granularity Check section).
152
+
153
+ **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.
154
+
155
+ **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.
156
+
157
+ **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.
158
+
159
+ **Note on the generated matrix:** The two sections (`Test Coverage Matrix`, `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.
160
+
161
+ ### 6. ASK About MCPs and Skills
162
+
163
+ **CRITICAL**: Before execution, ask the user:
164
+
165
+ > "For each task, which tools should I use?"
166
+ >
167
+ > **Available MCPs**: [list from project or user]
168
+ > **Available Skills**: [list from project or user]
169
+
170
+ ---
171
+
172
+ ## Template: `.specs/features/[feature]/tasks.md`
173
+
174
+ ```markdown
175
+ # [Feature] Tasks
176
+
177
+ ## Execution Protocol (MANDATORY -- do not skip)
178
+
179
+ Implement these tasks with the `tlc-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).
180
+
181
+ **If the skill cannot be activated, STOP and tell the user - do not proceed without it.**
182
+
183
+ ---
184
+
185
+ **Design**: `.specs/features/[feature]/design.md`
186
+ **Status**: Draft | Approved | In Progress | Done
187
+
188
+ ---
189
+
190
+ <!-- The two 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. -->
191
+
192
+ ## Test Coverage Matrix
193
+
194
+ [Generated in step 1.5 - see process above]
195
+
196
+ ## Gate Check Commands
197
+
198
+ [Generated in step 1.5 - see process above]
199
+
200
+ ---
201
+
202
+ ## Execution Plan
203
+
204
+ Phases are ordered and run sequentially - each phase completes before the next begins, and tasks within a phase execute in order.
205
+
206
+ ### Phase 1: Foundation
207
+
208
+ Tasks that must be done first, in order.
209
+
210
+ ```
211
+ T1 → T2 → T3
212
+ ```
213
+
214
+ ### Phase 2: Core Implementation
215
+
216
+ Builds on the foundation.
217
+
218
+ ```
219
+ T4 → T5 → T6 → T7
220
+ ```
221
+
222
+ ### Phase 3: Integration
223
+
224
+ Bringing it all together.
225
+
226
+ ```
227
+ T8 → T9
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Task Breakdown
233
+
234
+ ### T1: [Create X Interface]
235
+
236
+ **What**: [One sentence: exact deliverable]
237
+ **Where**: `src/path/to/file.ts`
238
+ **Depends on**: None
239
+ **Reuses**: `src/existing/BaseInterface.ts`
240
+ **Requirement**: [FEAT]-01
241
+
242
+ **Tools**:
243
+
244
+ - MCP: `filesystem` (or NONE)
245
+ - Skill: NONE
246
+
247
+ **Done when**:
248
+
249
+ - [ ] Interface defined with all methods from design
250
+ - [ ] Types exported correctly
251
+ - [ ] No TypeScript errors
252
+
253
+ **Tests**: [unit/e2e/integration/none - from coverage matrix]
254
+ **Gate**: [quick/full/build - from gate check commands]
255
+
256
+ ---
257
+
258
+ ### T2: [Implement Y Service]
259
+
260
+ **What**: [Exact deliverable]
261
+ **Where**: `src/services/YService.ts`
262
+ **Depends on**: T1
263
+ **Reuses**: `src/services/BaseService.ts` patterns
264
+
265
+ **Tools**:
266
+
267
+ - MCP: `filesystem`, `context7`
268
+ - Skill: NONE
269
+
270
+ **Done when**:
271
+
272
+ - [ ] Implements interface from T1
273
+ - [ ] Handles error cases from design
274
+ - [ ] Gate check passes: `[quick gate command from the Gate Check Commands above]`
275
+ - [ ] Test count: [N] tests pass (no silent deletions)
276
+
277
+ **Tests**: unit
278
+ **Gate**: quick
279
+
280
+ ---
281
+
282
+ ### T3: [Create Z Component]
283
+
284
+ **What**: [Exact deliverable]
285
+ **Where**: `src/components/ZComponent.tsx`
286
+ **Depends on**: T1
287
+ **Reuses**: `src/components/BaseComponent.tsx`
288
+
289
+ **Tools**:
290
+
291
+ - MCP: `filesystem`
292
+ - Skill: NONE
293
+
294
+ **Done when**:
295
+
296
+ - [ ] Component renders correctly
297
+ - [ ] Handles props from interface
298
+ - [ ] Follows existing component patterns
299
+ - [ ] Gate check passes: `[quick gate command from the Gate Check Commands above]`
300
+ - [ ] Test count: [N] tests pass (no silent deletions)
301
+
302
+ **Tests**: unit
303
+ **Gate**: quick
304
+
305
+ ---
306
+
307
+ ### T4: [Add A Feature to Y]
308
+
309
+ **What**: [Exact deliverable]
310
+ **Where**: `src/services/YService.ts` (modify)
311
+ **Depends on**: T2, T3
312
+ **Reuses**: Existing service patterns
313
+
314
+ **Tools**:
315
+
316
+ - MCP: `filesystem`, `github`
317
+ - Skill: `api-design`
318
+
319
+ **Done when**:
320
+
321
+ - [ ] Feature works per acceptance criteria
322
+ - [ ] Gate check passes: `[full gate command from the Gate Check Commands above]`
323
+ - [ ] Test count: [N] tests pass (no silent deletions)
324
+
325
+ **Tests**: integration
326
+ **Gate**: full
327
+
328
+ **Commit**: `feat([scope]): [description]`
329
+
330
+ ---
331
+
332
+ ## Phase Execution Map
333
+
334
+ Visual representation of task ordering. Phases run in sequence, and tasks within a phase run in order:
335
+
336
+ ```
337
+ Phase 1 → Phase 2 → Phase 3
338
+
339
+ Phase 1: T1 ------→ T2 ------→ T3
340
+ Phase 2: T4 ------→ T5 ------→ T6 ------→ T7
341
+ Phase 3: T8 ------→ T9
342
+ ```
343
+
344
+ Execution is strictly sequential - there is no intra-phase parallelism. A single agent (or batch worker) works one task at a time, in order.
345
+
346
+ **How phase-based execution works:**
347
+
348
+ At Execute, the agent counts total tasks and packs phases into **task-budgeted batches** (~7 tasks
349
+ per worker, whole phases - the benchmarked sweet spot is ~20 tasks → ~3 workers). A **phase** is the
350
+ semantic/dependency unit; a **batch** is one or more *consecutive whole phases* assigned to one
351
+ worker. The cut only ever lands on a phase boundary - a phase is never split across workers. When
352
+ packing yields more than one batch (> ~8 tasks), the agent offers to dispatch batch sub-agents.
353
+ Batches run sequentially: each worker executes ALL its tasks in order, then reports a compact summary
354
+ before the next batch starts. This right-sizes the worker count by workload instead of by phase
355
+ count (one-per-phase is too fragmented; expensive and slow). See [sub-agents.md](sub-agents.md) for
356
+ the full model - packing algorithm, offer-then-confirm, worker payload, compact summary contract,
357
+ failure handling, and context sizing guidance.
358
+
359
+ When the whole feature fits a single batch (≤ ~8 tasks), execution happens inline in the main window
360
+ with no sub-agents spawned.
361
+
362
+ **The orchestrating agent's role during Execute:**
363
+ 1. Count total tasks and pack phases into ~7-task batches - offer batch sub-agents if that yields more than one batch and the user accepts
364
+ 2. Dispatch the next batch (to a worker, or execute inline)
365
+ 3. Receive the compact batch summary
366
+ 4. Update tasks.md with results
367
+ 5. If the batch summary shows all tasks complete: proceed to the next batch
368
+ 6. If a task failed: decide fix/escalate before dispatching the next batch
369
+
370
+ ---
371
+
372
+ ## Task Granularity Check
373
+
374
+ Before approving tasks, verify they are granular enough:
375
+
376
+ | Task | Scope | Status |
377
+ | ------------------------------- | ------------- | ------------ |
378
+ | T1: Create email input | 1 component | ✅ Granular |
379
+ | T2: Add validation function | 1 function | ✅ Granular |
380
+ | T3: Create form with all fields | 5+ components | ❌ Split it! |
381
+ | T4: Connect to API | 1 function | ✅ Granular |
382
+
383
+ **Granularity check**:
384
+
385
+ - ✅ 1 component / 1 function / 1 endpoint = Good
386
+ - ⚠️ 2-3 related things in same file = OK if cohesive
387
+ - ❌ Multiple components or files = MUST split
388
+
389
+ ---
390
+
391
+ ## Diagram-Definition Cross-Check
392
+
393
+ 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.
394
+
395
+ For each task, check:
396
+
397
+ | Task | Depends On (task body) | Diagram Shows | Status |
398
+ | ---- | ---------------------- | ------------- | ------ |
399
+ | T[N] | [deps from body] | [deps from diagram arrows] | ✅ Match or ❌ Mismatch |
400
+
401
+ **Rules:**
402
+
403
+ - Every `Depends on` in a task body must have a corresponding arrow in the diagram.
404
+ - Every arrow in the diagram must correspond to a `Depends on` in the target task's body.
405
+ - A task must never depend on a task in a later phase - dependencies point backward or within the same phase only.
406
+
407
+ ---
408
+
409
+ ## Test Co-location Validation
410
+
411
+ 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.
412
+
413
+ 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.
414
+
415
+ | Task | Code Layer Created/Modified | Matrix Requires | Task Says | Status |
416
+ | ---- | --------------------------- | --------------- | --------- | ------ |
417
+ | T[N]: [name] | [layer from coverage matrix] | [test type] | [task's Tests field] | ✅ OK or ❌ VIOLATION |
418
+
419
+ **Rules:**
420
+
421
+ - "Tested in another task" is NOT a valid justification for `Tests: none`. That is test deferral - the exact anti-pattern this validation prevents.
422
+ - `Tests: none` is only valid when the coverage matrix says "none" for that code layer.
423
+ - If a task creates MULTIPLE code layers (e.g., service + controller), use the HIGHEST test type required by any of them.
424
+ - Any ❌ VIOLATION → restructure the task to include its required tests before proceeding.
425
+
426
+ **Resolving compilation dependencies:**
427
+
428
+ 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:
429
+
430
+ 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).
431
+ 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).
432
+
433
+ 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.
434
+
435
+ ---
436
+
437
+ ## Tips
438
+
439
+ - **Phases are ordered** - Each phase completes before the next; tasks run in order within a phase
440
+ - **Reuses = Token saver** - Always reference existing code
441
+ - **Tools per task** - MCPs and Skills prevent wrong approaches
442
+ - **Dependencies are gates** - Clear what blocks what
443
+ - **Done when = Testable** - If you can't verify it, rewrite it
444
+ - **Requirement ID = Traceable** - Every task traces back to a spec requirement
445
+ - **One commit per task** - Plan the commit message format in advance
446
+
447
+ ---
448
+
449
+ ## Task Verification Standards
450
+
451
+ 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.