qfai 1.7.13 → 1.7.15

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 (74) hide show
  1. package/README.md +35 -8
  2. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +2 -2
  3. package/assets/init/.qfai/assistant/agents/product-experience-architect.md +2 -2
  4. package/assets/init/.qfai/assistant/agents/product-surface-reviewer.md +1 -1
  5. package/assets/init/.qfai/assistant/instructions/agent-selection.md +2 -0
  6. package/assets/init/.qfai/assistant/instructions/shared-skill-delegation-baseline.md +88 -0
  7. package/assets/init/.qfai/assistant/instructions/shared-skill-operating-baseline.md +49 -0
  8. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +28 -88
  9. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +50 -114
  10. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +137 -208
  11. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-md-brand-catalog.md +90 -0
  12. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +26 -0
  13. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-coverage-checklist.md +20 -0
  14. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/example-mapping-guide.md +18 -0
  15. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/oq-and-deferred-rules.md +41 -0
  16. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +22 -0
  17. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +50 -0
  18. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/platform_baselines.md +107 -0
  19. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/review_audit_playbook.md +104 -0
  20. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +76 -0
  21. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +143 -1005
  22. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +9 -0
  23. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +1 -1
  24. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/04_Sources.md +83 -32
  25. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +7 -7
  26. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/prototyping.yaml +12 -4
  27. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +2 -2
  28. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +2 -2
  29. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/10_implementation_strategy.md +31 -13
  30. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/12_design_system.md +115 -0
  31. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/21_design_eval_trend_derived.md +86 -24
  32. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/23_design_eval_aggregate.md +12 -0
  33. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +1 -1
  34. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +2 -0
  35. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +27 -27
  36. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +145 -155
  37. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +118 -355
  38. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +30 -0
  39. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +29 -0
  40. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +37 -0
  41. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +32 -0
  42. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +33 -0
  43. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +50 -115
  44. package/assets/init/.qfai/assistant/steering/agent-catalog.yml +1 -1
  45. package/assets/init/.qfai/assistant/steering/agent-routing.yml +20 -8
  46. package/assets/init/.qfai/assistant/steering/manifest.md +4 -7
  47. package/assets/init/.qfai/assistant/steering/product.md +6 -6
  48. package/assets/init/.qfai/assistant/steering/review-profiles.yml +3 -0
  49. package/assets/init/.qfai/assistant/steering/ui-definition-protocol.md +7 -7
  50. package/assets/init/.qfai/contracts/README.md +15 -8
  51. package/assets/init/.qfai/contracts/ui/README.md +24 -26
  52. package/assets/init/.qfai/discussion/README.md +35 -32
  53. package/assets/init/.qfai/evidence/README.md +65 -181
  54. package/assets/init/.qfai/evidence/calibration.yaml +26 -0
  55. package/assets/init/.qfai/review/README.md +56 -11
  56. package/assets/init/.qfai/specs/README.md +2 -2
  57. package/assets/init/root/qfai.config.yaml +5 -6
  58. package/assets/scripts/capture-screenshots.js +128 -0
  59. package/assets/uix-rev/comparison-review.md +3 -15
  60. package/assets/uix-rev/contracts-review.md +5 -2
  61. package/assets/uix-rev/scoring-review.md +10 -2
  62. package/assets/uix-rev/strategy-review.md +11 -7
  63. package/dist/cli/index.cjs +8532 -4204
  64. package/dist/cli/index.cjs.map +1 -1
  65. package/dist/cli/index.mjs +8599 -4271
  66. package/dist/cli/index.mjs.map +1 -1
  67. package/dist/index.cjs +9808 -5532
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.d.cts +467 -277
  70. package/dist/index.d.ts +467 -277
  71. package/dist/index.mjs +8909 -4647
  72. package/dist/index.mjs.map +1 -1
  73. package/package.json +1 -1
  74. package/assets/uix-rev/migration-review.md +0 -17
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: qfai-sdd
3
3
  title: QFAI SDD Unified (Outline/Slice/Plan/Delta)
4
- description: "Create and update layered SDD artifacts (\_policies + spec-XXXX) in one workflow."
4
+ description: "Create and update layered SDD artifacts (_policies + spec-XXXX) in one workflow."
5
5
  argument-hint: "[<spec-id-or-name>] [--auto]"
6
6
  allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
7
7
  roles:
@@ -34,29 +34,24 @@ QFAI Skill Body (SSOT)
34
34
 
35
35
  ## User Questions (AskUserQuestion Protocol)
36
36
 
37
- - When a question to the user is needed (e.g., OQ resolution, NFR priority decisions),
38
- the agent MUST use AskUserQuestion if the tool is available.
39
- - When AskUserQuestion supports structured choices (radio/multi-select),
40
- the agent MUST prefer structured choices over free-text input.
41
- - If AskUserQuestion is technically unavailable, present the same question as a normal message
42
- with explicit numbered choices.
43
- The agent SHOULD preserve structured choice semantics (enumerated options, selection constraints).
44
- The reason for unavailability MUST be stated.
37
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#user-questions-askuserquestion-protocol`.
38
+
39
+ Skill-specific examples:
40
+
41
+ - OQ resolution
42
+ - NFR priority decisions
45
43
 
46
44
  ### Spec Create/Delete Confirmation (Mandatory)
47
45
 
