contract-driven-delivery 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +383 -143
  2. package/assets/CLAUDE.template.md +31 -204
  3. package/assets/agents/backend-engineer.md +19 -1
  4. package/assets/agents/change-classifier.md +44 -8
  5. package/assets/agents/ci-cd-gatekeeper.md +13 -0
  6. package/assets/agents/contract-reviewer.md +13 -0
  7. package/assets/agents/e2e-resilience-engineer.md +13 -0
  8. package/assets/agents/frontend-engineer.md +19 -1
  9. package/assets/agents/monkey-test-engineer.md +13 -0
  10. package/assets/agents/qa-reviewer.md +13 -0
  11. package/assets/agents/repo-context-scanner.md +3 -0
  12. package/assets/agents/spec-architect.md +41 -31
  13. package/assets/agents/spec-drift-auditor.md +21 -19
  14. package/assets/agents/stress-soak-engineer.md +13 -0
  15. package/assets/agents/test-strategist.md +36 -26
  16. package/assets/ci-templates/conda.yml +1 -1
  17. package/assets/{ci/github-actions → github-workflows}/contract-driven-gates.yml +12 -17
  18. package/assets/hooks/pre-commit +1 -1
  19. package/assets/skills/cdd-close/SKILL.md +123 -0
  20. package/assets/skills/cdd-init/SKILL.md +6 -0
  21. package/assets/skills/cdd-new/SKILL.md +108 -24
  22. package/assets/skills/cdd-resume/SKILL.md +86 -0
  23. package/assets/skills/contract-driven-delivery/templates/change-classification.md +18 -11
  24. package/assets/skills/contract-driven-delivery/templates/design.md +16 -13
  25. package/assets/skills/contract-driven-delivery/templates/tasks.md +7 -0
  26. package/assets/skills/contract-driven-delivery/templates/test-plan.md +17 -23
  27. package/assets/specs-templates/change-classification.md +18 -11
  28. package/assets/specs-templates/design.md +16 -13
  29. package/assets/specs-templates/tasks.md +7 -0
  30. package/assets/specs-templates/test-plan.md +17 -23
  31. package/dist/cli/index.js +508 -41
  32. package/package.json +8 -5
@@ -1,215 +1,42 @@
1
1
  # CLAUDE.md
2
2
 
