qfai 1.3.0 → 1.3.12

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 (93) hide show
  1. package/README.md +53 -138
  2. package/assets/init/.qfai/README.md +24 -1
  3. package/assets/init/.qfai/assistant/instructions/change-classification.md +107 -0
  4. package/assets/init/.qfai/assistant/instructions/requirements-decomposition.md +75 -0
  5. package/assets/init/.qfai/assistant/prompts/qfai-discuss.md +3 -0
  6. package/assets/init/.qfai/assistant/prompts/qfai-implement.md +97 -0
  7. package/assets/init/.qfai/assistant/prompts/qfai-pr.md +85 -0
  8. package/assets/init/.qfai/assistant/prompts/qfai-require.md +41 -47
  9. package/assets/init/.qfai/assistant/prompts/qfai-scenario-test.md +92 -0
  10. package/assets/init/.qfai/assistant/prompts/qfai-spec.md +14 -3
  11. package/assets/init/.qfai/assistant/prompts/qfai-unit-test.md +92 -0
  12. package/assets/init/.qfai/assistant/prompts/qfai-verify.md +6 -0
  13. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +12 -0
  14. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +12 -0
  15. package/assets/init/.qfai/assistant/skills/qfai-discuss/SKILL.md +12 -0
  16. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +12 -0
  17. package/assets/init/.qfai/assistant/skills/qfai-pr/SKILL.md +12 -0
  18. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +12 -0
  19. package/assets/init/.qfai/assistant/skills/qfai-require/SKILL.md +12 -0
  20. package/assets/init/.qfai/assistant/skills/qfai-scenario-test/SKILL.md +12 -0
  21. package/assets/init/.qfai/assistant/skills/qfai-spec/SKILL.md +12 -0
  22. package/assets/init/.qfai/assistant/skills/qfai-tdd-green/SKILL.md +12 -0
  23. package/assets/init/.qfai/assistant/skills/qfai-tdd-red/SKILL.md +12 -0
  24. package/assets/init/.qfai/assistant/skills/qfai-tdd-refactor/SKILL.md +12 -0
  25. package/assets/init/.qfai/assistant/skills/qfai-unit-test/SKILL.md +12 -0
  26. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +12 -0
  27. package/assets/init/.qfai/assistant/skills.local/README.md +26 -0
  28. package/assets/init/.qfai/discussions/README.md +83 -0
  29. package/assets/init/.qfai/require/README.md +103 -57
  30. package/assets/init/.qfai/require/actors.md +10 -0
  31. package/assets/init/.qfai/require/business-flows.md +17 -0
  32. package/assets/init/.qfai/require/glossary.md +7 -0
  33. package/assets/init/.qfai/require/require.md +41 -0
  34. package/assets/init/.qfai/specs/README.md +79 -78
  35. package/assets/init/.qfai/templates/spec/delta.md +73 -0
  36. package/assets/init/.qfai/waivers.yml +12 -0
  37. package/assets/init/root/.claude/commands/qfai-atdd.md +3 -3
  38. package/assets/init/root/.claude/commands/qfai-configure.md +3 -3
  39. package/assets/init/root/.claude/commands/qfai-discuss.md +3 -3
  40. package/assets/init/root/.claude/commands/qfai-implement.md +14 -0
  41. package/assets/init/root/.claude/commands/qfai-pr.md +14 -0
  42. package/assets/init/root/.claude/commands/qfai-prototyping.md +3 -3
  43. package/assets/init/root/.claude/commands/qfai-require.md +3 -3
  44. package/assets/init/root/.claude/commands/qfai-scenario-test.md +14 -0
  45. package/assets/init/root/.claude/commands/qfai-spec.md +3 -3
  46. package/assets/init/root/.claude/commands/qfai-tdd-green.md +3 -3
  47. package/assets/init/root/.claude/commands/qfai-tdd-red.md +3 -3
  48. package/assets/init/root/.claude/commands/qfai-tdd-refactor.md +3 -3
  49. package/assets/init/root/.claude/commands/qfai-unit-test.md +14 -0
  50. package/assets/init/root/.claude/commands/qfai-verify.md +3 -3
  51. package/assets/init/root/.codex/README.md +6 -5
  52. package/assets/init/root/.codex/skills/qfai-atdd/SKILL.md +3 -3
  53. package/assets/init/root/.codex/skills/qfai-configure/SKILL.md +3 -3
  54. package/assets/init/root/.codex/skills/qfai-discuss/SKILL.md +3 -3
  55. package/assets/init/root/.codex/skills/qfai-implement/SKILL.md +18 -0
  56. package/assets/init/root/.codex/skills/qfai-pr/SKILL.md +18 -0
  57. package/assets/init/root/.codex/skills/qfai-prototyping/SKILL.md +3 -3
  58. package/assets/init/root/.codex/skills/qfai-require/SKILL.md +3 -3
  59. package/assets/init/root/.codex/skills/qfai-scenario-test/SKILL.md +18 -0
  60. package/assets/init/root/.codex/skills/qfai-spec/SKILL.md +3 -3
  61. package/assets/init/root/.codex/skills/qfai-tdd-green/SKILL.md +3 -3
  62. package/assets/init/root/.codex/skills/qfai-tdd-red/SKILL.md +3 -3
  63. package/assets/init/root/.codex/skills/qfai-tdd-refactor/SKILL.md +3 -3
  64. package/assets/init/root/.codex/skills/qfai-unit-test/SKILL.md +18 -0
  65. package/assets/init/root/.codex/skills/qfai-verify/SKILL.md +3 -3
  66. package/assets/init/root/.github/PULL_REQUEST_TEMPLATE.md +70 -0
  67. package/assets/init/root/.github/copilot-instructions.md +4 -2
  68. package/assets/init/root/.github/prompts/qfai-atdd.prompt.md +1 -1
  69. package/assets/init/root/.github/prompts/qfai-configure.prompt.md +1 -1
  70. package/assets/init/root/.github/prompts/qfai-discuss.prompt.md +1 -1
  71. package/assets/init/root/.github/prompts/qfai-implement.prompt.md +17 -0
  72. package/assets/init/root/.github/prompts/qfai-pr.prompt.md +17 -0
  73. package/assets/init/root/.github/prompts/qfai-prototyping.prompt.md +1 -1
  74. package/assets/init/root/.github/prompts/qfai-require.prompt.md +1 -1
  75. package/assets/init/root/.github/prompts/qfai-scenario-test.prompt.md +17 -0
  76. package/assets/init/root/.github/prompts/qfai-spec.prompt.md +1 -1
  77. package/assets/init/root/.github/prompts/qfai-tdd-green.prompt.md +1 -1
  78. package/assets/init/root/.github/prompts/qfai-tdd-red.prompt.md +1 -1
  79. package/assets/init/root/.github/prompts/qfai-tdd-refactor.prompt.md +1 -1
  80. package/assets/init/root/.github/prompts/qfai-unit-test.prompt.md +17 -0
  81. package/assets/init/root/.github/prompts/qfai-verify.prompt.md +1 -1
  82. package/assets/init/root/qfai.config.yaml +1 -0
  83. package/dist/cli/index.cjs +2896 -589
  84. package/dist/cli/index.cjs.map +1 -1
  85. package/dist/cli/index.mjs +2896 -589
  86. package/dist/cli/index.mjs.map +1 -1
  87. package/dist/index.cjs +2892 -586
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.cts +72 -1
  90. package/dist/index.d.ts +72 -1
  91. package/dist/index.mjs +2897 -591
  92. package/dist/index.mjs.map +1 -1
  93. package/package.json +1 -1
