Tell your agent what "done" looks like
Give your coding agent a finish line you can check yourself, ask for a plan first, and stop it after step one. It takes about five minutes and catches wrong turns early.
The problem: Agents stop when they think they're done, and sometimes "fix" a test instead of the bug.
How to do it
- Pick one small feature. Choose something you can check by hand in a minute, like a settings toggle or a new form field.
- Write what done means. Describe the finished result as things you can see or do: what you click, what changes, what still works after a refresh.
- Ask for a plan and a test first. Before any code, ask for a short plan (about 3 steps) and a quick manual test you can run yourself.
- Protect the tests. Tell the agent not to edit existing tests to make them pass.
- Stop after step one. Have the agent stop after the first step so you can run your test before it continues.
Example prompt
Add a dark-mode toggle to the settings page. Done means: I click the toggle, the whole app switches theme, and it stays switched after I refresh. Before you write code, give me a 3-step plan and a 1-minute test I can do by hand. Don't edit any existing tests to make them pass. Stop after step 1 so I can check it.
Why it works: Five minutes of setup, and you catch wrong turns before they spread across your project.
Works with: Any coding agent (Claude Code, Codex, Cursor, OpenCode...).