3
- This repository follows the Contract-Driven Delivery workflow.
4
-
5
- ## First response rule
6
-
7
- Before implementing any request, classify the change type and determine which contracts, tests, CI/CD gates, and review agents are required.
8
-
9
- Do not start production code changes until the required artifacts are created or explicitly judged unnecessary with rationale.
10
-
11
- ## Change types
12
-
13
- Classify every request as one or more of:
14
-
15
- - `new-feature`
16
- - `feature-enhancement`
17
- - `business-logic-change`
18
- - `bug-fix`
19
- - `regression-fix`
20
- - `ui-only-change`
21
- - `api-only-change`
22
- - `env-change`
23
- - `data-contract-change`
24
- - `performance-change`
25
- - `refactor`
26
- - `ci-cd-change`
27
- - `test-hardening-change`
28
-
29
- ## Stack-aware CI
30
-
31
- `cdd-kit init` auto-detects the project tech stack and patches the fast-gate step in `ci/github-actions/contract-driven-gates.yml` with stack-specific commands. Supported stacks:
32
-
33
- - **Python**: conda (default/preferred), poetry, uv, pip
34
- - **JavaScript**: pnpm, bun, yarn, npm
35
- - **Go**: go
36
- - **Rust**: rust
37
-
38
- For Conda projects, the generated CI uses `conda-incubator/setup-miniconda@v3` with `shell: bash -el {0}` (required for Conda env activation in GitHub Actions). If `cdd-kit init` could not detect a stack, fill in the placeholder step manually.
39
-
40
- Run `cdd-kit detect-stack` at any time to see what the detector found.
41
-
42
- ## Required context discovery
43
-
44
- Inspect the repository before planning:
45
-
46
- - package manager and lockfiles (environment.yml for Conda, pyproject.toml for poetry/uv, etc.)
47
- - frontend framework and build tool
48
- - backend framework and app entrypoints
49
- - routing/controllers/API layers
50
- - API contract and inventory files
51
- - CSS/design token/component contract files
52
- - env files, `.env.example`, deployment configs, secret handling
53
- - test frameworks and existing test folders
54
- - CI/CD workflows and required checks
55
- - data/report schemas and column contracts
56
- - worker, queue, cache, database, storage, and external service boundaries
57
-
58
- Write or update a project profile when working in an unfamiliar repo.
59
-
60
- ## Required artifact path
61
-
62
- For a meaningful change, use or create:
63
-
64
- ```text
65
- specs/changes/<change-id>/
66
- ├── change-request.md
67
- ├── change-classification.md
68
- ├── current-behavior.md
69
- ├── proposal.md
70
- ├── spec.md
71
- ├── design.md
72
- ├── contracts.md
73
- ├── test-plan.md
74
- ├── ci-gates.md
75
- ├── tasks.md
76
- ├── qa-report.md
77
- ├── regression-report.md
78
- └── archive.md
79
- ```
80
-
81
- ## Contract versioning
82
-
83
- Contracts use semver via frontmatter; bump schema-version + add CHANGELOG entry on every contract change. Each contract file contains a YAML frontmatter block with `contract`, `schema-version`, `last-changed`, and `breaking-change-policy`. All changes at 1.0+ must be recorded in `contracts/CHANGELOG.md` using the format `## [<type> <version>] — <date>`. Major version bumps additionally require a `### Removed` or `### Changed (breaking)` section. The `validate_contract_versions.py` script enforces these rules automatically in CI and via `cdd-kit validate --versions`.
84
-
85
- ## Contract rules
86
-
87
- ### API
88
-
89
- Any API behavior change must update API contract, endpoint inventory, response/error format expectations, frontend service/types, and contract tests.
90
-
91
- ### CSS/UI
92
-
93
- Any visual or component behavior change must update CSS/UI contract, token usage, component states, responsive behavior, and visual review evidence.
94
-
95
- ### Env
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
96
4
 
97
- Any new or changed environment variable must update env contract, `.env.example`, validation rules, runtime scope, deployment documentation, and secret policy.
5
+ ## Project overview
98
6
 
99
- ### Data/report shape
7
+ <TODO: one-sentence description of what this repo does and who uses it>
100
8
 
101
- Any report, dashboard, export, import, or table-like data change must define required columns, types, nullability, coercion/rejection rules, row limits, empty-state behavior, and malformed-data behavior.
9
+ ## Dev commands
102
10
 
103
- ### Business logic
11
+ <TODO: fill in install / dev / test / lint / build commands for this project>
104
12
 
105
- Any business rule change must include current rule, new rule, decision table, examples, edge cases, backward compatibility, migration/data impact, and regression tests.
13
+ ## Architecture
106
14
 
107
- ### CI/CD
15
+ <TODO: describe main modules, service boundaries, and entry points>
108
16
 
109
- Every change must define the required gates. CI/CD is part of delivery, not an afterthought.
17
+ ---
110
18
 