48
- - **When creating a new spec**: approval via AskUserQuestion is mandatory.
49
- Example prompt: `"Create new spec-XXXX (${subject}) in category ${category}. Approve?"`
50
- Choices: `["Approve", "Reject"]`
51
- - **When deleting an existing spec**: approval via AskUserQuestion is mandatory.
52
- Example prompt: `"Delete spec-XXXX (${subject}). Reason: ${rationale}. Approve?"`
53
- Choices: `["Approve", "Reject"]`
54
- - **When only updating an existing spec**: no confirmation is required.
46
+ - When creating a new spec: approval via AskUserQuestion is mandatory.
47
+ - When deleting an existing spec: approval via AskUserQuestion is mandatory.
48
+ - When only updating an existing spec: no confirmation is required.
55
49
  - If approval is not granted, skip the operation and record the reason in `delta.md`.
56
50
 
57
51
  ## FORMAT SSOT (Mandatory)
58
52
 
59
- - Before writing or editing any `.qfai/**` artifact, read and follow:
53
+ - Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#format-ssot-mandatory`.
54
+ - Before writing `.qfai/**`, read:
60
55
  - `.qfai/discussion/README.md`
61
56
  - `.qfai/specs/README.md`
62
57
  - `.qfai/contracts/**/README.md`
@@ -64,64 +59,48 @@ QFAI Skill Body (SSOT)
64
59
  - `.qfai/assistant/steering/agent-catalog.yml`
65
60
  - `.qfai/assistant/steering/agent-routing.yml`
66
61
  - `.qfai/assistant/steering/review-profiles.yml`
67
- - `.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md`
68
- - Use skill-local templates as SSOT:
69
- - `.qfai/assistant/skills/qfai-sdd/templates/report/preflight_summary.md`
70
- - Do NOT duplicate templates directly in this workflow markdown.
71
- - Completion requires a format self-check in evidence.
62
+ - `.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md`
63
+ - Use skill-local templates as SSOT and keep templates out of this file.
72
64
 
73
65
  ## Inputs Priority (Preflight)
74
66
 
75
67
  Determine preflight input in this order:
76
68
 
77
- 1. Latest `.qfai/discussion/discussion-*/` pack (lexicographically largest)
78
- 2. Validate that the latest discussion-pack has all required files (`01_Context.md` .. `99_delta.md`), minimum contents, and no blocking OQ.
79
- 3. If validation fails, stop `/qfai-sdd` and guide to:
80
- - `/qfai-discussion` for discussion-pack generation/fix
69
+ 1. Latest `.qfai/discussion/discussion-*/` pack (lexicographically largest).
70
+ 2. Validate that the latest discussion-pack has required files, minimum contents, and no blocking OQ.
71
+ 3. If validation fails, stop `/qfai-sdd` and guide to `/qfai-discussion`.
81
72
 
82
73
  Then read inputs in this order:
83
74
 
84
75
  - P1: `.qfai/assistant/instructions/*`
85
76
  - P2: `.qfai/assistant/steering/*`
86
- - P3: existing `.qfai/specs/<spec-id>/**` (if updating)
77
+ - P3: existing `.qfai/specs/<spec-id>/**` when updating
87
78
  - P4: `.qfai/discussion/**`, `.qfai/contracts/**`
88
79
 
89
80
  ## Sub-agent Delegation (MANDATORY)
90
81
 
91
- This section is mandatory and overrides any conflicting fallback text in this file.
82
+ Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md`.
92
83
 
93
84
  ### Orchestrator Protocol (MUST)
94
85
 
95
- - Orchestrator may only create work orders, delegate tasks, integrate outputs, and present results to the user.
96
- - Orchestrator MUST NOT generate the primary artifact first draft.
97
- - Orchestrator MUST NOT serve as Reviewer or skip delegation for convenience.
86
+ - No additional overrides.
98
87
 
99
88
  ### Capability Probe (MUST)
100
89
 
101
- 1. Run one harmless Probe Task (for example: "reply with ok") once at stage start.
102
- 2. If subagents are unavailable, explicitly ask the user for Simulation mode approval.
103
- 3. Without explicit approval, stop the stage and do not continue.
90
+ - No additional overrides.
104
91
 
105
- ### Simulation mode (Opt-in only)
92
+ ### Delegation Failure (Hard Stop)
106
93
 
107
- - Allowed only when the user explicitly states `Simulation mode allowed`.
108
- - When used, record both of the following in outputs/evidence:
109
- - `Subagents: simulated (reason: <why unavailable>)`
110
- - `User approval: <quote or reference>`
94
+ - No additional overrides.
95
+ - Do not simulate roles. If the first required delegation fails, stop the stage and report remediation.
111
96
 
112
97
  ### Work Orders Summary (MANDATORY evidence)
113
98
 
114
- Every major artifact in this stage MUST include a `## Work Orders Summary` section with this fixed table schema:
115
-
116
- | Step | Role (sub-agent) | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE) |
117
- | ---- | ---------------- | ---------- | ------------ | ------------- | -------------------- |
118
- | 1 | <role> | <task> | <refs> | <refs> | PASS/REVISE |
119
-
120
- - `Output (refs)` must point to in-file anchors or relative evidence file paths.
99
+ Use the shared schema.
121
100
 
122
101
  ### Stage Minimum Roles (MUST)
123
102
 
124
- - Delegate: `requirements-analyst` drafts requirement-aligned spec content and open-question handling.
103
+ - Delegate: `requirements-analyst` drafts requirement-aligned spec content and OQ handling.
125
104
  - Delegate: `solution-architect` drafts structural, contract, and architecture-sensitive sections.
126
105
  - Delegate: `test-design-analyst` drafts traceability, examples, and test-design structure.
127
106
  - Delegate: `product-experience-architect` only when the target is UI-bearing.
@@ -131,40 +110,19 @@ Every major artifact in this stage MUST include a `## Work Orders Summary` secti
131
110
 
132
111
  ### No-argument batch delegation (MUST)
133
112
 
