contract-driven-delivery 1.10.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 CHANGED
@@ -1,237 +1,477 @@
1
1
  # Contract-Driven Delivery Kit
2
2
 
3
- A reusable Claude Code development kit for brownfield full-stack systems that need specification-driven development, test-driven development, strict contracts, CI/CD gates, visual review, E2E, resilience, fuzz/monkey, stress, and soak testing.
3
+ **cdd-kit** is a Claude Code development kit that turns AI agents into a disciplined engineering team: contracts-first, test-first, spec-first. Every change goes through classification, contract review, TDD, implementation, and gate verification — automatically orchestrated by Claude Code skills.
4
4
 
5
- This kit is designed for internal production systems such as dashboards, reporting systems, workflow tools, and data-heavy web apps. It is repo-informed but repo-agnostic: install it once, deploy it into any repository, and apply the same delivery discipline without repeating instructions every time.
5
+ Designed for solo developers and small teams building brownfield production systems (dashboards, APIs, workflow tools, data apps) who want AI to do all the implementation while they stay in the spec-author and reviewer seat.
6
6
 
7
- ## Install via npm
7
+ ---
8
+
9
+ ## Install
8
10
 
9
11
  ```bash
10
12
  npm install -g contract-driven-delivery
11
13
  ```
12
14
 
13
- Requires Node.js 18+ and Python 3.8+.
14
-
15
- ## CLI Usage
15
+ Requires **Node.js 18+** and **Python 3.8+** (for contract validators).
16
16
 
17
- ### `cdd-kit init`
17
+ ---
18
18
 
19
- Installs Claude Code agents and the `contract-driven-delivery` skill into `~/.claude`, and scaffolds project files (`contracts/`, `specs/templates/`, `tests/templates/`, `ci/`, `CLAUDE.md`, `AGENTS.md`) into the current repository.
19
+ ## Quick Start
20
20
 
21
21
  ```bash
22
- cdd-kit init # global + local (recommended for first-time setup)
23
- cdd-kit init --global-only # only install agents/skill into ~/.claude
24
- cdd-kit init --local-only # only scaffold project files in current repo
25
- cdd-kit init --force # overwrite existing project files (CLAUDE.md is never overwritten)
22
+ # 1. Install globally
23
+ npm install -g contract-driven-delivery
24
+
25
+ # 2. Go to your repo
26
+ cd your-repo
27
+
28
+ # 3. Deploy the kit
29
+ cdd-kit init
30
+
31
+ # 4. Open Claude Code in your repo and tell Claude:
32
+ # "Use /cdd-new to set up the project. My system is a <brief description>."
26
33
  ```
27
34
 
28
- ### `cdd-kit update`
35
+ ---
36
+
37
+ ## How to Direct Claude Code
38
+
39
+ > All workflows are started by typing a **natural language instruction** to Claude Code in your IDE or terminal. The `/cdd-*` prefixed commands are Claude Code skills — not shell commands.
40
+
41
+ ### Starting a new project (first time)
42
+
43
+ After `cdd-kit init`, open Claude Code and say:
44
+
45
+ ```
46
+ Scan this repo and create a project profile. Tell me what contracts are
47
+ missing and what the minimum setup should be before we start any feature work.
48
+ ```
49
+
50
+ Claude will:
51
+ 1. Run `cdd-kit detect-stack` to detect the tech stack
52
+ 2. Read your existing code structure
53
+ 3. Create `specs/project-profile.md`
54
+ 4. Identify gaps in `contracts/` and recommend filling order
55
+
56
+ Then fill your contracts in this order (Claude can help draft them):
29
57
 