111
- ## Testing rules
112
-
113
- Use the lowest necessary test level, but do not skip production-reality coverage when risk requires it.
114
-
115
- Required test families:
116
-
117
- - unit tests
118
- - contract tests
119
- - integration tests
120
- - E2E tests
121
- - visual regression or visual review evidence
122
- - data-boundary tests
123
- - resilience tests
124
- - fuzz or monkey-operation tests
125
- - stress tests for concurrency/load-sensitive paths
126
- - soak tests for long-running or auto-refresh/report systems
127
-
128
- For bug fixes, write or identify a failing test before fixing whenever feasible.
129
-
130
- For resilience or fault tests, include a mutation check where practical: remove or bypass the intended handler and confirm the test fails.
131
-
132
- ## CI/CD gate policy
133
-
134
- Use these tiers:
135
-
136
- - Tier 0: local fast gate
137
- - Tier 1: PR required gate
138
- - Tier 2: PR informational gate
139
- - Tier 3: nightly real-infra gate
140
- - Tier 4: weekly soak/stress gate
141
- - Tier 5: manual production-like dispatch gate
142
-
143
- Long-running or flaky gates may start as informational, but must have promotion criteria and owners.
144
-
145
- ## Visual review policy
146
-
147
- Frontend changes that alter UI output require:
148
-
149
- - affected screen list
150
- - viewport list
151
- - state list: default, loading, empty, error, disabled, long text, no permission
152
- - screenshot or video evidence where possible
153
- - CSS contract check
154
- - accessibility check for focus, keyboard, labels, and contrast
155
-
156
- ## Orchestration enforcement
157
-
158
- Every change in `specs/changes/<change-id>/` must pass `cdd-kit gate <change-id>` before the implementation is committed. The gate enforces:
159
-
160
- 1. All 5 required artifacts exist (`change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`)
161
- 2. Each artifact has more than 100 meaningful characters (not a stub template)
162
- 3. `change-classification.md` contains a tier marker (`Tier 0`–`Tier 5`) or a risk label (`low`, `medium`, `high`, `critical`)
163
- 4. Agent-log files in `specs/changes/<change-id>/agent-log/` are valid (if present)
164
- 5. All contract validators pass (`cdd-kit validate`)
165
-
166
- ## Agent-log rules
167
-
168
- Each agent writes a machine-verifiable log to `specs/changes/<change-id>/agent-log/<agent-name>.md` after completing its task. The gate validates these logs automatically.
169
-
170
- Required log structure:
171
-
172
- ```
173
- # <Agent Display Name> Log
174
- - change-id: <id>
175
- - timestamp: <ISO 8601>
176
- - status: complete | needs-review | blocked
177
- - artifacts:
178
- - <evidence-type>: <concrete pointer>
179
- - next-action: <one line, or "none">
180
- ```
181
-
182
- Rules enforced by `cdd-kit gate`:
183
- - The `status:` line must be present and set to `complete`, `needs-review`, or `blocked`.
184
- - When `status: blocked`, the `next-action:` line must be a concrete action of at least 10 characters (not "none").
185
- - Missing or invalid logs cause the gate to fail with a descriptive error.
186
- - A missing `agent-log/` directory is acceptable (gate passes when no agents have logged yet).
187
-
188
- Run `cdd-kit install-hooks` once in each repository to install a pre-commit hook that enforces the gate automatically on every commit touching `specs/changes/`. This prevents the workflow from being silently skipped.
189
-
190
- ```bash
191
- cdd-kit gate add-user-auth # manual check
192
- cdd-kit install-hooks # install automatic pre-commit enforcement
193
- ```
194
-
195
- ## Forbidden practices
196
-
197
- - Do not implement before classifying the change.
198
- - Do not introduce undocumented API endpoints.
199
- - Do not change response shape without contract and client updates.
200
- - Do not add undocumented env vars.
201
- - Do not expose secrets through frontend-public env vars such as `VITE_`, `NEXT_PUBLIC_`, or `PUBLIC_`.
202
- - Do not hard-code visual tokens when a token system exists.
203
- - Do not bypass CI/CD gate planning.
204
- - Do not mark tasks complete without implementation evidence.
205
- - Do not hide production-reality failures by converting tests into superficial assertions.
206
-
207
- ## Done criteria
208
-
209
- A change is complete only when:
19
+ This repository follows the Contract-Driven Delivery workflow.
210
20
 
