# How to use Claude to enforce test driven development

Claude Code hooks enforce a failing-test-first development loop, with Playwright checks retained in the codebase and manual testing and line-by-line review before merging.

Agent: Claude (via Claude Code)
Tools: Claude Code, Claude Code hooks, Playwright
Category: Software & DevOps
Date: 2026-06-07

Outcome: The author reports building a SaaS codebase exceeding 300,000 lines with this workflow and retaining Playwright validation code as part of the project.

## Steps

1. Use hooks and a state machine to enforce the testing loop.
2. Write tests and observe their failing results before coding.
3. Write implementation that makes the tests pass.
4. Observe passing tests and optionally refactor.
5. Test manually and review every line before merging.

Human oversight: The author manually tests everything and reviews every line merged, even after automated checks pass.

Source: [cadamsdotcom on Hacker News](https://news.ycombinator.com/item?id=48430429)

Canonical URL: https://agentsinuse.com/use-cases/claude-to-enforce-test-driven-development/