30
- Updates the agents and skill in `~/.claude` to the latest installed version. Does not touch project-level files like `contracts/` or `CLAUDE.md`.
58
+ | Contract | File | What it captures |
59
+ |---|---|---|
60
+ | Env | `contracts/env/env-contract.md` | Every env var, secret flag, default, validation |
61
+ | API | `contracts/api/api-contract.md` | Every endpoint: method, path, auth, schemas, errors |
62
+ | Data | `contracts/data/data-shape-contract.md` | Schemas, types, nullability, bad-data behavior |
63
+ | CSS/UI | `contracts/css/css-contract.md` | Design tokens, component states, forbidden raw values |
64
+ | Business | `contracts/business/business-rules.md` | Rules, edge cases, decision tables |
65
+ | CI/CD | `contracts/ci/ci-gate-contract.md` | Gate tiers, promotion policy, rollback policy |
66
+
67
+ ---
68
+
69
+ ### Starting a new task / feature / bug fix
70
+
71
+ Type this in Claude Code:
72
+
73
+ ```
74
+ /cdd-new add JWT authentication to the API
75
+ ```
76
+
77
+ or
78
+
79
+ ```
80
+ /cdd-new redesign the user dashboard to show real-time metrics
81
+ ```
82
+
83
+ or
84
+
85
+ ```
86
+ /cdd-new fix the order export timeout when result set exceeds 10 000 rows
87
+ ```
88
+
89
+ **What happens:**
90
+ 1. Claude generates a `change-id` (e.g. `add-jwt-auth`) and scaffolds `specs/changes/add-jwt-auth/`
91
+ 2. The `change-classifier` agent (Opus) reads the request, classifies risk and tier, decides which agents are needed
92
+ 3. Agents run in order: contracts → test plan → spec/architecture review (if needed) → backend engineer → frontend engineer → CI/CD gates → QA
93
+ 4. Each agent produces machine-verifiable evidence (agent-log files)
94
+ 5. `cdd-kit gate <change-id>` runs automatically to confirm all artifacts are complete
95
+ 6. Claude reports a summary and the suggested git commit
96
+
97
+ **You stay in control by:**
98
+ - Reviewing the `change-classification.md` before implementation starts
99
+ - Checking the `test-plan.md` to confirm the right test families are planned
100
+ - Reading the final `agent-log/qa-reviewer.md` for the release-readiness verdict
101
+
102
+ ---
103
+
104
+ ### Updating architecture or contracts
105
+
106
+ ```
107
+ /cdd-new update the API contract to add pagination to all list endpoints
108
+ ```
109
+
110
+ ```
111
+ /cdd-new migrate the database from MySQL to PostgreSQL
112
+ ```
113
+
114
+ ```
115
+ /cdd-new add Redis caching layer to the reporting queries
116
+ ```
117
+
118
+ The change-classifier will detect that these are architectural or contract-level changes, assign a higher risk tier (0–2), and automatically require:
119
+ - Architecture review (`spec-architect` agent)
120
+ - E2E, resilience, stress, and monkey tests
121
+ - Updated contracts before any implementation begins
122
+
123
+ ---
124
+
125
+ ### Resuming an interrupted task
126
+
127
+ If a session was cut off or you need to return to an in-progress change:
128
+
129
+ ```
130
+ /cdd-resume add-jwt-auth
131
+ ```
132
+
133
+ or, if you're unsure of the change-id:
134
+
135
+ ```
136
+ What changes are currently in progress? (cdd-kit list)
137
+ ```
138
+
139
+ **What happens:**
140
+ 1. Claude reads `tasks.md` and `agent-log/` to determine what was completed
141
+ 2. Reports the current state (which agents ran, which tasks are pending)
142
+ 3. Asks if you want to continue from the next pending agent
143
+ 4. Resumes the full agent flow from where it stopped, with no duplication
144
+
145
+ > If you're upgrading from an older version and your change was created before v1.11.0, Claude will automatically run `cdd-kit migrate <change-id>` to upgrade the format before resuming.
146
+
147
+ ---
148
+
149
+ ### Closing a completed change
150
+
151
+ After the PR is merged:
152
+
153
+ ```
154
+ /cdd-close add-jwt-auth
155
+ ```
156
+
157
+ **What happens:**
158
+ 1. Runs `cdd-kit gate` to confirm the change still passes
159
+ 2. Synthesizes `archive.md` — a permanent record of what changed, what tests were added, and what lessons were found
160
+ 3. Invokes `contract-reviewer` to propose any durable learnings back into `contracts/`
161
+ 4. Runs `cdd-kit archive add-jwt-auth` — moves the change from `specs/changes/` to `specs/archive/2026/`
162
+ 5. Reduces the active context that future Claude sessions need to load
163
+
164
+ ---
165
+
166
+ ### Abandoning a change
167
+
168
+ If you decide not to proceed with a change:
169
+
170
+ ```
171
+ /cdd-close add-jwt-auth
172
+ ```
173
+
174
+ Then when Claude asks for confirmation, say "abandon it." Claude will run:
31
175
 
