A specification states what software must do, independent of how it does it. For AI-generated code, tests often serve as the inspectable specification: they define intent rather than merely checking an implementation. section 8.3 section 8.3.7
Reliable specifications expose requirements and their limits:
- State required behavior, promises, and invariants directly; avoid encoding implementation choices. section 8.3.7
- Treat passing tests as evidence that an expressed contract holds, not proof that the deeper requirement is correct. section 8.3.7
- Separate specification-derived tests from tests written after implementation; circular tests can preserve the agent's misunderstanding. section 10.4.1
- Escalate from examples to properties, and consider formal verification when bugs are catastrophic, domains are naturally formal, or regulation demands it. section 8.6 section 8.6.5
A behavioral specification in a test
The assertion `parse_markup("**bold**") == "<strong>bold</strong>"` specifies the required transformation without deciding whether the implementation uses regular expressions, parser combinators, or a state machine. By contrast, a discount test that expects 4.99 when the correct result is 5.00 merely confirms a shared implementation mistake. section 8.3.7 section 10.4.1
The central risk is not only incorrect code but an incorrect specification. Proofs can establish that code satisfies a specification while leaving open whether the specification expresses the intended behavior. section 8.6











