qfai 1.2.6 → 1.2.8

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 (28) hide show
  1. package/README.md +6 -0
  2. package/assets/init/.qfai/README.md +84 -44
  3. package/assets/init/.qfai/assistant/prompts/qfai-atdd.md +11 -0
  4. package/assets/init/.qfai/assistant/prompts/qfai-configure.md +11 -0
  5. package/assets/init/.qfai/assistant/prompts/qfai-discuss.md +11 -0
  6. package/assets/init/.qfai/assistant/prompts/qfai-prototyping.md +157 -0
  7. package/assets/init/.qfai/assistant/prompts/qfai-require.md +11 -0
  8. package/assets/init/.qfai/assistant/prompts/qfai-spec.md +11 -0
  9. package/assets/init/.qfai/assistant/prompts/qfai-tdd-green.md +11 -0
  10. package/assets/init/.qfai/assistant/prompts/qfai-tdd-red.md +11 -0
  11. package/assets/init/.qfai/assistant/prompts/qfai-tdd-refactor.md +11 -0
  12. package/assets/init/.qfai/assistant/prompts/qfai-verify.md +11 -0
  13. package/assets/init/.qfai/assistant/prompts.local/README.md +7 -16
  14. package/assets/init/.qfai/contracts/README.md +31 -24
  15. package/assets/init/.qfai/contracts/api/README.md +50 -11
  16. package/assets/init/.qfai/contracts/db/README.md +16 -13
  17. package/assets/init/.qfai/contracts/ui/README.md +19 -14
  18. package/assets/init/.qfai/evidence/README.md +50 -14
  19. package/assets/init/.qfai/require/README.md +84 -10
  20. package/assets/init/.qfai/specs/README.md +312 -51
  21. package/assets/init/root/.claude/commands/qfai-prototyping.md +14 -0
  22. package/assets/init/root/.codex/skills/qfai-prototyping/SKILL.md +18 -0
  23. package/assets/init/root/.github/prompts/qfai-prototyping.prompt.md +17 -0
  24. package/dist/cli/index.cjs +2 -2
  25. package/dist/cli/index.mjs +2 -2
  26. package/dist/index.cjs +2 -2
  27. package/dist/index.mjs +2 -2
  28. package/package.json +1 -1