package/README.md CHANGED
@@ -31,15 +31,13 @@ npx qfai report
31
31
  ## What you can do (CLI commands)
32
32
 
33
33
  - `npx qfai init`
34
- - Creates the QFAI workspace under `.qfai/` (requirements/specs/contracts/report) and installs the AI assistant kit (`assistant/` with prompts, instructions, agents, and steering templates for product/tech/structure/manifest), plus a default GitHub Actions workflow and `qfai.config.yaml`.
34
+ - Creates the QFAI workspace under `.qfai/` (requirements/specs/contracts/report) and installs the AI assistant kit (`assistant/` with prompts, instructions, agents, and steering templates), plus a default GitHub Actions workflow and `qfai.config.yaml`.
35
35
  - `npx qfai validate`
36
36
  - Validates specs/contracts/scenarios/traceability and writes `.qfai/report/validate.json`; use `--fail-on error` (or `--fail-on warning`) to turn it into a CI gate, and `--format github` to emit GitHub-friendly annotations.
37
37
  - `npx qfai report`
38
38
  - Produces a human-readable report (`report.md` by default) or an internal JSON export (`report.json`) from `validate.json`; use `--base-url` to link file paths in Markdown to your repository viewer.
39
39
  - `npx qfai doctor`
40
40
  - Diagnoses configuration discovery, path resolution, glob scanning, and `validate.json` inputs before running validate/report; use `--fail-on` to enforce failures in CI.
41
- - `npx qfai guardrails`
42
- - Lists, extracts, or checks Decision Guardrails in `delta.md` (`list` / `extract` / `check`); use `--path` to point at target files/directories or custom locations.
43
41
 
44
42
  ## Operating model (prompt-driven workflow)
45
43
 
@@ -57,17 +55,15 @@ The agent reads QFAI assets under `.qfai/assistant/` and produces or updates SDD
57
55
 
58
56
  QFAI includes a small set of custom prompts (stored under `.qfai/assistant/prompts/`) designed to keep the workflow opinionated and repeatable.
59
57
 
60
- - **qfai-configure**: Analyze the repository (language, frameworks, test layout, directory structure) and update steering (`product.md`, `tech.md`, `structure.md`, `manifest.md`) plus `qfai.config.yaml` with a minimal diff (especially `testFileGlobs`, and optionally `validation.require.specSections` when you want strict headings). Run this once right after `npx qfai init`, and re-run it when the repository structure changes or when you want to enforce required spec headings. Output: updated steering + YAML + validation checklist.
61
- - **qfai-discuss**: Turn an idea into clear requirements via pre-knowledge research, a full question draft, and one-question-at-a-time discussion of scope, constraints, risks, and open questions.
62
- - **qfai-require**: Produce `require.md` in the requirements directory from your idea or discussion output.
58
+ - **qfai-configure**: Analyze the repository (language, frameworks, test layout, directory structure) and tailor `qfai.config.yaml` accordingly (especially `testFileGlobs`). Run this once right after `npx qfai init`, and re-run it when the repository structure changes.
59
+ - **qfai-discuss**: Turn an idea into clear requirements by discussing scope, constraints, risks, and open questions.
60
+ - **qfai-require**: Produce `.qfai/require/require.md` from your idea or discussion output.
63
61
  - **qfai-spec**: Produce `.qfai/specs/*` and `.qfai/contracts/*` from the requirements, including traceability scaffolding.