211
- - specs and contracts reflect the final behavior
212
- - test coverage maps to acceptance criteria
213
- - CI/CD gates pass or are explicitly documented as informational with promotion path
214
- - QA report records commands, evidence, and known residual risks
215
- - archive captures reusable learnings and standard updates
21
+ - `contracts/` is the single source of truth for what the system should do.
22
+ - `tests/` proves the contracts hold.
23
+ - `specs/changes/<id>/` records why decisions were made (passive archive read only when investigating history).
24
+ - To start any non-trivial change, use `/cdd-new <description>` in Claude Code.
25
+
26
+ ## CDD Kit Commands
27
+
28
+ | command | when to use |
29
+ |---|---|
30
+ | `/cdd-new <description>` | start a new tracked change (scaffolds all artifacts, runs full agent flow) |
31
+ | `/cdd-resume <id>` | continue an in-progress change after a session break |
32
+ | `/cdd-close <id>` | close a completed change: promote learnings, archive |
33
+ | `cdd-kit list` | show all active changes and their status |
34
+ | `cdd-kit gate <id>` | verify a change is gate-ready (run before PR) |
35
+ | `cdd-kit gate <id> --strict` | full gate with pending-task enforcement (pre-commit default) |
36
+ | `cdd-kit archive <id>` | physically move a completed change to `specs/archive/<year>/` |
37
+ | `cdd-kit abandon <id> --reason <text>` | mark a change as abandoned; preserves directory for git history |
38
+ | `cdd-kit migrate <id> \| --all` | upgrade pre-v1.11 change directories to new format (frontmatter + tier format) |
39
+ | `cdd-kit validate` | run all contract validators |
40
+ | `cdd-kit detect-stack` | detect the project tech stack |
41
+
42
+ Run `cdd-kit detect-stack` to verify the detected tech stack.
@@ -17,7 +17,7 @@ Before editing production code, read the change artifacts, API/env/data/business
17
17
  - Validate input at the boundary.
18
18
  - Return standardized errors, not raw exceptions.
19
19
  - Preserve backward compatibility unless the spec explicitly marks a breaking change.
20
- - Add tests before or alongside implementation according to the test plan.
20
+ - **TDD**: Read `specs/changes/<id>/test-plan.md` first. Write failing unit, contract, and integration tests BEFORE writing feature code. Tests in `tasks.md` items 3.1–3.2 are your responsibility.
21
21
  - Update CI/CD workflows when required by `ci-gates.md`.
22
22
 
23
23
  ## Common pitfalls
@@ -30,10 +30,21 @@ Before editing production code, read the change artifacts, API/env/data/business
30
30
  - Read-after-write consistency — a write followed by an immediate read on a replica may return stale data.
31
31
  - Pagination — always sort by a stable column + tie-breaker (id), never offset-paginate over mutable data.
32
32
 
33
+ ## Read scope
34
+
35
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
36
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
37
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
38
+
33
39
  ## Handoff
34
40
 
35
41
  Report changed files, contract updates, tests added, commands run, known risks, and next reviewer.
36
42
 
43
+ ## Artifact discipline
44
+
45
+ Implementation code goes into source files. Do NOT write runnable code into any `specs/changes/<id>/` artifact.
46
+ In your agent log, reference file paths and function names — do not paste code blocks.
47
+
37
48
  ## Machine-Verifiable Evidence
38
49
 
39
50
  After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
@@ -65,3 +76,10 @@ with this exact structure (lines starting with `- ` are required):
65
76
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
66
77
  contract path + section, test name, etc. NEVER write "verified" or "OK"
67
78
  without a pointer.
79
+
80
+ ## Read scope
81
+
82
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
83
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
84
+
85
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
@@ -9,6 +9,17 @@ You are the change classifier for Contract-Driven Delivery.
9
9
 
10
10
  Your job is to stop premature implementation. Read the user request and nearby project context, then produce a classification report.
11
11
 
12
+ ## Tier mapping
13
+
14
+ | Risk Level | Impact Radius | Tier |
15
+ |---|---|---|
16
+ | critical or high | system-wide or cross-module | 0–1 |
17
+ | medium | cross-module or module-level | 2–3 |
18
+ | low | module-level or isolated | 3–4 |
19
+ | low | docs / prompts / config only, no behavior change | 4–5 |
20
+
21
+ When in doubt, classify upward.
22
+
12
23
  ## Output