package/README.md CHANGED
@@ -62,6 +62,7 @@ QFAI includes a small set of custom prompts (stored under `.qfai/assistant/promp
62
62
  - **qfai-require**: Produce `require.md` in the requirements directory from your idea or discussion output.
63
63
  - **qfai-spec**: Produce `.qfai/specs/*` and `.qfai/contracts/*` from the requirements, including traceability scaffolding.
64
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.
65
66
  - **qfai-atdd**: Implement acceptance tests (E2E/API/Integration) and drive Scenario Coverage to 100% using a Coverage Ledger.
66
67
  - **qfai-tdd-red**: Implement fast tests first (unit/component) and drive Unit/Component Scenario Coverage to 100% using a Coverage Ledger.
67
68
  - **qfai-tdd-green**: Implement production code to make the tests pass.
@@ -104,6 +105,11 @@ AG->>Q: Read .qfai/assistant/prompts/qfai-spec.md
104
105
  AG->>R: Create specs + contracts + scenario.feature
105
106
  AG-->>U: SDD artifacts ready
106
107
 
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)
112
+
107
113
  U->>AG: Run /qfai-atdd
108
114
  AG->>Q: Read .qfai/assistant/prompts/qfai-atdd.md
109
115
  AG->>R: Implement acceptance tests
@@ -1,60 +1,100 @@
1
- # .qfai
1
+ # .qfai (QFAI Workspace)
2
2
 
3
3
  ## Purpose
4
4
 
5
- `.qfai` is the workspace where QFAI artifacts live so requirements, contracts, specs, and reports stay aligned.
5
+ `.qfai/` is the **single workspace** for QFAI artifacts so that requirements, contracts, spec packs, and automation stay aligned and traceable.
6
6
 
7
- ## What belongs here
7
+ This folder is generated by `qfai init`. It is designed to be:
8
8
 
9
- - Assistant assets (prompts, instructions, steering, roles)
10
- - Requirements (single requirements document)
11
- - Contracts (api/db/ui)
12
- - Spec packs (spec.md, delta.md, scenario.feature)
13
- - Evidence files (prompt completion records)
14
- - Generated reports (validate/report/doctor outputs)
9
+ - **predictable** (stable file layout),
10
+ - **reviewable** (human-readable Markdown/YAML/SQL),
11
+ - **machine-checkable** (validators enforce minimal structural rules).
15
12
 
16
- ## What does not belong here
13
+ ## Recommended QFAI sequence (project)
17
14
 
18
- - Application source code
19
- - Generated tests or build artifacts
20
- - Ad-hoc notes outside the defined structure
15
+ ```mermaid
16
+ flowchart TD
17
+ A[/qfai-discuss/] --> B[/qfai-require/]
18
+ B --> C[/qfai-spec/]
19
+ C --> D[/qfai-prototyping/]
20
+ D --> E[/qfai-atdd/]
21
+ E --> F[/qfai-tdd-red/]
22
+ F --> G[/qfai-tdd-green/]
23
+ G --> H[/qfai-tdd-refactor/]
24
+ ```
25
+
26
+ > Formatting MUST follow the templates in each directory README.
27
+ > Do not invent per-file formats.
21
28
 
22
- ## Structure (overview)
29
+ ## Directory map
23
30
 
24
31
  ```text
25
32
  .qfai/
26
- README.md
27
- assistant/
28
- agents/
29
- instructions/
30
- prompts/
31
- prompts.local/
32
- steering/
33
- contracts/
34
- README.md
35
- api/
36
- db/
37
- ui/
38
- require/
39
- README.md
40
- <requirements document created by /qfai-require>
41
- evidence/
42
- <prompt evidence files>
43
- specs/
44
- README.md
45
- <spec packs>
46
- report/
47
- <generated by qfai validate/report/doctor>
33
+ ├── README.md
34
+ ├── assistant/
35
+ │ ├── prompts/ # canonical prompts (SSOT)
36
+ │ ├── prompts.local/ # minimal overrides (project-specific)
37
+ │ ├── agents/ # sub-agent missions / guardrails
38
+ │ ├── steering/ # project steering (inputs for prompts)
39
+ │ └── instructions/ # tool/integration instructions
40
+ ├── require/
41
+ │ ├── README.md
42
+ │ └── require.md # single requirements document
43
+ ├── contracts/
44
+ │ ├── README.md
45
+ │ ├── api/README.md # OpenAPI YAML style guide
46
+ │ ├── db/README.md # SQL contracts style guide
47
+ │ └── ui/README.md # UI contract YAML style guide
48
+ ├── specs/
49
+ │ ├── README.md
50
+ │ └── spec-0001/
51
+ │ ├── spec.md
52
+ │ ├── delta.md
53
+ │ ├── scenario.feature
54
+ │ ├── case-catalogue.md
55
+ │ └── traceability-matrix.md
56
+ └── evidence/
57
+ ├── README.md
58
+ └── <prompt>-<run>.md # completion evidence (gitignored by default)
48
59
  ```
49
60
 
50
- ## Operating rules
61
+ ## Rules (global)
62
+
63
+ ### R1. README-as-SSOT for formatting
64
+
65
+ Each directory `README.md` defines:
66
+
67
+ - required files,
68
+ - canonical **template**,
69
+ - realistic **sample**,
70
+ - quality checklist,
71
+ - anti-patterns.
72
+
73
+ All custom prompts must:
74
+
75
+ 1. read the relevant directory README(s),
76
+ 2. generate artifacts matching their templates,
77
+ 3. run a self-check before declaring completion.
78
+
79
+ ### R2. Evidence is not versioned by default
80
+
81
+ Evidence under `.qfai/evidence/` is **gitignored by default** (see repository `.gitignore` and/or project `.git/info/exclude`).
82
+
83
+ - Evidence is still useful locally and in PR review (attach or paste snippets), but it should not pollute version control.
84
+
85
+ ### R3. Keep artifacts atomic
86
+
87
+ - Prefer many small, stable identifiers (REQ/BR/AC/CASE/SC) over long paragraphs that hide multiple rules.
88
+ - If a statement contains multiple independent “must” clauses, split it.
89
+
90
+ ### R4. Do not put templates in prompts
51
91
 
52
- - READMEs are reference guides; do not edit them during execution. Raise Open Questions instead.
53
- - Create new artifacts only in the intended directories.
54
- - Always run the repo's gates before declaring completion.
92
+ Templates/samples MUST live only in `.qfai/**/README.md`.
93
+ Prompts only **reference** them to avoid double maintenance.
55
94
 
56
- ## Checklist
95
+ ## Where to look next
57
96
 
58
- - [ ] I used the correct directory for each artifact
59
- - [ ] I did not edit README files
60
- - [ ] I ran the repository gate commands and recorded results
97
+ - Requirements format: `require/README.md`
98
+ - Contracts format: `contracts/README.md` and sub-READMEs
99
+ - Spec pack format: `specs/README.md`
100
+ - Evidence rules: `evidence/README.md`
@@ -18,6 +18,17 @@ mode: execution-focused
18
18
 
19
19
  # /qfai-atdd — Implement Automated Acceptance Tests (ATDD)
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Do NOT declare completion based on unit/component tests.
@@ -18,6 +18,17 @@ mode: evidence-focused
18
18
 
19
19
  # /qfai-configure - Configure QFAI for this repository
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Only update `qfai.config.yaml`, `.qfai/assistant/steering/*`, and `.qfai/evidence/configure-<run-id>.md` unless explicitly asked.
@@ -18,6 +18,17 @@ mode: interactive-by-default
18
18
 
19
19
  # /qfai-discuss — Discussion → Requirements Clarity
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Do NOT declare completion without covering all Required Coverage topics.
@@ -0,0 +1,157 @@
1
+ <!--
2
+ QFAI Prompt Body (SSOT)
3
+ - This file is intended to be referenced by tool-specific custom prompt definitions (e.g., Copilot .prompt.md, Claude Code slash commands).
4
+ - Keep tool-specific wrappers thin: "Read this file and follow it."
5
+ -->
6
+
7
+ ---
8
+
9
+ id: qfai-prototyping
10
+ title: QFAI Prototyping (Implement a runnable contract skeleton)
11
+ description: "Implement a minimal end-to-end runnable skeleton (UI + API + DB) based on contracts, before ATDD/TDD automation."
12
+ argument-hint: "<spec-id> [--auto]"
13
+ allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
14
+ roles: [FullStackEngineer, BackendEngineer, FrontendEngineer, DBEngineer, DevOpsCIEngineer, QAEngineer, CodeReviewer]
15
+ mode: execution-focused
16
+
17
+ ---
18
+
19
+ # /qfai-prototyping
20
+
21
+ Build a **minimum runnable vertical slice** from `.qfai/contracts/**` so that:
22
+
23
+ - developers can start the app locally (`pnpm dev` or equivalent),
24
+ - the UI is navigable (no 404 on routes declared in UI contracts),
25
+ - the API responds for paths declared in OpenAPI contracts,
26
+ - persistence exists at least as a working skeleton (real DB or a clearly marked temporary store),
27
+ - the project is ready for `/qfai-atdd` automation.
28
+
29
+ ## FORMAT SSOT (Mandatory)
30
+
31
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
32
+ - `.qfai/require/README.md`
33
+ - `.qfai/specs/README.md`
34
+ - `.qfai/contracts/**/README.md`
35
+ - `.qfai/evidence/README.md`
36
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
37
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
38
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm "matches README template".
39
+
40
+ ## CRITICAL CONSTRAINTS (Read First)
41
+
42
+ - Do NOT implement acceptance tests or unit tests (that is `/qfai-atdd` and TDD phases).
43
+ - You MUST produce the required evidence file: `.qfai/evidence/prototyping-<spec-id>.md`.
44
+ - `.qfai/evidence/` is intentionally NOT tracked by Git (it ships with a local `.gitignore`).
45
+ - Do NOT commit evidence files; summarize key outcomes in the PR description instead.
46
+ - You MUST run the dev server and perform manual verification.
47
+ - You MUST stop and escalate if runtime evidence or contract alignment is missing.
48
+ - Implementation must align with existing project conventions; do NOT introduce new frameworks.
49
+ - Completion must be approved by a reviewer who did not implement the code.
50
+
51
+ ## Inputs (read first)
52
+
53
+ - `.qfai/contracts/ui/*.yaml` (routes/screens/elements/actions)
54
+ - `.qfai/contracts/api/*.yaml` (OpenAPI)
55
+ - `.qfai/contracts/db/*.sql` (schema constraints)
56
+ - `.qfai/specs/<spec-id>/spec.md` + `delta.md` (scope + decisions)
57
+ - `.qfai/specs/<spec-id>/scenario.feature` (for “what users do”, but do NOT implement tests here)
58
+
59
+ ## Output boundaries
60
+
61
+ - ✅ You MAY implement application code required for a runnable skeleton.
62
+ - ✅ You MAY add minimal wiring/config (env examples, local DB setup scripts, dev server config).
63
+ - ✅ You MAY add minimal “smoke scripts” (e.g., `scripts/smoke.ts`) if they help manual verification.
64
+ - ❌ Do NOT implement acceptance tests here (that is `/qfai-atdd`).
65
+ - ❌ Do NOT implement unit/component tests here (that is TDD phases).
66
+ - ❌ Do NOT change `.qfai/**/README.md` content. They are templates and remain SSOT.
67
+
68
+ ## Mission (what “prototype” means)
69
+
70
+ Implement the following **contract-satisfying skeleton**, aiming for the smallest viable integration:
71
+
72
+ ### 1) UI skeleton
73
+
74
+ - For every screen/route in `contracts/ui/*.yaml`:
75
+ - create a page/route that renders and is reachable,
76
+ - include placeholder components for declared elements (table/input/button),
77
+ - implement declared navigation actions (links/buttons).
78
+
79
+ ### 2) API skeleton
80
+
81
+ - For every endpoint in `contracts/api/*.yaml` used by the spec pack:
82
+ - implement the route handler,
83
+ - return realistic stub responses aligned with schemas,
84
+ - implement minimal error shape (e.g., validation error payload) if contracts imply it.
85
+
86
+ ### 3) DB skeleton
87
+
88
+ - Apply or integrate the SQL contracts:
89
+ - if project uses migrations: add migration(s) from `contracts/db/*.sql`,
90
+ - else: create schema setup script with explicit instructions.
91
+ - If using a temporary in-memory store initially, it MUST be:
92
+ - documented in code comments,
93
+ - shaped to match the DB contract schema,
94
+ - replaceable by real DB without rewriting the whole app.
95
+
96
+ ### 4) Wiring & dev experience
97
+
98
+ - Ensure local startup works:
99
+ - `pnpm install`
100
+ - `pnpm dev`
101
+ - Add or update minimal documentation under project README (outside `.qfai/`) if needed for running the skeleton.
102
+
103
+ ## Work process (required)
104
+
105
+ 1. **Inventory contracts**: list UI routes, API endpoints, DB tables/constraints.
106
+ 2. **Select minimal implementation strategy** based on detected stack:
107
+ - If Next.js/React: implement pages and API routes accordingly.
108
+ - If Express/Fastify/etc: implement server routes and connect frontend.
109
+ - If unknown: choose the project’s existing conventions; do not introduce a new stack.
110
+ 3. Implement UI routes first (avoid 404).
111
+ 4. Implement API endpoints next (return stub JSON).
112
+ 5. Implement DB skeleton and connect (or provide clear temporary store).
113
+ 6. Run the dev server and perform a manual “happy path” click-through.
114
+
115
+ ## Completion criteria (hard gate)
116
+
117
+ You may declare completion ONLY if:
118
+
119
+ - [ ] Dev server starts locally without errors (`pnpm dev` or project equivalent).
120
+ - [ ] All UI routes declared in UI contracts are reachable (no 404).
121
+ - [ ] At least one end-to-end happy path works in the UI:
122
+ - list screen loads data (stub OK),
123
+ - create/edit screen submits and updates list (stub OK),
124
+ - navigation works.
125
+ - [ ] All implemented API endpoints respond with status codes consistent with the contract.
126
+ - [ ] Evidence file exists: `.qfai/evidence/prototyping-<spec-id>.md`
127
+ - includes executed commands,
128
+ - includes “Format Self-Check”,
129
+ - includes a short manual verification log.
130
+
131
+ ## Reviewer checklist (for CodeReviewer role)
132
+
133
+ - No test automation was added here.
134
+ - Implementation aligns with project conventions (no new framework added).
135
+ - UI/API/DB skeleton matches contract definitions.
136
+ - Completion criteria are objectively satisfied.
137
+
138
+ ## Evidence (MANDATORY)
139
+
140
+ - Create evidence file: `.qfai/evidence/prototyping-<spec-id>.md`
141
+ - Include the following sections:
142
+ 1. **Contract Inventory**: list of UI routes, API endpoints, DB tables from contracts.
143
+ 2. **Implementation Summary**: what was implemented for each contract item.
144
+ 3. **Dev Server Startup**: commands executed and result.
145
+ 4. **Manual Verification Log**: step-by-step click-through with observations.
146
+ 5. **Format Self-Check**: list each artifact and confirm "matches README template".
147
+
148
+ ## FINAL CHECKLIST (Check Last)
149
+
150
+ - [ ] CRITICAL CONSTRAINTS were followed.
151
+ - [ ] Evidence file exists: `.qfai/evidence/prototyping-<spec-id>.md`.
152
+ - [ ] Dev server starts without errors.
153
+ - [ ] All UI routes from contracts are reachable (no 404).
154
+ - [ ] All API endpoints respond with expected status codes.
155
+ - [ ] Manual verification log is complete.
156
+ - [ ] No test automation was added.
157
+ - [ ] Completion approved by a reviewer who did not implement the code.
@@ -18,6 +18,17 @@ mode: approval-gated
18
18
 
19
19
  # /qfai-require — Create Requirements Artifact
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Keep `require.md` headings in English and follow the template exactly.
@@ -18,6 +18,17 @@ mode: approval-gated
18
18
 
19
19
  # /qfai-spec — Create Specification Pack (SDD)
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Contracts MUST be completed first; do not write spec/scenario before contracts.
@@ -18,6 +18,17 @@ mode: iterative
18
18
 
19
19
  # /qfai-tdd-green — Implement to Green (TDD)
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Do NOT declare completion based on tests alone.
@@ -18,6 +18,17 @@ mode: test-first
18
18
 
19
19
  # /qfai-tdd-red — Implement Tests First (TDD Red)
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - You MUST implement tests only. Do NOT implement production logic.
@@ -18,6 +18,17 @@ mode: refactor
18
18
 
19
19
  # /qfai-tdd-refactor — Refactor Safely (TDD Refactor)
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Do NOT change externally visible behavior or specs/contracts.
@@ -18,6 +18,17 @@ mode: evidence-focused
18
18
 
19
19
  # /qfai-verify — Quality Gates and Evidence
20
20
 
21
+ ## FORMAT SSOT (Mandatory)
22
+
23
+ - **Before writing or editing any `.qfai/**` artifact\*\*, read and follow the relevant directory README template and sample:
24
+ - `.qfai/require/README.md`
25
+ - `.qfai/specs/README.md`
26
+ - `.qfai/contracts/**/README.md`
27
+ - `.qfai/evidence/README.md`
28
+ - **Do NOT copy** templates/samples into this prompt or into other prompt markdown.
29
+ - The generated artifacts must match the README-defined structure (headings, ordering, table columns).
30
+ - Completion requires a **Format Self-Check** in the evidence: list each artifact and confirm “matches README template”.
31
+
21
32
  ## CRITICAL CONSTRAINTS (Read First)
22
33
 
23
34
  - Do NOT declare completion without running the defined gates.
@@ -2,21 +2,14 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Allow minimal overrides of canonical prompts when project-specific constraints cannot be captured in steering.
5
+ `prompts.local/` allows **minimal overrides** of canonical prompts when project constraints cannot be expressed via steering.
6
6
 
7
7
  ## Rules
8
8
 
9
9
  - Keep diffs minimal and focused.
10
- - File name must match the canonical prompt name.
11
- - Do not copy the full canonical prompt into this folder.
12
-
13
- ## Structure
14
-
15
- ```text
16
- prompts.local/
17
- README.md
18
- <prompt>.md
19
- ```
10
+ - File name must match the canonical prompt name (e.g. `qfai-atdd.md`).
11
+ - Do not copy the entire canonical prompt into this folder.
12
+ - Overrides MUST still respect: README-as-SSOT for formatting.
20
13
 
21
14
  ## Override template (excerpt)
22
15
 
@@ -30,10 +23,8 @@ prompts.local/
30
23
  ## Rationale
31
24
 
32
25
  - <why steering cannot cover this>
33
- ```
34
26
 
35
- ## Checklist
27
+ ## Additional constraints
36
28
 
37
- - [ ] Override is strictly necessary
38
- - [ ] Steering cannot express the constraint
39
- - [ ] The change does not conflict with validation/verification gates
29
+ - <any extra constraints>
30
+ ```
@@ -2,38 +2,45 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Contracts define the API/DB/UI surface that specs and scenarios may reference. Contracts must be created before specs.
5
+ Contracts define the **stable surface** that specs and tests may reference.
6
+ They are the boundary between “what we promise” and “how we implement”.
6
7
 
7
- ## What belongs here
8
+ QFAI organizes contracts into three types:
8
9
 
9
- - contracts/api (YAML)
10
- - contracts/db (SQL)
11
- - contracts/ui (YAML)
12
-
13
- ## What does not belong here
10
+ ```text
11
+ contracts/
12
+ ├── api/ # OpenAPI YAML (endpoints, request/response)
13
+ ├── db/ # SQL schema contracts (tables, columns, constraints)
14
+ └── ui/ # UI contract YAML (screens, elements, user actions)
15
+ ```
14
16
 
15
- - categories beyond api/db/ui
16
- - implementation code or tests
17
- - markdown embedded inside YAML/SQL
17
+ ## Directory rules
18
18
 
19
- ## Structure
19
+ - Contract files are **minimal**: only what specs actually need.
20
+ - Each contract file must declare `QFAI-CONTRACT-ID` at the top.
21
+ - Prefer additive changes; breaking changes require delta notes.
20
22
 
21
23
  ```text
22
24
  contracts/
23
- README.md
24
- api/
25
- README.md
26
- <api contracts>
27
- db/
28
- README.md
29
- <db contracts>
30
- ui/
31
- README.md
32
- <ui contracts>
25
+ ├── README.md
26
+ ├── api/
27
+ │ ├── README.md
28
+ │ └── api-0001-<slug>.yaml
29
+ ├── db/
30
+ │ ├── README.md
31
+ │ └── db-0001-<slug>.sql
32
+ └── ui/
33
+ ├── README.md
34
+ └── ui-0001-<slug>.yaml
33
35
  ```
34
36
 
37
+ ## How contracts relate to specs
38
+
39
+ - `spec.md` and `scenario.feature` reference contracts via `QFAI-CONTRACT-REF`.
40
+ - Traceability must include “Contracts” in the chain table.
41
+
35
42
  ## Checklist
36
43
 
37
- - [ ] Contracts exist before specs reference them
38
- - [ ] Only api/db/ui categories are used
39
- - [ ] Each contract file declares QFAI-CONTRACT-ID
44
+ - [ ] Contract IDs exist and are unique.
45
+ - [ ] Contracts match what specs reference (no missing IDs).
46
+ - [ ] Contracts are minimal but sufficient for prototyping and test automation.