134
- - If `/qfai-sdd` is invoked without `<spec-id-or-name>`, treat the run as an all-capability batch.
113
+ - Without argument (`/qfai-sdd`): target all capabilities listed in `_policies/03_Capabilities.md`.
135
114
  - Enumerate targets from `.qfai/specs/_policies/03_Capabilities.md` and keep `spec-0001..N` mapping stable by Capability order.
136
- - In batch mode, run Contracts-first and Outline exactly once as shared outputs.
137
- - Delegate Slice in parallel per spec using the routing for `qfai-sdd` in `.qfai/assistant/steering/agent-routing.yml`.
138
- - Delegate Plan and Delta per spec after the design phase passes its blocking reviewers.
115
+ - Run Contracts-first and Outline once per batch.
116
+ - Delegate Slice in parallel per spec.
139
117
  - Validate gate and Review gate run once at batch tail after all target specs are integrated.
140
118
  - Evidence is mandatory per spec: `.qfai/evidence/sdd-spec-XXXX.md`.
141
- - Optional batch summary is allowed: `.qfai/evidence/sdd-batch-<timestamp>.md`.
142
119
  - Every per-spec evidence MUST include `## Work Orders Summary`.
143
120
 
144
121
  ### Reviewer Gate (MUST)
145
122
 
146
- - Final completion gate MUST be delegated to an independent `completion-reviewer`.
147
- - Reviewer checks (minimum):
148
- - Required roles were delegated (no orchestrator self-authoring).
149
- - DoD satisfied (validate gate, test-layer hard gate, evidence, DR-IDs).
150
- - Validate gate evidence exists and is fresh:
151
- - `qfai validate --fail-on error --format github` completed with `error=0`.
152
- - `.qfai/report/validate.log` and `.qfai/report/specs-coverage/spec-*.md` are present.
153
- - Layer coverage hard gates are all clear:
154
- - `QFAI-COV-201/202/203/204/205/206` are `0`.
155
- - ATDD annotation hard gates are all clear when test assets are part of scope:
156
- - `QFAI-ATDD-101/102/103/111/112/113/121/122` are `0`.
157
- - `QFAI-COV-207` warnings are reviewed as density-smell signals.
158
- - **Drift Protocol enforced**:
159
- - No upstream artifact edits were made without an explicit user-approved Change Request.
160
- - If upstream changes exist, the correct owner skill was re-run after approval; downstream did not patch upstream directly.
161
- - **Test-layer policy enforced**:
162
- - E2E/API/Integration coverage aligns with `steering/test-layers.md` and the project plan.
163
- - Do not use pyramid ratios as a gate; use floors/ratios only as signals. Coverage obligations are the gate.
164
- - Test implementation guidance is explicit for downstream phases:
165
- - `tests/e2e/**` -> `QFAI:SPEC-XXXX:US-YYYY`
166
- - `tests/integration/**` -> `QFAI:SPEC-XXXX:TC-YYYY`
167
- - `tests/api/**` -> `QFAI:CON-API-XXXX` (and no TC annotations)
123
+ - Follow `.qfai/assistant/instructions/shared-skill-delegation-baseline.md#reviewer-gate-baseline`.
124
+ - Reviewers must check Drift Protocol, `.qfai/assistant/steering/test-layers.md`, and validate evidence freshness.
125
+ - `QFAI-COV-207` warnings are density-smell signals, not hard gates.
168
126
  - Route specialist reviewers from `.qfai/assistant/steering/agent-routing.yml` and `.qfai/assistant/steering/review-profiles.yml`.
169
127
  - Default SDD review set:
170
128
  - `completion-reviewer`
@@ -173,252 +131,80 @@ Every major artifact in this stage MUST include a `## Work Orders Summary` secti
173
131
  - `product-surface-reviewer` for UI-bearing specs
174
132
  - `qa-gatekeeper` when validate, coverage, runtime, or prototyping evidence is affected
175
133
  - Do not declare DONE or handoff until all routed blocking reviewers return `PASS`.
176
- - Every reviewer MUST provide a concrete alternative or fix proposal when returning `FAIL`.
177
134
 
178
135
  ### Work order template (copy/paste)
179
136
 
180
- ```text
181
- Task title: <short>
182
- Role: <sub-agent role>
183
- Goal: <what to decide/produce>
184
- Inputs (refs):
185
- - <file/section>
186
- Constraints:
187
- - must: enforce Drift Protocol (no upstream edits without user approval + CR)
188
- - must: verify plan/test-layer adherence (`steering/test-layers.md` + plan)
189
- - must: check `qfai validate --fail-on error` passes with evidence (`error=0`)
190
- - must: enforce `.qfai/assistant/steering/test-layers.md` hard gates
191
- - must_not: accept test-volume ratios/floors as a hard gate
192
- - must_not: accept upstream edits made directly by downstream phase
193
- Output format:
194
- - <headings / bullet schema>
195
- Quality bar:
196
- - PASS if ...
197
- - REVISE if ...
198
- ```
137
+ Use the shared template.
199
138
 
200
139
  ### Reviewer response template
201
140
 
202
- ```text
203
- Result: PASS | REVISE
204
- Findings:
205
- - <issue>
206
- Required fixes:
207
- - <action>
208
- Evidence checked:
209
- - <refs>
210
- ```
141
+ Use the shared template.
142
+
143
+ - Required field: `Status (PASS/REVISE)`.
211
144
 
212
145
  ## Review Cycle Protocol (RCP)
213
146
 
214
- - Routing SSOT: `.qfai/assistant/steering/agent-routing.yml`.
215
- - Review profile SSOT: `.qfai/assistant/steering/review-profiles.yml`.
147
+ - Follow `.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md`.
216
148
  - Footer SSOT: `.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md`.