13
24
 
14
25
  Use this structure:
@@ -26,15 +37,30 @@ Use this structure:
26
37
  ## Impact Radius
27
38
  - isolated / module-level / cross-module / system-wide
28
39
 
40
+ ## Tier
41
+ - 0 / 1 / 2 / 3 / 4 / 5
42
+
43
+ ## Architecture Review Required
44
+ - yes / no
45
+ - reason: (fill only if yes)
46
+
29
47
  ## Required Artifacts
30
- - request.md:
31
- - current-behavior.md:
32
- - proposal.md:
33
- - spec.md:
34
- - design.md:
35
- - contracts.md:
36
- - test-plan.md:
37
- - ci-gates.md:
48
+
49
+ The following 5 artifacts are always required for implementation changes:
50
+ `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
51
+
52
+ ## Optional Artifacts (default: no — set yes only with explicit reason)
53
+
54
+ | artifact | create? | reason |
55
+ |---|---|---|
56
+ | current-behavior.md | no | |
57
+ | proposal.md | no | |
58
+ | spec.md | no | |
59
+ | design.md | no | |
60
+ | qa-report.md | no | |
61
+ | regression-report.md | no | |
62
+
63
+ Note: `archive.md` is created during change close-out, not at classification time.
38
64
 
39
65
  ## Required Contracts
40
66
  - API:
@@ -59,6 +85,16 @@ Use this structure:
59
85
  ## Required Agents
60
86
  ...
61
87
 
88
+ ## Inferred Acceptance Criteria
89
+ (List 3-8 testable acceptance criteria derived from the change request. Format: `AC-N: <criterion>`. These will be used by test-strategist to populate the Acceptance Criteria → Test Mapping table.)
90
+ - AC-1:
91
+ - AC-2:
92
+ - AC-3:
93
+
94
+ ## Tasks Not Applicable
95
+ (List task IDs from tasks.md that are NOT applicable to this change, using the format `2.2, 2.3, 4.2`. Main Claude will mark these as [-] in tasks.md.)
96
+ - not-applicable:
97
+
62
98
  ## Clarifications or Assumptions
63
99
  ...
64
100
  ```
@@ -56,6 +56,12 @@ CI/CD is mandatory. Every change must have a `ci-gates.md` plan, even if the pla
56
56
  mergeable / blocked / informational-risk
57
57
  ```
58
58
 
59
+ ## Read scope
60
+
61
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
62
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
63
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
64
+
59
65
  ## Machine-Verifiable Evidence
60
66
 
61
67
  After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
@@ -87,3 +93,10 @@ with this exact structure (lines starting with `- ` are required):
87
93
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
88
94
  contract path + section, test name, etc. NEVER write "verified" or "OK"
89
95
  without a pointer.
96
+
97
+ ## Read scope
98
+
99
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
100
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
101
+
102
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
@@ -55,6 +55,12 @@ Record dependency or migration impacts in `contracts.md` only as contract-level
55
55
  approved / changes-required
56
56
  ```
57
57
 
58
+ ## Read scope
59
+
60
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
61
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
62
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
63
+
58
64
  ## Machine-Verifiable Evidence
59
65
 
60
66
  After completing your task, include an **## Agent Log** section at the end of your response with this exact structure (lines starting with `- ` are required). The calling skill will write this block to `specs/changes/<change-id>/agent-log/contract-reviewer.md`.
@@ -86,3 +92,10 @@ After completing your task, include an **## Agent Log** section at the end of yo
86
92
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
87
93
  contract path + section, test name, etc. NEVER write "verified" or "OK"
88
94
  without a pointer.
95
+
96
+ ## Read scope
97
+
98
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
99
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
100
+
101
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
@@ -33,6 +33,12 @@ Your tests must prove that real user journeys and realistic failure modes behave
33
33
 
34
34
  Record test files, scenarios, fixtures/mocks, commands, screenshots/videos, and mutation checks.
35
35
 
