Skip to main content
Updated Mar 07, 2026

Phase 3 — Tests as Specification

Chapters 38, 39, 40, 41: Verify

Your role: Verifier — "I can define correct and prove it"

A type signature tells AI what shape the code should have. A test tells AI what it should do. Phase 3 teaches control flow (how code makes decisions and repeats), pytest (how you define "correct" before implementation exists), iterating on AI output (the feedback loop that makes TDG reliable), and error handling (anticipating what can go wrong). By the end, you write complete test suites that serve as the full specification AI implements against.

#ChapterKey Focus
38Control Flow — Through the Lens of TestingHow code makes decisions and repeats
39pytest Deep DiveDefining "correct" before implementation
40Iterating on AI Output — The Feedback LoopThe cycle that makes TDG reliable
41Error Handling and ExceptionsAnticipating what can go wrong