AI confidently writes code that's completely wrong
A practical fix and a copyable AI coding prompt. Replace bracketed placeholders with your project details.
1. Check the problem
Confidently wrong code almost always hides one edge case the model never considered. Ask how it would verify the code works, and what happens if the input is empty, null, or huge.
2. Use the prompt
Before I accept this code, answer two things. One: how would you verify it actually works, what specific inputs or test cases would prove it? Two: what happens if [the key input] is empty, null, very large, or malformed? Walk each case and fix any that break.3. Verify the fix
Review the proposed diff, run the relevant checks and exercise the original failing flow before merging.
Continue in the related workflow chapter or read the longer explanation.