Prompting Agents for Maximum Accuracy

My simple but bulletproof recipe for prompting agents for maximum accuracy. This workflow doesn't require a 'plan mode', as it is contained within the prompts themselves - this also makes this recipe harness-independent and will work great across Codex, Claude Code etc.

Step-by-step copyable instructions

analyze the current state of the codebase and identify how to best implement <feature X> and if are we missing any prerequisites for it
From my experience, asking it to also identify prerequisites makes for a more concise plan, even though one could argue that this is all part of the feature itself.
form a plan on how to tackle the feature implementation and potential prerequisites, ask questions if any part of the requirements is unclear
"Ask questions" is basically the plan mode, and can be used liberally on any step.
write the plan to file
This is useful if later switching between agents.
split the current plan into logical parts so we can begin implementing it piece by piece
before implementing part 1, what are the edge cases you didn't consider?
This works best if done per part because of the narrower scope.
write the updated plan to file
implement part 1
analyze the code you just wrote for any potential issues, rank them from low to high severity
Works best if only the current part's changes are in your git status.
implement the ones you deem crucial for proceeding with the rest of the plan
Works better than just saying to implement "high" severity issues, but severity still gives a useful overview.
before implementing part 2, what are the edge cases you didn't consider?
...

Why it works

This creates a nice controlled loop of planning, execution, and validation.

I've noticed that compaction has less of a detrimental effect than expected, likely due to lots of reflection on the code throughout the thread.

Tested and confirmed working great with Codex (gpt-5.5 medium) and Cursor (Sonnet 4.6 medium).