AI-generated code can look plausible while violating unstated requirements. Verification-first addresses that risk by having the person who knows what correctness means write checks or specifications before the implementation exists. The human defines intent and anticipates failure modes before seeing generated code. section 1.4
For a single function, this resembles test-driven development with the model as implementer. For a feature, the contract can also include API schemas, invariants, performance gates, and error semantics. The common requirement is that verification precedes implementation. section 1.4
import pytest
# Assume is_valid_isbn13 is the function to be generated
def test_valid_isbn_with_hyphens():
assert is_valid_isbn13("978-0-306-40615-7") is True
def test_valid_isbn_without_hyphens():
assert is_valid_isbn13("9780306406157") is True
def test_invalid_checksum():
assert is_valid_isbn13("978-0-306-40615-0") is False
def test_invalid_length():
assert is_valid_isbn13("978-0-306-40615") is False
def test_contains_non_numeric_characters():
assert is_valid_isbn13("978-0-306-40615-X") is FalseThese ISBN-13 tests define expected behavior before generation, including valid formats, an invalid checksum, incorrect length, and nonnumeric characters. section 1.4
Use the checks to judge the generated implementation, not its apparent fluency. A practical final question is whether you would be willing to go on-call for the resulting system. section 1.4
