In spec-driven development, a specification describes what a system must do before the corresponding implementation is written or changed. It records externally observable behavior, constraints, and conditions for acceptance. The specification can combine prose and examples for business rules with machine-readable artifacts such as OpenAPI definitions for HTTP interfaces or schemas for event payloads. It can be as small as a contract change and a few acceptance cases. The point is to make behavior reviewable and verifiable, not to produce a large document.
Consider a cloud API that starts an asynchronous report export. Its specification can define a 202 response with a job identifier, require a retry with the same idempotency key and request body to return the existing identifier within a stated window, and prevent callers from accessing jobs owned by another tenant. An OpenAPI document can define the request and response shapes, while acceptance tests verify replay and tenant isolation. Teams can build and test clients against a mock before the worker is ready, then verify the deployed API against the same contract. Schema validation alone cannot establish that retries avoid creating duplicate jobs.
Engineers can implement the specification by hand, generate client libraries or server stubs from a schema, or give an AI assistant the approved requirements, repository conventions, and acceptance criteria to draft code and tests. During review, the assistant can compare a diff with the spec, flag a missing error case, or suggest a refactor that preserves the public contract. Reviewers must still check assumptions and test edge cases independently: code and tests generated from the same misunderstanding can agree and still be wrong. Security scans also serve a separate purpose, and suggested performance improvements should be confirmed under representative load.
Keep the spec, implementation, and verification changes together in version control. For shared interfaces, run compatibility checks in continuous integration and use integration tests against a representative cloud environment for behavior that depends on managed services, such as message redelivery. When requirements change, update the spec and tests with the implementation. Establish a regeneration rule for generated files so manual edits are not silently overwritten.
The payoff is earlier feedback on mismatched assumptions, especially when multiple teams deploy independently. The cost is maintaining the specification and its checks as the system evolves. Overly detailed specs can lock in design choices that do not affect consumers, while vague criteria leave important decisions to whoever writes or generates the code. The approach is neither waterfall nor synonymous with AI code generation: teams can revise a small specification each iteration and choose which parts, if any, to automate.