A prompt can produce plausible code without establishing whether the result is safe to own. Specification-driven development addresses that risk by making the specification—not the prompt—the authoritative artifact from which plans, tasks, tests, and verification gates derive. section 1.3 section 1.4
The core rhythm is specify → implement → verify. An executable specification defines the intended effect before implementation and can span API schemas, error semantics, domain invariants, property checks, state-machine guards, performance gates, security policies, and provenance. A failed gate might be a broken contract, a violated invariant, a low mutation score, or excessive p95 latency—not just a failing unit test. section 1.5
A practical workflow separates exploration from production ownership:
- Explore the domain through spikes, scoping, or prototypes before committing to a specification. section 1.3
- Define intent and correctness before seeing generated implementation code; anticipate failure modes as well as the happy path. section 1.4
- Derive and approve a plan and independently verifiable tasks. Vertical slices can cross policy, adapter, contract, and test, rather than adding one layer at a time. section 1.5
- Have agents translate intent into code and verification, then enforce gates through CI/CD. Keep the human responsible for deciding which claims are true and auditing results. section 1.3 section 1.5
- Iterate through verification and finish with tested, team-owned code—not merely a green build. section 1.3 section 1.5
Feature: Refund policy
Rule: Time-bounded, single-order refunds
Example: Within 30 days is allowed
Given an order "O1" purchased at 2025-08-01T10:00:00Z
When a refund of 25.00 USD is requested at 2025-08-28T09:59:00Z
Then the refund is approved and remaining refundable equals 75.00 USD
Example: After 30 days is rejected
Given an order "O2" purchased at 2025-08-01T10:00:00Z
When a refund is requested at 2025-08-31T10:00:01Z
Then the request is rejected with reason "expired"
Example: Partials must not exceed the original
Given prior refunds of 90.00 USD on a 100.00 USD order
When a refund of 20.00 USD is requested
Then the request is rejected with reason "exceeds-remaining"This executable refund specification makes approval, expiry, and cumulative refund limits concrete before implementation. section 1.5
The approach inherits the effect-before-implementation discipline of test-driven development, but puts a feature-wide specification at the center. Context engineering complements it by determining which instructions, code, documentation, constraints, and tool output reach the model. The model choice is secondary to the specification and its enforcement; generated code still requires verification and human ownership. section 1.3 section 1.5



