promptgarden ๐ŸŒฑ
๐ŸŒ ES
Prompt patternโ—โ—โ—‹3 min ยท +40 XP

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:

  1. Describe the goal and requirements
  2. Ask the AI to produce a step-by-step plan (no code yet)
  3. Read the plan, correct wrong assumptions, answer open questions
  4. 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

RELATED TOPICS

Pattern: Feed Context Instead of Asking Vaguely โ—โ—‹โ—‹Vibe Coding: When It Works, When It Bites You โ—โ—‹โ—‹What Is a Prompt? โ—โ—‹โ—‹