Write the check before the code.
I used to ask the model to build a feature and then figure out afterwards whether it worked. "Build me a login page." It would come back with a form, a button, some code that looked right — and then I'd click the button and nothing would happen, or it would say "success" and never actually save anything. I'd spend an hour poking at it, trying to work out what "working" even meant for that page. Was the password supposed to be hashed? Was it supposed to redirect? I hadn't decided, so I couldn't tell the model it was wrong — and the model couldn't tell me either.
Now I write the check first, in one plain sentence, before I ask for any code. "When I type the right password and click login, I land on the dashboard. When I type the wrong one, I see 'wrong password' and stay on the page." That's it. Two sentences. Then I ask for the code, and when it comes back I run those two checks. Pass or fail, no guessing, no arguing about what the feature was supposed to do.
The check does something else too: it forces me to actually decide what I want before the model starts building. Most of the time I discover I didn't know — I wanted a login page, but I hadn't thought about what happens after login, or what the error should say. The model will happily build on top of that vagueness and fill every gap with a guess. The check is where I catch my own vagueness first, while it's still cheap.
It doesn't have to be a real test file. A sentence in the prompt is enough: "This works when…" followed by the one thing that must happen. Write the check, then ask for the code. If the code passes the check, it's done. If it doesn't, you know exactly what to fix — and so does the model.