32
176
  ```bash
33
- cdd-kit update
177
+ cdd-kit abandon add-jwt-auth --reason "decided to use a third-party auth service instead"
34
178
  ```
35
179
 
36
- ### `cdd-kit new <name>`
180
+ The directory stays on disk for git history, but `cdd-kit list` will show it as `abandoned`.
181
+
182
+ ---
37
183
 
38
- Creates a new change scaffold under `specs/changes/<name>/` with the required template files.
184
+ ### Checking the status of all active changes
185
+
186
+ Type to Claude:
187
+
188
+ ```
189
+ What changes are currently in progress?
190
+ ```
191
+
192
+ Claude will run `cdd-kit list`, which shows:
193
+
194
+ ```
195
+ Active changes:
196
+ add-jwt-auth [in-progress] (3 pending)
197
+ fix-export-timeout [gate-blocked]
198
+ redesign-dashboard [in-progress] (12 pending)
199
+ ```
200
+
201
+ ---
202
+
203
+ ## CLI Reference
204
+
205
+ These are shell commands — not Claude Code skills. Run them directly in the terminal, or Claude Code will run them on your behalf.
206
+
207
+ ### `cdd-kit init`
208
+
209
+ Installs agents and skill into `~/.claude` and scaffolds project files.
39
210
 
40
211
  ```bash
41
- cdd-kit new add-user-auth # required templates only
42
- cdd-kit new add-user-auth --all # include all optional templates
43
- cdd-kit new add-user-auth --force # re-scaffold even if directory already exists
212
+ cdd-kit init # global + local (recommended)
213
+ cdd-kit init --global-only # only install into ~/.claude
214
+ cdd-kit init --local-only # only scaffold project files
215
+ cdd-kit init --force # overwrite existing project files
44
216
  ```
45
217
 
46
- Required templates: `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
218
+ Creates: `contracts/`, `specs/templates/`, `CLAUDE.md`, `AGENTS.md`, `hooks/`
47
219
 
48
- Optional templates (with `--all`): `current-behavior.md`, `proposal.md`, `spec.md`, `design.md`, `contracts.md`, `qa-report.md`, `regression-report.md`, `archive.md`
220
+ ---
49
221
 
50
- ### `cdd-kit validate`
222
+ ### `cdd-kit update`
51
223
 
52
- Runs contract validation scripts against the current repository.
224
+ Updates agents and skill in `~/.claude` to the latest installed version. Does not touch `contracts/` or `CLAUDE.md`.
53
225
 
54
226
  ```bash
55
- cdd-kit validate # run all validators
56
- cdd-kit validate --contracts # validate API/data/CSS contracts + semantic validators
57
- cdd-kit validate --env # validate env contract
58
- cdd-kit validate --ci # validate CI gate policy
59
- cdd-kit validate --spec # validate spec traceability
227
+ cdd-kit update
228
+ cdd-kit update --yes # apply without confirmation
60
229
  ```
61
230
 
62
- `--contracts` also chains two semantic validators:
63
- - **API semantic**: checks endpoint table for valid HTTP methods, paths starting with `/`, and valid auth values.
64
- - **Env semantic**: checks variable table for secrets with default values (forbidden), and warns on required non-secret vars with no default.
231
+ ---
65
232
 
66
233
  ### `cdd-kit gate <change-id>`
67
234
 
68
- Validates that a change has completed the full orchestration workflow before it can be committed or shipped. Checks: directory exists, all 5 required artifacts are present, each has > 100 meaningful characters (not a stub), `change-classification.md` contains a tier or risk marker, and all contract validators pass.
235
+ The single quality gate for a change. Blocks merge if anything is missing or incomplete.
69
236
 
70
237
  ```bash
