Paths Subjects Questions Quizzes Pricing Search
Intermediate Open Free

The Instruction That Keeps Claude From Writing the Fix Too Early

You want Claude Code to write tests from a spec before it writes any implementation, the way the docs' TDD-style loop recommends.

Which instruction actually enforces that ordering?

Solution

The correct answer is "Explicitly say not to implement yet, then run and confirm they fail."

The negative constraint is what does the work: "write tests for X covering cases A, B, C. Do NOT write the implementation yet. Run them and confirm they fail." Without that explicit instruction, an agent free to write both will often write them together or implementation first — and one that can edit tests will sometimes make a red suite green the wrong way rather than fix the underlying code. Just saying "write tests for X" with no constraint doesn't prevent any of that.

Share this question

← Back to Claude Code Best Practices: Reliable, Cheap, High-Leverage Sessions practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.