64
- - Includes a preflight step that bootstraps missing `qfai.config.yaml` and `assistant/steering/*` when run directly after init.
65
- - **qfai-prototyping**: Implement a minimal runnable skeleton (UI + API + DB) from contracts before test automation. Run after `/qfai-spec` to ensure the app is runnable with `pnpm dev` (or equivalent) before writing tests.
66
- - **qfai-atdd**: Implement acceptance tests (E2E/API/Integration), enforce layer floors, and drive Coverage Ledger to 100% (sub-agents required when supported).
67
- - **qfai-tdd-red**: Implement fast tests first (unit/component) and drive Unit/Component Scenario Coverage to 100% using a Coverage Ledger.
68
- - **qfai-tdd-green**: Implement production code to make the tests pass.
69
- - **qfai-tdd-refactor**: Refactor safely after tests are green.
62
+ - **qfai-scenario-test**: Implement acceptance tests (ATDD) driven by specs/scenarios.
63
+ - **qfai-unit-test**: Implement unit tests (TDD) driven by specs/scenarios.
64
+ - **qfai-implement**: Implement the feature; iterate test→fix until all quality gates are green.
70
65
  - **qfai-verify**: Run/interpret the local quality gates and produce a PR-ready summary.
66
+ - **qfai-pr**: Draft a PR description aligned with the repository’s PR template.
71
67
 
72
68
  ### Workflow sequence (example)
73
69
 
@@ -86,7 +82,7 @@ R-->>U: .qfai kit installed (prompts, instructions, agents)
86
82
 
87
83
  U->>AG: Run /qfai-configure
88
84
  AG->>Q: Read .qfai/assistant/prompts/qfai-configure.md
89
- AG->>R: Update qfai.config.yaml (testFileGlobs, optional specSections)
85
+ AG->>R: Update qfai.config.yaml (testFileGlobs, etc.)
90
86
  AG-->>U: Config tuned to this repo
91
87
 
92
88
  opt If you only have an idea
@@ -100,38 +96,27 @@ AG->>R: Create/Update requirements docs
100
96
  AG-->>U: Requirements ready
101
97
 
102
98
  U->>AG: Run /qfai-spec
103
- Note over U,AG: /qfai-spec performs a preflight to converge config/steering when /qfai-configure is skipped.
104
99
  AG->>Q: Read .qfai/assistant/prompts/qfai-spec.md
105
100
  AG->>R: Create specs + contracts + scenario.feature
106
101
  AG-->>U: SDD artifacts ready
107
102
 
108
- U->>AG: Run /qfai-prototyping
109
- AG->>Q: Read .qfai/assistant/prompts/qfai-prototyping.md
110
- AG->>R: Implement minimal runnable skeleton (UI + API + DB)
111
- AG-->>U: Runnable prototype ready (dev server starts)
103
+ U->>AG: Run /qfai-scenario-test
104
+ AG->>Q: Read .qfai/assistant/prompts/qfai-scenario-test.md
105
+ AG->>R: Implement acceptance tests
106
+ AG-->>U: Scenario tests ready
112
107
 
113
- U->>AG: Run /qfai-atdd
114
- AG->>Q: Read .qfai/assistant/prompts/qfai-atdd.md
115
- AG->>R: Implement acceptance tests (3 layers + floors)
116
- AG-->>U: Acceptance tests ready
108
+ U->>AG: Run /qfai-unit-test
109
+ AG->>Q: Read .qfai/assistant/prompts/qfai-unit-test.md
110
+ AG->>R: Implement unit tests
111
+ AG-->>U: Unit tests ready
117
112
 
118
- U->>AG: Run /qfai-tdd-red
119
- AG->>Q: Read .qfai/assistant/prompts/qfai-tdd-red.md
120
- AG->>R: Implement fast tests (RED)
121
- AG-->>U: RED tests ready
122
-
123
- U->>AG: Run /qfai-tdd-green
124
- AG->>Q: Read .qfai/assistant/prompts/qfai-tdd-green.md
113
+ U->>AG: Run /qfai-implement
114
+ AG->>Q: Read .qfai/assistant/prompts/qfai-implement.md
125
115
  loop Implement and fix until green
126
116
  AG->>R: Implement code changes
127
117
  AG->>R: Run project tests locally
128
118
  end
129
- AG-->>U: Working implementation (tests green)
130
-
131
- U->>AG: Run /qfai-tdd-refactor
132
- AG->>Q: Read .qfai/assistant/prompts/qfai-tdd-refactor.md
133
- AG->>R: Refactor safely
134
- AG-->>U: Refactor complete
119
+ AG-->>U: Working implementation (quality gates passing)
135
120
 
136
121
  U->>R: Run npx qfai validate
137
122
  U->>R: Run npx qfai report
@@ -141,85 +126,41 @@ R-->>U: Traceability checks and report artifacts
141
126
  Operational notes.
142
127
 
143
128
  - Each custom prompt must output in the user’s language (absolute requirement).
