@dtlabs/ai-toolkit 0.17.5 → 0.18.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 (34) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/agent-registry.js +39 -0
  3. package/package.json +1 -1
  4. package/src/claude/agents/gaia-generate-requirements-use-case.md +97 -0
  5. package/src/claude/agents/gaia-generate-requirements.md +22 -27
  6. package/src/claude/agents/gaia-generate-tech-spec-component.md +93 -0
  7. package/src/claude/agents/gaia-generate-tech-spec.md +47 -103
  8. package/src/claude/agents/gaia-generate-work-breakdown-task.md +151 -0
  9. package/src/claude/agents/gaia-generate-work-breakdown.md +94 -100
  10. package/src/claude/agents/gaia-validate-feature-docs.md +13 -8
  11. package/src/claude/commands/assemble-docs.md +16 -0
  12. package/src/claude/commands/feature-status.md +9 -4
  13. package/src/claude/scripts/ac-task-matrix.js +87 -0
  14. package/src/claude/scripts/assemble-docs.js +66 -0
  15. package/src/claude/scripts/req-assembler.js +127 -0
  16. package/src/claude/scripts/req-graph-checks.js +71 -0
  17. package/src/claude/scripts/req-skeleton-check.js +64 -0
  18. package/src/claude/scripts/tech-spec-assembler.js +188 -0
  19. package/src/claude/scripts/tech-spec-graph-checks.js +84 -0
  20. package/src/claude/scripts/templates/gaia-component-template.md +64 -0
  21. package/src/claude/scripts/templates/gaia-dependency-graph-template.md +85 -0
  22. package/src/claude/scripts/templates/gaia-requirements-index-template.md +144 -0
  23. package/src/claude/scripts/templates/gaia-task-template.md +92 -0
  24. package/src/claude/scripts/templates/gaia-tech-spec-index-template.md +137 -0
  25. package/src/claude/scripts/templates/gaia-use-case-template.md +56 -0
  26. package/src/claude/scripts/templates/gaia-user-story-template.md +61 -0
  27. package/src/claude/scripts/wb-graph-checks.js +754 -0
  28. package/src/claude/scripts/wb-render.js +6 -11
  29. package/src/claude/scripts/wb-skeleton-check.js +99 -0
  30. package/src/claude/scripts/wb-validate.js +49 -655
  31. package/src/claude/scripts/wbs-assembler.js +368 -0
  32. package/src/claude/skills/implement-feature/SKILL.md +12 -6
  33. package/src/claude/workflows/pm-phase1.js +324 -18
  34. package/src/claude/workflows/pm-phase2.js +277 -14
package/CHANGELOG.md CHANGED
@@ -1,4 +1,25 @@
1
1
  ## 0.1.4 (2026-07-21)
