Red/green TDD
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
Appending 'use red/green TDD' to coding agent prompts makes them verify their own work with failing-then-passing tests, reducing broken or unused code.
Simon Willison recommends a short phrase, 'use red/green TDD', for getting better results from AI coding tools. Test-driven development is a way of writing software where the tests are written first, confirmed to fail, and then the code is written until they pass. This stops AI assistants from producing code that does not work or that is never used. He demonstrated it with simple prompts to Claude and ChatGPT.
Simon Willison argues that telling coding agents to 'use red/green TDD' is a cheap, effective way to reduce the two most common AI coding failures: code that does not work and unnecessary code that never gets used. The technique also builds a test suite that protects existing features as projects grow. Teams using agents like Claude Code or OpenAI Codex can adopt it immediately with a prompt change, though no cost or productivity figures are given.
Willison's 'red/green TDD' pattern instructs an agent to write tests first, verify they fail (red), then implement until they pass (green). Confirming the red phase is essential: without it, a test may pass already and exercise nothing. It mitigates agents producing non-functional or unnecessary code while accumulating a regression suite. He tested the prompt with Claude and ChatGPT, noting ChatGPT needed 'Use your code environment' appended or it never executed the tests.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.