144
- - Prompts must consult instructions/steering and delta.md; rejected options must not be reintroduced without a [RE-OPEN] Decision Record.
145
129
  - Except `qfai-discuss`, each prompt must analyze the project context (architecture, tech stack, test framework, repo structure) before generating artifacts or code.
146
- - Prompts must delegate work to role-based sub-agents when supported; Orchestrator does not implement and Reviewer is non-edit.
147
- - /qfai-atdd and /qfai-tdd-red must maintain a Coverage Ledger and do not declare completion until 100% implemented (exceptions require DR + approval).
130
+ - Prompts should delegate work to multiple role-based sub-agents (Planner, Architect, Contract Designer, QA, Code Reviewer, etc.) to emulate a real delivery flow.
131
+ - Change classification (Primary/Tags) is required in delta.md and recommended in PRs. See `.qfai/assistant/instructions/change-classification.md`.
132
+ - Verification planning is recorded in `delta.md` (`Verification -> Plan`) and validated in CI (`VFY-*` rules).
148
133
 
149
134
  ## Configuration
150
135
 
151
- Configuration is stored at the repository root as `qfai.config.yaml`.
152
- Most projects only customize `paths` and `validation.traceability`.
153
- `.qfai/require` is currently a fixed location (not configurable).
136
+ Configuration is stored at the repository root as `qfai.config.yaml`; you can change paths, traceability policies, and CI gate thresholds.
154
137
 
155
- Example: a schema-valid configuration.
138
+ Example: override paths and traceability globs.
156
139
 
157
140
  ```yaml
158
141
  paths:
159
- specsDir: .qfai/specs
160
142
  contractsDir: .qfai/contracts
143
+ specsDir: .qfai/specs
144
+ requireDir: .qfai/require
161
145
  outDir: .qfai/report
162
146
  promptsDir: .qfai/assistant/prompts
163
147
  srcDir: src
164
148
  testsDir: tests
165
-
166
149
  validation:
167
150
  failOn: error # error | warning | never
168
151
  traceability:
169
152
  testFileGlobs:
170
153
  - "src/**/*.test.ts"
171
154
  - "tests/**/*.spec.ts"
172
- - "features/**/*.feature"
173
155
  testFileExcludeGlobs:
174
156
  - "**/fixtures/**"
175
157
  scMustHaveTest: true
176
158
  scNoTestSeverity: warning # error | warning
177
-
178
- output:
179
- validateJsonPath: .qfai/report/validate.json
180
- ```
181
-
182
- ### Spec validation (BR lines and required sections)
183
-
184
- BR lines are required and must use the format `- [BR-0001-0001][P1] ...` (priority P0-P3). Headings can be in any language.
185
- AC lines are supported with the format `- [AC-0001-0001] Given/When/Then ... (CASE-0001-0001)`.
186
- `validation.require.specSections` controls required H2 section titles in `spec.md`. The default is an empty list to support multi-language specs.
187
- If you want strict required headings, run `/qfai-configure` and specify your desired spec template headings.
188
-
189
- Example (Japanese):
190
-
191
- ```yaml
192
- validation:
193
- require:
194
- specSections:
195
- - 背景
196
- - スコープ
197
- - 非ゴール
198
- - 用語
199
- - 前提
200
- - 決定事項
201
- - 業務ルール
202
- ```
203
-
204
- Example (English):
205
-
206
- ```yaml
207
- validation:
208
- require:
209
- specSections:
210
- - Background
211
- - Scope
212
- - Non-goals
213
- - Glossary
214
- - Assumptions
215
- - Decisions
216
- - Business Rules
217
159
  ```
218
160
 
219
161
  Notes.
220
162
 
221
163
  - `validate.json`, `report.json`, and `doctor.json` are internal exports and are not a stable external contract; prefer `report.md` for integrations that must survive tool upgrades.
222
- - `--strict` is a CLI option for `qfai validate` (treat warnings as failures); it is not a YAML setting.
223
164
  - Scenario files are expected to use the Gherkin extension `*.feature` (not `*.md`).
224
165
 
225
166
  ## Specifications and contracts (SDD)
@@ -233,25 +174,9 @@ QFAI uses a small, opinionated set of artifacts to reduce ambiguity and prevent
233
174
  - API contracts: YAML (`.yaml` / `.yml`)
234
175
  - DB contracts: SQL (`.sql`)
235
176
  - Scenarios (ATDD): Gherkin `.feature` files
236
- - Delta: append-only Change Log + Decision Records (selected/rejected; RE-OPEN required to revisit rejected options)
237
177
 
238
178
  Traceability is validated across these artifacts, so code changes remain grounded in the specs and the tests prove compliance.
239
179
 
240
- Traceability evidence can be provided in two ways:
241
-
242
- - `QFAI:SC-XXXX-XXXX` annotations inside test code
243
- - `@SC-XXXX-XXXX` tags inside `.feature` files (Cucumber-style acceptance tests)
244
-
245
- ### Test strategy tags (optional)
246
-
247
- You can annotate scenarios with lightweight test strategy metadata to keep the test pyramid/trophy healthy.
248
- These tags are opt-in and only produce warnings, so you can roll them out gradually without breaking existing specs.
249
-
250
- - Layer tags: `@layer-unit`, `@layer-component`, `@layer-integration`, `@layer-api`, `@layer-e2e`
251
- - Size tags: `@size-s`, `@size-m`, `@size-l`
252
-
253
- Traceability enforcement is layer-aware: once any SC in a layer has test evidence, coverage for that layer becomes mandatory; layers without evidence are deferred until tests exist.
254
-
255
180
  ## Continuous integration (GitHub Actions)