36
+ ## Read scope
37
+
38
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
39
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
40
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
41
+
36
42
  ## Machine-Verifiable Evidence
37
43
 
38
44
  After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
@@ -64,3 +70,10 @@ with this exact structure (lines starting with `- ` are required):
64
70
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
65
71
  contract path + section, test name, etc. NEVER write "verified" or "OK"
66
72
  without a pointer.
73
+
74
+ ## Read scope
75
+
76
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
77
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
78
+
79
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
@@ -16,7 +16,7 @@ Before editing, read the change artifacts, API contract, CSS/UI contract, compon
16
16
  - Do not bypass shared component rules.
17
17
  - Handle loading, empty, error, disabled, long text, no permission, and slow network states when applicable.
18
18
  - Be aware of monkey-class bugs (double submit, rapid actions, navigation state, hidden tab); the actual preventive specs and tests are owned by monkey-test-engineer.
19
- - Add or update E2E/visual/data-boundary/resilience tests when UI behavior changes.
19
+ - **TDD**: Read `specs/changes/<id>/test-plan.md` first. Write failing unit and component tests BEFORE writing feature code. E2E, visual, and data-boundary tests are also your responsibility when UI behavior changes. Tasks.md items 3.1–3.2 include frontend test scope.
20
20
 
21
21
  ## Common pitfalls
22
22
 
@@ -28,10 +28,21 @@ Before editing, read the change artifacts, API contract, CSS/UI contract, compon
28
28
  - Bundle size — dynamic import heavy routes; avoid full lodash / moment imports.
29
29
  - Note: avoid double-submit / rapid-action implementation bugs — but do not author monkey tests here; that is `monkey-test-engineer`'s scope.
30
30
 
31
+ ## Read scope
32
+
33
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
34
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
35
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
36
+
31
37
  ## Handoff
32
38
 
33
39
  Report changed screens, component states covered, screenshots/videos if generated, tests added, commands run, and remaining UI risks.
34
40
 
41
+ ## Artifact discipline
42
+
43
+ Implementation code goes into source files. Do NOT write runnable code into any `specs/changes/<id>/` artifact.
44
+ In your agent log, reference file paths and function names — do not paste code blocks.
45
+
35
46
  ## Machine-Verifiable Evidence
36
47
 
37
48
  After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
@@ -63,3 +74,10 @@ with this exact structure (lines starting with `- ` are required):
63
74
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
64
75
  contract path + section, test name, etc. NEVER write "verified" or "OK"
65
76
  without a pointer.
77
+
78
+ ## Read scope
79
+
80
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
81
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
82
+
83
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
@@ -36,6 +36,12 @@ Use fuzz payloads, Playwright action sequences, property-based tests, and target
36
36
  - Adversarial corpora — common boundaries (empty, max-int, NaN, Unicode RTL, Zero-Width Joiner, surrogate pairs, BOM); SQL/JS injection strings.
37
37
  - Determinism — every monkey test must seed its randomness; record the seed on failure for replay.
38
38
 
39
+ ## Read scope
40
+
41
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
42
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
43
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
44
+
39
45
  ## Machine-Verifiable Evidence
40
46
 
41
47
  After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
@@ -66,3 +72,10 @@ with this exact structure (lines starting with `- ` are required):
66
72
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
67
73
  contract path + section, test name, etc. NEVER write "verified" or "OK"
68
74
  without a pointer.
