contract-driven-delivery 1.9.0 → 1.10.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.
- package/assets/CLAUDE.template.md +14 -203
- package/assets/agents/backend-engineer.md +6 -1
- package/assets/agents/change-classifier.md +34 -8
- package/assets/agents/frontend-engineer.md +6 -1
- package/assets/agents/repo-context-scanner.md +3 -0
- package/assets/agents/spec-architect.md +28 -31
- package/assets/agents/spec-drift-auditor.md +21 -19
- package/assets/agents/test-strategist.md +25 -28
- package/assets/ci-templates/conda.yml +1 -1
- package/assets/{ci/github-actions → github-workflows}/contract-driven-gates.yml +12 -17
- package/assets/skills/cdd-init/SKILL.md +6 -0
- package/assets/skills/cdd-new/SKILL.md +59 -1
- package/assets/skills/contract-driven-delivery/templates/change-classification.md +17 -11
- package/assets/skills/contract-driven-delivery/templates/design.md +16 -13
- package/assets/skills/contract-driven-delivery/templates/test-plan.md +17 -23
- package/assets/specs-templates/change-classification.md +17 -11
- package/assets/specs-templates/design.md +16 -13
- package/assets/specs-templates/test-plan.md +17 -23
- package/dist/cli/index.js +27 -2
- package/package.json +1 -1
|
@@ -1,215 +1,26 @@
|
|
|
1
1
|
# CLAUDE.md
|
|
2
2
|
|
|
3
|
-
This
|
|
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
|
-
|
|
5
|
+
## Project overview
|
|
98
6
|
|
|
99
|
-
|
|
7
|
+
<TODO: one-sentence description of what this repo does and who uses it>
|
|
100
8
|
|
|
101
|
-
|
|
9
|
+
## Dev commands
|
|
102
10
|
|
|
103
|
-
|
|
11
|
+
<TODO: fill in install / dev / test / lint / build commands for this project>
|
|
104
12
|
|
|
105
|
-
|
|
13
|
+
## Architecture
|
|
106
14
|
|
|
107
|
-
|
|
15
|
+
<TODO: describe main modules, service boundaries, and entry points>
|
|
108
16
|
|
|
109
|
-
|
|
17
|
+
---
|
|
110
18
|
|
|
111
|
-
|
|
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
|
|
19
|
+
This repository follows the Contract-Driven Delivery workflow.
|
|
208
20
|
|
|
209
|
-
|
|
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.
|
|
210
25
|
|
|
211
|
-
-
|
|
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
|
|
26
|
+
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
|
-
-
|
|
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
|
|
@@ -34,6 +34,11 @@ Before editing production code, read the change artifacts, API/env/data/business
|
|
|
34
34
|
|
|
35
35
|
Report changed files, contract updates, tests added, commands run, known risks, and next reviewer.
|
|
36
36
|
|
|
37
|
+
## Artifact discipline
|
|
38
|
+
|
|
39
|
+
Implementation code goes into source files. Do NOT write runnable code into any `specs/changes/<id>/` artifact.
|
|
40
|
+
In your agent log, reference file paths and function names — do not paste code blocks.
|
|
41
|
+
|
|
37
42
|
## Machine-Verifiable Evidence
|
|
38
43
|
|
|
39
44
|
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
@@ -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
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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:
|
|
@@ -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
|
-
-
|
|
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
|
|
|
@@ -32,6 +32,11 @@ Before editing, read the change artifacts, API contract, CSS/UI contract, compon
|
|
|
32
32
|
|
|
33
33
|
Report changed screens, component states covered, screenshots/videos if generated, tests added, commands run, and remaining UI risks.
|
|
34
34
|
|
|
35
|
+
## Artifact discipline
|
|
36
|
+
|
|
37
|
+
Implementation code goes into source files. Do NOT write runnable code into any `specs/changes/<id>/` artifact.
|
|
38
|
+
In your agent log, reference file paths and function names — do not paste code blocks.
|
|
39
|
+
|
|
35
40
|
## Machine-Verifiable Evidence
|
|
36
41
|
|
|
37
42
|
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
@@ -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,42 @@ proposed / accepted / superseded
|
|
|
49
49
|
|
|
50
50
|
## Output
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
Write to `specs/changes/<change-id>/design.md` using this structure:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
# Design: <change-id>
|
|
54
56
|
|
|
55
57
|
## Summary
|
|
56
|
-
|
|
58
|
+
(1 paragraph: what changes architecturally and why)
|
|
57
59
|
|
|
58
|
-
##
|
|
59
|
-
|
|
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
|
-
...
|
|
60
|
+
## Affected Components
|
|
61
|
+
| component | file path(s) | nature of change |
|
|
62
|
+
|---|---|---|
|
|
77
63
|
|
|
78
|
-
##
|
|
79
|
-
|
|
64
|
+
## Key Decisions
|
|
65
|
+
- **Decision**: rationale — rejected alternative: reason rejected
|
|
80
66
|
|
|
81
|
-
##
|
|
82
|
-
|
|
67
|
+
## Migration / Rollback
|
|
68
|
+
(Prose description. SQL and code go in migration files, not here.)
|
|
83
69
|
|
|
84
|
-
##
|
|
85
|
-
...
|
|
86
|
-
|
|
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
|
+
|
|
91
88
|
## Machine-Verifiable Evidence
|
|
92
89
|
|
|
93
90
|
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec-drift-auditor
|
|
3
|
-
description: Audit drift
|
|
3
|
+
description: Audit drift between live contracts, implementation code, tests, and CI gates. Does NOT read historical specs/changes — contracts/ is the single source of truth.
|
|
4
4
|
tools: Read, Grep, Glob, Bash
|
|
5
5
|
model: claude-opus-4-7
|
|
6
6
|
---
|
|
@@ -9,22 +9,27 @@ You are the spec drift auditor.
|
|
|
9
9
|
|
|
10
10
|
Multi-iteration development creates drift. Find it before it becomes production debt.
|
|
11
11
|
|
|
12
|
-
## Audit
|
|
12
|
+
## Audit axes
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
- Does every
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
- Are
|
|
14
|
+
**1. contracts/ vs code**
|
|
15
|
+
- Does every contract entry (API endpoint, business rule, env var, CSS token) have evidence in source code?
|
|
16
|
+
- Does any code behaviour exceed or contradict what contracts declare?
|
|
17
|
+
|
|
18
|
+
**2. contracts/ vs tests**
|
|
19
|
+
- Does every contract entry have at least one corresponding test?
|
|
20
|
+
- Are tests asserting the correct contract schema (not internal implementation details)?
|
|
21
|
+
|
|
22
|
+
**3. CI workflows vs ci-gates declarations**
|
|
23
|
+
- Does every gate declared in contracts/ci/ci-gate-contract.md exist in .github/workflows/?
|
|
24
|
+
- Are required gates non-skippable?
|
|
25
|
+
|
|
26
|
+
By default, do NOT read `specs/changes/` history. Only read historical change records when the user explicitly asks for cross-iteration traceability or historical investigation ("why was X decided?"). Contracts are the authority.
|
|
21
27
|
|
|
22
28
|
## Cadence and automation
|
|
23
29
|
|
|
24
30
|
- Cadence — before every release to main; weekly during active multi-iteration work; ad-hoc when QA finds unexplained behavior.
|
|
25
31
|
- Automatable — file existence, traceability term presence, contract column completeness, CI step presence (already covered by `validate_*.py` scripts).
|
|
26
|
-
- Manual-only — semantic correctness ("does the spec actually describe what shipped?"),
|
|
27
|
-
- Sunset policy — archived specs older than 12 months that conflict with current contracts must be either updated, marked superseded, or moved to `specs/archive/_deprecated/`.
|
|
32
|
+
- Manual-only — semantic correctness ("does the spec actually describe what shipped?"), cross-iteration redundancy.
|
|
28
33
|
|
|
29
34
|
## Output
|
|
30
35
|
|
|
@@ -43,19 +48,17 @@ Multi-iteration development creates drift. Find it before it becomes production
|
|
|
43
48
|
|
|
44
49
|
## CI/Test Drift
|
|
45
50
|
...
|
|
46
|
-
|
|
47
|
-
## Archive Actions Needed
|
|
48
|
-
...
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
## Machine-Verifiable Evidence
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
Write this block to `specs/audits/<YYYY-MM-DD>-drift-audit.md` (create the file yourself).
|
|
56
|
+
Use this exact structure (lines starting with `- ` are required):
|
|
54
57
|
|
|
55
58
|
```
|
|
56
59
|
## Agent Log
|
|
57
60
|
# Spec Drift Auditor Log
|
|
58
|
-
-
|
|
61
|
+
- audit-id: <YYYY-MM-DD>-drift
|
|
59
62
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
60
63
|
- status: complete | needs-review | blocked
|
|
61
64
|
- artifacts:
|
|
@@ -67,12 +70,11 @@ After completing your task, include an **## Agent Log** section at the end of yo
|
|
|
67
70
|
### Required artifacts for this agent
|
|
68
71
|
- `surfaces-audited`: list (specs/contracts/code/tests/CI/tasks/archive)
|
|
69
72
|
- `drift-items`: count + severity
|
|
70
|
-
- `drift-summary-path`:
|
|
73
|
+
- `drift-summary-path`: `specs/audits/<YYYY-MM-DD>-drift-audit.md`
|
|
71
74
|
- `next-audit-due`: ISO date
|
|
72
75
|
|
|
73
76
|
### Rules
|
|
74
|
-
- NEVER omit this
|
|
75
|
-
is missing the `status:` line or has an invalid status.
|
|
77
|
+
- NEVER omit this audit summary file. The drift-audit cadence (release / weekly / ad-hoc) requires this file as its persistence record; missing `status:` voids the audit.
|
|
76
78
|
- If you cannot complete the task, set `status: blocked` and write a
|
|
77
79
|
concrete `next-action` (NOT "investigate further" — write the actual
|
|
78
80
|
next step a human can act on).
|
|
@@ -29,43 +29,40 @@ Design tests before implementation. Prefer concrete test cases, inputs, expected
|
|
|
29
29
|
|
|
30
30
|
## Output
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
# Test Plan
|
|
32
|
+
Write to `specs/changes/<change-id>/test-plan.md` using this structure:
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|---|---|---|---|
|
|
38
|
-
|
|
39
|
-
## Unit Tests
|
|
40
|
-
...
|
|
41
|
-
|
|
42
|
-
## Contract Tests
|
|
43
|
-
...
|
|
34
|
+
```markdown
|
|
35
|
+
# Test Plan: <change-id>
|
|
44
36
|
|
|
45
|
-
##
|
|
46
|
-
|
|
37
|
+
## Acceptance Criteria → Test Mapping
|
|
38
|
+
| criterion id | test family | test file path | tier |
|
|
39
|
+
|---|---|---|---|
|
|
47
40
|
|
|
48
|
-
##
|
|
49
|
-
|
|
41
|
+
## Test Families Required
|
|
42
|
+
| family | tier | notes |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| (unit / contract / integration / e2e / data-boundary / resilience / monkey / stress / soak) | | |
|
|
50
45
|
|
|
51
|
-
##
|
|
52
|
-
...
|
|
46
|
+
## Out of Scope
|
|
53
47
|
|
|
54
|
-
##
|
|
55
|
-
|
|
48
|
+
## Notes
|
|
49
|
+
(Keep under 10 lines. Implementation detail belongs in the test files themselves.)
|
|
50
|
+
```
|
|
56
51
|
|
|
57
|
-
##
|
|
58
|
-
...
|
|
52
|
+
## Output discipline
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
...
|
|
54
|
+
Your output goes into `specs/changes/<id>/test-plan.md`. It must answer WHAT to test and WHY — not HOW to implement the tests.
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
- **DO** write: acceptance criteria → test family mapping (table)
|
|
57
|
+
- **DO** write: test file paths and test function names (one line each, no body)
|
|
58
|
+
- **DO** write: tier assignment per test family
|
|
59
|
+
- **DO NOT** write: full test function bodies
|
|
60
|
+
- **DO NOT** write: mock setup details, fixture data, or expected JSON payloads
|
|
61
|
+
- **DO NOT** write: per-test input/output tables with more than 15 rows
|
|
62
|
+
- **DO NOT** write: example assertions or test helper code
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
```
|
|
64
|
+
Implementation detail belongs in the test files, not in test-plan.md.
|
|
65
|
+
Target: `test-plan.md` ≤ 100 lines.
|
|
69
66
|
|
|
70
67
|
## Machine-Verifiable Evidence
|
|
71
68
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
- uses: conda-incubator/setup-miniconda@v3
|
|
2
2
|
with:
|
|
3
3
|
environment-file: environment.yml
|
|
4
|
-
activate-environment: "
|
|
4
|
+
activate-environment: "{{conda-env-name}}"
|
|
5
5
|
auto-activate-base: false
|
|
6
6
|
- name: Lint + Type + Test
|
|
7
7
|
shell: bash -el {0}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Contract-driven gates baseline (provided by cdd-kit).
|
|
2
|
-
#
|
|
3
|
-
# See
|
|
2
|
+
# Application/test commands MUST be customized for your stack.
|
|
3
|
+
# See ci/gate-policy.md for tier semantics and promotion policy.
|
|
4
4
|
|
|
5
5
|
name: contract-driven-gates
|
|
6
6
|
|
|
7
7
|
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main, master]
|
|
8
10
|
pull_request:
|
|
9
11
|
workflow_dispatch:
|
|
10
12
|
schedule:
|
|
@@ -21,23 +23,16 @@ jobs:
|
|
|
21
23
|
with:
|
|
22
24
|
python-version: '3.10'
|
|
23
25
|
|
|
24
|
-
- name:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
run: python .claude/skills/contract-driven-delivery/scripts/validate_contracts.py .
|
|
29
|
-
|
|
30
|
-
- name: Validate env contract
|
|
31
|
-
run: python .claude/skills/contract-driven-delivery/scripts/validate_env_contract.py contracts/env/env-contract.md
|
|
32
|
-
|
|
33
|
-
- name: Validate ci gates
|
|
34
|
-
run: python .claude/skills/contract-driven-delivery/scripts/validate_ci_gates.py
|
|
26
|
+
- name: Set up Node.js
|
|
27
|
+
uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: '20'
|
|
35
30
|
|
|
36
|
-
- name:
|
|
37
|
-
run:
|
|
31
|
+
- name: Install cdd-kit
|
|
32
|
+
run: npm install -g contract-driven-delivery
|
|
38
33
|
|
|
39
|
-
- name: Validate
|
|
40
|
-
run:
|
|
34
|
+
- name: Validate contracts and gates
|
|
35
|
+
run: cdd-kit validate
|
|
41
36
|
|
|
42
37
|
- name: Repository-specific fast gate
|
|
43
38
|
run: |
|
|
@@ -186,3 +186,9 @@ Next step: /cdd-new <describe the gap or feature to address first>
|
|
|
186
186
|
- Gate enforcement starts only after contracts reach 1.0.0
|
|
187
187
|
- Scanning agents only report — YOU (main Claude) write all files
|
|
188
188
|
- If `cdd-kit init` fails: `npm install -g contract-driven-delivery@latest`
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## After Completion
|
|
193
|
+
|
|
194
|
+
The `/cdd-init` workflow is now complete. **Return to normal assistant mode immediately.** Answer any question the user asks — including questions unrelated to this project, new feature discussions, or general conversation — without requiring them to use a specific command. Do not wait for a commit or any other action before resuming normal behavior.
|
|
@@ -5,6 +5,42 @@ description: Start a new tracked change. Scaffolds all required artifacts, class
|
|
|
5
5
|
|
|
6
6
|
# cdd-new — New Change Request
|
|
7
7
|
|
|
8
|
+
## Mental model
|
|
9
|
+
|
|
10
|
+
- `contracts/` = the single source of truth (live — always reflects current system behaviour)
|
|
11
|
+
- `tests/` = proof the contracts hold (live)
|
|
12
|
+
- `specs/changes/<id>/` = why we decided this back then (passive archive — read only when investigating history, never as input to planning)
|
|
13
|
+
- `CLAUDE.md` = what this project is and how to start work
|
|
14
|
+
|
|
15
|
+
## Spec depth rules
|
|
16
|
+
|
|
17
|
+
Every artifact under `specs/changes/<id>/` answers **WHAT** and **WHY**, not HOW.
|
|
18
|
+
|
|
19
|
+
Soft caps (guidance, not gate-enforced):
|
|
20
|
+
- `spec.md` ≤ 200 lines
|
|
21
|
+
- `design.md` ≤ 150 lines
|
|
22
|
+
- `test-plan.md` ≤ 100 lines
|
|
23
|
+
- `ci-gates.md` ≤ 80 lines
|
|
24
|
+
|
|
25
|
+
**Forbidden in spec artifacts** (these belong in code/tests, not specs):
|
|
26
|
+
- SQL DDL or migration code → put in migrations/, reference the path
|
|
27
|
+
- ORM model code (SQLAlchemy, Prisma, etc.) → put in source, reference the module
|
|
28
|
+
- Full test function bodies, mock setup, fixture data, expected JSON payloads → put in tests/
|
|
29
|
+
- Runnable code blocks > 10 lines belong in source files, not specs. Pseudocode and mapping tables are fine at any length.
|
|
30
|
+
- Per-test input/output tables with more than 15 rows (data-boundary tests with up to 15 boundary cases are acceptable)
|
|
31
|
+
|
|
32
|
+
**test-plan.md should contain:**
|
|
33
|
+
- Acceptance criteria → test family mapping (table)
|
|
34
|
+
- Test file paths and test names (one line per test, no implementation detail)
|
|
35
|
+
- Tier assignment per family
|
|
36
|
+
- Out-of-scope list
|
|
37
|
+
|
|
38
|
+
**design.md should contain:**
|
|
39
|
+
- Architecture summary (1 paragraph)
|
|
40
|
+
- Affected components (table: component | file path | nature of change)
|
|
41
|
+
- Key decisions and rejected alternatives (prose)
|
|
42
|
+
- Migration/rollback strategy (prose, not SQL)
|
|
43
|
+
|
|
8
44
|
## Input
|
|
9
45
|
|
|
10
46
|
The skill argument is the user's change description in natural language (e.g., "add JWT authentication to the API" or "redesign the dashboard homepage").
|
|
@@ -26,6 +62,14 @@ If no description is provided, ask the user: "Please describe the change you wan
|
|
|
26
62
|
|
|
27
63
|
---
|
|
28
64
|
|
|
65
|
+
## Artifact opt-in policy
|
|
66
|
+
|
|
67
|
+
Only create optional artifacts (`current-behavior.md`, `proposal.md`, `spec.md`, `design.md`, `qa-report.md`, `regression-report.md`, `archive.md`) when the classifier's `change-classification.md` explicitly marks them as `yes`.
|
|
68
|
+
|
|
69
|
+
If the classifier marks an artifact as `no` or leaves it blank, **do not create the file** — even if a review agent could contribute to it.
|
|
70
|
+
|
|
71
|
+
The 5 always-required artifacts are: `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`.
|
|
72
|
+
|
|
29
73
|
## Step 1: Generate change-id and scaffold
|
|
30
74
|
|
|
31
75
|
Derive a `change-id` from the description:
|
|
@@ -243,24 +287,28 @@ If any agent sets `status: blocked` in its log, halt immediately and report the
|
|
|
243
287
|
2. **`test-strategist`** (write-capable) — writes `specs/changes/<change-id>/test-plan.md` directly.
|
|
244
288
|
- YOU tick: applicable items in section 3 based on what test families were planned
|
|
245
289
|
|
|
246
|
-
3. **`spec-architect`** (write-capable) — only if
|
|
290
|
+
3. **`spec-architect`** (write-capable) — only if `change-classification.md` contains `Architecture Review Required: yes`.
|
|
247
291
|
- YOU tick: `1.3` (if it produced a gate plan)
|
|
248
292
|
|
|
249
293
|
4. **`backend-engineer`** (write-capable) — if the change touches server, API, data, or business logic. Writes implementation and its own agent-log.
|
|
250
294
|
- YOU tick: `4.1` and/or `4.3` based on scope
|
|
295
|
+
- Note: `tasks.md` items 3.1–3.2 (unit/contract/integration tests) are written by `backend-engineer` and/or `frontend-engineer` in TDD fashion — failing tests first, implementation second. Items 3.3–3.5 are written by dedicated test engineers (Tier 0–1 only or when classifier explicitly requires them).
|
|
251
296
|
|
|
252
297
|
5. **`frontend-engineer`** (write-capable) — if the change touches UI, components, or client-side behavior. Writes implementation and its own agent-log.
|
|
253
298
|
- YOU tick: `4.2`
|
|
254
299
|
|
|
255
300
|
6. **`dependency-security-reviewer`** (read-only) — if the change touches lockfiles, package manifests, or DB migrations.
|
|
301
|
+
- **Only invoke if** `change-classification.md` lists lockfiles, package manifests, or DB migrations as affected.
|
|
256
302
|
- YOU write: `agent-log/dependency-security-reviewer.md`
|
|
257
303
|
- YOU tick: applicable security-related items
|
|
258
304
|
|
|
259
305
|
7. **`ui-ux-reviewer`** (read-only) — if any UI change (run alongside or after frontend-engineer).
|
|
306
|
+
- **Only invoke if** classifier marks UI/CSS as affected.
|
|
260
307
|
- YOU write: `agent-log/ui-ux-reviewer.md`
|
|
261
308
|
- YOU tick: `5.1`
|
|
262
309
|
|
|
263
310
|
8. **`visual-reviewer`** (read-only) — if any UI change (run after ui-ux-reviewer).
|
|
311
|
+
- **Only invoke if** classifier marks UI/CSS as affected.
|
|
264
312
|
- YOU write: `agent-log/visual-reviewer.md`
|
|
265
313
|
- YOU tick: `5.2`
|
|
266
314
|
|
|
@@ -293,6 +341,8 @@ All agents from Tier 2–3, plus insert these after `frontend-engineer` / `backe
|
|
|
293
341
|
- If backend-only with no UI: skip `frontend-engineer`, `ui-ux-reviewer`, `visual-reviewer`
|
|
294
342
|
- If UI-only with no backend: skip `backend-engineer`
|
|
295
343
|
|
|
344
|
+
**Resuming from blocked**: After the user resolves the blocking issue, re-invoke the blocked agent (do not restart from Step 1). Continue with the remaining agents in their original order.
|
|
345
|
+
|
|
296
346
|
---
|
|
297
347
|
|
|
298
348
|
## Step 4: Run the gate
|
|
@@ -314,6 +364,8 @@ cdd-kit gate <change-id>
|
|
|
314
364
|
4. Re-run `cdd-kit gate <change-id>`
|
|
315
365
|
5. Repeat until gate passes (max 3 iterations; if still failing after 3, report to user)
|
|
316
366
|
|
|
367
|
+
**Terminal state after 3 failures**: Add a line at the top of `tasks.md` reading `status: gate-blocked` and report all blocking items to the user. The change is paused — do not proceed to Step 5.
|
|
368
|
+
|
|
317
369
|
---
|
|
318
370
|
|
|
319
371
|
## Step 5: Report to user
|
|
@@ -364,3 +416,9 @@ Please review the above items and re-run: cdd-kit gate <change-id>
|
|
|
364
416
|
- Every agent must have its `agent-log/<name>.md` written — YOU write it for read-only agents after receiving their response; write-capable agents write their own
|
|
365
417
|
- Tick the relevant `tasks.md` checkbox immediately after each agent completes — do not batch
|
|
366
418
|
- `qa-reviewer` always runs last and makes the release-readiness decision
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## After Completion
|
|
423
|
+
|
|
424
|
+
The `/cdd-new` workflow is now complete. **Return to normal assistant mode immediately.** Answer any question the user asks — including questions unrelated to this change, new feature discussions, debugging help, or general conversation — without requiring them to use a specific command. The git commit shown in the report is a suggestion, not a required next step; do not wait for it before resuming normal behavior.
|
|
@@ -11,17 +11,23 @@
|
|
|
11
11
|
- isolated / module-level / cross-module / system-wide
|
|
12
12
|
|
|
13
13
|
## Required Artifacts
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
|
21
|
-
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
14
|
+
|
|
15
|
+
The following 5 artifacts are always required for implementation changes:
|
|
16
|
+
`change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
|
|
17
|
+
|
|
18
|
+
Optional artifacts — only create when explicitly needed:
|
|
19
|
+
|
|
20
|
+
| artifact | create? (yes / no) | reason |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| current-behavior.md | no | |
|
|
23
|
+
| proposal.md | no | |
|
|
24
|
+
| spec.md | no | |
|
|
25
|
+
| design.md | no | |
|
|
26
|
+
| qa-report.md | no | |
|
|
27
|
+
| regression-report.md | no | |
|
|
28
|
+
| archive.md | no | |
|
|
29
|
+
|
|
30
|
+
Default is **no**. Change classifier must explicitly set `yes` with a reason.
|
|
25
31
|
|
|
26
32
|
## Required Contracts
|
|
27
33
|
- API:
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
change-id: <id>
|
|
3
|
+
schema-version: 0.1.0
|
|
4
|
+
last-changed: <date>
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
# Design: <change-id>
|
|
4
8
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
## API Design
|
|
9
|
+
## Summary
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
(1 paragraph: what changes architecturally and why)
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Affected Components
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
| component | file path(s) | nature of change |
|
|
16
|
+
|---|---|---|
|
|
14
17
|
|
|
15
|
-
##
|
|
18
|
+
## Key Decisions
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
- **Decision**: rationale — rejected alternative: reason rejected
|
|
18
21
|
|
|
19
|
-
##
|
|
22
|
+
## Migration / Rollback
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
(Prose description. SQL and code go in migration files, not here.)
|
|
22
25
|
|
|
23
|
-
##
|
|
26
|
+
## Open Risks
|
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
change-id: <id>
|
|
3
|
+
schema-version: 0.1.0
|
|
4
|
+
last-changed: <date>
|
|
5
|
+
risk: low | medium | high
|
|
6
|
+
tier: 0 | 1 | 2 | 3 | 4 | 5
|
|
7
|
+
---
|
|
2
8
|
|
|
3
|
-
|
|
4
|
-
| requirement | test family | planned file/spec | expected evidence |
|
|
5
|
-
|---|---|---|---|
|
|
6
|
-
|
|
7
|
-
## Unit Tests
|
|
8
|
-
|
|
9
|
-
## Contract Tests
|
|
10
|
-
|
|
11
|
-
## Integration Tests
|
|
9
|
+
# Test Plan: <change-id>
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Acceptance Criteria → Test Mapping
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Resilience Tests
|
|
20
|
-
|
|
21
|
-
## Fuzz / Monkey Operation Tests
|
|
13
|
+
| criterion id | test family | test file path | tier |
|
|
14
|
+
|---|---|---|---|
|
|
15
|
+
| AC-1 | unit | tests/unit/test_xxx.py | 0 |
|
|
22
16
|
|
|
23
|
-
##
|
|
17
|
+
## Test Families Required
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
Mark all that apply: unit / contract / integration / e2e / data-boundary / resilience / monkey / stress / soak
|
|
26
20
|
|
|
27
|
-
##
|
|
21
|
+
## Out of Scope
|
|
28
22
|
|
|
29
|
-
##
|
|
23
|
+
## Notes
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
(Keep this section under 10 lines. Implementation detail belongs in the test files themselves.)
|
|
@@ -11,17 +11,23 @@
|
|
|
11
11
|
- isolated / module-level / cross-module / system-wide
|
|
12
12
|
|
|
13
13
|
## Required Artifacts
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
|
21
|
-
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
14
|
+
|
|
15
|
+
The following 5 artifacts are always required for implementation changes:
|
|
16
|
+
`change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
|
|
17
|
+
|
|
18
|
+
Optional artifacts — only create when explicitly needed:
|
|
19
|
+
|
|
20
|
+
| artifact | create? (yes / no) | reason |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| current-behavior.md | no | |
|
|
23
|
+
| proposal.md | no | |
|
|
24
|
+
| spec.md | no | |
|
|
25
|
+
| design.md | no | |
|
|
26
|
+
| qa-report.md | no | |
|
|
27
|
+
| regression-report.md | no | |
|
|
28
|
+
| archive.md | no | |
|
|
29
|
+
|
|
30
|
+
Default is **no**. Change classifier must explicitly set `yes` with a reason.
|
|
25
31
|
|
|
26
32
|
## Required Contracts
|
|
27
33
|
- API:
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
change-id: <id>
|
|
3
|
+
schema-version: 0.1.0
|
|
4
|
+
last-changed: <date>
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
# Design: <change-id>
|
|
4
8
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
## API Design
|
|
9
|
+
## Summary
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
(1 paragraph: what changes architecturally and why)
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Affected Components
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
| component | file path(s) | nature of change |
|
|
16
|
+
|---|---|---|
|
|
14
17
|
|
|
15
|
-
##
|
|
18
|
+
## Key Decisions
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
- **Decision**: rationale — rejected alternative: reason rejected
|
|
18
21
|
|
|
19
|
-
##
|
|
22
|
+
## Migration / Rollback
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
(Prose description. SQL and code go in migration files, not here.)
|
|
22
25
|
|
|
23
|
-
##
|
|
26
|
+
## Open Risks
|
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
change-id: <id>
|
|
3
|
+
schema-version: 0.1.0
|
|
4
|
+
last-changed: <date>
|
|
5
|
+
risk: low | medium | high
|
|
6
|
+
tier: 0 | 1 | 2 | 3 | 4 | 5
|
|
7
|
+
---
|
|
2
8
|
|
|
3
|
-
|
|
4
|
-
| requirement | test family | planned file/spec | expected evidence |
|
|
5
|
-
|---|---|---|---|
|
|
6
|
-
|
|
7
|
-
## Unit Tests
|
|
8
|
-
|
|
9
|
-
## Contract Tests
|
|
10
|
-
|
|
11
|
-
## Integration Tests
|
|
9
|
+
# Test Plan: <change-id>
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Acceptance Criteria → Test Mapping
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Resilience Tests
|
|
20
|
-
|
|
21
|
-
## Fuzz / Monkey Operation Tests
|
|
13
|
+
| criterion id | test family | test file path | tier |
|
|
14
|
+
|---|---|---|---|
|
|
15
|
+
| AC-1 | unit | tests/unit/test_xxx.py | 0 |
|
|
22
16
|
|
|
23
|
-
##
|
|
17
|
+
## Test Families Required
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
Mark all that apply: unit / contract / integration / e2e / data-boundary / resilience / monkey / stress / soak
|
|
26
20
|
|
|
27
|
-
##
|
|
21
|
+
## Out of Scope
|
|
28
22
|
|
|
29
|
-
##
|
|
23
|
+
## Notes
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
(Keep this section under 10 lines. Implementation detail belongs in the test files themselves.)
|
package/dist/cli/index.js
CHANGED
|
@@ -26,6 +26,7 @@ var ASSET = {
|
|
|
26
26
|
specsTemplates: join(ASSETS_DIR, "specs-templates"),
|
|
27
27
|
testsTemplates: join(ASSETS_DIR, "tests-templates"),
|
|
28
28
|
ci: join(ASSETS_DIR, "ci"),
|
|
29
|
+
githubWorkflows: join(ASSETS_DIR, "github-workflows"),
|
|
29
30
|
hooks: join(ASSETS_DIR, "hooks"),
|
|
30
31
|
claudeTemplate: join(ASSETS_DIR, "CLAUDE.template.md"),
|
|
31
32
|
agentsTemplate: join(ASSETS_DIR, "AGENTS.template.md")
|
|
@@ -224,6 +225,18 @@ function detectStack(repoRoot) {
|
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
// src/commands/init.ts
|
|
228
|
+
function readCondaEnvName(cwd) {
|
|
229
|
+
const envYml = join4(cwd, "environment.yml");
|
|
230
|
+
if (!existsSync3(envYml))
|
|
231
|
+
return "base";
|
|
232
|
+
try {
|
|
233
|
+
const content = readFileSync2(envYml, "utf8");
|
|
234
|
+
const match = content.match(/^name:\s*(.+)$/m);
|
|
235
|
+
return match ? match[1].trim() : "base";
|
|
236
|
+
} catch {
|
|
237
|
+
return "base";
|
|
238
|
+
}
|
|
239
|
+
}
|
|
227
240
|
function loadCiTemplate(stack) {
|
|
228
241
|
const templatePath = join4(ASSETS_DIR, "ci-templates", `${stack}.yml`);
|
|
229
242
|
if (!existsSync3(templatePath))
|
|
@@ -326,6 +339,13 @@ async function init(opts) {
|
|
|
326
339
|
);
|
|
327
340
|
track(ciCreated);
|
|
328
341
|
log.ok(`ci/ \u2014 ${ciCount} file(s) written.`);
|
|
342
|
+
const { count: wfCount, created: wfCreated } = copyDirTracked(
|
|
343
|
+
ASSET.githubWorkflows,
|
|
344
|
+
join4(cwd, ".github", "workflows"),
|
|
345
|
+
{ overwrite: opts.force, label: ".github/workflows" }
|
|
346
|
+
);
|
|
347
|
+
track(wfCreated);
|
|
348
|
+
log.ok(`.github/workflows/ \u2014 ${wfCount} file(s) written.`);
|
|
329
349
|
const detection = detectStack(cwd);
|
|
330
350
|
if (detection.polyglot) {
|
|
331
351
|
const PYTHON_STACKS = ["conda", "poetry", "uv", "pip"];
|
|
@@ -345,12 +365,17 @@ async function init(opts) {
|
|
|
345
365
|
} else {
|
|
346
366
|
log.warn("Could not detect stack \u2014 CI placeholder left in place.");
|
|
347
367
|
}
|
|
348
|
-
const ciYmlDest = join4(cwd, "
|
|
368
|
+
const ciYmlDest = join4(cwd, ".github", "workflows", "contract-driven-gates.yml");
|
|
349
369
|
if (existsSync3(ciYmlDest)) {
|
|
350
370
|
const template = loadCiTemplate(detection.primary);
|
|
351
371
|
if (template) {
|
|
352
372
|
const original = readFileSync2(ciYmlDest, "utf8");
|
|
353
|
-
|
|
373
|
+
let patched = patchFastGateYml(original, template, detection.primary);
|
|
374
|
+
if (detection.primary === "conda" && patched.includes("{{conda-env-name}}")) {
|
|
375
|
+
const envName = readCondaEnvName(cwd);
|
|
376
|
+
patched = patched.replace(/\{\{conda-env-name\}\}/g, envName);
|
|
377
|
+
log.ok(`Conda environment name set to: ${envName}`);
|
|
378
|
+
}
|
|
354
379
|
if (patched !== original) {
|
|
355
380
|
writeFileSync(ciYmlDest, patched, "utf8");
|
|
356
381
|
log.ok(`CI fast-gate patched for stack: ${detection.primary}`);
|
package/package.json
CHANGED