217
- - Every review cycle executes only the reviewers selected for the current phase and conditions.
218
- - Allowed reviewer verdicts: `PASS`, `FAIL`.
219
- - Any `FAIL` triggers targeted rerun for the failed reviewer and reviewers affected by the changed scope.
220
- - `fixed` is forbidden until all routed blocking reviewers are `PASS`.
149
+ - Allowed reviewer verdicts in the playbook remain `PASS` and `FAIL`.
221
150
 
222
151
  ## Stage 0 - Steering completion refresh (mandatory)
223
152
 
224
- Before moving forward in this stage, refresh these files:
225
-
226
- - `.qfai/assistant/steering/manifest.md`
227
- - `.qfai/assistant/steering/product.md`
228
- - `.qfai/assistant/steering/structure.md`
229
- - `.qfai/assistant/steering/tech.md`
230
-
231
- Rules:
232
-
233
- - Detect incomplete content (empty sections, placeholder-only lines, `<...>`, `TBD`, stale facts).
234
- - Fill what is verifiable from repository evidence (tree, docs, require/spec artifacts, package.json, CI definitions).
235
- - If something cannot be verified, record it as an Open Question and ask the user.
236
- - Even if steering is already complete, update it when new facts are discovered in this stage.
153
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#stage-0---steering-completion-refresh-mandatory`.
237
154
 
238
155
  ## Delta Rejected Guard (Mandatory)
239
156
 
240
- - Do NOT reintroduce options marked as rejected in `09_delta.md` (or `*_delta.md`).
241
- - If a rejected option must be reconsidered, add a `[RE-OPEN]` decision record with explicit approval evidence.
157
+ Follow `.qfai/assistant/instructions/shared-skill-operating-baseline.md#delta-rejected-guard-mandatory`.
242
158
 
243
159
  ## Workflow Convention (Mandatory)
244
160
 
245
- - **This skill proceeds in this exact order: Contracts-first -> Outline -> Slice -> Plan finalize -> Delta update.**
246
- - **Upper-to-lower references are forbidden. Lower-to-upper references are allowed.**
247
- - **Connections between layers MUST be represented by IDs and required edges (`US->AC->BR->EX->TC`).**
248
- - **Plan finalize MUST happen after at least one user-story slice is grounded.**
249
- - **Unresolved items MUST be moved to `08_Open-questions.md` (spec scope) or `_policies/09_Open-questions.md` (shared scope).**
161
+ - Phase order is fixed: Contracts-first -> Outline -> Slice -> Plan finalize -> Delta update.
162
+ - Upper-to-lower references are forbidden. Lower-to-upper references are allowed.
163
+ - Reference direction shorthand: lower-to-upper only.
164
+ - Connections between layers MUST be represented by IDs and required edges (`US->AC->BR->EX->TC`).
165
+ - Plan finalize MUST happen after at least one user-story slice is grounded.
166
+ - Unresolved items MUST move to shared or spec open-question files.
167
+ - Detailed phase checklists live in `.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md`.
250
168
 
251
169
  ## Slice Policy Protocol (Mandatory)
252
170
 
253
- Before any spec creation, update, or deletion, the agent MUST:
254
-
255
- 1. Treat `_policies/11_Slice-Policy.md` as the SSOT for spec slicing decisions.
256
- 2. If `_policies/11_Slice-Policy.md` is missing, stale, or no longer matches the repository structure, create or update it before continuing.
257
- 3. Classify each target into a category (structural / CLI / skill / agent).
258
- 4. Enforce 1:1 mapping per category rule (1 command = 1 spec, 1 skill = 1 spec, etc.).
259
- 5. Use `_policies/11_Slice-Policy.md` to decide whether each detected change is CREATE, UPDATE, or DELETE.
260
- 6. If a new CLI command or skill is detected that has no corresponding spec, propose CREATE (requires AskUserQuestion).
261
- 7. If a CLI command or skill has been removed but its spec still exists, propose DELETE (requires AskUserQuestion).
262
- 8. If the action violates slice rules, STOP and report the violation — do NOT proceed without user override.
263
- 9. Do not start Phase 2 (Slice) until `_policies/11_Slice-Policy.md` exists and reflects the current slicing model.
171
+ - Treat `_policies/11_Slice-Policy.md` as the SSOT for spec slicing decisions.
172
+ - If `_policies/11_Slice-Policy.md` is missing or stale, create or refresh it before continuing.
173
+ - Classify each target into a category (structural / CLI / skill / agent).
174
+ - Use `_policies/11_Slice-Policy.md` to decide CREATE, UPDATE, or DELETE.
175
+ - If a new CLI command or skill has no corresponding spec, propose CREATE.
176
+ - If a CLI command or skill has been removed but its spec still exists, propose DELETE.
177
+ - Do not start Phase 2 (Slice) until `_policies/11_Slice-Policy.md` exists and reflects the current slicing model.
264
178
 
265
179
  ## Arguments and Target Selection (Mandatory)
266
180
 
267
181
  - With argument (`/qfai-sdd <spec-id-or-name> [--auto]`): update only the matched single spec target.
268
182
  - Without argument (`/qfai-sdd`): target all capabilities listed in `_policies/03_Capabilities.md`.
269
- - If `_policies/03_Capabilities.md` or `_policies/11_Slice-Policy.md` does not exist, bootstrap shared templates first, then enumerate capabilities.
183
+ - If `_policies/03_Capabilities.md` or `_policies/11_Slice-Policy.md` does not exist, bootstrap shared templates first.
270
184
  - Capability order in `_policies/03_Capabilities.md` is SSOT for `spec-0001..N` assignment and ID stability.
271
185
  - Reordering capability-to-spec mapping is a Change Request decision and must not be done implicitly.
