Pattern: Plan First, Then Code
Have the AI write a plan before it starts coding โ it prevents expensive wrong turns.
The problem with "just do it"
If you tell an agent "build this" directly, it starts acting immediately โ and often makes silent assumptions that turn out wrong. You usually only notice once something's already half-built the wrong way.
The pattern
Ask the AI for a plan before any code gets written:
- Describe the goal and requirements
- Ask the AI to produce a step-by-step plan (no code yet)
- Read the plan, correct wrong assumptions, answer open questions
- Only then: "Now implement the plan"
Why this works better
A plan is cheap to read and correct โ code is more expensive to read and correct. Catching a mistake in the plan ("you forgot we already have auth middleware") takes a minute. Catching the same mistake in finished code takes much longer.
When it matters most
- Multi-step or unclear tasks
- When multiple files or systems are involved
- When mistakes would be costly (production code, database migrations)
For small, unambiguous changes ("change this color"), an explicit planning step is usually overkill.
EXAMPLE
Prompt: 'First create a plan (no code changes) for a login feature with email+password. I'll confirm the plan before you start.'
QUICK QUIZ
Why is a planning step before coding worthwhile?
SOURCES
- Anthropic: Claude Code best practices โ www.anthropic.com
- Anthropic docs: Claude Code common workflows โ docs.anthropic.com
- Anthropic docs: Prompt engineering overview โ docs.anthropic.com