Use the custom prompts from this article and the linked repository to have the agent (1) plan, (2) implement, and (3) review any code before considering it complete.
These are straightforward, proven client-side prompt engineering techniques. This approach consistently improves results, regardless of the LLM used.