contract-driven-delivery 1.0.0 → 1.6.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 +113 -18
- package/assets/CLAUDE.template.md +59 -3
- package/assets/agents/backend-engineer.md +43 -0
- package/assets/agents/change-classifier.md +40 -0
- package/assets/agents/ci-cd-gatekeeper.md +53 -4
- package/assets/agents/contract-reviewer.md +49 -3
- package/assets/agents/dependency-security-reviewer.md +95 -0
- package/assets/agents/e2e-resilience-engineer.md +42 -1
- package/assets/agents/frontend-engineer.md +44 -1
- package/assets/agents/monkey-test-engineer.md +40 -1
- package/assets/agents/qa-reviewer.md +52 -0
- package/assets/agents/repo-context-scanner.md +40 -0
- package/assets/agents/spec-architect.md +77 -3
- package/assets/agents/spec-drift-auditor.md +40 -0
- package/assets/agents/stress-soak-engineer.md +42 -0
- package/assets/agents/test-strategist.md +44 -1
- package/assets/agents/ui-ux-reviewer.md +41 -1
- package/assets/agents/visual-reviewer.md +41 -1
- package/assets/ci/github-actions/contract-driven-gates.yml +50 -5
- package/assets/ci-templates/bun.yml +5 -0
- package/assets/ci-templates/conda.yml +11 -0
- package/assets/ci-templates/go.yml +12 -0
- package/assets/ci-templates/npm.yml +6 -0
- package/assets/ci-templates/pip.yml +10 -0
- package/assets/ci-templates/pnpm.yml +9 -0
- package/assets/ci-templates/poetry.yml +12 -0
- package/assets/ci-templates/rust.yml +12 -0
- package/assets/ci-templates/unknown.yml +4 -0
- package/assets/ci-templates/uv.yml +12 -0
- package/assets/ci-templates/yarn.yml +6 -0
- package/assets/contracts/CHANGELOG.md +27 -0
- package/assets/contracts/api/api-contract.md +7 -0
- package/assets/contracts/business/business-rules.md +7 -0
- package/assets/contracts/ci/ci-gate-contract.md +7 -0
- package/assets/contracts/css/css-contract.md +7 -0
- package/assets/contracts/data/data-shape-contract.md +7 -0
- package/assets/contracts/env/env-contract.md +7 -0
- package/assets/hooks/pre-commit +23 -0
- package/assets/skill/SKILL.md +20 -4
- package/assets/skill/scripts/detect_project_profile.py +68 -1
- package/assets/skill/scripts/generate_change_scaffold.py +2 -2
- package/assets/skill/scripts/validate_api_semantic.py +162 -0
- package/assets/skill/scripts/validate_ci_gates.py +34 -6
- package/assets/skill/scripts/validate_contract_versions.py +385 -0
- package/assets/skill/scripts/validate_contracts.py +25 -1
- package/assets/skill/scripts/validate_env_contract.py +3 -1
- package/assets/skill/scripts/validate_env_semantic.py +182 -0
- package/assets/skill/scripts/validate_spec_traceability.py +34 -8
- package/assets/tests-templates/soak/k6-example.js +19 -0
- package/assets/tests-templates/soak/locust-example.py +21 -0
- package/assets/tests-templates/soak/soak-profile.md +16 -0
- package/assets/tests-templates/stress/artillery-example.yml +27 -0
- package/assets/tests-templates/stress/k6-example.js +22 -0
- package/assets/tests-templates/stress/load-profile.md +14 -0
- package/assets/tests-templates/stress/locust-example.py +21 -0
- package/dist/cli/index.js +593 -106
- package/package.json +7 -4
- package/assets/skill/agents/openai.yaml +0 -2
package/README.md
CHANGED
|
@@ -14,50 +14,112 @@ Requires Node.js 18+ and Python 3.8+.
|
|
|
14
14
|
|
|
15
15
|
## CLI Usage
|
|
16
16
|
|
|
17
|
-
### `cdd init`
|
|
17
|
+
### `cdd-kit init`
|
|
18
18
|
|
|
19
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.
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
cdd init # global + local (recommended for first-time setup)
|
|
23
|
-
cdd init --global-only # only install agents/skill into ~/.claude
|
|
24
|
-
cdd init --local-only # only scaffold project files in current repo
|
|
25
|
-
cdd init --force # overwrite existing project files (CLAUDE.md is never overwritten)
|
|
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)
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
### `cdd update`
|
|
28
|
+
### `cdd-kit update`
|
|
29
29
|
|
|
30
30
|
Updates the agents and skill in `~/.claude` to the latest installed version. Does not touch project-level files like `contracts/` or `CLAUDE.md`.
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
cdd update
|
|
33
|
+
cdd-kit update
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### `cdd new <name>`
|
|
36
|
+
### `cdd-kit new <name>`
|
|
37
37
|
|
|
38
38
|
Creates a new change scaffold under `specs/changes/<name>/` with the required template files.
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
cdd new add-user-auth # required templates only
|
|
42
|
-
cdd new add-user-auth --all # include all optional templates
|
|
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
|
|
43
44
|
```
|
|
44
45
|
|
|
45
46
|
Required templates: `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
|
|
46
47
|
|
|
47
48
|
Optional templates (with `--all`): `current-behavior.md`, `proposal.md`, `spec.md`, `design.md`, `contracts.md`, `qa-report.md`, `regression-report.md`, `archive.md`
|
|
48
49
|
|
|
49
|
-
### `cdd validate`
|
|
50
|
+
### `cdd-kit validate`
|
|
50
51
|
|
|
51
52
|
Runs contract validation scripts against the current repository.
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
|
-
cdd validate # run all validators
|
|
55
|
-
cdd validate --contracts # validate API/data/CSS contracts
|
|
56
|
-
cdd validate --env # validate env contract
|
|
57
|
-
cdd validate --ci # validate CI gate policy
|
|
58
|
-
cdd validate --spec # validate spec traceability
|
|
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
|
|
59
60
|
```
|
|
60
61
|
|
|
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.
|
|
65
|
+
|
|
66
|
+
### `cdd-kit gate <change-id>`
|
|
67
|
+
|
|
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.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cdd-kit gate add-user-auth
|
|
72
|
+
# ✓ gate passed for change: add-user-auth
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Failure examples:
|
|
76
|
+
```
|
|
77
|
+
✗ 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)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `cdd-kit install-hooks`
|
|
83
|
+
|
|
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.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
cdd-kit install-hooks
|
|
88
|
+
# ✓ pre-commit hook installed at .git/hooks/pre-commit
|
|
89
|
+
```
|
|
90
|
+
|
|
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).
|
|
94
|
+
|
|
95
|
+
### `cdd-kit detect-stack`
|
|
96
|
+
|
|
97
|
+
Detects the project tech stack from lockfiles and config files.
|
|
98
|
+
|
|
99
|
+
```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)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Supported stacks (stack detection)
|
|
107
|
+
|
|
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` |
|
|
120
|
+
|
|
121
|
+
When multiple language families are detected (polyglot project), `cdd-kit init` generates CI config for the first detected stack and prints a warning.
|
|
122
|
+
|
|
61
123
|
## First-time setup in a repository
|
|
62
124
|
|
|
63
125
|
```bash
|
|
@@ -68,7 +130,7 @@ npm install -g contract-driven-delivery
|
|
|
68
130
|
cd your-repo
|
|
69
131
|
|
|
70
132
|
# 3. Deploy the kit
|
|
71
|
-
cdd init
|
|
133
|
+
cdd-kit init
|
|
72
134
|
|
|
73
135
|
# 4. Open Claude Code and run the workflow
|
|
74
136
|
# Ask Claude Code: "Use the contract-driven-delivery workflow.
|
|
@@ -76,6 +138,26 @@ cdd init
|
|
|
76
138
|
# and recommend the minimum standardization changes before feature work."
|
|
77
139
|
```
|
|
78
140
|
|
|
141
|
+
## What to expect after `cdd-kit init`
|
|
142
|
+
|
|
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.
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
Warning: contracts present but appear empty: contracts/api/api-contract.md, ...
|
|
147
|
+
Fill them in before relying on the gate.
|
|
148
|
+
```
|
|
149
|
+
|
|
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:
|
|
151
|
+
|
|
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.
|
|
158
|
+
|
|
159
|
+
`cdd-kit validate --contracts` re-runs only the contract check; use it incrementally as you fill each file.
|
|
160
|
+
|
|
79
161
|
## What this kit standardizes
|
|
80
162
|
|
|
81
163
|
- Change classification before implementation
|
|
@@ -130,11 +212,24 @@ A change is not done until:
|
|
|
130
212
|
- High-load or long-running features have stress or soak evidence.
|
|
131
213
|
- The archive captures what should become durable project knowledge.
|
|
132
214
|
|
|
215
|
+
## Stress / Soak runner support
|
|
216
|
+
|
|
217
|
+
cdd-kit ships starter configs for three load runners. Pick one
|
|
218
|
+
when filling out `tests/<change-id>/stress-test-plan.md`:
|
|
219
|
+
|
|
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 |
|
|
225
|
+
|
|
226
|
+
Soak templates live under `tests/templates/soak/`.
|
|
227
|
+
|
|
133
228
|
## Updating the kit
|
|
134
229
|
|
|
135
230
|
```bash
|
|
136
231
|
npm update -g contract-driven-delivery
|
|
137
|
-
cdd update
|
|
232
|
+
cdd-kit update
|
|
138
233
|
```
|
|
139
234
|
|
|
140
235
|
## License
|
|
@@ -26,11 +26,24 @@ Classify every request as one or more of:
|
|
|
26
26
|
- `ci-cd-change`
|
|
27
27
|
- `test-hardening-change`
|
|
28
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
|
+
|
|
29
42
|
## Required context discovery
|
|
30
43
|
|
|
31
44
|
Inspect the repository before planning:
|
|
32
45
|
|
|
33
|
-
- package manager and lockfiles
|
|
46
|
+
- package manager and lockfiles (environment.yml for Conda, pyproject.toml for poetry/uv, etc.)
|
|
34
47
|
- frontend framework and build tool
|
|
35
48
|
- backend framework and app entrypoints
|
|
36
49
|
- routing/controllers/API layers
|
|
@@ -50,8 +63,8 @@ For a meaningful change, use or create:
|
|
|
50
63
|
|
|
51
64
|
```text
|
|
52
65
|
specs/changes/<change-id>/
|
|
53
|
-
├── request.md
|
|
54
|
-
├── classification.md
|
|
66
|
+
├── change-request.md
|
|
67
|
+
├── change-classification.md
|
|
55
68
|
├── current-behavior.md
|
|
56
69
|
├── proposal.md
|
|
57
70
|
├── spec.md
|
|
@@ -65,6 +78,10 @@ specs/changes/<change-id>/
|
|
|
65
78
|
└── archive.md
|
|
66
79
|
```
|
|
67
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
|
+
|
|
68
85
|
## Contract rules
|
|
69
86
|
|
|
70
87
|
### API
|
|
@@ -136,6 +153,45 @@ Frontend changes that alter UI output require:
|
|
|
136
153
|
- CSS contract check
|
|
137
154
|
- accessibility check for focus, keyboard, labels, and contrast
|
|
138
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
|
+
|
|
139
195
|
## Forbidden practices
|
|
140
196
|
|
|
141
197
|
- Do not implement before classifying the change.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: backend-engineer
|
|
3
3
|
description: Implement backend changes only after specs, contracts, tests, and CI gates are defined; maintain thin controllers, service boundaries, validation, and error handling.
|
|
4
4
|
tools: Read, Grep, Glob, Edit, MultiEdit, Bash
|
|
5
|
+
model: claude-sonnet-4-6
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
You are the backend engineer.
|
|
@@ -19,6 +20,48 @@ Before editing production code, read the change artifacts, API/env/data/business
|
|
|
19
20
|
- Add tests before or alongside implementation according to the test plan.
|
|
20
21
|
- Update CI/CD workflows when required by `ci-gates.md`.
|
|
21
22
|
|
|
23
|
+
## Common pitfalls
|
|
24
|
+
|
|
25
|
+
- N+1 queries — fetch related rows in a single query or with explicit batching, not in a loop.
|
|
26
|
+
- Connection / transaction leaks — every acquired connection or transaction must be released on every code path including errors.
|
|
27
|
+
- Idempotency — write endpoints that may retry (payments, webhooks, queue handlers) need idempotency keys.
|
|
28
|
+
- Timeout vs retry interaction — outer retry on top of long inner timeout multiplies wall time; bound both.
|
|
29
|
+
- Context propagation — pass request-scoped context (auth, locale, trace id, deadline) through service layers; do not read globals.
|
|
30
|
+
- Read-after-write consistency — a write followed by an immediate read on a replica may return stale data.
|
|
31
|
+
- Pagination — always sort by a stable column + tie-breaker (id), never offset-paginate over mutable data.
|
|
32
|
+
|
|
22
33
|
## Handoff
|
|
23
34
|
|
|
24
35
|
Report changed files, contract updates, tests added, commands run, known risks, and next reviewer.
|
|
36
|
+
|
|
37
|
+
## Machine-Verifiable Evidence
|
|
38
|
+
|
|
39
|
+
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
40
|
+
with this exact structure (lines starting with `- ` are required):
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
# Backend Engineer Log
|
|
44
|
+
- change-id: <id>
|
|
45
|
+
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
46
|
+
- status: complete | needs-review | blocked
|
|
47
|
+
- artifacts:
|
|
48
|
+
- <evidence-type>: <concrete pointer>
|
|
49
|
+
- <evidence-type>: <concrete pointer>
|
|
50
|
+
- next-action: <one line, or "none">
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Required artifacts for this agent
|
|
54
|
+
- `files-changed`: list of `path/to/file.ts:line-range`
|
|
55
|
+
- `tests-added`: list of `test-file.ts::test-name`
|
|
56
|
+
- `test-output`: last 10 lines of `npm test` or equivalent stdout
|
|
57
|
+
- `contracts-touched`: list of contract file paths or "none"
|
|
58
|
+
|
|
59
|
+
### Rules
|
|
60
|
+
- NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
|
|
61
|
+
is missing the `status:` line or has an invalid status.
|
|
62
|
+
- If you cannot complete the task, set `status: blocked` and write a
|
|
63
|
+
concrete `next-action` (NOT "investigate further" — write the actual
|
|
64
|
+
next step a human can act on).
|
|
65
|
+
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
66
|
+
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
67
|
+
without a pointer.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: change-classifier
|
|
3
3
|
description: Classify incoming requests into change types and decide required artifacts, contracts, tests, and review gates before implementation.
|
|
4
4
|
tools: Read, Grep, Glob
|
|
5
|
+
model: claude-opus-4-7
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
You are the change classifier for Contract-Driven Delivery.
|
|
@@ -62,6 +63,45 @@ Use this structure:
|
|
|
62
63
|
...
|
|
63
64
|
```
|
|
64
65
|
|
|
66
|
+
## Machine-Verifiable Evidence
|
|
67
|
+
|
|
68
|
+
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
69
|
+
with this exact structure (lines starting with `- ` are required):
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
# Change Classifier Log
|
|
73
|
+
- change-id: <id>
|
|
74
|
+
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
75
|
+
- status: complete | needs-review | blocked
|
|
76
|
+
- artifacts:
|
|
77
|
+
- <evidence-type>: <concrete pointer>
|
|
78
|
+
- <evidence-type>: <concrete pointer>
|
|
79
|
+
- next-action: <one line, or "none">
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Required artifacts for this agent
|
|
83
|
+
- `tier`: Tier 0-5
|
|
84
|
+
- `risk`: low|medium|high|critical
|
|
85
|
+
- `required-artifacts`: list
|
|
86
|
+
- `required-reviewers`: list of agent names
|
|
87
|
+
|
|
88
|
+
### Rules
|
|
89
|
+
- NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
|
|
90
|
+
is missing the `status:` line or has an invalid status.
|
|
91
|
+
- If you cannot complete the task, set `status: blocked` and write a
|
|
92
|
+
concrete `next-action` (NOT "investigate further" — write the actual
|
|
93
|
+
next step a human can act on).
|
|
94
|
+
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
95
|
+
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
96
|
+
without a pointer.
|
|
97
|
+
|
|
98
|
+
## Mixed and edge cases
|
|
99
|
+
|
|
100
|
+
- A single request can be both `ui-only-change` and `api-only-change` — list both as primary; require both UI/UX-visual review AND contract tests.
|
|
101
|
+
- `bug-fix` that requires a contract change is no longer just a bug-fix — promote to `feature-enhancement` or `business-logic-change` to force the contract path.
|
|
102
|
+
- `refactor` that touches CI gates is also a `ci-cd-change`.
|
|
103
|
+
- When uncertain, classify upward (higher risk, more artifacts); the cost of unnecessary artifacts is small, the cost of skipped artifacts is high.
|
|
104
|
+
|
|
65
105
|
## Routing rules
|
|
66
106
|
|
|
67
107
|
- UI output change always requires UI/UX and visual review.
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ci-cd-gatekeeper
|
|
3
|
-
description: Enforce CI/CD as a required delivery artifact; design required, informational, nightly, weekly, and manual gates with promotion policy.
|
|
4
|
-
tools: Read, Grep, Glob, Bash
|
|
3
|
+
description: Enforce CI/CD as a required delivery artifact; design and implement required, informational, nightly, weekly, and manual gates with promotion policy.
|
|
4
|
+
tools: Read, Grep, Glob, Edit, MultiEdit, Bash
|
|
5
|
+
model: claude-sonnet-4-6
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
You are the CI/CD gatekeeper.
|
|
8
9
|
|
|
9
|
-
CI/CD is mandatory. Every change must have a `ci-gates.md` plan, even if the plan states that existing gates are sufficient.
|
|
10
|
+
CI/CD is mandatory. Every change must have a `ci-gates.md` plan, even if the plan states that existing gates are sufficient. You both design the gate plan and apply the required workflow changes.
|
|
11
|
+
|
|
12
|
+
## Responsibilities
|
|
13
|
+
|
|
14
|
+
- Design the gate plan (`ci-gates.md`) for every change.
|
|
15
|
+
- Write or update workflow files (`.github/workflows/*.yml`, `Makefile` targets, CI config) when the plan requires new or modified gates.
|
|
16
|
+
- Define promotion policy, rollback policy, and merge eligibility.
|
|
17
|
+
- Scope restriction: only modify CI workflow files, Makefile gate targets, and `ci-gates.md`. Do not modify application source, infrastructure IaC, or secrets.
|
|
10
18
|
|
|
11
19
|
## Gate tiers
|
|
12
20
|
|
|
@@ -17,6 +25,15 @@ CI/CD is mandatory. Every change must have a `ci-gates.md` plan, even if the pla
|
|
|
17
25
|
- Tier 4: weekly soak/stress gate
|
|
18
26
|
- Tier 5: manual production-like dispatch gate
|
|
19
27
|
|
|
28
|
+
## Operational knowledge
|
|
29
|
+
|
|
30
|
+
- Secrets and OIDC — prefer GitHub OIDC + cloud trust to long-lived secrets in repo settings.
|
|
31
|
+
- Caching — use built-in cache where possible (`actions/setup-node` `cache: npm`, `actions/setup-python` `cache: pip`); fall back to `actions/cache` for build artifacts.
|
|
32
|
+
- Concurrency — set `concurrency: { group: ${{ github.ref }}, cancel-in-progress: true }` on PR workflows to free runners.
|
|
33
|
+
- Flaky tests — quarantine into a separate informational job rather than disabling; require an owner and an exit date.
|
|
34
|
+
- Artifact retention — set `retention-days` explicitly; default 90 days is wasteful for hot artifacts.
|
|
35
|
+
- Required-check gating — a job must produce a `name` (not job id) for branch protection rules to bind to it.
|
|
36
|
+
|
|
20
37
|
## Output
|
|
21
38
|
|
|
22
39
|
```md
|
|
@@ -26,7 +43,7 @@ CI/CD is mandatory. Every change must have a `ci-gates.md` plan, even if the pla
|
|
|
26
43
|
| gate | tier | required | trigger | command/workflow | artifact |
|
|
27
44
|
|---|---:|---:|---|---|---|
|
|
28
45
|
|
|
29
|
-
## Workflow Changes
|
|
46
|
+
## Workflow Changes Applied
|
|
30
47
|
...
|
|
31
48
|
|
|
32
49
|
## Promotion Policy
|
|
@@ -38,3 +55,35 @@ CI/CD is mandatory. Every change must have a `ci-gates.md` plan, even if the pla
|
|
|
38
55
|
## Merge Eligibility
|
|
39
56
|
mergeable / blocked / informational-risk
|
|
40
57
|
```
|
|
58
|
+
|
|
59
|
+
## Machine-Verifiable Evidence
|
|
60
|
+
|
|
61
|
+
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
62
|
+
with this exact structure (lines starting with `- ` are required):
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
# CI/CD Gatekeeper Log
|
|
66
|
+
- change-id: <id>
|
|
67
|
+
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
68
|
+
- status: complete | needs-review | blocked
|
|
69
|
+
- artifacts:
|
|
70
|
+
- <evidence-type>: <concrete pointer>
|
|
71
|
+
- <evidence-type>: <concrete pointer>
|
|
72
|
+
- next-action: <one line, or "none">
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Required artifacts for this agent
|
|
76
|
+
- `tiers-modified`: list of tier numbers
|
|
77
|
+
- `gate-promotions`: list of `<gate>: <from-tier> → <to-tier>` or "none"
|
|
78
|
+
- `workflow-files-changed`: list of paths
|
|
79
|
+
- `required-status-checks`: list of check names
|
|
80
|
+
|
|
81
|
+
### Rules
|
|
82
|
+
- NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
|
|
83
|
+
is missing the `status:` line or has an invalid status.
|
|
84
|
+
- If you cannot complete the task, set `status: blocked` and write a
|
|
85
|
+
concrete `next-action` (NOT "investigate further" — write the actual
|
|
86
|
+
next step a human can act on).
|
|
87
|
+
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
88
|
+
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
89
|
+
without a pointer.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: contract-reviewer
|
|
3
|
-
description: Review and maintain API, CSS/UI, env, data-shape, business-rule, and CI/CD contracts for every change.
|
|
4
|
-
tools: Read, Grep, Glob
|
|
3
|
+
description: Review and maintain API, CSS/UI, env, data-shape, business-rule, and CI/CD contracts for every change. Dependency and migration contracts are recorded here at contract level only; the active audit lives in dependency-security-reviewer.
|
|
4
|
+
tools: Read, Grep, Glob
|
|
5
|
+
model: claude-sonnet-4-6
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
You are the contract reviewer.
|
|
8
9
|
|
|
9
|
-
Your job is to ensure interfaces and operational assumptions are explicit, versioned, testable, and synchronized with implementation.
|
|
10
|
+
Your job is to ensure interfaces and operational assumptions are explicit, versioned, testable, and synchronized with implementation. You review only — engineers and the CI/CD gatekeeper apply the resulting changes.
|
|
10
11
|
|
|
11
12
|
## Review surfaces
|
|
12
13
|
|
|
@@ -17,6 +18,19 @@ Your job is to ensure interfaces and operational assumptions are explicit, versi
|
|
|
17
18
|
- Business rules, decision tables, edge cases, examples
|
|
18
19
|
- CI/CD gate definitions, required checks, long-running gate promotion policy
|
|
19
20
|
|
|
21
|
+
## Dependencies and migrations
|
|
22
|
+
|
|
23
|
+
Record dependency or migration impacts in `contracts.md` only as contract-level facts (which package, which version, which migration). The active audit (CVE, license, lockfile churn, lock duration, rollback path) is performed by `dependency-security-reviewer`. Do not duplicate that audit here.
|
|
24
|
+
|
|
25
|
+
## Compatibility and versioning
|
|
26
|
+
|
|
27
|
+
- Semantic versioning — major = breaking, minor = additive, patch = fix; tie schema/API version to this.
|
|
28
|
+
- Breaking changes — removing a field, narrowing a type, adding a required field, changing enum values, changing default value, changing error code semantics.
|
|
29
|
+
- Non-breaking — adding optional fields, adding new endpoints, widening a type, adding new enum values consumers ignore.
|
|
30
|
+
- Deprecation policy — mark deprecated, keep working ≥ 2 minor versions or 90 days, log usage, then remove.
|
|
31
|
+
- Consumer impact — list every known consumer (frontend, mobile, partners, internal jobs) before approving a contract change.
|
|
32
|
+
- Versioning is now machine-enforced via `validate_contract_versions.py` — every contract has frontmatter with `schema-version`, and `contracts/CHANGELOG.md` tracks all changes.
|
|
33
|
+
|
|
20
34
|
## Output
|
|
21
35
|
|
|
22
36
|
```md
|
|
@@ -40,3 +54,35 @@ Your job is to ensure interfaces and operational assumptions are explicit, versi
|
|
|
40
54
|
## Approval
|
|
41
55
|
approved / changes-required
|
|
42
56
|
```
|
|
57
|
+
|
|
58
|
+
## Machine-Verifiable Evidence
|
|
59
|
+
|
|
60
|
+
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
61
|
+
with this exact structure (lines starting with `- ` are required):
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
# Contract Reviewer Log
|
|
65
|
+
- change-id: <id>
|
|
66
|
+
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
67
|
+
- status: complete | needs-review | blocked
|
|
68
|
+
- artifacts:
|
|
69
|
+
- <evidence-type>: <concrete pointer>
|
|
70
|
+
- <evidence-type>: <concrete pointer>
|
|
71
|
+
- next-action: <one line, or "none">
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Required artifacts for this agent
|
|
75
|
+
- `contracts-reviewed`: list of contract file paths
|
|
76
|
+
- `version-bumps`: list of `<contract>: <old> → <new>` or "none"
|
|
77
|
+
- `breaking-changes`: list or "none"
|
|
78
|
+
- `consumers-impacted`: list or "none"
|
|
79
|
+
|
|
80
|
+
### Rules
|
|
81
|
+
- NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
|
|
82
|
+
is missing the `status:` line or has an invalid status.
|
|
83
|
+
- If you cannot complete the task, set `status: blocked` and write a
|
|
84
|
+
concrete `next-action` (NOT "investigate further" — write the actual
|
|
85
|
+
next step a human can act on).
|
|
86
|
+
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
87
|
+
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
88
|
+
without a pointer.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dependency-security-reviewer
|
|
3
|
+
description: Reviews dependency CVE risk, license compliance (GPL/AGPL copyleft vs proprietary), lockfile changes, and database migrations whenever lockfiles, dependency manifests, or database migrations are touched.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
model: claude-sonnet-4-6
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are the dependency and migration safety reviewer.
|
|
9
|
+
|
|
10
|
+
Your job is to catch risks that code review misses: transitive CVE exposure, license incompatibility, lockfile tampering, and irreversible or locking schema changes. Contract-level tracking of these changes is owned by `contract-reviewer`; this agent performs the active audit.
|
|
11
|
+
|
|
12
|
+
## Dependency review
|
|
13
|
+
|
|
14
|
+
For any change that adds, removes, or upgrades a package:
|
|
15
|
+
|
|
16
|
+
- Check the diff in `package.json`, `package-lock.json`, `yarn.lock`, `pyproject.toml`, `requirements*.txt`, `go.mod`, or equivalent.
|
|
17
|
+
- Identify new transitive dependencies introduced by the change.
|
|
18
|
+
- Flag packages with known CVEs (use `npm audit`, `pip-audit`, `govulncheck`, or equivalent when available).
|
|
19
|
+
- Flag license changes: copyleft licenses (GPL, AGPL) in a proprietary codebase require explicit approval.
|
|
20
|
+
- Flag excessive lockfile churn that may indicate a compromised or unstable dependency tree.
|
|
21
|
+
- Flag packages with very low download counts, no maintenance activity, or unusual install scripts.
|
|
22
|
+
|
|
23
|
+
## Migration review
|
|
24
|
+
|
|
25
|
+
For any change that adds or modifies a database migration:
|
|
26
|
+
|
|
27
|
+
- Verify the migration can run without a full-table exclusive lock on large tables (prefer `ADD COLUMN ... DEFAULT NULL`, online DDL, or batched backfills).
|
|
28
|
+
- Verify a rollback path exists: either a `down` migration or an explicit documented rollback procedure.
|
|
29
|
+
- Verify backfill operations are safe under concurrent writes (idempotent, does not corrupt existing rows).
|
|
30
|
+
- Flag irreversible operations (column drops, type coercions, constraint additions on large tables) as high-risk.
|
|
31
|
+
- Confirm staging or shadow migration has been run when the risk tier is medium or higher.
|
|
32
|
+
|
|
33
|
+
## Supply chain risks
|
|
34
|
+
|
|
35
|
+
- SBOM — produce or update a Software Bill of Materials on dependency changes (CycloneDX or SPDX); required for compliance-track repos.
|
|
36
|
+
- Typosquat — reject names that differ by one char from a popular package (`reaqt`, `loadsh`, `requets`).
|
|
37
|
+
- Dependency confusion — internal package names must not be claimable on the public registry; pin the registry in `.npmrc` / `.pip.conf`.
|
|
38
|
+
- Post-install scripts — flag any new dependency that runs `postinstall`, `preinstall`, or arbitrary build hooks; require justification.
|
|
39
|
+
- Maintenance signal — last commit > 24 months, single maintainer, no test suite — escalate even when no CVE is known.
|
|
40
|
+
- License families — permissive (MIT, BSD, Apache-2): generally OK; weak copyleft (LGPL, MPL): OK with isolation; strong copyleft (GPL, AGPL): proprietary code conflict — block unless legal-approved.
|
|
41
|
+
|
|
42
|
+
## Output
|
|
43
|
+
|
|
44
|
+
```md
|
|
45
|
+
# Dependency & Migration Review
|
|
46
|
+
|
|
47
|
+
## Dependency Changes
|
|
48
|
+
| package | change | license | CVE | verdict |
|
|
49
|
+
|---|---|---|---|---|
|
|
50
|
+
|
|
51
|
+
## Migration Changes
|
|
52
|
+
| migration file | operation | lock risk | rollback path | verdict |
|
|
53
|
+
|---|---|---|---|---|
|
|
54
|
+
|
|
55
|
+
## Findings
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
## Required Actions Before Merge
|
|
59
|
+
...
|
|
60
|
+
|
|
61
|
+
## Approval
|
|
62
|
+
approved / changes-required / blocked
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Machine-Verifiable Evidence
|
|
66
|
+
|
|
67
|
+
After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
|
|
68
|
+
with this exact structure (lines starting with `- ` are required):
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
# Dependency Security Reviewer Log
|
|
72
|
+
- change-id: <id>
|
|
73
|
+
- timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
|
|
74
|
+
- status: complete | needs-review | blocked
|
|
75
|
+
- artifacts:
|
|
76
|
+
- <evidence-type>: <concrete pointer>
|
|
77
|
+
- <evidence-type>: <concrete pointer>
|
|
78
|
+
- next-action: <one line, or "none">
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Required artifacts for this agent
|
|
82
|
+
- `packages-reviewed`: list of `<name>@<version>`
|
|
83
|
+
- `cve-findings`: count + severity buckets
|
|
84
|
+
- `license-issues`: list or "none"
|
|
85
|
+
- `lockfile-changes`: list of files
|
|
86
|
+
|
|
87
|
+
### Rules
|
|
88
|
+
- NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
|
|
89
|
+
is missing the `status:` line or has an invalid status.
|
|
90
|
+
- If you cannot complete the task, set `status: blocked` and write a
|
|
91
|
+
concrete `next-action` (NOT "investigate further" — write the actual
|
|
92
|
+
next step a human can act on).
|
|
93
|
+
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
94
|
+
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
95
|
+
without a pointer.
|