256
181
 
257
182
  (GitHub Actions)
@@ -260,21 +185,9 @@ Traceability enforcement is layer-aware: once any SC in a layer has test evidenc
260
185
 
261
186
  What works out-of-the-box.
262
187
 
263
- - The generated workflow runs without installing repository dependencies; it only executes `npx qfai validate --fail-on error`, so it works even if your repo is not a Node project.
264
- - The default workflow does not enable `actions/setup-node` caching, so it does not require a lockfile.
265
- - If you want to pin the QFAI version, install your repo dependencies (e.g., to run tests), or enable dependency caching, customize the workflow accordingly.
188
+ - The generated workflow is npm-oriented (`npm ci`); if your repository uses pnpm/yarn/bun, replace the install/cache steps accordingly.
266
189
  - The default validate gate fails only on `error`; use `--fail-on warning` or `--strict` if you want a stricter gate.
267
190
 
268
- Optional cache example (requires a lockfile):
269
-
270
- ```yaml
271
- - uses: actions/setup-node@v4
272
- with:
273
- node-version: 20
274
- cache: npm
275
- # cache-dependency-path: package-lock.json
276
- ```
277
-
278
191
  Typical customizations.
279
192
 
280
193
  - Add a second job to generate `report.md` from the uploaded `validate.json`.
@@ -291,12 +204,12 @@ Typical customizations.
291
204
  │ └── commands
292
205
  │ ├── qfai-configure.md
293
206
  │ ├── qfai-discuss.md
294
- │ ├── qfai-atdd.md
207
+ │ ├── qfai-implement.md
208
+ │ ├── qfai-pr.md
295
209
  │ ├── qfai-require.md
210
+ │ ├── qfai-scenario-test.md
296
211
  │ ├── qfai-spec.md
297
- │ ├── qfai-tdd-green.md
298
- │ ├── qfai-tdd-red.md
299
- │ ├── qfai-tdd-refactor.md
212
+ │ ├── qfai-unit-test.md
300
213
  │ └── qfai-verify.md
301
214
  ├── .codex
302
215
  │ └── skills
@@ -304,17 +217,17 @@ Typical customizations.
304
217
  │ │ └── SKILL.md
305
218
  │ ├── qfai-discuss
306
219
  │ │ └── SKILL.md
307
- │ ├── qfai-atdd
220
+ │ ├── qfai-implement
308
221
  │ │ └── SKILL.md
309
- │ ├── qfai-require
222
+ │ ├── qfai-pr
310
223
  │ │ └── SKILL.md
311
- │ ├── qfai-spec
224
+ │ ├── qfai-require
312
225
  │ │ └── SKILL.md
313
- │ ├── qfai-tdd-green
226
+ │ ├── qfai-scenario-test
314
227
  │ │ └── SKILL.md
315
- │ ├── qfai-tdd-red
228
+ │ ├── qfai-spec
316
229
  │ │ └── SKILL.md
317
- │ ├── qfai-tdd-refactor
230
+ │ ├── qfai-unit-test
318
231
  │ │ └── SKILL.md
319
232
  │ └── qfai-verify
320
233
  │ └── SKILL.md
@@ -322,16 +235,17 @@ Typical customizations.
322
235
  │ ├── prompts
323
236
  │ │ ├── qfai-configure.prompt.md
324
237
  │ │ ├── qfai-discuss.prompt.md
325
- │ │ ├── qfai-atdd.prompt.md
238
+ │ │ ├── qfai-implement.prompt.md
239
+ │ │ ├── qfai-pr.prompt.md
326
240
  │ │ ├── qfai-require.prompt.md
241
+ │ │ ├── qfai-scenario-test.prompt.md
327
242
  │ │ ├── qfai-spec.prompt.md
328
- │ │ ├── qfai-tdd-green.prompt.md
329
- │ │ ├── qfai-tdd-red.prompt.md
330
- │ │ ├── qfai-tdd-refactor.prompt.md
243
+ │ │ ├── qfai-unit-test.prompt.md
331
244
  │ │ └── qfai-verify.prompt.md
332
245
  │ ├── workflows
333
246
  │ │ └── qfai.yml
334
- └── copilot-instructions.md
247
+ ├── copilot-instructions.md
248
+ │ └── PULL_REQUEST_TEMPLATE.md
335
249
  ├── .qfai
336
250
  │ ├── assistant
337
251
  │ │ ├── agents
@@ -360,12 +274,12 @@ Typical customizations.
360
274
  │ │ │ ├── README.md
361
275
  │ │ │ ├── qfai-configure.md
362
276
  │ │ │ ├── qfai-discuss.md
363
- │ │ │ ├── qfai-atdd.md
277
+ │ │ │ ├── qfai-implement.md
278
+ │ │ │ ├── qfai-pr.md
364
279
  │ │ │ ├── qfai-require.md
280
+ │ │ │ ├── qfai-scenario-test.md
365
281
  │ │ │ ├── qfai-spec.md
366
- │ │ │ ├── qfai-tdd-green.md
367
- │ │ │ ├── qfai-tdd-red.md
368
- │ │ │ ├── qfai-tdd-refactor.md
282
+ │ │ │ ├── qfai-unit-test.md
369
283
  │ │ │ └── qfai-verify.md