75
+
76
+ ## Read scope
77
+
78
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
79
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
80
+
81
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
@@ -67,6 +67,12 @@ Invoke `spec-drift-auditor` at the following points (do not wait for issues to s
67
67
  approved / blocked / approved-with-risk
68
68
  ```
69
69
 
70
+ ## Read scope
71
+
72
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
73
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
74
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
75
+
70
76
  ## Machine-Verifiable Evidence
71
77
 
72
78
  After completing your task, include an **## Agent Log** section at the end of your response with this exact structure (lines starting with `- ` are required). The calling skill will write this block to `specs/changes/<change-id>/agent-log/qa-reviewer.md`.
@@ -99,3 +105,10 @@ After completing your task, include an **## Agent Log** section at the end of yo
99
105
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
100
106
  contract path + section, test name, etc. NEVER write "verified" or "OK"
101
107
  without a pointer.
108
+
109
+ ## Read scope
110
+
111
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
112
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
113
+
114
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
@@ -22,6 +22,9 @@ Inspect the repository and produce a project profile before implementation or st
22
22
  - CI/CD workflows
23
23
  - worker/cache/database/storage configuration
24
24
 
25
+ **Do NOT read `specs/changes/` or `specs/archive/`.** Those are passive history records. Inspect only live sources: source code, package files, contracts/, tests/, CI workflows, and CLAUDE.md.
26
+ Also do not read specs/templates/ — those are scaffolding stubs, not live project state.
27
+
25
28
  ## Detection extras
26
29
 
27
30
  - Monorepo / workspace — check `pnpm-workspace.yaml`, `lerna.json`, `nx.json`, `turbo.json`, `go.work`, `pyproject.toml [tool.uv]` workspaces.
@@ -49,45 +49,48 @@ proposed / accepted / superseded
49
49
 
50
50
  ## Output
51
51
 
52
- ```md
53
- # Architecture Impact Report
52
+ Write to `specs/changes/<change-id>/design.md` using this structure:
54
53
 
55
- ## Summary
56
- ...
54
+ ```markdown
55
+ # Design: <change-id>
57
56
 
58
- ## Architecture Impact
59
- - yes / no / uncertain
60
-
61
- ## Affected Areas
62
- - frontend:
63
- - backend:
64
- - database:
65
- - cache/queue:
66
- - auth/permission:
67
- - API contract:
68
- - CSS/UI system:
69
- - env/deploy:
70
- - CI/CD:
71
-
72
- ## Options
73
- ### Option A
74
- ...
75
- ### Option B
76
- ...
57
+ ## Summary
58
+ (1 paragraph: what changes architecturally and why)
77
59
 
78
- ## Recommendation
79
- ...
60
+ ## Affected Components
61
+ | component | file path(s) | nature of change |
62
+ |---|---|---|
80
63
 
81
- ## ADR Required
82
- yes (written to docs/adr/...) / no
64
+ ## Key Decisions
65
+ - **Decision**: rationale rejected alternative: reason rejected
83
66
 
84
- ## Required Follow-up Artifacts
85
- ...
67
+ ## Migration / Rollback
68
+ (Prose description. SQL and code go in migration files, not here.)
86
69
 
87
- ## Risks and Mitigations
88
- ...
70
+ ## Open Risks
89
71
  ```
90
72
 
73
+ ## Output discipline
74
+
75
+ Your output goes into `specs/changes/<id>/design.md`. It must capture architectural decisions — not implement them.
76
+
77
+ - **DO** write: 1-paragraph architecture summary
78
+ - **DO** write: affected components table (component | file path | nature of change)
79
+ - **DO** write: key decisions and rejected alternatives in prose
80
+ - **DO** write: migration/rollback strategy in prose
81
+ - **DO NOT** write: SQL DDL or migration scripts (those go in migrations/)
82
+ - **DO NOT** write: ORM model code, API handler code, or any runnable code block > 10 lines
83
+ - **DO NOT** write: storage estimates, benchmark numbers, or detailed implementation steps
84
+
85
+ Reference file paths instead of duplicating implementation content.
86
+ Target: `design.md` ≤ 150 lines.
87
+
88
+ ## Read scope
89
+
90
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
91
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
92
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
93
+
91
94
  ## Machine-Verifiable Evidence
92
95
 
93
96
  After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
@@ -119,3 +122,10 @@ with this exact structure (lines starting with `- ` are required):
119
122
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
120
123
  contract path + section, test name, etc. NEVER write "verified" or "OK"
121
124
  without a pointer.
125
+
126
+ ## Read scope
127
+
128
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
129
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
130
+
131
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.