272
- - Batch policy (no argument):
273
- - Contracts-first/Outline: once per batch.
274
- - Slice/Plan/Delta: once per target spec (parallel delegation required).
275
- - Validate/RCP: once at the batch tail after integrating all target specs.
276
186
 
277
187
  ## CRITICAL CONSTRAINTS (Read First)
278
188
 
279
- - This unified entrypoint owns the full SDD flow directly (preflight + shared/spec artifacts + plan); do not route to deprecated split entrypoints.
280
- - Use only skill-local templates:
281
- - `.qfai/assistant/skills/qfai-sdd/templates/specs/`
282
- - `.qfai/assistant/skills/qfai-sdd/templates/contracts/`
189
+ - This unified entrypoint owns the full SDD flow directly.
190
+ - Use only skill-local templates under `.qfai/assistant/skills/qfai-sdd/templates/`, including `templates/contracts`, `templates/report`, and `templates/specs`.
283
191
  - Always write `.qfai/report/preflight_summary.md` before generating shared/spec artifacts.
284
- - Contracts are contract-first mandatory outputs in this skill:
285
- - create/update `.qfai/contracts/(api|db|ui)/**` before shared/spec slices
286
- - `_policies/05_Contracts.md` must include a Contract Index with short IDs (`DB-001`, `API-001`, `UI-001`)
287
- - every indexed short ID must map to a declared file with `QFAI-CONTRACT-ID`:
288
- - `DB-001 -> CON-DB-0001 -> db-0001-<slug>.sql`
289
- - `API-001 -> CON-API-0001 -> api-0001-<slug>.yaml`
290
- - `UI-001 -> CON-UI-0001 -> ui-0001-<slug>.yaml`
291
- - `<slug>` comes from entity/router/screen and must be sanitized to kebab-case
292
- - allocate new contract IDs by scanning existing declarations and using next sequential NNNN per kind
293
- - never duplicate existing declared IDs; update in-place when the contract already exists
294
- - contract stubs must be syntactically valid (OpenAPI YAML / UI YAML / executable SQL skeleton)
295
- - `/qfai-sdd` must stop when discussion-pack is missing/incomplete or has blocking OQ (guide to `/qfai-discussion` first).
192
+ - Contracts are contract-first mandatory outputs in this skill.
193
+ - `_policies/05_Contracts.md` must include a Contract Index.
194
+ - `/qfai-sdd` must stop when discussion-pack is missing, incomplete, or has blocking OQ.
195
+ - Discussion-pack preflight is mandatory, including classification-aware `prototyping.yaml` validation.
296
196
  - Reviewer routing is fixed by `.qfai/assistant/steering/agent-routing.yml` and `.qfai/assistant/steering/review-profiles.yml`.
297
197
  - RCP wording must be sourced from `.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md`.