370
284
  │ │ ├── prompts.local
371
285
  │ │ │ └── README.md
@@ -373,7 +287,6 @@ Typical customizations.
373
287
  │ │ │ ├── README.md
374
288
  │ │ │ ├── product.md
375
289
  │ │ │ ├── structure.md
376
- │ │ │ ├── manifest.md
377
290
  │ │ │ └── tech.md
378
291
  │ │ └── README.md
379
292
  │ ├── contracts
@@ -401,10 +314,12 @@ Typical customizations.
401
314
 
402
315
  - **GitHub Copilot prompt files**: `.github/prompts/*.prompt.md` (invoke from Copilot Chat as `/qfai-...`).
403
316
  - **GitHub Copilot repository instructions**: `.github/copilot-instructions.md` (baseline behavior guidance for Copilot in this repo).
404
- - **Claude Code slash commands**: `.claude/commands/*.md` (invoke as `/qfai-...`).
405
- - **OpenAI Codex skills**: `.codex/skills/*/SKILL.md` (invoke as Codex skills; each skill points to the canonical QFAI prompt).
317
+ - **Claude Code slash commands**: `.claude/commands/*.md` (invoke as `/qfai-...`; commands forward to `.qfai/assistant/skills/<id>/SKILL.md`).
318
+ - **OpenAI Codex skills**: `.codex/skills/*/SKILL.md` (invoke as Codex skills; each skill points to the canonical QFAI skill doc).
319
+
320
+ Each of these files is intentionally thin and forwards to the canonical source of truth under `.qfai/assistant/` (Copilot/Claude/Codex wrappers: `skills/` -> `prompts/` (SSOT in v1.3.x)).
406
321
 
407
- Each of these files is intentionally thin and forwards to the canonical source of truth under `.qfai/assistant/prompts/`.
322
+ Claude Code wrappers also use `skills/` as the entrypoint (v1.3.8+): `.claude/commands` -> `.qfai/assistant/skills/` -> `.qfai/assistant/prompts/` (SSOT in v1.3.x).
408
323
 
409
324
  ## Contributing (for QFAI maintainers)
410
325
 
@@ -25,21 +25,32 @@ flowchart TD
25
25
 
26
26
  > Formatting MUST follow the templates in each directory README.
27
27
  > Do not invent per-file formats.
28
+ > Requirements decomposition starts from **Actors** and **Business Flows** in `require/`.
29
+ > Keep `business-flows.md` as the top-level narrative backbone; derive REQ/SPEC/SCENARIO from BF steps.
28
30
 
29
31
  ## Directory map
30
32
 
31
33
  ```text
32
34
  .qfai/
33
35
  ├── README.md
36
+ ├── discussions/
37
+ │ ├── README.md
38
+ │ └── discuss-0001-<topic>.md # discussion log (decision/evidence)
34
39
  ├── assistant/
35
40
  │ ├── prompts/ # canonical prompts (SSOT)
36
41
  │ ├── prompts.local/ # minimal overrides (project-specific)
42
+ │ ├── skills/ # skill wrappers (experimental)
43
+ │ ├── skills.local/ # project-specific skill overrides
37
44
  │ ├── agents/ # sub-agent missions / guardrails
38
45
  │ ├── steering/ # project steering (inputs for prompts)
39
46
  │ └── instructions/ # tool/integration instructions
40
47
  ├── require/
41
48
  │ ├── README.md
42
- └── require.md # single requirements document
49
+ ├── glossary.md # terms (SSOT)
50
+ │ ├── actors.md # actor catalog (SSOT)
51
+ │ ├── business-flows.md # business flow catalog (SSOT)
52
+ │ ├── require.md # requirements (REQ-*) + BF coverage map
53
+ │ └── open-questions.md
43
54
  ├── contracts/
44
55
  │ ├── README.md
45
56
  │ ├── api/README.md # OpenAPI YAML style guide
@@ -53,6 +64,9 @@ flowchart TD
53
64
  │ ├── scenario.feature
54
65
  │ ├── case-catalogue.md
55
66
  │ └── traceability-matrix.md
67
+ ├── templates/
68
+ │ └── spec/
69
+ │ └── delta.md
56
70
  └── evidence/
57
71
  ├── README.md
58
72
  └── <prompt>-<run>.md # completion evidence (gitignored by default)
@@ -92,9 +106,18 @@ Evidence under `.qfai/evidence/` is **gitignored by default** (see repository `.
92
106
  Templates/samples MUST live only in `.qfai/**/README.md`.
93
107
  Prompts only **reference** them to avoid double maintenance.
94
108
 
109
+ ## Skills (experimental)
110
+
111
+ QFAI also ships an **assistant skills** tree at `assistant/skills/`.
112
+
113
+ Currently, these `SKILL.md` files are **thin wrappers** around the canonical prompts (SSOT remains `assistant/prompts/`).
114
+
115
+ Later versions will migrate SSOT from prompts to skills and update tool wrappers accordingly.
116
+
95
117
  ## Where to look next
96
118
 
97
119
  - Requirements format: `require/README.md`
98
120
  - Contracts format: `contracts/README.md` and sub-READMEs
99
121
  - Spec pack format: `specs/README.md`
