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.
- package/README.md +383 -143
- package/assets/CLAUDE.template.md +31 -204
- package/assets/agents/backend-engineer.md +19 -1
- package/assets/agents/change-classifier.md +44 -8
- package/assets/agents/ci-cd-gatekeeper.md +13 -0
- package/assets/agents/contract-reviewer.md +13 -0
- package/assets/agents/e2e-resilience-engineer.md +13 -0
- package/assets/agents/frontend-engineer.md +19 -1
- package/assets/agents/monkey-test-engineer.md +13 -0
- package/assets/agents/qa-reviewer.md +13 -0
- package/assets/agents/repo-context-scanner.md +3 -0
- package/assets/agents/spec-architect.md +41 -31
- package/assets/agents/spec-drift-auditor.md +21 -19
- package/assets/agents/stress-soak-engineer.md +13 -0
- package/assets/agents/test-strategist.md +36 -26
- package/assets/ci-templates/conda.yml +1 -1
- package/assets/{ci/github-actions → github-workflows}/contract-driven-gates.yml +12 -17
- package/assets/hooks/pre-commit +1 -1
- package/assets/skills/cdd-close/SKILL.md +123 -0
- package/assets/skills/cdd-init/SKILL.md +6 -0
- package/assets/skills/cdd-new/SKILL.md +108 -24
- package/assets/skills/cdd-resume/SKILL.md +86 -0
- package/assets/skills/contract-driven-delivery/templates/change-classification.md +18 -11
- package/assets/skills/contract-driven-delivery/templates/design.md +16 -13
- package/assets/skills/contract-driven-delivery/templates/tasks.md +7 -0
- package/assets/skills/contract-driven-delivery/templates/test-plan.md +17 -23
- package/assets/specs-templates/change-classification.md +18 -11
- package/assets/specs-templates/design.md +16 -13
- package/assets/specs-templates/tasks.md +7 -0
- package/assets/specs-templates/test-plan.md +17 -23
- package/dist/cli/index.js +508 -41
- package/package.json +8 -5
|
@@ -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).
|
|
@@ -60,6 +60,12 @@ Use realistic load profiles rather than arbitrary request loops.
|
|
|
60
60
|
...
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
## Read scope
|
|
64
|
+
|
|
65
|
+
- Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
|
|
66
|
+
- **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.
|
|
67
|
+
- Forbidden: other `specs/changes/` directories, `specs/archive/`
|
|
68
|
+
|
|
63
69
|
## Machine-Verifiable Evidence
|
|
64
70
|
|
|
65
71
|
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
@@ -91,3 +97,10 @@ with this exact structure (lines starting with `- ` are required):
|
|
|
91
97
|
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
92
98
|
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
93
99
|
without a pointer.
|
|
100
|
+
|
|
101
|
+
## Read scope
|
|
102
|
+
|
|
103
|
+
- Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
|
|
104
|
+
- Forbidden: other `specs/changes/` directories, `specs/archive/`
|
|
105
|
+
|
|
106
|
+
Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
|
|
@@ -29,43 +29,46 @@ 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
|
-
|---|---|---|---|
|
|
34
|
+
```markdown
|
|
35
|
+
# Test Plan: <change-id>
|
|
38
36
|
|
|
39
|
-
##
|
|
40
|
-
|
|
37
|
+
## Acceptance Criteria → Test Mapping
|
|
38
|
+
| criterion id | test family | test file path | tier |
|
|
39
|
+
|---|---|---|---|
|
|
41
40
|
|
|
42
|
-
##
|
|
43
|
-
|
|
41
|
+
## Test Families Required
|
|
42
|
+
| family | tier | notes |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| (unit / contract / integration / e2e / data-boundary / resilience / monkey / stress / soak) | | |
|
|
44
45
|
|
|
45
|
-
##
|
|
46
|
-
...
|
|
46
|
+
## Out of Scope
|
|
47
47
|
|
|
48
|
-
##
|
|
49
|
-
|
|
48
|
+
## Notes
|
|
49
|
+
(Keep under 10 lines. Implementation detail belongs in the test files themselves.)
|
|
50
|
+
```
|
|
50
51
|
|
|
51
|
-
##
|
|
52
|
-
...
|
|
52
|
+
## Output discipline
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
...
|
|
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.
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
Implementation detail belongs in the test files, not in test-plan.md.
|
|
65
|
+
Target: `test-plan.md` ≤ 100 lines.
|
|
62
66
|
|
|
63
|
-
##
|
|
64
|
-
...
|
|
67
|
+
## Read scope
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
- Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
|
|
70
|
+
- **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.
|
|
71
|
+
- Forbidden: other `specs/changes/` directories, `specs/archive/`
|
|
69
72
|
|
|
70
73
|
## Machine-Verifiable Evidence
|
|
71
74
|
|
|
@@ -98,3 +101,10 @@ with this exact structure (lines starting with `- ` are required):
|
|
|
98
101
|
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
99
102
|
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
100
103
|
without a pointer.
|
|
104
|
+
|
|
105
|
+
## Read scope
|
|
106
|
+
|
|
107
|
+
- Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
|
|
108
|
+
- Forbidden: other `specs/changes/` directories, `specs/archive/`
|
|
109
|
+
|
|
110
|
+
Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.
|
|
@@ -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: |
|
package/assets/hooks/pre-commit
CHANGED
|
@@ -14,7 +14,7 @@ change_ids=$(echo "$staged" | grep -oE '^specs/changes/[^/]+' | sort -u | sed 's
|
|
|
14
14
|
|
|
15
15
|
for id in $change_ids; do
|
|
16
16
|
echo "[cdd-kit] running gate for change: $id"
|
|
17
|
-
if ! cdd-kit gate "$id"; then
|
|
17
|
+
if ! cdd-kit gate "$id" --strict; then
|
|
18
18
|
echo "[cdd-kit] gate failed for $id — commit rejected."
|
|
19
19
|
echo "[cdd-kit] fix issues above; --no-verify bypasses but defeats the kit."
|
|
20
20
|
exit 1
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cdd-close
|
|
3
|
+
description: Close and archive a completed change. Confirms all tasks are done, promotes durable learnings, then runs cdd-kit archive. Args: <change-id>
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# cdd-close — Close and Archive a Change
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
A change is "done" when:
|
|
11
|
+
1. Gate has passed (`cdd-kit gate <change-id>` exits 0)
|
|
12
|
+
2. PR is merged (or change is abandoned)
|
|
13
|
+
3. Durable learnings have been promoted to `contracts/` or `CLAUDE.md`
|
|
14
|
+
|
|
15
|
+
This skill drives steps 2–3 and physically moves the change to `specs/archive/`.
|
|
16
|
+
|
|
17
|
+
## Input
|
|
18
|
+
|
|
19
|
+
The skill argument is the change-id (e.g., `add-jwt-auth`).
|
|
20
|
+
|
|
21
|
+
If not provided, ask: "Which change-id do you want to close?"
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Abandon path
|
|
26
|
+
|
|
27
|
+
If the user wants to **abandon** this change (not close as complete):
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
cdd-kit abandon <change-id> --reason "<reason>"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This marks `tasks.md` as `status: abandoned` and records it in `specs/archive/INDEX.md`. The directory is preserved for git history. Do NOT run the rest of this skill after abandoning.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Step 1: Confirm gate status
|
|
38
|
+
|
|
39
|
+
Run: `cdd-kit gate <change-id>`
|
|
40
|
+
|
|
41
|
+
If gate fails: stop and report failures. Do NOT archive a change that hasn't passed gate.
|
|
42
|
+
|
|
43
|
+
Exception: if `tasks.md` contains `status: gate-blocked`, ask the user: "This change was gate-blocked. Abandon it? (yes/no)". If yes, run `cdd-kit abandon <change-id> --reason "gate-blocked after 3 attempts"` and stop.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 2: Review tasks.md section 7
|
|
48
|
+
|
|
49
|
+
Read `specs/changes/<change-id>/tasks.md`.
|
|
50
|
+
|
|
51
|
+
Check section 7:
|
|
52
|
+
- `7.1 Archive change` — will be ticked after Step 4
|
|
53
|
+
- `7.2 Promote durable learnings to contracts or CLAUDE.md` — must be done NOW
|
|
54
|
+
|
|
55
|
+
If `7.2` is `[ ]`, proceed to Step 2.5. If already `[x]` or `[-]`, skip Steps 2.5 and 3.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Step 2.5: Create archive.md
|
|
60
|
+
|
|
61
|
+
Read `specs/changes/<change-id>/agent-log/` (all log files) and `specs/changes/<change-id>/qa-report.md` (if exists).
|
|
62
|
+
|
|
63
|
+
Synthesize a `specs/changes/<change-id>/archive.md` file with:
|
|
64
|
+
- **Change Summary**: 1 paragraph what was changed and why
|
|
65
|
+
- **Final Behavior**: what the system now does differently
|
|
66
|
+
- **Final Contracts Updated**: list from agent-log evidence
|
|
67
|
+
- **Final Tests Added / Updated**: list from agent-log evidence
|
|
68
|
+
- **Final CI/CD Gates**: list from ci-gates.md
|
|
69
|
+
- **Production Reality Findings**: any surprises or deviations from the plan (from qa-reviewer agent-log)
|
|
70
|
+
- **Lessons Promoted to Standards**: (leave blank — to be filled in Step 3)
|
|
71
|
+
- **Follow-up Work**: any known issues deferred
|
|
72
|
+
|
|
73
|
+
This file is the source for Step 3's learning promotion.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Step 3: Promote learnings (task 7.2)
|
|
78
|
+
|
|
79
|
+
Read `specs/changes/<change-id>/archive.md` section `## Lessons Promoted to Standards`.
|
|
80
|
+
|
|
81
|
+
If there are lessons to promote, invoke `contract-reviewer` with:
|
|
82
|
+
- The archive.md lessons section
|
|
83
|
+
- Instruction: "Review these lessons and propose specific additions to the relevant contract files. For each lesson, output: target file, target section, proposed text (≤ 5 lines), schema-version bump required (yes/no)."
|
|
84
|
+
|
|
85
|
+
After contract-reviewer responds:
|
|
86
|
+
1. Apply each proposed addition to the contract file (YOU write)
|
|
87
|
+
2. Run `cdd-kit validate --contracts` to confirm format is preserved
|
|
88
|
+
3. Fill in `## Lessons Promoted to Standards` in archive.md with what was promoted
|
|
89
|
+
4. Tick `7.2` in tasks.md
|
|
90
|
+
|
|
91
|
+
If there are no lessons to promote, mark `[-]` for 7.2 with rationale.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Step 4: Archive
|
|
96
|
+
|
|
97
|
+
Run: `cdd-kit archive <change-id>`
|
|
98
|
+
|
|
99
|
+
If successful, tick `7.1` in tasks.md (the file is now in specs/archive/, update it there):
|
|
100
|
+
`specs/archive/<year>/<change-id>/tasks.md` — change `7.1` from `[ ]` to `[x]`.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Step 5: Report
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
## /cdd-close complete
|
|
108
|
+
|
|
109
|
+
Change ID: <change-id>
|
|
110
|
+
Archived to: specs/archive/<year>/<change-id>/
|
|
111
|
+
Learnings promoted: <list what was added to contracts/CLAUDE.md, or "none">
|
|
112
|
+
|
|
113
|
+
specs/changes/<change-id>/ has been removed from the active surface.
|
|
114
|
+
Token cost of future sessions reduced by ~<N> files.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Rules
|
|
120
|
+
|
|
121
|
+
- NEVER archive before gate passes (unless user explicitly confirms abandoned)
|
|
122
|
+
- NEVER skip Step 3 — lessons rot if not promoted
|
|
123
|
+
- The archive command is irreversible without git — remind user to commit after archiving
|
|
@@ -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,16 @@ 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`) when the classifier's `change-classification.md` explicitly marks them as `yes`.
|
|
68
|
+
|
|
69
|
+
Note: `archive.md` is created during `/cdd-close`, not during `/cdd-new` — it is not part of the classifier's opt-in surface.
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
The 5 always-required artifacts are: `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`.
|
|
74
|
+
|
|
29
75
|
## Step 1: Generate change-id and scaffold
|
|
30
76
|
|
|
31
77
|
Derive a `change-id` from the description:
|
|
@@ -72,18 +118,25 @@ Create `specs/changes/<change-id>/change-classification.md` with blank template:
|
|
|
72
118
|
## Impact Radius
|
|
73
119
|
- isolated / module-level / cross-module / system-wide
|
|
74
120
|
|
|
121
|
+
## Tier
|
|
122
|
+
- 0 / 1 / 2 / 3 / 4 / 5
|
|
123
|
+
|
|
124
|
+
## Architecture Review Required
|
|
125
|
+
- yes / no
|
|
126
|
+
- reason: (fill only if yes)
|
|
127
|
+
|
|
75
128
|
## Required Artifacts
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
| qa-report.md | | |
|
|
86
|
-
| regression-report.md | | |
|
|
129
|
+
Always required: change-request.md, change-classification.md, test-plan.md, ci-gates.md, tasks.md
|
|
130
|
+
|
|
131
|
+
## Optional Artifacts (default: no — set yes only with explicit reason)
|
|
132
|
+
| artifact | create? | reason |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| current-behavior.md | no | |
|
|
135
|
+
| proposal.md | no | |
|
|
136
|
+
| spec.md | no | |
|
|
137
|
+
| design.md | no | |
|
|
138
|
+
| qa-report.md | no | |
|
|
139
|
+
| regression-report.md | no | |
|
|
87
140
|
|
|
88
141
|
## Required Contracts
|
|
89
142
|
- API:
|
|
@@ -114,21 +167,19 @@ Create `specs/changes/<change-id>/test-plan.md` with blank template:
|
|
|
114
167
|
```
|
|
115
168
|
# Test Plan: <change-id>
|
|
116
169
|
|
|
117
|
-
##
|
|
170
|
+
## Acceptance Criteria → Test Mapping
|
|
171
|
+
| criterion id | test family | test file path | tier |
|
|
172
|
+
|---|---|---|---|
|
|
118
173
|
|
|
119
|
-
##
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
## Integration Tests
|
|
124
|
-
|
|
125
|
-
## E2E Tests
|
|
126
|
-
|
|
127
|
-
## Resilience / Data-Boundary Tests
|
|
128
|
-
|
|
129
|
-
## Stress / Soak Tests
|
|
174
|
+
## Test Families Required
|
|
175
|
+
| family | tier | notes |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| (unit / contract / integration / e2e / data-boundary / resilience / monkey / stress / soak) | | |
|
|
130
178
|
|
|
131
179
|
## Out of Scope
|
|
180
|
+
|
|
181
|
+
## Notes
|
|
182
|
+
(Keep under 10 lines. Implementation detail belongs in the test files themselves.)
|
|
132
183
|
```
|
|
133
184
|
|
|
134
185
|
Create `specs/changes/<change-id>/ci-gates.md` with blank template:
|
|
@@ -146,6 +197,13 @@ Create `specs/changes/<change-id>/ci-gates.md` with blank template:
|
|
|
146
197
|
|
|
147
198
|
Create `specs/changes/<change-id>/tasks.md` with ALL checkboxes unchecked:
|
|
148
199
|
```
|
|
200
|
+
---
|
|
201
|
+
change-id: <change-id>
|
|
202
|
+
status: in-progress
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
<!-- [x]=done [-]=N/A [ ]=pending -->
|
|
206
|
+
|
|
149
207
|
# Tasks: <change-id>
|
|
150
208
|
|
|
151
209
|
## 1. Preparation
|
|
@@ -208,6 +266,8 @@ Invoke `change-classifier` agent with:
|
|
|
208
266
|
|
|
209
267
|
Wait until these three writes are done before continuing.
|
|
210
268
|
|
|
269
|
+
**After writing change-classification.md**: read the classifier's `## Tasks Not Applicable` list. For each listed task ID (e.g., `2.2`, `4.2`), update `tasks.md` to change that item from `[ ]` to `[-]`. Do this before invoking any other agent.
|
|
270
|
+
|
|
211
271
|
---
|
|
212
272
|
|
|
213
273
|
## Step 3: Read the tier and commission agents
|
|
@@ -220,6 +280,13 @@ Read `change-classification.md` to determine the tier. Then invoke agents **in t
|
|
|
220
280
|
|
|
221
281
|
If any agent sets `status: blocked` in its log, halt immediately and report the agent's `next-action` to the user — do not proceed to subsequent agents.
|
|
222
282
|
|
|
283
|
+
**When invoking any agent, always begin the prompt with:**
|
|
284
|
+
```
|
|
285
|
+
CURRENT_CHANGE_ID: <change-id>
|
|
286
|
+
Change directory: specs/changes/<change-id>/
|
|
287
|
+
```
|
|
288
|
+
This ensures the agent's Read scope restriction points to the correct directory.
|
|
289
|
+
|
|
223
290
|
---
|
|
224
291
|
|
|
225
292
|
### Tier 4–5 (low risk: docs, prompts, config-only, no behavior change)
|
|
@@ -242,25 +309,30 @@ If any agent sets `status: blocked` in its log, halt immediately and report the
|
|
|
242
309
|
|
|
243
310
|
2. **`test-strategist`** (write-capable) — writes `specs/changes/<change-id>/test-plan.md` directly.
|
|
244
311
|
- YOU tick: applicable items in section 3 based on what test families were planned
|
|
312
|
+
- Provide the classifier's `## Inferred Acceptance Criteria` list to test-strategist. These become the `criterion id` column in the Acceptance Criteria → Test Mapping table.
|
|
245
313
|
|
|
246
|
-
3. **`spec-architect`** (write-capable) — only if
|
|
314
|
+
3. **`spec-architect`** (write-capable) — only if `change-classification.md` contains `Architecture Review Required: yes`.
|
|
247
315
|
- YOU tick: `1.3` (if it produced a gate plan)
|
|
248
316
|
|
|
249
317
|
4. **`backend-engineer`** (write-capable) — if the change touches server, API, data, or business logic. Writes implementation and its own agent-log.
|
|
250
318
|
- YOU tick: `4.1` and/or `4.3` based on scope
|
|
319
|
+
- 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
320
|
|
|
252
321
|
5. **`frontend-engineer`** (write-capable) — if the change touches UI, components, or client-side behavior. Writes implementation and its own agent-log.
|
|
253
322
|
- YOU tick: `4.2`
|
|
254
323
|
|
|
255
324
|
6. **`dependency-security-reviewer`** (read-only) — if the change touches lockfiles, package manifests, or DB migrations.
|
|
325
|
+
- **Only invoke if** `change-classification.md` lists lockfiles, package manifests, or DB migrations as affected.
|
|
256
326
|
- YOU write: `agent-log/dependency-security-reviewer.md`
|
|
257
327
|
- YOU tick: applicable security-related items
|
|
258
328
|
|
|
259
329
|
7. **`ui-ux-reviewer`** (read-only) — if any UI change (run alongside or after frontend-engineer).
|
|
330
|
+
- **Only invoke if** classifier marks UI/CSS as affected.
|
|
260
331
|
- YOU write: `agent-log/ui-ux-reviewer.md`
|
|
261
332
|
- YOU tick: `5.1`
|
|
262
333
|
|
|
263
334
|
8. **`visual-reviewer`** (read-only) — if any UI change (run after ui-ux-reviewer).
|
|
335
|
+
- **Only invoke if** classifier marks UI/CSS as affected.
|
|
264
336
|
- YOU write: `agent-log/visual-reviewer.md`
|
|
265
337
|
- YOU tick: `5.2`
|
|
266
338
|
|
|
@@ -293,6 +365,8 @@ All agents from Tier 2–3, plus insert these after `frontend-engineer` / `backe
|
|
|
293
365
|
- If backend-only with no UI: skip `frontend-engineer`, `ui-ux-reviewer`, `visual-reviewer`
|
|
294
366
|
- If UI-only with no backend: skip `backend-engineer`
|
|
295
367
|
|
|
368
|
+
**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.
|
|
369
|
+
|
|
296
370
|
---
|
|
297
371
|
|
|
298
372
|
## Step 4: Run the gate
|
|
@@ -314,6 +388,8 @@ cdd-kit gate <change-id>
|
|
|
314
388
|
4. Re-run `cdd-kit gate <change-id>`
|
|
315
389
|
5. Repeat until gate passes (max 3 iterations; if still failing after 3, report to user)
|
|
316
390
|
|
|
391
|
+
**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.
|
|
392
|
+
|
|
317
393
|
---
|
|
318
394
|
|
|
319
395
|
## Step 5: Report to user
|
|
@@ -364,3 +440,11 @@ Please review the above items and re-run: cdd-kit gate <change-id>
|
|
|
364
440
|
- 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
441
|
- Tick the relevant `tasks.md` checkbox immediately after each agent completes — do not batch
|
|
366
442
|
- `qa-reviewer` always runs last and makes the release-readiness decision
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## After Completion
|
|
447
|
+
|
|
448
|
+
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.
|
|
449
|
+
|
|
450
|
+
When the change is merged and ready to close, run `/cdd-close <change-id>` to promote learnings and archive the change directory.
|