contract-driven-delivery 1.8.1 → 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 +36 -10
- package/assets/agents/contract-reviewer.md +2 -2
- package/assets/agents/dependency-security-reviewer.md +2 -2
- package/assets/agents/frontend-engineer.md +6 -1
- package/assets/agents/qa-reviewer.md +2 -2
- package/assets/agents/repo-context-scanner.md +5 -2
- package/assets/agents/spec-architect.md +28 -31
- package/assets/agents/spec-drift-auditor.md +22 -20
- package/assets/agents/test-strategist.md +25 -28
- package/assets/agents/ui-ux-reviewer.md +2 -2
- package/assets/agents/visual-reviewer.md +2 -2
- 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 +304 -42
- 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:
|
|
@@ -65,10 +91,10 @@ Use this structure:
|
|
|
65
91
|
|
|
66
92
|
## Machine-Verifiable Evidence
|
|
67
93
|
|
|
68
|
-
After completing your task, write
|
|
69
|
-
with this exact structure (lines starting with `- ` are required):
|
|
94
|
+
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/change-classifier.md`.
|
|
70
95
|
|
|
71
96
|
```
|
|
97
|
+
## Agent Log
|
|
72
98
|
# Change Classifier Log
|
|
73
99
|
- change-id: <id>
|
|
74
100
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
@@ -57,10 +57,10 @@ approved / changes-required
|
|
|
57
57
|
|
|
58
58
|
## Machine-Verifiable Evidence
|
|
59
59
|
|
|
60
|
-
After completing your task, write
|
|
61
|
-
with this exact structure (lines starting with `- ` are required):
|
|
60
|
+
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`.
|
|
62
61
|
|
|
63
62
|
```
|
|
63
|
+
## Agent Log
|
|
64
64
|
# Contract Reviewer Log
|
|
65
65
|
- change-id: <id>
|
|
66
66
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
@@ -64,10 +64,10 @@ approved / changes-required / blocked
|
|
|
64
64
|
|
|
65
65
|
## Machine-Verifiable Evidence
|
|
66
66
|
|
|
67
|
-
After completing your task, write
|
|
68
|
-
with this exact structure (lines starting with `- ` are required):
|
|
67
|
+
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/dependency-security-reviewer.md`.
|
|
69
68
|
|
|
70
69
|
```
|
|
70
|
+
## Agent Log
|
|
71
71
|
# Dependency Security Reviewer Log
|
|
72
72
|
- change-id: <id>
|
|
73
73
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
@@ -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`
|
|
@@ -69,10 +69,10 @@ approved / blocked / approved-with-risk
|
|
|
69
69
|
|
|
70
70
|
## Machine-Verifiable Evidence
|
|
71
71
|
|
|
72
|
-
After completing your task, write
|
|
73
|
-
with this exact structure (lines starting with `- ` are required):
|
|
72
|
+
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`.
|
|
74
73
|
|
|
75
74
|
```
|
|
75
|
+
## Agent Log
|
|
76
76
|
# QA Reviewer Log
|
|
77
77
|
- change-id: <id>
|
|
78
78
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
@@ -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.
|
|
@@ -81,10 +84,10 @@ frontend / backend / fullstack / monorepo / library / tool
|
|
|
81
84
|
|
|
82
85
|
## Machine-Verifiable Evidence
|
|
83
86
|
|
|
84
|
-
After completing your task, write
|
|
85
|
-
with this exact structure (lines starting with `- ` are required):
|
|
87
|
+
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/repo-context-scanner.md`.
|
|
86
88
|
|
|
87
89
|
```
|
|
90
|
+
## Agent Log
|
|
88
91
|
# Repo Context Scanner Log
|
|
89
92
|
- change-id: <id>
|
|
90
93
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
@@ -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
|
-
|
|
54
|
-
|
|
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):
|
|
55
57
|
|
|
56
58
|
```
|
|
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 @@ with this exact structure (lines starting with `- ` are required):
|
|
|
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
|
|
|
@@ -51,10 +51,10 @@ approved / changes-required
|
|
|
51
51
|
|
|
52
52
|
## Machine-Verifiable Evidence
|
|
53
53
|
|
|
54
|
-
After completing your task, write
|
|
55
|
-
with this exact structure (lines starting with `- ` are required):
|
|
54
|
+
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/ui-ux-reviewer.md`.
|
|
56
55
|
|
|
57
56
|
```
|
|
57
|
+
## Agent Log
|
|
58
58
|
# UI/UX Reviewer Log
|
|
59
59
|
- change-id: <id>
|
|
60
60
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
@@ -53,10 +53,10 @@ approved / changes-required
|
|
|
53
53
|
|
|
54
54
|
## Machine-Verifiable Evidence
|
|
55
55
|
|
|
56
|
-
After completing your task, write
|
|
57
|
-
with this exact structure (lines starting with `- ` are required):
|
|
56
|
+
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/visual-reviewer.md`.
|
|
58
57
|
|
|
59
58
|
```
|
|
59
|
+
## Agent Log
|
|
60
60
|
# Visual Reviewer Log
|
|
61
61
|
- change-id: <id>
|
|
62
62
|
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|