122
+ - Change classification (Primary/Tags): `assistant/instructions/change-classification.md`
100
123
  - Evidence rules: `evidence/README.md`
@@ -0,0 +1,107 @@
1
+ # Change Classification (Primary / Tags)
2
+
3
+ To keep PR/design/review/test planning aligned, classify each change along two axes.
4
+
5
+ - **Primary**: choose exactly one main purpose (mutually exclusive).
6
+ - **Tags**: choose zero or more impacted surfaces.
7
+
8
+ This classification is used in:
9
+
10
+ - PR body (Change Classification)
11
+ - `.qfai/specs/*/delta.md` Metadata
12
+ - Review focus (QA / Architect / Code Reviewer)
13
+ - Test strategy (which layers to add/update)
14
+
15
+ ---
16
+
17
+ ## 1. Primary (choose exactly one)
18
+
19
+ Primary answers: "What is the main purpose of this change?"
20
+
21
+ | Primary | Meaning (short) | Typical examples | Expected tests/evidence |
22
+ | -------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
23
+ | **Initial** | New capability/artifact without changing existing behavior | New command/prompt, new spec pack template, new validator rule | New tests are expected. Update README/templates. |
24
+ | **Behavior** | User-observable output changes | `validate` results change, output format/defaults change, `init` artifacts change, config/contract changes | Regression tests + acceptance updates. Note migration/compat impact. |
25
+ | **Structural** | Internal changes with no external behavior change | Refactor, internal algorithm swap (same output), type cleanup, deduplication | Existing tests should still pass; show evidence of output stability. |
26
+ | **Ops** | Ops/dev/distribution changes (runtime behavior unchanged) | CI/release/packaging/scripts, docs-only, tests-only | Provide gate command evidence (format/lint/test/pack). |
27
+
28
+ ### Primary decision algorithm (for AI)
29
+
30
+ Pick the **first** that applies:
31
+
32
+ 1. **Behavior**: With the same inputs/assumptions, does user-observable output change?
33
+ - Example: validate error/warn changes, report output changes, `init` artifacts change, config defaults change, CLI options change.
34
+ 2. **Initial**: A new capability/artifact is added without changing existing behavior.
35
+ - Example: new guardrail check, new command, new template file.
36
+ 3. **Structural**: Internal structure changes but external behavior stays the same.
37
+ 4. **Ops**: None of the above; only CI/release/tooling/docs/tests.
38
+
39
+ #### Common pitfalls
40
+
41
+ - **`init` outputs** are user-observable. Usually **Behavior**; if only new files are added, **Initial**.
42
+ - **Config schema/defaults/allowed inputs** changes are **Behavior** (often with `@api`).
43
+ - **Log wording only** can be **Ops**, unless logs are part of an external contract.
44
+ - **Tests only** is **Ops** (`@test`), but if tests accompany behavior changes, Primary is **Behavior**.
45
+
46
+ ---
47
+
48
+ ## 2. Tags (multi-select)
49
+
50
+ Tags indicate which surfaces are affected. They do not replace Primary.
51
+
52
+ | Tag | Trigger condition | Examples |
53
+ | --------- | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
54
+ | **@api** | Public interfaces/contracts/inputs/outputs are involved | CLI options, `qfai.config.yaml` schema, public `validate.json` schema, contracts/specs formats |
55
+ | **@db** | Persisted data formats or DB contracts are involved | `.qfai/contracts/db/*`, SQL contracts, ledger formats, report data structure |
56
+ | **@nfr** | Non-functional goals (perf/reliability/security/operability) | Performance improvements, error/recovery changes, logging/observability, security fixes |
57
+ | **@docs** | Documentation/templates/guides change | README, guides, template explanations, rules clarification |
58
+ | **@test** | Tests/verification/CI strategy change | Tests added/updated, fixtures updated, gate command changes |
59
+
60
+ ### Tag selection (for AI)
61
+
62
+ - You may assign tags mechanically from file types.
63
+ - When in doubt, include the tag (over-tagging is safer than under-tagging).
64
+ - If only `@docs` and `@test` remain, re-check whether Primary should be **Ops**.
65
+
66
+ ---
67
+
68
+ ## 3. Where to declare (required)
69
+
70
+ ### 3.1 PR body
71
+
72
+ Include in the PR template:
73
+
74
+ - Primary: `Initial | Behavior | Structural | Ops`
75
+ - Tags: list from `@api @db @nfr @docs @test`
76
+ - Rationale (1-3 lines)
77
+
78
+ ### 3.2 delta.md
79
+
80
+ Include in each spec pack `delta.md` Metadata:
81
+
82
+ - Primary
83
+ - Tags
84
+
85
+ Include in each DL entry `#### Verification`:
86
+
87
+ - `### Plan` with one or more items (`id/level/target/method/owner/expected`)
88
+ - If `compat: Change`, `Verification.Plan` is required
89
+
90
+ ---
91
+
92
+ ## 4. Examples
93
+
94
+ ### Example 1: Fix a validate misclassification bug
95
+
96
+ - Primary: **Behavior** (results change)
97
+ - Tags: **@api @test** (public output + tests)
98
+
99
+ ### Example 2: Parser refactor (output unchanged)
100
+
101
+ - Primary: **Structural**
102
+ - Tags: **@nfr @test** (quality/maintainability; add regression tests if needed)
103
+
104
+ ### Example 3: README-only update
105
+
106
+ - Primary: **Ops**
107
+ - Tags: **@docs**
@@ -0,0 +1,75 @@
1
+ # Requirements Decomposition (SSOT)
2
+
3
+ ## Purpose
4
+
5
+ Define a **repeatable decomposition** from top-level domain context to requirements, specs, and tests.
6
+
7
+ This document is the **decision rule SSOT** for AI and humans when answering:
8
+
9
+ - "What is the top-level structure?"
10
+ - "How do we break down work into spec packs?"
11
+ - "How do we keep traceability stable?"
12
+
13
+ ## Canonical order (top -> down)
14
+
15
+ 1. **Glossary** (`require/glossary.md`)
16
+ 2. **Actors** (`require/actors.md`)
17
+ 3. **Business flows** (`require/business-flows.md`)
18
+ 4. **Requirements** (`require/require.md`)
19
+ 5. **Spec packs** (`specs/spec-*/spec.md`, `delta.md`, `scenario.feature`, `case-catalogue.md`, `traceability-matrix.md`)
20
+ 6. **ATDD / TDD** (tests + code)
21
+
22
+ ## Decision rules
23
+
24
+ ### Rule 1 - Always anchor scope to Business Flow steps
25
+
26
+ - A spec pack MUST be a slice of **one or more BF steps**.
27
+ - If a BF step is in scope, it MUST be covered by:
28
+ - a requirement (`REQ-*`) and/or
29
+ - a spec pack (`spec-*`) and/or
30
+ - an explicit Out-of-scope row in the Coverage Map.
31
+
32
+ ### Rule 2 - Use actors to remove ambiguity
33
+
34
+ When writing requirements/specs/scenarios, explicitly name:
35
+
36
+ - the primary actor who initiates the interaction
37
+ - any supporting actors (external services, humans, systems)
38
+
39
+ If an actor is missing, add it to `actors.md` before proceeding.
40
+
41
+ ### Rule 3 - Keep Glossary small but authoritative
42
+
43
+ - Add terms only if they reduce ambiguity or avoid inconsistent naming.
44
+ - Prefer **one term** with synonyms over multiple near-duplicate terms.
45
+ - When a term changes meaning, record the decision in a discussion log.
46
+
47
+ ## How to decompose (mechanical procedure)
48
+
49
+ 1. Draft **Actors** (Primary / Supporting / System).
50
+ 2. Draft **Business Flow backbone**:
51
+ - 5-15 steps per flow is a useful target.
52
+ - Each step should be a verb phrase and observable.
53
+ 3. For each in-scope BF step, draft:
54
+ - a candidate user story (optional; can remain implicit)
55
+ - one or more atomic **REQ-FUNC** items (EARS style recommended)
56
+ - any **REQ-NFR** needed for the step
57
+ 4. Group BF steps into spec packs:
58
+ - Aim for 1-3 scenarios per spec pack.
59
+ - Split when scenarios exceed that or when the slice spans multiple distinct user goals.
60
+ 5. In each spec pack:
61
+ - Reference BF step IDs and actor IDs in `spec.md` Context.
62
+ - Ensure traceability matrix includes BF step IDs.
63
+
64
+ ## Examples
65
+
66
+ ### Example: One BF step -> one spec pack
67
+
68
+ - BF step: `BF-0003-S02 User submits validation request`
69
+ - Spec pack: `spec-0012`
70
+ - Context: Actor `ACT-0001 Developer`
71
+ - Traceability: `BF-0003-S02 -> REQ-FUNC-0044 -> spec-0012 -> SC-0012-01`
72
+
73
+ ## Non-goals
74
+
75
+ - BPMN diagrams are NOT required (text-first). If you add diagrams, they are optional evidence, not SSOT.
@@ -21,6 +21,7 @@ mode: interactive-by-default
21
21
  ## FORMAT SSOT (Mandatory)
