The vibe coders would tell you:
you don't. You test the program, or ask the LLM to write tests for you, and if there are any issues, you ask it to fix them. And you do that in a loop until there are no more issues.
I imagine that at some point they must wonder what their role is, and why the LLM couldn't do all of that independently.