298
- - `_policies/04_Business-Flow.md` must be Markdown and include at least one Mermaid `flowchart` or `sequenceDiagram`.
299
- - Business Flow must not be authored as Gherkin (`*Business-flow*.feature` is deprecated).
300
- - If diagrams are written in discussion/spec/evidence artifacts, Mermaid syntax must be inside ` ```mermaid ` fences only.
198
+ - `_policies/04_Business-Flow.md` must be Markdown and include Mermaid `flowchart` or `sequenceDiagram`.
301
199
  - `05_Examples.md` must include `EX-ID` and `BR-Ref` mappings.
302
- - `06_Test-Cases.md` must include `TC-ID`, `EX-Ref`, `AC-Refs`, and `Type` (normal/error/boundary/edge).
303
- - `06_Test-Cases.md` quality depth: each AC must have at minimum one normal-path and one error/boundary test case. Normal-path-only coverage is incomplete.
304
- - Do not complete this stage until:
305
- - `qfai validate --fail-on error --format github | tee .qfai/report/validate.log` exits successfully.
306
- - `.qfai/report/specs-coverage/spec-*.md` has been read for density review.
307
- - Reference direction rules from `.qfai/specs/README.md` must be enforced:
308
- - upper-to-lower references are forbidden
309
- - lower-to-upper references are allowed
310
- - Keep `specs/` definition-only and keep operational status as execution logs under `.qfai/report/run-*`.
311
- - BR/Examples/Test-cases depth must be explicit:
312
- - BR decomposes AC into decision-level rules.
313
- - Examples concretize BR.
314
- - Test-cases realize Examples.
315
- - If counts are intentionally sparse, document reason and completion plan.
316
- - Do not leave ambiguity untracked:
317
- - ask the user when certainty is below threshold
318
- - unresolved decisions become explicit Open Questions
319
-
320
- ### Phase 0 - Contracts-first (mandatory)
321
-
322
- Create/update:
323
-
324
- - `.qfai/contracts/api/**`
325
- - `.qfai/contracts/db/**`
326
- - `.qfai/contracts/ui/**`
327
- - `_policies/05_Contracts.md` Contract Index table (DB/API/UI short IDs)
328
-
329
- Rules:
330
-
331
- - This phase MUST complete before Outline/Slice.
332
- - If `_policies/05_Contracts.md` lists an ID, the corresponding declared contract file MUST exist.
333
- - If a contract is empty, create a valid minimal stub and include `QFAI-CONTRACT-ID`.
334
- - `none` is allowed only when there is no contract impact and rationale is written.
335
-
336
- ### Phase 1 - Outline (layer-first)
337
-
338
- Create/update:
339
-
340
- - `_policies/01_Objective.md`
341
- - `_policies/02_Initiative.md`
342
- - `_policies/03_Capabilities.md`
343
- - `_policies/04_Business-Flow.md`
344
- - `_policies/05_Contracts.md`
345
- - `_policies/06_Glossary.md`
346
- - `_policies/07_Constraints.md`
347
- - `_policies/08_Decisions.md`
348
- - `_policies/09_Open-questions.md`
349
- - `_policies/10_delta.md`
350
- - `_policies/11_Slice-Policy.md`
351
-
352
- Rules:
353
-
354
- - Temporary `TBD` is allowed, but each `TBD` must be mirrored into `_policies/09_Open-questions.md`.
355
- - `_policies/04_Business-Flow.md` must include Mermaid and keep diagram syntax inside ` ```mermaid ` fences.
356
- - `_policies/08_Decisions.md` and `_policies/10_delta.md` must exist even when empty, and must explicitly state `0 items`.
357
- - `_policies/11_Slice-Policy.md` must be created or refreshed in this phase and must explain:
358
- - slice categories
359
- - create/update/delete decision rules
360
- - ID stability rules
361
- - gap / renumbering policy
362
- - If the current repository shape and `_policies/11_Slice-Policy.md` disagree, update the policy file first and record the decision in delta.
363
-
364
- ### Phase 2 - Slice (slice-first)
365
-
366
- Create/update:
367
-
368
- - `spec-XXXX/01_Spec.md`
369
- - `spec-XXXX/02_User-stories.md`
370
- - `spec-XXXX/03_Acceptance-Criteria.md`
371
- - `spec-XXXX/04_Business-Rules.md`
372
- - `spec-XXXX/05_Examples.md`
373
- - `spec-XXXX/06_Test-Cases.md`
374
- - `spec-XXXX/07_Decisions.md`
375
- - `spec-XXXX/08_Open-questions.md`
376
-
377
- Slice gate (must pass before Phase 3):
378
-
379
- - For each US, AC must exist.
380
- - For each AC, BR and SC must exist.
381
- - For each TC, EX reference must exist.
382
- - `SC` tags must align with the target `spec-XXXX` namespace.
383
- - `07_Decisions.md` and `08_Open-questions.md` must exist even when empty and include explicit `0 items` statements.
384
- - `01_Spec.md` is the execution Primary SSOT and MUST copy down applicable NFR, policy, evidence summary, relevant requirements, and an Escalation Hook to `_policies`.
385
-
386
- ### Phase 3 - Plan finalize
387
-
388
- Create/update:
389
-
390
- - `spec-XXXX/10_Plan.md`
391
-
392
- Rules:
393
-
394
- - Finalize only after at least one user-story slice has passed Phase 2 gate.
395
- - `spec-XXXX/10_Plan.md` is the single source of truth for How.
396
- - Do not create `specs/plan.md`.
397
-
398
- ### Phase 4 - Delta update
399
-
400
- Create/update:
401
-
402
- - `spec-XXXX/09_delta.md` (or `spec-XXXX/*_delta.md`)
403
-
404
- Rules:
405
-
406
- - Record adoption/rejection rationale.
407
- - Rejected section MUST include `DO NOT` and `Temptation`.
408
-
409
- ## Completion Contract (Shared)
410
-
411
- Before declaring completion, you MUST:
412
-
413
- - OQ / undefined resolution: resolve ambiguity or explicitly defer with rationale and approval evidence.
414
- - Deliverable completeness: verify all required artifacts and sections are present.
415
- - OQ / placeholder scan: remove unresolved placeholders (`TBD`, `TODO`, `???`, `OPEN QUESTION`, etc.) unless explicitly deferred.
416
- - Run static checks proving the pack is reviewable.
417
- - Run validate gate and keep evidence:
418
- - `qfai validate --fail-on error --format github | tee .qfai/report/validate.log`
419
- - `.qfai/report/specs-coverage/spec-*.md`
420
- - If validate fails, fix spec-layer sources and rerun validate until `error=0`.
421
- - Do not patch upstream intent from downstream artifacts (Drift Protocol applies).
200
+ - `06_Test-Cases.md` must include `TC-ID`, `EX-Ref`, `AC-Refs`, and `Type`.
201
+ - `06_Test-Cases.md` quality depth must include normal-path plus error or boundary coverage.
202
+ - Do not complete the stage until `qfai validate --fail-on error --format github | tee .qfai/report/validate.log` exits with `error=0`.
203
+ - Reference direction rules from `.qfai/specs/README.md` must be enforced.
204
+ - Keep `specs/` definition-only and operational status under `.qfai/report/run-*`.
205
+ - Traceability depth and density-smell review rules live in:
206
+ - `.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md`
207
+ - `.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md`
422
208
 
423
209
  ## Goal
424
210
 
@@ -426,75 +212,56 @@ Create or update layered SDD artifacts in one run so downstream execution phases
426
212
 
427
213
  ## Non-goals
428
214
 
429
- - Writing production code or runnable tests.
430
- - Skipping phase order or bypassing slice/plan gates.
431
- - Reintroducing rejected options without explicit re-open approval.
215
+ - Writing production code or runnable tests
216
+ - Skipping phase order or bypassing slice/plan gates
217
+ - Reintroducing rejected options without explicit re-open approval
432
218
 
433
219
  ## Mandatory Outputs
434
220
 
435
- - `.qfai/specs/_policies/01_Objective.md`
436
- - `.qfai/specs/_policies/02_Initiative.md`
437
- - `.qfai/specs/_policies/03_Capabilities.md`
438
- - `.qfai/specs/_policies/04_Business-Flow.md`
439
- - `.qfai/specs/_policies/05_Contracts.md`
440
- - `.qfai/specs/_policies/06_Glossary.md`
441
- - `.qfai/specs/_policies/07_Constraints.md`
442
- - `.qfai/specs/_policies/08_Decisions.md`
443
- - `.qfai/specs/_policies/09_Open-questions.md`
444
- - `.qfai/specs/_policies/10_delta.md`
445
- - `.qfai/specs/_policies/11_Slice-Policy.md`
446
- - `.qfai/specs/spec-XXXX/01_Spec.md`
447
- - `.qfai/specs/spec-XXXX/02_User-stories.md`
448
- - `.qfai/specs/spec-XXXX/03_Acceptance-Criteria.md`
449
- - `.qfai/specs/spec-XXXX/04_Business-Rules.md`
450
- - `.qfai/specs/spec-XXXX/05_Examples.md`
451
- - `.qfai/specs/spec-XXXX/06_Test-Cases.md`
452
- - `.qfai/specs/spec-XXXX/07_Decisions.md`
453
- - `.qfai/specs/spec-XXXX/08_Open-questions.md`
454
- - `.qfai/specs/spec-XXXX/10_Plan.md`
455
- - `.qfai/specs/spec-XXXX/09_delta.md` (or `*_delta.md`)
456
- - Updated contracts under `.qfai/contracts/**` (mandatory in this workflow)
221
+ - Shared `_policies/01..11` layered files
222
+ - Target `spec-XXXX/01..10` layered files
223
+ - Updated contracts under `.qfai/contracts/**`
457
224
  - `.qfai/report/preflight_summary.md`
458
- - Evidence file (per target spec): `.qfai/evidence/sdd-spec-XXXX.md`
225
+ - Evidence file: `.qfai/evidence/sdd-spec-XXXX.md`
226
+
227
+ The canonical file set is defined by skill templates under `.qfai/assistant/skills/qfai-sdd/templates/`.
459
228
 
460
229
  ## Required Process
461
230
 
462
- 1. Detect latest discussion-pack (`.qfai/discussion/discussion-*`, lexicographically largest) and run readiness checks.
463
- 2. If readiness checks fail, stop and show blockers with `/qfai-discussion`.
464
- 3. Analyze repository context, existing artifacts, constraints, and open decisions.
465
- 4. Write `.qfai/report/preflight_summary.md` from `templates/report/preflight_summary.md`.
466
- 5. Execute Phase 0 (Contracts-first) and ensure `_policies/05_Contracts.md` index and `.qfai/contracts/**` are aligned.
467
- 6. Execute Phase 1 (Outline) in layer-first order.
468
- 7. Ensure `_policies/11_Slice-Policy.md` exists and matches the current repository slicing model before any CREATE / UPDATE / DELETE spec decision.
469
- 8. Execute Phase 2 (Slice) and pass slice gate for each target spec (single target: at least one user-story slice; no-argument batch: all enumerated specs).
470
- 9. Execute Phase 3 (Plan finalize) and make every target `10_Plan.md` actionable as How-only.
471
- 10. Execute Phase 4 (Delta update) and record adoption/rejection rationale for every target spec.
472
- 11. Run `qfai validate --fail-on error --format github | tee .qfai/report/validate.log`.
473
- 12. Run Density Review Pass using `.qfai/report/specs-coverage/spec-*.md` and `QFAI-COV-207` warnings.
474
- 13. If any validate error exists, fix the source layer table(s) and repeat steps 11-12 until `error=0`.
475
- 14. Record static checks, validate evidence, and density review outcomes in evidence.
231
+ 1. Run preflight on the latest discussion-pack and stop if blockers remain.
232
+ 2. Analyze repository context, existing artifacts, constraints, and open decisions.
233
+ 3. Write `.qfai/report/preflight_summary.md`.
234
+ 4. Execute Phase 0 (Contracts-first).
235
+ 5. Execute Phase 1 (Outline).
236
+ 6. Ensure `_policies/11_Slice-Policy.md` exists and matches the current slicing model.
237
+ 7. Execute Phase 2 (Slice) and pass slice gate for each target spec.
238
+ 8. Execute Phase 3 (Plan finalize) after at least one slice gate passes.
239
+ 9. Execute Phase 4 (Delta update).
240
+ 10. Run `qfai validate --fail-on error --format github | tee .qfai/report/validate.log`.
241
+ 11. Review `.qfai/report/specs-coverage/spec-*.md` and triage density-smell warnings.
242
+ 12. If validate fails, fix source-layer artifacts and repeat until `error=0`.
243
+
244
+ Use:
245
+
246
+ - `.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md`
247
+ - `.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md`
248
+
249
+ for detailed entry conditions, stop conditions, and artifact-by-artifact execution notes.
476
250
 
477
251
  ## Unified SDD Quality Gate
478
252
 
479
- Run static checks:
253
+ Run the quality gate checklist from `.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md`.
254
+
255
+ Minimum checks that must remain visible here:
480
256
 
481
257
  - Confirm required `_policies` and `spec-XXXX` layered files exist.
482
- - Confirm `_policies/11_Slice-Policy.md` exists and matches the repository's current slice model.
483
- - Confirm `_policies/04_Business-Flow.md` includes Mermaid and at least one `flowchart` or `sequenceDiagram`.
484
- - Confirm `01_Spec.md` includes copy-down context and Escalation Hook to `_policies`.
485
- - Confirm Mermaid syntax is not written in ` ```text ` or language-less fences.
486
- - Confirm `05_Examples.md` provides `EX-ID` + `BR-Ref` mappings.
487
- - Confirm `06_Test-Cases.md` provides `TC-ID` + `EX-Ref` + `AC-Refs` + `Type`.
488
- - Confirm `06_Test-Cases.md` includes error/boundary/edge test cases, not only normal paths.
489
- - Confirm reference direction follows lower-to-upper only.
258
+ - Confirm `_policies/11_Slice-Policy.md` matches the repository's current slice model.
259
+ - Confirm `_policies/04_Business-Flow.md` includes Mermaid.
260
+ - Confirm `01_Spec.md` includes copy-down context and Escalation Hook.
490
261
  - Confirm required edges `US -> AC -> BR -> EX -> TC`.
491
- - Confirm BR/Examples/Test-cases contain non-empty IDs and coverage mapping.
492
- - Confirm `QFAI-COV-201/202/203/204/205/206` are zero.
493
- - Confirm `QFAI-ATDD-101/102/103/111/112/113/121/122` are zero when test assets are in review scope.
494
- - Confirm `.qfai/report/specs-coverage/spec-*.md` was reviewed and `QFAI-COV-207` warnings were triaged.
495
- - Confirm `10_Plan.md` exists and contains implementation/test strategy as How-only.
262
+ - Confirm `10_Plan.md` exists and remains How-only.
496
263
  - Confirm `specs/plan.md` does not exist.
497
- - Confirm `09_delta.md` (or `*_delta.md`) includes rejected guardrails (`DO NOT`, `Temptation`) when rejections exist.
264
+ - Confirm validate exits with `error=0`.
498
265
 
499
266
  ## Evidence (MANDATORY)
500
267
 
@@ -504,12 +271,13 @@ Required sections:
504
271
 
505
272
  - Objective
506
273
  - Inputs reviewed (files/paths)
507
- - Preflight summary path (`.qfai/report/preflight_summary.md`)
508
- - Open questions summary (Open/Answered/Deferred)
274
+ - Preflight summary path
275
+ - Open questions summary
509
276
  - Decisions made (with rationale)
510
277
  - Work performed (what changed, where)
511
278
  - Commands executed + key outputs
512
- - Validate evidence paths (`.qfai/report/validate.log`, `.qfai/report/specs-coverage/spec-*.md`)
279
+ - Validate evidence paths
280
+ - Work Orders Summary
513
281
  - Gaps / Open risks
514
282
  - Final status (PASS/FAIL) + who confirmed
515
283
 
@@ -528,21 +296,17 @@ When declaring DONE, include:
528
296
  - [ ] CRITICAL CONSTRAINTS were followed.
529
297
  - [ ] `.qfai/report/preflight_summary.md` was generated before spec authoring.
530
298
  - [ ] Contracts-first -> Outline -> Slice -> Plan finalize -> Delta update order was preserved.
531
- - [ ] `_policies/05_Contracts.md` index and `.qfai/contracts/**` declared files are aligned.
299
+ - [ ] `_policies/05_Contracts.md` Contract Index and `.qfai/contracts/**` declarations are aligned.
532
300
  - [ ] Upper-to-lower references were not introduced.
533
301
  - [ ] At least one user-story slice passed gate before plan finalization.
534
302
  - [ ] Required `_policies` + `spec-XXXX` outputs exist and are internally consistent.
535
- - [ ] `_policies/11_Slice-Policy.md` exists and was created or refreshed before spec slice decisions.
536
- - [ ] `_policies/04_Business-Flow.md` is Markdown + Mermaid (`flowchart` or `sequenceDiagram`).
537
- - [ ] Mermaid syntax was not written in ` ```text ` or language-less fences.
538
- - [ ] `10_Plan.md` is finalized with implementation/test strategy (How-only).
303
+ - [ ] `_policies/11_Slice-Policy.md` exists and reflects the current slicing model.
304
+ - [ ] `_policies/04_Business-Flow.md` is Markdown + Mermaid.
305
+ - [ ] `10_Plan.md` is finalized as How-only.
539
306
  - [ ] `specs/plan.md` was not created.
540
307
  - [ ] `09_delta.md` (or `*_delta.md`) contains adoption/rejection rationale.
541
308
  - [ ] `qfai validate --fail-on error --format github` ran and produced `error=0`.
542
- - [ ] `QFAI-COV-201/202/203/204/205/206` are all zero.
543
- - [ ] `QFAI-ATDD-101/102/103/111/112/113/121/122` are all zero when test assets are in scope.
544
- - [ ] `.qfai/report/specs-coverage/spec-*.md` was reviewed for density-smell signals (`QFAI-COV-207`).
545
- - [ ] Unresolved items are tracked in shared/spec Open Questions files.
309
+ - [ ] `.qfai/report/specs-coverage/spec-*.md` was reviewed.
546
310
  - [ ] Quality gate checks are recorded in evidence.
547
311
  - [ ] Evidence file exists and is complete.
548
312
  - [ ] Reviewer approval is recorded.
@@ -550,9 +314,8 @@ When declaring DONE, include:
550
314
  ## Completion Checklist (MUST)
551
315
 
552
316
  - [ ] This skill's Definition of Done is satisfied.
553
- - [ ] Required artifacts were produced or updated (if applicable).
554
- - [ ] Diagram artifacts follow Mermaid fence rules (if diagrams were used).
555
- - [ ] Open questions were logged to the proper OQ file (if applicable).
317
+ - [ ] Required artifacts were produced or updated.
318
+ - [ ] Open questions were logged to the proper OQ file.
556
319
  - [ ] The completion message was presented to the user.
557
320
  - [ ] Next actions were enumerated for all available options.
558
321
 
@@ -565,6 +328,6 @@ When this skill is complete, provide a final user-facing completion message and
565
328
  - Test-first path: `/qfai-atdd`.
566
329
  Action: implement acceptance tests from the finalized spec pack.
567
330
  - Contracts status:
568
- Action: confirm contracts were created/updated under `.qfai/contracts/**` and referenced by `_policies/05_Contracts.md`.
331
+ Action: confirm contracts were created or updated under `.qfai/contracts/**` and referenced by `_policies/05_Contracts.md`.
569
332
  - Spec pack needs correction: rerun `/qfai-sdd`.
570
333
  Action: fix layered `_policies + spec-XXXX` consistency and decision records, then regenerate evidence.