Most agent-written bugs come from skipping straight to code before the shape of the problem is settled. This skill enforces a fixed order: understand, then plan, then test, then implement.
The order, non-negotiable
- Restate the goal in one paragraph. If you can't, you don't understand it well enough to start.
- Write a short plan — the files you'll touch, the approach, and how you'll verify it. For anything touching more than two or three files, share the plan before writing code.
- Write the test first. A failing test that names the exact behavior you're about to build. Run it. Confirm it fails for the right reason.
- Implement the minimum that makes the test pass. Resist the urge to generalize past what's asked.
- Refactor only with tests green, and only the code you just touched.
Red flags — stop and restart the order
- "I'll just write the code and add tests after" — tests written after implementation only prove the code does what it does, not what it should.
- "This is too small to plan" — small tasks are exactly where skipped planning produces silent scope creep.
- Editing a file you haven't read yet.
When to break the order
Throwaway spikes and pure exploration don't need this — but say so out loud ("this is a spike, I'm not following build-discipline for it") rather than silently skipping steps on real work.