2
+ ## [0.18.0](https://github.com/dtlab-tech/ai-toolkit/compare/v0.17.5...v0.18.0) (2026-10-19)
3
+
4
+
5
+ ### Features
6
+
7
+ * **planning-pipeline:** split Work Breakdown and Requirements generation into skeleton+per-item passes ([f7e7b66](https://github.com/dtlab-tech/ai-toolkit/commit/f7e7b66efe94a860bbd867402a250c5d92d56f4a))
8
+ * **pm-phase1/pm-phase2:** split-only document generation with on-demand assembly ([40d8700](https://github.com/dtlab-tech/ai-toolkit/commit/40d87007d2125789c7943348ee4000467bffc882))
9
+ * **pm-phase1:** split Tech-Spec generation into skeleton+per-component passes ([a42a83c](https://github.com/dtlab-tech/ai-toolkit/commit/a42a83c9413275888c7e0fa5bfae80a165da3d71))
10
+ * **pm-phase1:** tag Tech-Spec File Inventory with AC IDs and extend the traceability matrix ([4a15510](https://github.com/dtlab-tech/ai-toolkit/commit/4a15510c4d2da110445976d1b9586b6d45252c6f))
11
+ * **pm-phase2:** render an AC-to-Task traceability matrix at Gate 2 ([d975942](https://github.com/dtlab-tech/ai-toolkit/commit/d9759423771454a8d677f747bc0d4fc1e00de375))
12
+ * **templates:** move the FTR-020 doc templates into the toolkit and make generation use them ([de7ffca](https://github.com/dtlab-tech/ai-toolkit/commit/de7ffca19b42ae324d8c8f8460cc9aeda23d8298))
13
+ * traceability matrix, template relocation, split-only doc generation (FTR-025) ([bf17caa](https://github.com/dtlab-tech/ai-toolkit/commit/bf17caa1517fa28a4f28b3efb44f7a327661e184))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **pm-phase1:** host-compute each use case's Related Business Rules/Acceptance Criteria ([507ecfa](https://github.com/dtlab-tech/ai-toolkit/commit/507ecfa94cb8094049a3543dbf44d47c2ea38f80))
19
+ * **tech-spec-assembler:** make the component Change/Tests heading scan fence-aware ([90af9ca](https://github.com/dtlab-tech/ai-toolkit/commit/90af9ca0585d3280ee12a97d3f745bae7de5fe69))
20
+ * **wb-graph-checks:** scope AC-task validation by a phase's own sourceUC, not its ID ([fab14cb](https://github.com/dtlab-tech/ai-toolkit/commit/fab14cbcb2f4fc180e5b2bb234dad25a5d7a2b61))
21
+ * **wbs:** wire the FTR-020 phase-detail template into real WB generation; fix a second sourceUC-drop ([54ed68e](https://github.com/dtlab-tech/ai-toolkit/commit/54ed68e5921e271a8b6ba4c54b0db748303648b1))
22
+
2
23
  ## [0.17.5](https://github.com/dtlab-tech/ai-toolkit/compare/v0.17.4...v0.17.5) (2026-10-13)
3
24
 
4
25
 
@@ -168,6 +168,19 @@ const CATALOG = [
168
168
  deprecationTarget: null,
169
169
  platforms: ['claude'],
170
170
  },
171
+ {
172
+ agentId: 'gaia.agent.planner.requirements-use-case',
173
+ nativeNames: { claude: 'gaia-generate-requirements-use-case' },
174
+ relativeInstallPath: '.claude/agents/gaia-generate-requirements-use-case.md',
175
+ role: 'planner',
176
+ type: 'requirements',
177
+ authorisedPhases: ['planning'],
178
+ allowedPipelines: ['implement-feature'],
179
+ minimumToolkitVersion: '0.13.0',
180
+ deprecated: false,
181
+ deprecationTarget: null,
182
+ platforms: ['claude'],
183
+ },
171
184
  {
172
185
  agentId: 'gaia.agent.planner.tech-spec',
173
186
  nativeNames: { claude: 'gaia-generate-tech-spec' },
@@ -181,6 +194,19 @@ const CATALOG = [
181
194
  deprecationTarget: null,
182
195
  platforms: ['claude'],
183
196
  },
197
+ {
198
+ agentId: 'gaia.agent.planner.tech-spec-component',
199
+ nativeNames: { claude: 'gaia-generate-tech-spec-component' },
200
+ relativeInstallPath: '.claude/agents/gaia-generate-tech-spec-component.md',
201
+ role: 'planner',
202
+ type: 'tech-spec',
203
+ authorisedPhases: ['planning'],
204
+ allowedPipelines: ['implement-feature'],
205
+ minimumToolkitVersion: '0.13.0',
206
+ deprecated: false,
207
+ deprecationTarget: null,
208
+ platforms: ['claude'],
209
+ },
184
210
  {
185
211
  agentId: 'gaia.agent.planner.work-breakdown',
186
212
  nativeNames: { claude: 'gaia-generate-work-breakdown' },
@@ -194,6 +220,19 @@ const CATALOG = [
194
220
  deprecationTarget: null,
195
221
  platforms: ['claude'],
196
222
  },
223
+ {
224
+ agentId: 'gaia.agent.planner.work-breakdown-task',
225
+ nativeNames: { claude: 'gaia-generate-work-breakdown-task' },
226
+ relativeInstallPath: '.claude/agents/gaia-generate-work-breakdown-task.md',
227
+ role: 'planner',
228
+ type: 'work-breakdown',
229
+ authorisedPhases: ['planning'],
230
+ allowedPipelines: ['implement-feature'],
231
+ minimumToolkitVersion: '0.13.0',
232
+ deprecated: false,
233
+ deprecationTarget: null,
234
+ platforms: ['claude'],
235
+ },
197
236
  {
198
237
  agentId: 'gaia.agent.planner.validate-feature-docs',
199
238
  nativeNames: { claude: 'gaia-validate-feature-docs' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtlabs/ai-toolkit",
3
- "version": "0.17.5",
3
+ "version": "0.18.0",
4
4
  "description": "AI Toolkit — reusable agents and procedures for developers to build AI-powered applications.",
5
5
  "files": [
6
6
  "docs/",
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: gaia-generate-requirements-use-case
3
+ description: "Generates one use case's full detail (flows, postconditions) from its index-table row. Input: UC row + compact sibling index + feature.md"
4
+ model: haiku
5
+ tools: Read, Glob, Grep
6
+ ---
7
+
8
+ # Generate One Use Case's Detail
9
+
10
+ Given one use case's index-table row (ID, Title, Actor, Priority), the compact index of every
11
+ other use case in this feature, and `feature.md`, produce that use case's full detail: the field
12
+ table plus Main flow, Alternative flows, Error flows, and Postconditions — exactly the Section 2
13
+ content `gaia-generate-requirements` produced inline before this feature (FTR-021) split it out
14
+ into one bounded call per use case.
15
+
16
+ ## Input
17
+
18
+ The host supplies, in the dispatch prompt:
19
+ 1. This use case's own index-table row, verbatim: `id`, `title`, `actor`, `priority`.
20
+ 2. The compact full use-case index: every use case's `id` + `title` + `actor` only (for
21
+ cross-use-case awareness — so this use case's flow doesn't silently assume another use case's
22
+ behavior without naming it).
23
+ 3. The path to `feature.md` — read it in full before proceeding, to ground this use case's flow
24
+ in the feature's actual described behavior rather than inventing detail the row alone would
25
+ not carry.
26
+
27
+ You do not read `req/index.md` yourself and you never decide which use cases exist — that is
28
+ already fixed by the skeleton call that produced the row you were given.
29
+
30
+ Read `.claude/scripts/templates/gaia-use-case-template.md` before writing your response for the
31
+ canonical field-table/flow structure. Note: that template also shows "Related Business Rules"/
32
+ "Related Acceptance Criteria" cross-reference lines at the end of the file — do NOT produce them
33
+ yourself. The host computes both, mechanically, from `req/index.md`'s own Business Rules/
34
+ Acceptance Criteria tables, and appends them to your response after you return it — you are not
35
+ given that table data (and must not re-read `req/index.md` yourself to get it), so any version you
36
+ wrote would risk being wrong or duplicated. The Output section below is your actual, complete
37
+ output contract; stop after Postconditions.
38
+
39
+ ## Mandatory instruction
40
+
41
+ Restate the given **Title**, **Actor**, and **Priority** exactly as given in your field table —
42
+ do not reword, re-derive, or second-guess them. Your only new content is **Preconditions**,
43
+ **Trigger**, **Main flow**, **Alternative flows**, **Error flows**, and **Postconditions**.
44
+
45
+ ## Output
46
+
47
+ Return exactly this block as your final response, and nothing else (no preamble, no "here is the
48
+ use case", no Markdown code fence wrapping the whole thing) — you do not have a Write tool; the
49
+ host persists your response verbatim to `req/use-cases/{UC-ID}.md`:
50
+
51
+ ```markdown
52
+ ### {UC-ID}: {Title}
53
+
54
+ | Field | Value |
55
+ |-------|-------|
56
+ | Actor | {Actor} |
57
+ | Preconditions | ... |
58
+ | Trigger | ... |
59
+ | Priority | {Priority} |
60
+
61
+ **Main flow:**
62
+ 1. Step 1
63
+ 2. Step 2
64
+ 3. ...
65
+
66
+ **Alternative flows:**
67
+ - [condition] → [behavior]
68
+
69
+ **Error flows:**
70
+ - [error condition] → [system response]
71
+
72
+ **Postconditions:**
73
+ - [expected state after completion]
74
+ ```
75
+
76
+ If this use case has no alternative flows or no error flows worth documenting, write `- none`
77
+ under that heading rather than omitting the heading — every use case file keeps the same four
78
+ subsections, even when one is trivially empty, so a reader (or a future parser) never has to
79
+ guess whether a missing heading means "none" or "forgotten".
80
+
81
+ ## Clarification Protocol
82
+
83
+ If `feature.md` is ambiguous or missing information needed to write a complete flow for this one
84
+ use case, do not guess or invent behavior. Write the flow as far as the source supports, and add
85
+ an explicit note under **Postconditions** naming the open gap (e.g. "Open question: `feature.md`
86
+ does not specify what happens if X") — the host owns surfacing unresolved gaps to the user at
87
+ Gate 1, this agent only has to avoid silently inventing an answer.
88
+
89
+ ## Guidelines
90
+
91
+ - Write in **English**
92
+ - Be specific and testable — avoid vague steps like "the system processes the request"
93
+ - Include error scenarios and edge cases relevant to this one use case
94
+ - Derive all content strictly from `feature.md` and the given row — do not invent behavior not
95
+ described there
96
+ - Given/When/Then phrasing is not used here (that convention belongs to Section 7's Acceptance
97
+ Criteria, which the skeleton call already produced) — write flows as plain numbered steps
@@ -1,18 +1,30 @@
1
1
  ---
2
2
  name: gaia-generate-requirements
3
- description: "Generates a functional requirements document from a feature description. Input: path to feature.md"
3
+ description: "Generates the Requirements skeleton (everything except per-use-case flow detail) from a feature description. Input: path to feature.md"
4
4
  model: haiku
5
5
  tools: Read, Glob, Grep
6
6
  ---
7
7
 
8
- # Generate Functional Requirements Document
8
+ # Generate Functional Requirements Skeleton
9
9
 
10
- Given a feature description document, produce a structured **functional requirements document** suitable for stakeholder review and development handoff.
10
+ Given a feature description document, produce the **Requirements skeleton**: every section of
11
+ the functional requirements document except each use case's own flow detail (preconditions,
12
+ trigger, main/alternative/error flows, postconditions). Section 2 (Use Cases) is reduced to an
13
+ index table only — one row per use case, no flow body. A separate call (one per use case,
14
+ dispatched by the host after this skeleton is accepted) fills in each use case's full detail from
15
+ the row you write here; your response is never the final document by itself, it is assembled
16
+ together with those per-use-case files afterward (FTR-021).
11
17
 
12
18
  ## Input
13
19
 
14
20
  The user provides the path to a `feature.md` file. Read it in full before proceeding.
15
21
 
22
+ Also read `.claude/scripts/templates/gaia-requirements-index-template.md` before writing your
23
+ response — it is the canonical, authoritative structure for `req/index.md` (section order,
24
+ exact headings, table column contracts, and the parsing contract `req-skeleton-check.js`/
25
+ `req-assembler.js` rely on). The Output Structure section below summarizes it; the template
26
+ itself is the source of truth if the two ever disagree.
27
+
16
28
  ## Process
17
29
 
18
30
  1. **Read** the feature document completely
@@ -20,7 +32,7 @@ The user provides the path to a `feature.md` file. Read it in full before procee
20
32
  3. **Identify** all functional areas described
21
33
  3. **Extract** actors, use cases, business rules, acceptance criteria
22
34
  4. **Organize** into a structured requirements document
23
- 5. **Return** the complete document as your final response — you do not have a Write tool; the host persists your response to `{PREFIX}-Requirements.md` verbatim. Do not attempt to write any file yourself.
35
+ 5. **Return** the skeleton as your final response — every section except each use case's flow detail. You do not have a Write tool; the host persists your response to `req/index.md` verbatim. Do not attempt to write any file yourself, and do not write a use case's flow body inline in Section 2 — list it in the index table only.
24
36
 
25
37
  ## Output Filename (for your reference only — you do not write this file)
26
38
 
@@ -61,30 +73,13 @@ What is in scope and out of scope.
61
73
 
62
74
  ## 2. Use Cases
63
75
 
64
- For each use case:
65
-
66
- ### UC-XX: [Title]
67
-
68
- | Field | Value |
69
- |-------|-------|
70
- | Actor | ... |
71
- | Preconditions | ... |
72
- | Trigger | ... |
73
- | Priority | Must / Should / Could |
74
-
75
- **Main flow:**
76
- 1. Step 1
77
- 2. Step 2
78
- 3. ...
79
-
80
- **Alternative flows:**
81
- - [condition] → [behavior]
82
-
83
- **Error flows:**
84
- - [error condition] → [system response]
76
+ | UC ID | Title | Actor | Priority | File |
77
+ |-------|-------|-------|----------|------|
78
+ | UC-XX | [Title] | [Actor] | Must / Should / Could | use-cases/UC-XX.md |
85
79
 
86
- **Postconditions:**
87
- - [expected state after completion]
80
+ > One row per use case you identify. Do NOT write the use case's flow here — a separate call
81
+ > generates each use case's full detail (preconditions, trigger, main/alternative/error flows,
82
+ > postconditions) from this row.
88
83
 
89
84
  ## 3. Business Rules
90
85
 
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: gaia-generate-tech-spec-component
3
+ description: "Generates one component's full technical design (Change, Algorithm/Schema, Tests) from its index-table row. Input: component row + compact sibling index + feature.md/Requirements excerpt"
4
+ model: haiku
5
+ tools: Read, Glob, Grep
6
+ ---
7
+
8
+ # Generate One Component's Technical Design
9
+
10
+ Given one component's index-table row (Path, Domain, Addresses), the compact index of every
11
+ other component in this feature, and the relevant `feature.md`/Requirements excerpt, produce that
12
+ component's full technical design: `Change` (what changes and why), its actual design (whichever
13
+ of the monolithic template's Backend/Frontend/External-Integration shape matches this one file's
14
+ real nature — real code/schema, not prose), and `Tests` (the specific test file(s) and cases for
15
+ this component). This is `gaia-generate-tech-spec`'s per-component counterpart (FTR-024) — that
16
+ agent decides the skeleton (file list, feature-wide sections) once; this agent fills in one row's
17
+ own detail, one call per component.
18
+
19
+ ## Input
20
+
21
+ The host supplies, in the dispatch prompt:
22
+ 1. This component's own index-table row, verbatim: `Path`, `Domain`, `Addresses`.
23
+ 2. The compact full component index: every component's `Path` + `Domain` only (cross-component
24
+ awareness — e.g. "does another component already define this DTO?").
25
+ 3. The relevant excerpt of `feature.md`/`{PREFIX}-Requirements.md` (host-selected) — read it, but
26
+ do not re-search the full documents yourself.
27
+
28
+ You do not read `spec/index.md` yourself and you never decide which components exist — that is
29
+ already fixed by the skeleton call that produced the row you were given.
30
+
31
+ Read `.claude/scripts/templates/gaia-component-template.md` before writing your response — it is
32
+ the canonical, authoritative structure for your output (Change/design-body/Tests, and the parsing
33
+ contract `tech-spec-assembler.js`'s `parseComponentDetail` relies on). The Output section below is
34
+ a summary; the template itself is the source of truth if the two ever disagree.
35
+
36
+ ## Mandatory instruction
37
+
38
+ Restate the given **Path**, **Domain**, and **Addresses** exactly as given — do not reword,
39
+ re-derive, or second-guess them. Your only new content is this component's own `Change`
40
+ description, its actual design, and its `Tests` section.
41
+
42
+ ## Output
43
+
44
+ Return exactly this block as your final response, and nothing else (no preamble, no "here is the
45
+ component", no Markdown code fence wrapping the whole thing) — you do not have a Write tool; the
46
+ host persists your response verbatim to `spec/components/{fileSlug}.md`:
47
+
48
+ ```markdown
49
+ # {Path} — {New | Modified}
50
+
51
+ ## Change
52
+
53
+ <one paragraph: what changes about this file and why — name the specific functions/sections
54
+ affected, not just "this file is updated to support the new feature". If New: what it exports and
55
+ the shape of its inputs/outputs. If Modified: what specifically is added, replaced, or removed,
56
+ and what is explicitly left unchanged.>
57
+
58
+ ## {Algorithm | Data Model | Service Interface | Component Props | whichever name fits this
59
+ component's own real nature — pick one, do not invent multiple competing headings}
60
+
61
+ <real pseudocode or real code, not a prose description of "what it does". If this component
62
+ relocates logic from an existing file, name the exact source file and line ranges if known.>
63
+
64
+ ## Tests
65
+
66
+ <the specific test file(s) this component's change requires, and the key cases that matter — not
67
+ a generic "add tests for X".>
68
+ ```
69
+
70
+ If this component genuinely needs no design content beyond `Change` (e.g. a trivial
71
+ configuration file), omit the middle heading entirely rather than inventing content — but
72
+ `Change` and `Tests` are always required; `tech-spec-assembler.js` requires both of those two
73
+ headings to exist, in that relative order, to parse this file correctly.
74
+
75
+ ## Clarification Protocol
76
+
77
+ If the given excerpt is ambiguous or missing information needed to write this one component's
78
+ complete design, do not guess or invent behavior. Design as far as the source supports, and add
79
+ an explicit note under `Change` naming the open gap — the host owns surfacing unresolved gaps to
80
+ the user at Gate 1, this agent only has to avoid silently inventing an answer.
81
+
82
+ ## Guidelines
83
+
84
+ - Write in **English**
85
+ - Include actual code snippets for key definitions (models, DTOs, interfaces, components) using
86
+ the project's real language and conventions — reference `AGENTS.md`'s patterns if the relevant
87
+ excerpt doesn't already establish them
88
+ - Do not include implementation code for every method — focus on interfaces, contracts, and key
89
+ algorithms, the same restraint `gaia-generate-tech-spec` already applies
90
+ - For external API calls, document the full request/response including headers and error
91
+ scenarios, if this component is the one implementing that integration
92
+ - Derive all content strictly from the given row and excerpt — do not invent behavior not
93
+ described there
@@ -1,18 +1,30 @@
1
1
  ---
2
2
  name: gaia-generate-tech-spec
3
- description: "Generates a technical specification document from a feature description and requirements. Input: path to feature.md"
3
+ description: "Generates the Tech-Spec skeleton (everything except per-component design detail) from a feature description and requirements. Input: path to feature.md"
4
4
  model: haiku
5
5
  tools: Read, Glob, Grep
6
6
  ---
7
7
 
8
- # Generate Technical Specification
8
+ # Generate Technical Specification Skeleton
9
9
 
10
- Given a feature description document, produce a structured **technical specification document** suitable for implementation handoff to developers.
10
+ Given a feature description document, produce the **Tech-Spec skeleton**: every section of the
11
+ technical specification except each component's own design detail (Backend/Frontend/External-
12
+ Integration sections and Testing Strategy). Section 9 (File Inventory) is still produced in
13
+ full, now also declaring each file's `Domain` and a provisional `Spec` link — a separate call
14
+ (one per file, dispatched by the host after this skeleton is accepted) fills in each component's
15
+ full design from that row. Your response is never the final document by itself; it is assembled
16
+ together with those per-component files afterward (FTR-024).
11
17
 
12
18
  ## Input
13
19
 
14
20
  The user provides the path to a `feature.md` file. Read it in full before proceeding. Also read the relevant existing codebase files to ensure the spec aligns with current architecture.
15
21
 
22
+ Also read `.claude/scripts/templates/gaia-tech-spec-index-template.md` before writing your
23
+ response — it is the canonical, authoritative structure for `spec/index.md` (section order, exact
24
+ headings, the Section 9 column-order contract `tech-spec-graph-checks.js` relies on, and the
25
+ parsing contract `tech-spec-assembler.js` relies on). The Output Structure section below
26
+ summarizes it; the template itself is the source of truth if the two ever disagree.
27
+
16
28
  ## Step 0 — Read Project Conventions (MANDATORY)
17
29
 
18
30
  Before writing the spec, you MUST:
@@ -33,11 +45,12 @@ The tech spec MUST use the project's actual stack and patterns. Do not assume an
33
45
  ## Process
34
46
 
35
47
  1. **Read** the feature document completely
36
- 2. **Read** `{PREFIX}-Requirements.md` if it exists (for traceability)
48
+ 2. **Read** `req/index.md` if it exists (for traceability) — the AC table and Use Case index it
49
+ needs already live there, untouched by the per-UC split (FTR-021)
37
50
  3. **Read** `docs/features/REGISTRY.md` if it exists — identify features that touch the same entities, endpoints, or services as this feature. Note architectural dependencies and integration points in Section 5 (External Integrations) or Section 12 (Risks & Mitigations) of the output document. If a prior feature introduced shared infrastructure this feature reuses (e.g. auth middleware, base service, shared DTO), reference it explicitly.
38
51
  4. **Explore** the existing codebase areas affected (models, controllers/handlers, pages, services)
39
52
  4. **Design** the technical solution aligned with existing patterns from AGENTS.md
40
- 5. **Return** the complete document as your final response — you do not have a Write tool; the host persists your response to `{PREFIX}-Tech-Spec.md` verbatim. Do not attempt to write any file yourself.
53
+ 5. **Return** the skeleton as your final response — every section except each component's own design detail. You do not have a Write tool; the host persists your response to `spec/index.md` verbatim. Do not attempt to write any file yourself, and do not write a component's Backend/Frontend/External-Integration/Testing detail inline — list it in Section 9's index table only.
41
54
 
42
55
  ## Output Filename (for your reference only — you do not write this file)
43
56
 
@@ -85,97 +98,18 @@ For key flows, show the sequence of calls between components (text-based or Merm
85
98
 
86
99
  ## 3. Backend
87
100
 
88
- ### 3.1 Data Model
89
-
90
- For each new/modified entity:
91
- - Model/class definition with types and constraints
92
- - ORM/database configuration (if needed)
93
- - Migration notes
94
-
95
- ### 3.2 DTOs / Response Models
96
-
97
- For each DTO or response model:
98
- - Class/interface definition
99
- - Input vs Output distinction
100
- - Serialization attributes (if applicable)
101
-
102
- ### 3.3 Validation
103
-
104
- For each input model:
105
- - Validation rules
106
- - Error messages
107
-
108
- ### 3.4 API Endpoints
109
-
110
- For each endpoint:
111
- | Field | Value |
112
- |-------|-------|
113
- | Method | GET/POST/PUT/DELETE |
114
- | Path | /api/... |
115
- | Auth | Policy or role required |
116
- | Request body | DTO or none |
117
- | Response | DTO / array / status code |
118
- | Error codes | 400/401/403/404 scenarios |
119
-
120
- ### 3.5 Services
121
-
122
- For each new/modified service:
123
- - Interface definition
124
- - Key methods with signatures
125
- - Dependencies (injected services)
126
- - External API calls (if applicable)
127
-
128
- ### 3.6 Mapping / Transformations
129
-
130
- Mapping configurations between entities and DTOs (if applicable).
131
-
132
- ### 3.7 Dependency Registration
133
-
134
- Services, validators, and other registrations needed in the DI container / startup configuration.
101
+ _Per-component detail — see Section 9's Components table and each component's own design file
102
+ (generated separately, one call per component). Do not write any content here._
135
103
 
136
104
  ## 4. Frontend
137
105
 
138
- ### 4.1 Routes
139
-
140
- | Path | Component | Guard |
141
- |------|-----------|-------|
142
- | ... | ... | ... |
143
-
144
- ### 4.2 Components
145
-
146
- For each new component:
147
- - Props interface
148
- - State management
149
- - API calls
150
- - Responsive behavior (desktop vs mobile)
151
-
152
- ### 4.3 Pages
153
-
154
- For each page:
155
- - Layout description
156
- - Data fetching strategy
157
- - User interactions
158
- - Error handling
159
-
160
- ### 4.4 Navigation / Manifest Changes
161
-
162
- Changes to routing configuration or app manifests.
163
-
164
- ### 4.5 i18n Keys
165
-
166
- New translation keys needed (all supported locales).
167
-
168
- ### 4.6 Types / Interfaces
169
-
170
- TypeScript interfaces for API responses and component props.
106
+ _Per-component detail — see Section 9's Components table and each component's own design file
107
+ (generated separately, one call per component). Do not write any content here._
171
108
 
172
109
  ## 5. External Integrations
173
110
 
174
- For each external service:
175
- - Endpoints used
176
- - Authentication/authorization model
177
- - Rate limiting considerations
178
- - Error handling strategy
111
+ _Per-component detail — see Section 9's Components table and each component's own design file
112
+ (generated separately, one call per component). Do not write any content here._
179
113
 
180
114
  ## 6. Security Considerations
181
115
 
@@ -202,20 +136,29 @@ For each external service:
202
136
  Complete list of files to create or modify:
203
137
 
204
138
  ### New files
205
- | Path | Purpose |
206
- |------|---------|
207
- | ... | ... |
139
+ | Path | Purpose | Addresses | Domain | Spec |
140
+ |------|---------|-----------|--------|------|
141
+ | ... | ... | ... | ... | [components/{basename}](components/{basename}) |
208
142
 
209
143
  ### Modified files
210
- | Path | Change description |
211
- |------|-------------------|
212
- | ... | ... |
144
+ | Path | Change description | Addresses | Domain | Spec |
145
+ |------|-------------------|-----------|--------|------|
146
+ | ... | ... | ... | ... | [components/{basename}](components/{basename}) |
147
+
148
+ Column order matters: `Addresses` MUST stay the 3rd column (immediately after
149
+ `Purpose`/`Change description`) — this is the exact position `tech-spec-graph-checks.js`'s
150
+ existing, unmodified parser already reads from a 3-column legacy table, and it reads
151
+ positionally, not by header name. `Domain` and `Spec` are new TRAILING columns, safely ignored by
152
+ that parser. Do not reorder them. `Domain` is the same enum Work Breakdown tasks already use:
153
+ `BE | FE | DB | DevOps | INFRA | TEST`. `Spec` is a provisional link to this file's own design
154
+ file — `components/{the file's own basename, with its extension kept}.md` (e.g.
155
+ `src/services/foo.js` → `components/foo.js.md`); the host may rewrite this link if two files
156
+ share a basename, so treat it as provisional, not final.
213
157
 
214
158
  ## 10. Testing Strategy
215
159
 
216
- - Unit test coverage targets
217
- - Integration test scenarios
218
- - Manual verification steps
160
+ _Per-component detail — see each component's own design file's own Tests section (generated
161
+ separately, one call per component). Do not write any content here._
219
162
 
220
163
  ## 11. Implementation Order
221
164
 
@@ -247,11 +190,12 @@ Do NOT make arbitrary architectural decisions when the source is unclear. Ask fi
247
190
 
248
191
  - Write in **English**
249
192
  - **Read AGENTS.md and existing code** before writing the spec — ensure patterns match
250
- - Include actual code snippets for key definitions (models, DTOs, interfaces) using the project's language
251
193
  - Reference existing files that serve as patterns to follow
252
194
  - The file inventory must be exhaustive — every file that needs creation or modification
253
195
  - Implementation order must respect dependencies
254
- - For external API calls, document the full request/response including headers and error scenarios
255
- - Consider concurrency, edge cases, and failure modes
256
- - Do not include implementation code for every method — focus on interfaces, contracts, and key algorithms
196
+ - Consider concurrency, edge cases, and failure modes at the feature-wide level (Security,
197
+ Database, Configuration, Risks) — per-component edge cases belong in that component's own
198
+ design file, not here
257
199
  - If architectural decisions need to be made, present options with tradeoffs rather than deciding unilaterally
200
+ - For every file in the File Inventory, cite the Requirements AC ID(s) it implements in the `Addresses` column (comma-separated), or `—` if the file has no direct AC traceability (e.g. a shared helper with no behavior of its own). Do not invent AC IDs — only cite ones that exist in `req/index.md`'s own AC table.
201
+ - Do not write any Backend/Frontend/External-Integration/Testing content yourself — those sections' real content is produced by a separate call per component; your job is only to decide the file list (with `Domain`/`Addresses`) and every feature-wide section