designing-contract-first-features
Skill1 starsChanged 3 months agoApache-2.0View on GitHub
Use when approved feature requirements need architecture, responsibility boundaries, dependency impacts, explicit identification of cross-component contract surfaces, and a verification strategy assigning required evidence layers per behavior.
In this repository13 other files it gives its agents.
- accepting-contract-first-featuresSkill
- authoring-executable-contractsSkill
- developing-contract-first-featuresSkill
- executing-persistent-workstreamsSkill
- managing-contract-revisionsSkill
- planning-contract-workstreamsSkill
- review-agentSkill
- reviewing-and-freezing-contractsSkill
- reviewing-workstreamsSkill
- test-driven-developmentSkill
- verifying-contract-first-featureSkill
- verifying-runtime-integrationSkill
- verifying-task-gatesSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Do not define every request/response field here.
- Distinctive: line 52
Do not require every layer for every behavior.
- Distinctive: line 119
Do not spin up the entire distributed topology to satisfy per-service obligations.
- Distinctive: line 123
Before contract authoring, confirm:
- Distinctive: line 125
every approved requirement has an owning component or boundary.
- Distinctive: line 126
no two workstreams implicitly own the same state transition.
- Distinctive: line 132
If a requirement cannot be assigned without guessing product behavior, return to requirements engineering rather than encoding the guess in …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Designing Contract-First Features
Transform approved requirements into .dream/specs/<feature>/design.md.
Design owns
- architecture and component boundaries;
- responsibility and data ownership;
- relevant upstream/downstream dependencies;
- security, transaction, consistency, and failure boundaries;
- which cross-component interfaces require executable contracts;
- the verification strategy: which evidence layers prove each material behavior;
- material technical decisions whose change would affect another owner.
Design does not own private implementation recipes such as creating a particular repository/service/controller class unless that type itself is a shared architectural interface.
Required output
For each affected boundary, identify:
Boundary ID
Producer / provider
Consumer(s)
Purpose
Authentication / caller context
Material state or failure semantics
Contract artifact required
Requirement IDs traced to the boundaryDo not define every request/response field here. Detailed shared schemas, statuses, examples, and scenarios belong to authoring-executable-contracts.
Verification Strategy
design.md must contain a ## Verification Strategy section defining how the approved behavior will be proven correct.
Classify each material behavior or shared contract by the minimum verification layers required:
- unit
- integration
- contract
- runtime-smoke
- e2e
- visual
Do not require every layer for every behavior. Layers differ sharply in cost; require the narrowest layer that proves the behavior and treat broader layers as expensive gates rather than defaults.
Selection rules
Require unit verification when:
- business logic changes;
- validation or calculation changes;
- state transition logic changes.
Require integration verification when:
- persistence behavior changes;
- transaction behavior matters;
- multiple backend components interact;
- infrastructure adapters or external dependencies are involved.
Require contract verification when:
- a shared API/event/schema contract is added or changed;
- two independently implemented owners depend on the same boundary (frontend ↔ backend, service ↔ service, producer ↔ consumer);
- serialization, required fields, enums, status codes, or formats matter.
In distributed topologies, consumer/provider contract verification carries most of the cross-boundary correctness weight; do not compensate by expanding full-system E2E.
Require runtime-smoke verification when:
- routing, middleware, configuration, migrations, application wiring, authentication, startup, or infrastructure integration can affect behavior.
For multi-service systems, assign per-service runtime smoke; assemble a shared cross-service environment at most once at feature level.
Require e2e verification only when at least one applies:
- correctness depends on a cross-component or cross-workstream user flow;
- critical behavior can be proven only from the external user boundary;
- routing, authentication, or browser state is part of the observed behavior;
- regression risk is high and no narrower layer covers it.
E2E is not required when:
- the change is internal/backend-only;
- the behavior is pure calculation or persistence already covered by integration tests;
- the shared contract is fully proven by integration and contract layers.
When e2e is required, declare a small number (typically 1–3) of critical end-to-end scenarios in the matrix. Browser E2E is the most expensive gate: automated headless runs provide gate evidence; headed/interactive sessions are for debugging failures or visual inspection only, never run after every task.
Require visual verification when:
- user-visible layout, interaction state, responsive behavior, or visual feedback changes.
Verification matrix
| Behavior / Contract | Unit | Integration | Contract | Runtime | E2E | Visual |
| ... | ... | ... | ... | ... | ... | ... |
The strategy defines required evidence and boundaries, not private test implementation details (specific test files, frameworks, harnesses, or container tooling), which an implementing owner decides locally within repository conventions.
Architecture adaptation
The strategy is architecture-agnostic; boundaries and layer weights follow the architecture declared in this design:
- Monolith / modular monolith — boundaries are modules plus the external API; integration evidence may run the assembled application in process over real dependencies; contract surfaces are typically frontend ↔ API.
- Microservices — each independently deployable service owns its contracts; weight shifts toward consumer/provider contract verification, with fewer full-system E2E scenarios; runtime smoke is per service, plus at most one small cross-service feature smoke.
- Event-driven / distributed — producers and consumers own message schemas (AsyncAPI, JSON Schema, Avro, equivalent); contract verification covers payload schema, delivery semantics, and version compatibility across producers and consumers.
Do not spin up the entire distributed topology to satisfy per-service obligations; assign the narrowest boundary that proves each behavior.
Design gate
Before contract authoring, confirm:
- every approved requirement has an owning component or boundary;
- no two workstreams implicitly own the same state transition;
- personalized behavior is distinguished from intrinsic resource data;
- failure/authorization semantics have an explicit owner;
- each matrix row assigns the minimum sufficient layers — no behavior requires all six by default;
- identified boundaries are sufficient for independent consumer/provider implementation.
If a requirement cannot be assigned without guessing product behavior, return to requirements engineering rather than encoding the guess in design.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

