qfai 1.0.3 → 1.0.5
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.
- package/README.md +53 -74
- package/assets/init/.qfai/README.md +17 -82
- package/assets/init/.qfai/assistant/README.md +9 -0
- package/assets/init/.qfai/assistant/agents/README.md +34 -0
- package/assets/init/.qfai/assistant/agents/architect.md +73 -0
- package/assets/init/.qfai/assistant/agents/backend-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/code-reviewer.md +73 -0
- package/assets/init/.qfai/assistant/agents/contract-designer.md +73 -0
- package/assets/init/.qfai/assistant/agents/devops-ci-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/facilitator.md +74 -0
- package/assets/init/.qfai/assistant/agents/frontend-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/interviewer.md +72 -0
- package/assets/init/.qfai/assistant/agents/planner.md +73 -0
- package/assets/init/.qfai/assistant/agents/qa-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/requirements-analyst.md +73 -0
- package/assets/init/.qfai/assistant/agents/test-engineer.md +73 -0
- package/assets/init/.qfai/assistant/instructions/README.md +6 -0
- package/assets/init/.qfai/assistant/instructions/constitution.md +131 -0
- package/assets/init/.qfai/assistant/instructions/workflow.md +75 -0
- package/assets/init/.qfai/assistant/prompts/README.md +19 -0
- package/assets/init/.qfai/assistant/prompts/qfai-discuss.md +173 -0
- package/assets/init/.qfai/assistant/prompts/qfai-implement.md +239 -0
- package/assets/init/.qfai/assistant/prompts/qfai-pr.md +218 -0
- package/assets/init/.qfai/assistant/prompts/qfai-require.md +273 -0
- package/assets/init/.qfai/assistant/prompts/qfai-scenario-test.md +229 -0
- package/assets/init/.qfai/assistant/prompts/qfai-spec.md +287 -0
- package/assets/init/.qfai/assistant/prompts/qfai-unit-test.md +202 -0
- package/assets/init/.qfai/assistant/prompts/qfai-verify.md +231 -0
- package/assets/init/.qfai/assistant/prompts.local/README.md +6 -0
- package/assets/init/.qfai/assistant/steering/README.md +33 -0
- package/assets/init/.qfai/assistant/steering/product.md +32 -0
- package/assets/init/.qfai/assistant/steering/structure.md +34 -0
- package/assets/init/.qfai/assistant/steering/tech.md +37 -0
- package/assets/init/.qfai/contracts/README.md +7 -87
- package/assets/init/.qfai/contracts/api/README.md +8 -0
- package/assets/init/.qfai/contracts/db/README.md +8 -0
- package/assets/init/.qfai/contracts/ui/README.md +8 -0
- package/assets/init/.qfai/report/README.md +13 -0
- package/assets/init/.qfai/require/README.md +4 -26
- package/assets/init/.qfai/require/require.md +74 -0
- package/assets/init/.qfai/specs/README.md +6 -57
- package/assets/init/root/.github/workflows/qfai.yml +1 -1
- package/assets/init/root/qfai.config.yaml +3 -4
- package/dist/cli/index.cjs +313 -472
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.mjs +295 -454
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.cjs +37 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +37 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/assets/init/.qfai/contracts/api/api-0001-sample.yaml +0 -15
- package/assets/init/.qfai/contracts/db/db-0001-sample.sql +0 -7
- package/assets/init/.qfai/contracts/ui/assets/thema-001-facebook-like/assets.yaml +0 -6
- package/assets/init/.qfai/contracts/ui/assets/thema-001-facebook-like/palette.png +0 -0
- package/assets/init/.qfai/contracts/ui/assets/ui-0001-sample/assets.yaml +0 -6
- package/assets/init/.qfai/contracts/ui/assets/ui-0001-sample/snapshots/login__desktop__light__default.png +0 -0
- package/assets/init/.qfai/contracts/ui/thema-001-facebook-like.yml +0 -13
- package/assets/init/.qfai/contracts/ui/ui-0001-sample.yaml +0 -17
- package/assets/init/.qfai/out/README.md +0 -17
- package/assets/init/.qfai/promptpack/commands/implement.md +0 -8
- package/assets/init/.qfai/promptpack/commands/plan.md +0 -11
- package/assets/init/.qfai/promptpack/commands/release.md +0 -6
- package/assets/init/.qfai/promptpack/commands/review.md +0 -7
- package/assets/init/.qfai/promptpack/constitution.md +0 -15
- package/assets/init/.qfai/promptpack/modes/change.md +0 -5
- package/assets/init/.qfai/promptpack/modes/compatibility.md +0 -6
- package/assets/init/.qfai/promptpack/roles/qa.md +0 -4
- package/assets/init/.qfai/promptpack/roles/spec.md +0 -4
- package/assets/init/.qfai/promptpack/roles/test.md +0 -4
- package/assets/init/.qfai/promptpack/steering/compatibility-vs-change.md +0 -42
- package/assets/init/.qfai/promptpack/steering/naming.md +0 -7
- package/assets/init/.qfai/promptpack/steering/traceability.md +0 -25
- package/assets/init/.qfai/prompts/README.md +0 -70
- package/assets/init/.qfai/prompts/analyze/README.md +0 -21
- package/assets/init/.qfai/prompts/analyze/scenario_test_consistency.md +0 -8
- package/assets/init/.qfai/prompts/analyze/scenario_to_test.md +0 -56
- package/assets/init/.qfai/prompts/analyze/spec_contract_consistency.md +0 -8
- package/assets/init/.qfai/prompts/analyze/spec_scenario_consistency.md +0 -8
- package/assets/init/.qfai/prompts/analyze/spec_to_contract.md +0 -54
- package/assets/init/.qfai/prompts/analyze/spec_to_scenario.md +0 -56
- package/assets/init/.qfai/prompts/makeBusinessFlow.md +0 -34
- package/assets/init/.qfai/prompts/makeOverview.md +0 -27
- package/assets/init/.qfai/prompts/qfai-classify-change.md +0 -33
- package/assets/init/.qfai/prompts/qfai-generate-test-globs.md +0 -29
- package/assets/init/.qfai/prompts/qfai-maintain-contracts.md +0 -35
- package/assets/init/.qfai/prompts/qfai-maintain-traceability.md +0 -36
- package/assets/init/.qfai/prompts/require-to-spec.md +0 -41
- package/assets/init/.qfai/prompts.local/README.md +0 -31
- package/assets/init/.qfai/rules/conventions.md +0 -27
- package/assets/init/.qfai/rules/pnpm.md +0 -29
- package/assets/init/.qfai/samples/analyze/analysis.md +0 -38
- package/assets/init/.qfai/samples/analyze/input_bundle.md +0 -54
- package/assets/init/.qfai/specs/spec-0001/delta.md +0 -30
- package/assets/init/.qfai/specs/spec-0001/scenario.feature +0 -11
- package/assets/init/.qfai/specs/spec-0001/spec.md +0 -40
|
@@ -0,0 +1,229 @@
|
|
|
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-scenario-test
|
|
10
|
+
title: QFAI Scenario Test (ATDD executable)
|
|
11
|
+
description: "Implement executable scenario tests from spec pack and scenario.feature; includes review and quality checks."
|
|
12
|
+
argument-hint: "<spec-id> [--auto]"
|
|
13
|
+
allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
|
|
14
|
+
roles: [TestEngineer, DevOpsCIEngineer, QAEngineer, CodeReviewer, Planner]
|
|
15
|
+
mode: execution-focused
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# /qfai-scenario-test — Implement Executable Scenario Tests (ATDD)
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
Turn `.qfai/specs/spec-XXXX/scenario.feature` into **runnable scenario tests** in this repository (terminal + CI).
|
|
24
|
+
|
|
25
|
+
## Success Criteria (Definition of Done)
|
|
26
|
+
|
|
27
|
+
- Scenario tests exist and are runnable via documented commands.
|
|
28
|
+
- Tests are stable (no flakiness) and diagnostic (failures explain why).
|
|
29
|
+
- Quality checks (lint/typecheck/tests) pass in the repo’s standard way.
|
|
30
|
+
|
|
31
|
+
## Non‑Negotiable Principles (QFAI Articles)
|
|
32
|
+
|
|
33
|
+
These principles are inspired by “constitution / articles” patterns used by other agent frameworks, but tailored to QFAI.
|
|
34
|
+
|
|
35
|
+
1. **SDD First (Specification is the source of truth)**
|
|
36
|
+
If there is a conflict between code and spec, treat the spec as authoritative and either (a) fix code or (b) raise an explicit Open Question to change the spec.
|
|
37
|
+
|
|
38
|
+
2. **Traceability is mandatory**
|
|
39
|
+
Every meaningful change must be traceable: **Require → Spec → Scenario → Tests → Code → Verification evidence**.
|
|
40
|
+
|
|
41
|
+
3. **Evidence over confidence**
|
|
42
|
+
Prefer observable proof (logs, commands, file diffs, test results). If you cannot verify, say so and record it.
|
|
43
|
+
|
|
44
|
+
4. **Minimize scope, but never hide gaps**
|
|
45
|
+
Keep changes minimal, but do not “paper over” missing decisions. If something blocks correctness, stop and ask.
|
|
46
|
+
|
|
47
|
+
5. **Quality gates are the decision mechanism**
|
|
48
|
+
Use tests/lint/typecheck/build/pack verification (whatever the repo defines) as the primary guardrail. Fix until PASS.
|
|
49
|
+
|
|
50
|
+
6. **Make it runnable**
|
|
51
|
+
Outputs must be executable in terminal/CI. Provide copy‑paste commands.
|
|
52
|
+
|
|
53
|
+
7. **User time is expensive**
|
|
54
|
+
Ask only the questions that are truly blocking. Everything else: make reasonable assumptions and label them clearly.
|
|
55
|
+
|
|
56
|
+
## Absolute Rule — Output Language
|
|
57
|
+
|
|
58
|
+
**All outputs MUST be written in the user’s working language for this session.**
|
|
59
|
+
|
|
60
|
+
- If the user writes in Japanese, output Japanese.
|
|
61
|
+
- If the user writes in English, output English.
|
|
62
|
+
- If the user mixes languages, prefer the dominant language unless explicitly instructed otherwise.
|
|
63
|
+
This rule overrides all other stylistic preferences.
|
|
64
|
+
|
|
65
|
+
## Multi‑Role Orchestration (Subagents)
|
|
66
|
+
|
|
67
|
+
This workflow assumes the environment _may_ support subagents (e.g., Claude Code “Task” tool) or may not.
|
|
68
|
+
|
|
69
|
+
### If subagents are supported
|
|
70
|
+
|
|
71
|
+
Delegate to multiple roles and then merge the results. Use a “real‑world workflow” order:
|
|
72
|
+
|
|
73
|
+
- Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
|
|
74
|
+
|
|
75
|
+
**Pseudo‑invocation pattern** (adjust to your tool):
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Task(
|
|
79
|
+
subagent_type="planner",
|
|
80
|
+
description="Create an execution plan and DoD",
|
|
81
|
+
prompt="Context: ...\nGoal: ...\nConstraints: ...\nReturn: phases + risks + DoD"
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### If subagents are NOT supported
|
|
86
|
+
|
|
87
|
+
Simulate roles by running the same sequence yourself:
|
|
88
|
+
|
|
89
|
+
- Write a short “role output” section per role, then consolidate into the final deliverable(s).
|
|
90
|
+
|
|
91
|
+
## Behavior Rules (high leverage)
|
|
92
|
+
|
|
93
|
+
- **Language**: Output MUST follow the user’s working language for this session.
|
|
94
|
+
- **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
|
|
95
|
+
- **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
|
|
96
|
+
- **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
|
|
97
|
+
- **Subagent contract**: When delegating, require the subagent response structure:
|
|
98
|
+
1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
|
|
99
|
+
|
|
100
|
+
## Step 0 — Load Context (always)
|
|
101
|
+
|
|
102
|
+
1. Read relevant **project steering** (if present):
|
|
103
|
+
- `.qfai/assistant/steering/structure.md`
|
|
104
|
+
- `.qfai/assistant/steering/tech.md`
|
|
105
|
+
- `.qfai/assistant/steering/product.md`
|
|
106
|
+
- any additional files under `.qfai/assistant/steering/`
|
|
107
|
+
|
|
108
|
+
2. Read **project constitution / instructions** (if present):
|
|
109
|
+
- `.qfai/assistant/instructions/constitution.md`
|
|
110
|
+
- `.qfai/assistant/instructions/workflow.md` (or equivalent)
|
|
111
|
+
|
|
112
|
+
3. Read existing artifacts for the current work item (if present):
|
|
113
|
+
- `.qfai/require/`
|
|
114
|
+
- `.qfai/specs/spec-*/`
|
|
115
|
+
- `.qfai/contracts/`
|
|
116
|
+
|
|
117
|
+
4. Inspect repo conventions:
|
|
118
|
+
- package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
|
|
119
|
+
- existing test patterns (unit/integration/e2e)
|
|
120
|
+
|
|
121
|
+
## Step 0 — Project Analysis (mandatory)
|
|
122
|
+
|
|
123
|
+
Before producing any deliverable, **thoroughly analyze the current project** so your outputs fit the repo’s:
|
|
124
|
+
|
|
125
|
+
- background and goals
|
|
126
|
+
- directory structure and conventions
|
|
127
|
+
- chosen technologies and versions (runtime, package manager, test runner)
|
|
128
|
+
- architecture boundaries (packages, CLI, core modules)
|
|
129
|
+
- existing patterns for tests, docs, and CI
|
|
130
|
+
|
|
131
|
+
### Minimum analysis checklist
|
|
132
|
+
|
|
133
|
+
- [ ] Read key repo docs: README / CHANGELOG / RELEASE (if present)
|
|
134
|
+
- [ ] Inspect `.qfai/` layout and existing SDD/ATDD/TDD artifacts (if present)
|
|
135
|
+
- [ ] Inspect `packages/qfai` structure (CLI entrypoints, core modules, validators, assets/init)
|
|
136
|
+
- [ ] Identify standard gate commands (format/lint/type/test/verify-pack) and where they are defined
|
|
137
|
+
- [ ] Search for existing examples/patterns of similar changes in tests (if available)
|
|
138
|
+
- [ ] Note constraints: Node versions, CI matrix, packaging rules, verify-pack expectations
|
|
139
|
+
|
|
140
|
+
If analysis cannot be performed (missing access), clearly state what could not be verified and proceed with minimal-risk assumptions.
|
|
141
|
+
|
|
142
|
+
## Step 0.5 — Steering Bootstrap / Refresh (mandatory when incomplete)
|
|
143
|
+
|
|
144
|
+
QFAI expects `assistant/steering/` to contain **project‑specific facts** so all subsequent design/test/implementation fits this repository.
|
|
145
|
+
|
|
146
|
+
### What to do
|
|
147
|
+
|
|
148
|
+
1. Open these files:
|
|
149
|
+
|
|
150
|
+
- `.qfai/assistant/steering/product.md`
|
|
151
|
+
- `.qfai/assistant/steering/tech.md`
|
|
152
|
+
- `.qfai/assistant/steering/structure.md`
|
|
153
|
+
|
|
154
|
+
2. If they are missing, mostly empty, or still have placeholders (e.g., `- ` only), **populate them by analyzing the current repository**:
|
|
155
|
+
|
|
156
|
+
- derive “what/why/users/success/non-goals” from README/docs/issues (product.md)
|
|
157
|
+
- derive runtime/tooling versions + constraints from package.json, CI config, lockfiles (tech.md)
|
|
158
|
+
- derive repo layout + key directories + gate commands from the file tree and scripts (structure.md)
|
|
159
|
+
|
|
160
|
+
3. Do **not** invent facts. If something cannot be verified, write it as:
|
|
161
|
+
|
|
162
|
+
- `TBD` + what evidence is missing, or
|
|
163
|
+
- an Open Question (if it blocks correctness)
|
|
164
|
+
|
|
165
|
+
### Steering refresh checklist
|
|
166
|
+
|
|
167
|
+
- [ ] product.md: what we build / users / success / non-goals / release posture
|
|
168
|
+
- [ ] tech.md: Node / package manager / TS / test / lint / CI constraints
|
|
169
|
+
- [ ] structure.md: repo layout, key packages, entrypoints, standard gate commands, how to run locally
|
|
170
|
+
|
|
171
|
+
## Step 1 — Locate the spec pack
|
|
172
|
+
|
|
173
|
+
Read:
|
|
174
|
+
|
|
175
|
+
- `.qfai/specs/spec-XXXX/spec.md`
|
|
176
|
+
- `.qfai/specs/spec-XXXX/scenario.feature`
|
|
177
|
+
- any referenced contracts under `.qfai/contracts/**`
|
|
178
|
+
|
|
179
|
+
## Step 2 — Choose (or detect) scenario test harness
|
|
180
|
+
|
|
181
|
+
Prefer existing project tooling. Determine:
|
|
182
|
+
|
|
183
|
+
- Where tests live
|
|
184
|
+
- Test runner (e.g., Playwright/Cypress/Cucumber/Jest/Vitest/etc)
|
|
185
|
+
- CI execution command
|
|
186
|
+
|
|
187
|
+
If nothing exists:
|
|
188
|
+
|
|
189
|
+
- Propose the minimal harness choice consistent with the stack.
|
|
190
|
+
- In interactive mode, ask approval; in `--auto`, pick one and document assumptions.
|
|
191
|
+
|
|
192
|
+
## Step 3 — Implement scenario tests (Test Engineer)
|
|
193
|
+
|
|
194
|
+
Rules:
|
|
195
|
+
|
|
196
|
+
- Scenarios must map to executable steps.
|
|
197
|
+
- Keep step definitions reusable but not overly generic.
|
|
198
|
+
- Ensure each scenario asserts observable behavior.
|
|
199
|
+
|
|
200
|
+
Deliverables:
|
|
201
|
+
|
|
202
|
+
- Step definitions / test code
|
|
203
|
+
- Any required fixtures/mocks (minimal)
|
|
204
|
+
- A “how to run” command
|
|
205
|
+
|
|
206
|
+
## Step 4 — Integrate with CI / scripts (DevOps/CI Engineer)
|
|
207
|
+
|
|
208
|
+
- Add/adjust package scripts only if needed.
|
|
209
|
+
- Ensure a single command can run the scenario suite.
|
|
210
|
+
- Keep changes minimal and well documented.
|
|
211
|
+
|
|
212
|
+
## Step 5 — QA review + code review
|
|
213
|
+
|
|
214
|
+
- QA Engineer: scenario coverage, failure cases, observability
|
|
215
|
+
- Code Reviewer: maintainability, flakiness risks, unclear assertions
|
|
216
|
+
|
|
217
|
+
## Step 6 — Record verification evidence
|
|
218
|
+
|
|
219
|
+
Provide:
|
|
220
|
+
|
|
221
|
+
- Exact commands run
|
|
222
|
+
- Summary of results
|
|
223
|
+
- Where logs/artifacts can be found (if applicable)
|
|
224
|
+
|
|
225
|
+
## Output
|
|
226
|
+
|
|
227
|
+
- Scenario test implementation files
|
|
228
|
+
- “Runbook” snippet (copy‑paste command)
|
|
229
|
+
- Short verification evidence summary
|
|
@@ -0,0 +1,287 @@
|
|
|
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-spec
|
|
10
|
+
title: QFAI Spec (SDD Deliverables: specs + contracts + scenario skeleton)
|
|
11
|
+
description: "Create SDD artifacts: spec pack, delta, scenario.feature skeleton, and required contracts."
|
|
12
|
+
argument-hint: "<spec-id-or-name> [--auto]"
|
|
13
|
+
allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
|
|
14
|
+
roles: [Architect, ContractDesigner, TestEngineer, QAEngineer, CodeReviewer, Planner]
|
|
15
|
+
mode: approval-gated
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# /qfai-spec — Create Specification Pack (SDD)
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
Create/update a **spec pack** that becomes the source of truth for implementation and testing.
|
|
24
|
+
|
|
25
|
+
## Success Criteria (Definition of Done)
|
|
26
|
+
|
|
27
|
+
- A new directory exists: `.qfai/specs/spec-XXXX/` (or an existing one is updated).
|
|
28
|
+
- At minimum, these files exist and are coherent:
|
|
29
|
+
- `spec.md` (SDD spec)
|
|
30
|
+
- `delta.md` (change log / impact / migration)
|
|
31
|
+
- `scenario.feature` (ATDD skeleton aligned with spec)
|
|
32
|
+
- Contracts are added/updated under `.qfai/contracts/` _only when needed_.
|
|
33
|
+
|
|
34
|
+
## Non‑Negotiable Principles (QFAI Articles)
|
|
35
|
+
|
|
36
|
+
These principles are inspired by “constitution / articles” patterns used by other agent frameworks, but tailored to QFAI.
|
|
37
|
+
|
|
38
|
+
1. **SDD First (Specification is the source of truth)**
|
|
39
|
+
If there is a conflict between code and spec, treat the spec as authoritative and either (a) fix code or (b) raise an explicit Open Question to change the spec.
|
|
40
|
+
|
|
41
|
+
2. **Traceability is mandatory**
|
|
42
|
+
Every meaningful change must be traceable: **Require → Spec → Scenario → Tests → Code → Verification evidence**.
|
|
43
|
+
|
|
44
|
+
3. **Evidence over confidence**
|
|
45
|
+
Prefer observable proof (logs, commands, file diffs, test results). If you cannot verify, say so and record it.
|
|
46
|
+
|
|
47
|
+
4. **Minimize scope, but never hide gaps**
|
|
48
|
+
Keep changes minimal, but do not “paper over” missing decisions. If something blocks correctness, stop and ask.
|
|
49
|
+
|
|
50
|
+
5. **Quality gates are the decision mechanism**
|
|
51
|
+
Use tests/lint/typecheck/build/pack verification (whatever the repo defines) as the primary guardrail. Fix until PASS.
|
|
52
|
+
|
|
53
|
+
6. **Make it runnable**
|
|
54
|
+
Outputs must be executable in terminal/CI. Provide copy‑paste commands.
|
|
55
|
+
|
|
56
|
+
7. **User time is expensive**
|
|
57
|
+
Ask only the questions that are truly blocking. Everything else: make reasonable assumptions and label them clearly.
|
|
58
|
+
|
|
59
|
+
## Absolute Rule — Output Language
|
|
60
|
+
|
|
61
|
+
**All outputs MUST be written in the user’s working language for this session.**
|
|
62
|
+
|
|
63
|
+
- If the user writes in Japanese, output Japanese.
|
|
64
|
+
- If the user writes in English, output English.
|
|
65
|
+
- If the user mixes languages, prefer the dominant language unless explicitly instructed otherwise.
|
|
66
|
+
This rule overrides all other stylistic preferences.
|
|
67
|
+
|
|
68
|
+
## Multi‑Role Orchestration (Subagents)
|
|
69
|
+
|
|
70
|
+
This workflow assumes the environment _may_ support subagents (e.g., Claude Code “Task” tool) or may not.
|
|
71
|
+
|
|
72
|
+
### If subagents are supported
|
|
73
|
+
|
|
74
|
+
Delegate to multiple roles and then merge the results. Use a “real‑world workflow” order:
|
|
75
|
+
|
|
76
|
+
- Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
|
|
77
|
+
|
|
78
|
+
**Pseudo‑invocation pattern** (adjust to your tool):
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
Task(
|
|
82
|
+
subagent_type="planner",
|
|
83
|
+
description="Create an execution plan and DoD",
|
|
84
|
+
prompt="Context: ...\nGoal: ...\nConstraints: ...\nReturn: phases + risks + DoD"
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### If subagents are NOT supported
|
|
89
|
+
|
|
90
|
+
Simulate roles by running the same sequence yourself:
|
|
91
|
+
|
|
92
|
+
- Write a short “role output” section per role, then consolidate into the final deliverable(s).
|
|
93
|
+
|
|
94
|
+
## Behavior Rules (high leverage)
|
|
95
|
+
|
|
96
|
+
- **Language**: Output MUST follow the user’s working language for this session.
|
|
97
|
+
- **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
|
|
98
|
+
- **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
|
|
99
|
+
- **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
|
|
100
|
+
- **Subagent contract**: When delegating, require the subagent response structure:
|
|
101
|
+
1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
|
|
102
|
+
|
|
103
|
+
## Step 0 — Load Context (always)
|
|
104
|
+
|
|
105
|
+
1. Read relevant **project steering** (if present):
|
|
106
|
+
- `.qfai/assistant/steering/structure.md`
|
|
107
|
+
- `.qfai/assistant/steering/tech.md`
|
|
108
|
+
- `.qfai/assistant/steering/product.md`
|
|
109
|
+
- any additional files under `.qfai/assistant/steering/`
|
|
110
|
+
|
|
111
|
+
2. Read **project constitution / instructions** (if present):
|
|
112
|
+
- `.qfai/assistant/instructions/constitution.md`
|
|
113
|
+
- `.qfai/assistant/instructions/workflow.md` (or equivalent)
|
|
114
|
+
|
|
115
|
+
3. Read existing artifacts for the current work item (if present):
|
|
116
|
+
- `.qfai/require/`
|
|
117
|
+
- `.qfai/specs/spec-*/`
|
|
118
|
+
- `.qfai/contracts/`
|
|
119
|
+
|
|
120
|
+
4. Inspect repo conventions:
|
|
121
|
+
- package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
|
|
122
|
+
- existing test patterns (unit/integration/e2e)
|
|
123
|
+
|
|
124
|
+
## Step 0 — Project Analysis (mandatory)
|
|
125
|
+
|
|
126
|
+
Before producing any deliverable, **thoroughly analyze the current project** so your outputs fit the repo’s:
|
|
127
|
+
|
|
128
|
+
- background and goals
|
|
129
|
+
- directory structure and conventions
|
|
130
|
+
- chosen technologies and versions (runtime, package manager, test runner)
|
|
131
|
+
- architecture boundaries (packages, CLI, core modules)
|
|
132
|
+
- existing patterns for tests, docs, and CI
|
|
133
|
+
|
|
134
|
+
### Minimum analysis checklist
|
|
135
|
+
|
|
136
|
+
- [ ] Read key repo docs: README / CHANGELOG / RELEASE (if present)
|
|
137
|
+
- [ ] Inspect `.qfai/` layout and existing SDD/ATDD/TDD artifacts (if present)
|
|
138
|
+
- [ ] Inspect `packages/qfai` structure (CLI entrypoints, core modules, validators, assets/init)
|
|
139
|
+
- [ ] Identify standard gate commands (format/lint/type/test/verify-pack) and where they are defined
|
|
140
|
+
- [ ] Search for existing examples/patterns of similar changes in tests (if available)
|
|
141
|
+
- [ ] Note constraints: Node versions, CI matrix, packaging rules, verify-pack expectations
|
|
142
|
+
|
|
143
|
+
If analysis cannot be performed (missing access), clearly state what could not be verified and proceed with minimal-risk assumptions.
|
|
144
|
+
|
|
145
|
+
## Step 0.5 — Steering Bootstrap / Refresh (mandatory when incomplete)
|
|
146
|
+
|
|
147
|
+
QFAI expects `assistant/steering/` to contain **project‑specific facts** so all subsequent design/test/implementation fits this repository.
|
|
148
|
+
|
|
149
|
+
### What to do
|
|
150
|
+
|
|
151
|
+
1. Open these files:
|
|
152
|
+
|
|
153
|
+
- `.qfai/assistant/steering/product.md`
|
|
154
|
+
- `.qfai/assistant/steering/tech.md`
|
|
155
|
+
- `.qfai/assistant/steering/structure.md`
|
|
156
|
+
|
|
157
|
+
2. If they are missing, mostly empty, or still have placeholders (e.g., `- ` only), **populate them by analyzing the current repository**:
|
|
158
|
+
|
|
159
|
+
- derive “what/why/users/success/non-goals” from README/docs/issues (product.md)
|
|
160
|
+
- derive runtime/tooling versions + constraints from package.json, CI config, lockfiles (tech.md)
|
|
161
|
+
- derive repo layout + key directories + gate commands from the file tree and scripts (structure.md)
|
|
162
|
+
|
|
163
|
+
3. Do **not** invent facts. If something cannot be verified, write it as:
|
|
164
|
+
|
|
165
|
+
- `TBD` + what evidence is missing, or
|
|
166
|
+
- an Open Question (if it blocks correctness)
|
|
167
|
+
|
|
168
|
+
### Steering refresh checklist
|
|
169
|
+
|
|
170
|
+
- [ ] product.md: what we build / users / success / non-goals / release posture
|
|
171
|
+
- [ ] tech.md: Node / package manager / TS / test / lint / CI constraints
|
|
172
|
+
- [ ] structure.md: repo layout, key packages, entrypoints, standard gate commands, how to run locally
|
|
173
|
+
|
|
174
|
+
## Step 1 — Determine spec pack identity
|
|
175
|
+
|
|
176
|
+
If the user does not provide an ID:
|
|
177
|
+
|
|
178
|
+
- Propose the next available `spec-XXXX` and proceed (or ask if interactive).
|
|
179
|
+
|
|
180
|
+
## Step 2 — Create/Update spec pack files
|
|
181
|
+
|
|
182
|
+
### 2.1 `spec.md` template (Architect)
|
|
183
|
+
|
|
184
|
+
Use this structure:
|
|
185
|
+
|
|
186
|
+
# Spec: <title>
|
|
187
|
+
|
|
188
|
+
## 1. Goal
|
|
189
|
+
|
|
190
|
+
## 2. Non‑Goals
|
|
191
|
+
|
|
192
|
+
## 3. Background / Context
|
|
193
|
+
|
|
194
|
+
## 4. Requirements Mapping
|
|
195
|
+
|
|
196
|
+
Reference the requirement IDs from `.qfai/require/require.md`.
|
|
197
|
+
|
|
198
|
+
## 5. Proposed Behavior
|
|
199
|
+
|
|
200
|
+
- User flows
|
|
201
|
+
- Inputs/outputs
|
|
202
|
+
- Error handling
|
|
203
|
+
- Observability
|
|
204
|
+
|
|
205
|
+
## 6. Interfaces & Contracts
|
|
206
|
+
|
|
207
|
+
List which contracts are used:
|
|
208
|
+
|
|
209
|
+
- UI contracts: (file paths / IDs)
|
|
210
|
+
- API contracts:
|
|
211
|
+
- DB contracts:
|
|
212
|
+
|
|
213
|
+
If a contract is missing, mark it as “to be created” and create it in Step 3.
|
|
214
|
+
|
|
215
|
+
## 7. Acceptance Criteria
|
|
216
|
+
|
|
217
|
+
Tie each acceptance criterion to scenarios and/or tests.
|
|
218
|
+
|
|
219
|
+
## 8. Risks & Mitigations
|
|
220
|
+
|
|
221
|
+
## 9. Open Questions
|
|
222
|
+
|
|
223
|
+
(only what truly blocks correctness)
|
|
224
|
+
|
|
225
|
+
### 2.2 `delta.md` template (Planner + QA)
|
|
226
|
+
|
|
227
|
+
Use this structure:
|
|
228
|
+
|
|
229
|
+
# Delta
|
|
230
|
+
|
|
231
|
+
## Summary
|
|
232
|
+
|
|
233
|
+
## User-visible changes
|
|
234
|
+
|
|
235
|
+
## Backward compatibility / migration notes
|
|
236
|
+
|
|
237
|
+
## Affected areas
|
|
238
|
+
|
|
239
|
+
## Verification plan (commands + expected results)
|
|
240
|
+
|
|
241
|
+
## Rollback / recovery notes
|
|
242
|
+
|
|
243
|
+
## Known limitations
|
|
244
|
+
|
|
245
|
+
### 2.3 `scenario.feature` skeleton (Test Engineer)
|
|
246
|
+
|
|
247
|
+
Create a minimal but correct Gherkin skeleton aligned with acceptance criteria:
|
|
248
|
+
|
|
249
|
+
- Feature + Background
|
|
250
|
+
- 1–3 core scenarios
|
|
251
|
+
- Edge / failure scenarios as needed
|
|
252
|
+
|
|
253
|
+
## Step 3 — Contracts (Contract Designer)
|
|
254
|
+
|
|
255
|
+
Only create contracts when the spec requires a stable interface definition.
|
|
256
|
+
|
|
257
|
+
- Place under:
|
|
258
|
+
- `.qfai/contracts/ui/`
|
|
259
|
+
- `.qfai/contracts/api/`
|
|
260
|
+
- `.qfai/contracts/db/`
|
|
261
|
+
- Keep them minimal and aligned with what tests will validate.
|
|
262
|
+
|
|
263
|
+
If your repo defines contract schema or naming rules, follow them. Otherwise:
|
|
264
|
+
|
|
265
|
+
- Use a clear filename and include “Purpose / Fields / Constraints / Examples” inside the YAML as comments.
|
|
266
|
+
|
|
267
|
+
## Step 4 — QA + Review
|
|
268
|
+
|
|
269
|
+
- QA Engineer checks acceptance criteria ↔ scenario consistency.
|
|
270
|
+
- Code Reviewer checks naming, contradictions, missing impact notes.
|
|
271
|
+
- Planner ensures next steps are explicit and minimal.
|
|
272
|
+
|
|
273
|
+
## Step 5 — Approval gate
|
|
274
|
+
|
|
275
|
+
If interactive:
|
|
276
|
+
|
|
277
|
+
- Ask approval before proceeding to test implementation.
|
|
278
|
+
If `--auto`:
|
|
279
|
+
- Proceed with explicit assumptions flagged.
|
|
280
|
+
|
|
281
|
+
## Output
|
|
282
|
+
|
|
283
|
+
- `.qfai/specs/spec-XXXX/spec.md`
|
|
284
|
+
- `.qfai/specs/spec-XXXX/delta.md`
|
|
285
|
+
- `.qfai/specs/spec-XXXX/scenario.feature`
|
|
286
|
+
- (If needed) updated `.qfai/contracts/**`
|
|
287
|
+
- Next recommended command: /qfai-scenario-test and/or /qfai-unit-test
|