Test-driven development (TDD) builds quality through a repeated red/green/refactor loop: create a failing unit check, add just enough production code to pass it, then refactor while all checks remain green. section 4.3
Follow the loop in this order:
- Write a focused failing check for the behavior you want. section 4.3
- Implement only enough production code to make the check pass, fixing regressions revealed by the check suite. section 4.3
- Refactor the implementation without allowing checks to become red, then begin the next loop. section 4.3
Timesheet manager
A timesheet feature can begin with checks for tracking time against a project in half-hour units, requiring both a project and duration, and restricting visibility to the current user. Production code is added incrementally to satisfy those checks. section 4.4
Figure 4.1 The red/green/refactor TDD cycle
Use the red/green/refactor figure as a compact visual map of the repeating TDD cycle. section 4.3
Unit-checking tools rapidly verify explicit, narrowly defined assertions; they do not reveal everything about a system. Human judgment remains necessary to assess simultaneous events, user needs, business goals, design, and risks. LLM tools can accelerate check and code creation, but developers must lead the analytical and design work and verify generated output. section 4.1 section 4.3














