The Self-Refine technique follows steps:
Generate: Ask the AI to produce initial code
Critique: Ask it to review its own output for issues
Refine: Ask it to fix the issues it identified
This loop catches problems the initial generation missed. The AI often spots its own mistakes when explicitly asked to look for them.