22
22
 
23
23
  - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/discussions/README.md`
24
25
  - `.qfai/require/README.md`
25
26
  - `.qfai/specs/README.md`
26
27
  - `.qfai/contracts/**/README.md`
@@ -86,6 +87,7 @@ Turn a vague idea into explicit, testable requirements and decisions that downst
86
87
  ## Mandatory Outputs
87
88
 
88
89
  - Requirements Seed
90
+ - Draft catalogs (in the discuss record): **Actors (ACT-\*)**, **Business Flows (BF-\* + step IDs)**, **Glossary seeds (TERM-\*)**
89
91
  - Decision Table (with rejected/deferred options)
90
92
  - Discuss record: `.qfai/discussions/discuss-XXXX.md`
91
93
  - Evidence file: `.qfai/evidence/discuss-<discuss-id>.md`
@@ -94,6 +96,7 @@ Turn a vague idea into explicit, testable requirements and decisions that downst
94
96
  ## Success Criteria (Definition of Done)
95
97
 
96
98
  - A “Requirements Seed” exists: goals, non-goals, constraints, acceptance criteria (high level), and open questions.
99
+ - Draft **Actors / Business Flows / Glossary seeds** exist with stable IDs in the discuss record.
97
100
  - The output is ready to be fed into **/qfai-require** with minimal further clarification.
98
101
  - A **discuss record** is saved to `.qfai/discussions/discuss-XXXX.md` with all decisions and candidates.
99
102
  - Evidence file exists: `.qfai/evidence/discuss-<discuss-id>.md`.