71
- cdd-kit gate add-user-auth
72
- # gate passed for change: add-user-auth
238
+ cdd-kit gate add-jwt-auth
239
+ cdd-kit gate add-jwt-auth --strict
73
240
  ```
74
241
 
75
- Failure examples:
242
+ Checks:
243
+ - All 5 required artifacts exist (`change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`)
244
+ - Each artifact has sufficient content (not a stub): change-classification ≥ 200 chars, test-plan ≥ 200, ci-gates ≥ 150, others ≥ 100
245
+ - `change-classification.md` contains a tier or risk marker
246
+ - `agent-log/*.md` files all have `status: complete` (not blocked)
247
+ - Tier 0–1 changes have `e2e-resilience-engineer`, `monkey-test-engineer`, and `stress-soak-engineer` logs
248
+ - Tier 0–3 changes have `contract-reviewer` and `qa-reviewer` logs
249
+ - All contract validators pass
250
+
251
+ `--strict` additionally:
252
+ - Treats any pending `[ ]` tasks (except section 7 archive items) as errors
253
+ - Validates that every file path listed in `agent-log` artifact pointers actually exists on disk
254
+
255
+ Pre-commit hook uses `--strict` by default (installed via `cdd-kit install-hooks`).
256
+
76
257
  ```
258
+ ✓ gate passed for change: add-jwt-auth
259
+
77
260
  ✗ gate failed for change: feat-001
78
- missing required artifact: tasks.md
79
- change-classification.md: missing tier/risk marker (Tier 0-5 or low/medium/high/critical)
261
+ change-classification.md: appears to be a stub (< 200 meaningful chars)
262
+ Tier 1 change requires agent-log/e2e-resilience-engineer.md
263
+ ✗ 1 task(s) still pending (use [-] for N/A items, [x] for done)
80
264
  ```
81
265
 
82
- ### `cdd-kit install-hooks`
266
+ ---
267
+
268
+ ### `cdd-kit list`
83
269
 
84
- Installs a pre-commit Git hook that automatically runs `cdd-kit gate` for any change folder touched in the staged commit. Prevents skipping the orchestration workflow.
270
+ Lists all active changes in `specs/changes/` with status and pending task count.
85
271
 
86
272
  ```bash
87
- cdd-kit install-hooks
88
- # ✓ pre-commit hook installed at .git/hooks/pre-commit
273
+ cdd-kit list
89
274
  ```
90
275
 
91
- - Idempotent: re-running updates the cdd-kit block in place without duplicating it.
92
- - Preserves existing hook content: if a pre-commit hook already exists, the cdd-kit block is prepended after the shebang line.
93
- - Bypass with `--no-verify` (not recommended; defeats AI process enforcement).
276
+ ```
277
+ Active changes:
278
+ add-jwt-auth [in-progress] (3 pending)
279
+ fix-export-timeout [gate-blocked]
280
+ old-experiment [abandoned]
281
+ ```
94
282
 
95
- ### `cdd-kit detect-stack`
283
+ ---
96
284
 
97
- Detects the project tech stack from lockfiles and config files.
285
+ ### `cdd-kit archive <change-id>`
286
+
287
+ Physically moves a completed change from `specs/changes/` to `specs/archive/<year>/`.
98
288
 
99
289
  ```bash
100
- cdd-kit detect-stack
101
- # Detected stack: conda
102
- # Candidates (in order): conda, pnpm
103
- # Polyglot: yes (config will be generated for conda)
290
+ cdd-kit archive add-jwt-auth
291
+ # ✓ Archived: specs/changes/add-jwt-auth → specs/archive/2026/add-jwt-auth
292
+ # ✓ Index updated: specs/archive/INDEX.md
104
293
  ```
105
294
 
106
- ## Supported stacks (stack detection)
295
+ Warns (but does not block) if `tasks.md` has pending items or `status: gate-blocked`. Use after `/cdd-close` — the skill runs this automatically at the end.
107
296
 
108
- | Language | Tool | Detection signal |
109
- |------------|---------|----------------------------------------------|
110
- | Python | conda | `environment.yml`, `conda-lock.yml`, `meta.yaml` |
111
- | Python | poetry | `pyproject.toml` with `[tool.poetry]` |
112
- | Python | uv | `pyproject.toml` (no poetry section) |
113
- | Python | pip | `requirements.txt` |
114
- | JavaScript | pnpm | `package.json` + `pnpm-lock.yaml` |
115
- | JavaScript | bun | `package.json` + `bun.lockb` |
116
- | JavaScript | yarn | `package.json` + `yarn.lock` |
117
- | JavaScript | npm | `package.json` (no lockfile match) |
118
- | Go | go | `go.mod` |
119
- | Rust | rust | `Cargo.toml` |
297
+ ---
120
298
 
121
- When multiple language families are detected (polyglot project), `cdd-kit init` generates CI config for the first detected stack and prints a warning.
299
+ ### `cdd-kit abandon <change-id>`
122
300
 
123
- ## First-time setup in a repository
301
+ Marks a change as abandoned. Updates `tasks.md` status to `abandoned`, records the reason in `specs/archive/INDEX.md`. The directory stays on disk for git history.
124
302
 
125
303
  ```bash
126
- # 1. Install the CLI globally
127
- npm install -g contract-driven-delivery
304
+ cdd-kit abandon add-jwt-auth --reason "using Auth0 instead"
305
+ # ✓ Change add-jwt-auth marked as abandoned.
306
+ ```
128
307
 
129
- # 2. Navigate to your repository
130
- cd your-repo
308
+ ---
131
309
 
132
- # 3. Deploy the kit
133
- cdd-kit init
310
+ ### `cdd-kit migrate <change-id> | --all`
311
+
312
+ Upgrades pre-v1.11.0 change directories to the current format.
134
313
 
135
- # 4. Open Claude Code and run the workflow
136
- # Ask Claude Code: "Use the contract-driven-delivery workflow.
137
- # Scan this repo, create a project profile, identify missing contracts,
138
- # and recommend the minimum standardization changes before feature work."
314
+ ```bash
315
+ cdd-kit migrate add-jwt-auth # migrate one change
316
+ cdd-kit migrate --all # migrate all changes in specs/changes/
317
+ cdd-kit migrate --all --dry-run # preview without writing
139
318
  ```
140
319
 
141
- ## What to expect after `cdd-kit init`
320
+ What it upgrades:
321
+ - `tasks.md`: adds YAML frontmatter (`change-id`, `status: in-progress`) and `[x]/[-]/[ ]` legend if missing
322
+ - `change-classification.md`: detects old `**Tier:** Tier N` format and appends the new `## Tier\n- N` section so tier-based gate checks activate
142
323
 
143
- The first `cdd-kit validate` after `init` is expected to print contract placeholder warnings — six contract files are scaffolded but empty. Validation still exits 0; warnings are advisory.
324
+ Run this after upgrading from v1.10 or earlier if you have mid-flight changes.
144
325
 
145
- ```text
146
- Warning: contracts present but appear empty: contracts/api/api-contract.md, ...
147
- Fill them in before relying on the gate.
326
+ ```bash
327
+ cdd-kit migrate --all
328
+ git add specs/changes/
329
+ git commit -m "chore: migrate changes to v1.11.0 format"
148
330
  ```
149
331
 
150
- To turn warnings off, fill each contract with real content (typical user-filled contracts run 500+ characters of meaningful text, well above the placeholder threshold). Recommended filling order:
332
+ ---
151
333
 
152
- 1. `contracts/env/env-contract.md` — list every env var your app reads, with `secret`, `default`, `validation` columns.
153
- 2. `contracts/api/api-contract.md` — inventory every endpoint with method, path, request/response shape, and error format.
154
- 3. `contracts/data/data-shape-contract.md` — required columns, types, nullability, and malformed-data behavior for each data surface.
155
- 4. `contracts/css/css-contract.md` — design tokens, component states, and forbidden raw values.
156
- 5. `contracts/business/business-rules.md` — current rules, decision tables, edge cases.
157
- 6. `contracts/ci/ci-gate-contract.md` — gate tiers, promotion policy, rollback policy.
334
+ ### `cdd-kit validate`
158
335
 
159
- `cdd-kit validate --contracts` re-runs only the contract check; use it incrementally as you fill each file.
336
+ Runs contract validation scripts.
337
+
338
+ ```bash
339
+ cdd-kit validate # all validators
340
+ cdd-kit validate --contracts # API, CSS, data-shape (+ semantic checks)
341
+ cdd-kit validate --env # env contract
342
+ cdd-kit validate --ci # CI gate policy
343
+ cdd-kit validate --spec # spec traceability
344
+ cdd-kit validate --versions # contract frontmatter schema versions
345
+ ```
160
346
 
161
- ## What this kit standardizes
347
+ ---
162
348
 
163
- - Change classification before implementation
164
- - SDD artifacts for every meaningful change
165
- - TDD and test-first handoff rules
166
- - API, CSS/UI, environment, data-shape, business-rule, and CI/CD contracts
167
- - Required CI/CD gate planning for every change
168
- - E2E, resilience, data-boundary, monkey-operation, stress, and soak testing
169
- - Visual and UI/UX review for frontend changes
170
- - Spec drift audits across multiple iterations
171
- - Archiving completed changes back into durable standards
349
+ ### `cdd-kit new <name>`
172
350
 
173
- ## Core workflow
351
+ Scaffolds an empty change directory. Normally you use `/cdd-new` (the Claude Code skill) instead, which runs this and then orchestrates all agents. Use `cdd-kit new` only if you want an empty scaffold without agent orchestration.
174
352
 
175
- 1. Classify the change.
176
- 2. Scan the repository context.
177
- 3. Decide the required artifact path.
178
- 4. Write or update specs, contracts, tests, and CI gate plan before implementation.
179
- 5. Implement through the right engineer agents.
180
- 6. Run local and CI gates.
181
- 7. Run visual, E2E, resilience, stress, soak, or monkey testing as required.
182
- 8. Archive stable learnings back into contracts and standards.
353
+ ```bash
354
+ cdd-kit new add-user-auth
355
+ cdd-kit new add-user-auth --all # include optional templates too
356
+ cdd-kit new add-user-auth --force # overwrite existing directory
357
+ ```
183
358
 
184
- ## Change folder structure
359
+ ---
185
360
 
186
- ```text
187
- specs/changes/<change-id>/
188
- ├── change-request.md (required)
189
- ├── change-classification.md (required)
190
- ├── test-plan.md (required)
191
- ├── ci-gates.md (required)
192
- ├── tasks.md (required)
193
- ├── current-behavior.md
194
- ├── proposal.md
195
- ├── spec.md
196
- ├── design.md
197
- ├── contracts.md
198
- ├── qa-report.md
199
- ├── regression-report.md
200
- └── archive.md
361
+ ### `cdd-kit install-hooks`
362
+
363
+ Installs a pre-commit Git hook that auto-runs `cdd-kit gate --strict` on any staged change directory.
364
+
365
+ ```bash
366
+ cdd-kit install-hooks
367
+ # ✓ pre-commit hook installed at .git/hooks/pre-commit
201
368
  ```
202
369
 
203
- ## Definition of done
370
+ Idempotent. Preserves existing hook content. Bypass with `--no-verify` is possible but defeats enforcement.
204
371
 
205
- A change is not done until:
372
+ ---
206
373
 
207
- - Required specs and contracts are updated.
208
- - Required tests exist and are mapped to acceptance criteria.
209
- - Required CI/CD gates are present and green or explicitly marked as informational with promotion policy.
210
- - UI changes have visual evidence.
211
- - Data/reporting changes have data-boundary and bad-shape coverage.
212
- - High-load or long-running features have stress or soak evidence.
213
- - The archive captures what should become durable project knowledge.
374
+ ### `cdd-kit detect-stack`
214
375
 
215
- ## Stress / Soak runner support
376
+ Detects the project tech stack from lockfiles and config files.
216
377
 
217
- cdd-kit ships starter configs for three load runners. Pick one
218
- when filling out `tests/<change-id>/stress-test-plan.md`:
378
+ ```bash
379
+ cdd-kit detect-stack
380
+ # Detected stack: conda
381
+ # Polyglot: yes (config will be generated for conda)
382
+ ```
219
383
 
220
- | runner | best for | example |
221
- |--------|----------|---------|
222
- | k6 | JS-friendly, scriptable scenarios, native thresholds | tests/templates/stress/k6-example.js |
223
- | locust | Python teams, complex stateful scenarios | tests/templates/stress/locust-example.py |
224
- | artillery | declarative YAML, quick http flows | tests/templates/stress/artillery-example.yml |
384
+ | Language | Tool | Detection signal |
385
+ |---|---|---|
386
+ | Python | conda | `environment.yml`, `conda-lock.yml` |
387
+ | Python | poetry | `pyproject.toml` with `[tool.poetry]` |
388
+ | Python | uv | `pyproject.toml` (no poetry section) |
389
+ | Python | pip | `requirements.txt` |
390
+ | JS/TS | pnpm | `pnpm-lock.yaml` |
391
+ | JS/TS | bun | `bun.lockb` |
392
+ | JS/TS | yarn | `yarn.lock` |
393
+ | JS/TS | npm | `package.json` (fallback) |
394
+ | Go | go | `go.mod` |
395
+ | Rust | rust | `Cargo.toml` |
225
396
 
226
- Soak templates live under `tests/templates/soak/`.
397
+ ---
227
398
 
228
- ## Updating the kit
399
+ ## Upgrading from v1.10 or earlier
229
400
 
230
401
  ```bash
231
402
  npm update -g contract-driven-delivery
232
403
  cdd-kit update
404
+
405
+ # If you have mid-flight changes:
406
+ cdd-kit migrate --all
407
+ git add specs/changes/
408
+ git commit -m "chore: migrate changes to v1.11.0 format"
409
+ ```
410
+
411
+ **What changed in v1.11.0:**
412
+ - `gate --strict` and pre-commit enforcement
413
+ - Tier-based agent-log requirements (Tier 0–1 must have E2E/monkey/stress logs)
414
+ - `cdd-kit abandon`, `cdd-kit archive`, `cdd-kit list`, `cdd-kit migrate` commands
415
+ - `/cdd-resume` and `/cdd-close` Claude Code skills
416
+ - `change-classifier` outputs Acceptance Criteria + Tasks Not Applicable
417
+ - All agents require `CURRENT_CHANGE_ID` injection (handled automatically by skills)
418
+
419
+ ---
420
+
421
+ ## Directory structure after `cdd-kit init`
422
+
423
+ ```
424
+ your-repo/
425
+ ├── contracts/
426
+ │ ├── api/api-contract.md ← what endpoints exist and how they behave
427
+ │ ├── css/css-contract.md ← design tokens, component states
428
+ │ ├── data/data-shape-contract.md ← schemas, types, nullability
429
+ │ ├── env/env-contract.md ← every env var, secret flags, defaults
430
+ │ ├── business/business-rules.md ← rules, edge cases, decision tables
431
+ │ └── ci/ci-gate-contract.md ← gate tiers, promotion, rollback
432
+ ├── specs/
433
+ │ ├── project-profile.md ← overall system description
434
+ │ ├── changes/ ← active in-progress changes
435
+ │ │ └── <change-id>/
436
+ │ │ ├── change-request.md (required)
437
+ │ │ ├── change-classification.md (required)
438
+ │ │ ├── test-plan.md (required)
439
+ │ │ ├── ci-gates.md (required)
440
+ │ │ ├── tasks.md (required)
441
+ │ │ └── agent-log/ ← machine-verifiable evidence per agent
442
+ │ ├── archive/ ← completed and abandoned changes
443
+ │ │ ├── INDEX.md
444
+ │ │ └── 2026/<change-id>/
445
+ │ └── templates/
446
+ ├── tests/
447
+ ├── CLAUDE.md ← Claude's project guide (edit this)
448
+ └── AGENTS.md ← agent roster (auto-managed)
233
449
  ```
234
450
 
451
+ ---
452
+
453
+ ## Risk tiers and what each triggers
454
+
455
+ | Tier | Risk level | Example changes | Extra agents |
456
+ |---|---|---|---|
457
+ | 0–1 | High / critical | Auth, payments, migrations, concurrency | E2E + monkey + stress/soak |
458
+ | 2–3 | Medium | Feature with API change, bug fix with behavior change | Contract review + QA |
459
+ | 4–5 | Low | Docs, prompts, config only, no behavior change | Contract review + QA |
460
+
461
+ ---
462
+
463
+ ## Task notation in `tasks.md`
464
+
465
+ ```markdown
466
+ - [x] 1.1 Confirm classification ← done
467
+ - [-] 2.2 CSS/UI contract ← N/A (not applicable to this change)
468
+ - [ ] 4.1 Backend implementation ← pending
469
+ ```
470
+
471
+ `cdd-kit gate --strict` treats any `[ ]` (except section 7 archive tasks) as an error. Use `[-]` for items that are genuinely not applicable to a given change.
472
+
473
+ ---
474
+
235
475
  ## License
236
476
 
237
477
  MIT
@@ -23,4 +23,20 @@ This repository follows the Contract-Driven Delivery workflow.
23
23
  - `specs/changes/<id>/` records why decisions were made (passive archive — read only when investigating history).
24
24
  - To start any non-trivial change, use `/cdd-new <description>` in Claude Code.
25
25
 
26
+ ## CDD Kit Commands
27
+
28
+ | command | when to use |
29
+ |---|---|
30
+ | `/cdd-new <description>` | start a new tracked change (scaffolds all artifacts, runs full agent flow) |
31
+ | `/cdd-resume <id>` | continue an in-progress change after a session break |
32
+ | `/cdd-close <id>` | close a completed change: promote learnings, archive |
33
+ | `cdd-kit list` | show all active changes and their status |
34
+ | `cdd-kit gate <id>` | verify a change is gate-ready (run before PR) |
35
+ | `cdd-kit gate <id> --strict` | full gate with pending-task enforcement (pre-commit default) |
36
+ | `cdd-kit archive <id>` | physically move a completed change to `specs/archive/<year>/` |
37
+ | `cdd-kit abandon <id> --reason <text>` | mark a change as abandoned; preserves directory for git history |
38
+ | `cdd-kit migrate <id> \| --all` | upgrade pre-v1.11 change directories to new format (frontmatter + tier format) |
39
+ | `cdd-kit validate` | run all contract validators |
40
+ | `cdd-kit detect-stack` | detect the project tech stack |
41
+
26
42
  Run `cdd-kit detect-stack` to verify the detected tech stack.
@@ -30,6 +30,12 @@ Before editing production code, read the change artifacts, API/env/data/business
30
30
  - Read-after-write consistency — a write followed by an immediate read on a replica may return stale data.
31
31
  - Pagination — always sort by a stable column + tie-breaker (id), never offset-paginate over mutable data.
32
32
 
33
+ ## Read scope
34
+
35
+ - Allowed: `contracts/`, `tests/`, `src/`, and the change directory provided in `CURRENT_CHANGE_ID` at the top of your prompt
36
+ - **Before reading any file**: confirm the CURRENT_CHANGE_ID from your prompt header. If not provided, ask the caller: "What is the current change-id?" before proceeding.
37
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
38
+
33
39
  ## Handoff
34
40
 
35
41
  Report changed files, contract updates, tests added, commands run, known risks, and next reviewer.
@@ -70,3 +76,10 @@ with this exact structure (lines starting with `- ` are required):
70
76
  - Evidence must be concrete: file:line, command name + last-10-line stdout,
71
77
  contract path + section, test name, etc. NEVER write "verified" or "OK"
72
78
  without a pointer.
79
+
80
+ ## Read scope
81
+
82
+ - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
83
+ - Forbidden: other `specs/changes/` directories, `specs/archive/`
84
+
85
+ Read only the current change's directory. Do NOT glob `specs/changes/**` — it pulls historical data into context and wastes tokens.