Plan first: specification, small steps, checkpoints
Ask for a plan first on non-trivial tasks and write code only after approval: a wrong direction is cheap to fix in a plan, costly in a diff. A plan lists files, steps with checks, assumptions, open questions and a definition of done. Give the specification as input → result examples and work in small steps, stopping after each.
Agentic development · The cycle
An agent spent forty minutes rewriting a module in the wrong direction. What could two minutes have done?
The task: add a discount for repeat orders. Without a plan the agent immediately changed the order model, a migration, three services and nine tests. Only in review did it turn out that the discount should be computed at the cart level, not the order. Fixing a plan costs a minute, fixing a finished diff of twenty files costs hours. So for non-trivial tasks you ask for a plan first and move to code only after approval.
How it works and why. An agent follows the path it chose at the start and every next step builds on the earlier ones. A wrong choice of direction does not fade: it multiplies in every file. Plan mode (in many tools, Claude Code among them) restricts the agent to reading: it studies the code and proposes actions but does not change files. So the plan is cheap and you get a point at which to say "no".
The "plan → step → check" cycle
When a plan is needed. The change touches several modules, the requirements are incomplete, the area of code is new to you, the consequences are risky (data, payments, access rights). If the diff can be described in one sentence ("fix a typo in the message"), a plan is overkill.
What to ask for in a plan.
- which files and places in the code are touched;
- steps in execution order, each with a check;
- risks and the assumptions the agent made;
- open questions that a human must answer;
- what counts as done and how to check it.
Example: a plan where the mistake is visible. For the discount task the agent writes in its plan:
1. Add a discount field to the Order model (migration).
2. Compute the discount in OrderService.create().
3. Show the discount on the order page.
4. Tests: the discount applies to the second order.
Assumption: the discount belongs to the order.
Open questions: none.
When reviewing, look for gaps, not style. There are three here: the "Assumption" line is the mistake itself (the discount is computed on the cart, before the order exists); there are no negative scenarios (the first order, a cancelled previous order, the threshold boundary); "Open questions: none" with incomplete requirements is suspicious. The answer at plan stage: "the discount is on the cart, the threshold comes from config, cancelled orders do not count; rewrite the steps". That is two minutes instead of forty.
Specification as input. This is a natural role for QA: formulate acceptance criteria with "input → expected result" examples, a list of boundary cases and negative scenarios. Such a specification goes to the agent before the plan, and later the tests are written from it too. Examples are more concrete than prose descriptions and leave less room for interpretation:
Cart 99 UAH, 1 completed order in history -> no discount
Cart 100 UAH, 1 completed order -> 5% discount, 95 UAH
Cart 100 UAH, the only order is cancelled -> no discount
Small steps and checkpoints. Each step is one coherent change that can be read in a few minutes and checked by tests. After a step the agent stops, the human looks at the result and gives the next one. This way a mistake does not have time to pile up. It is handy to save the plan into a file: a new session can continue from it without retelling everything.
Limits and alternatives. A plan is not a guarantee: the agent may drift from it mid-work and nobody notices. So after each step the diff is compared with the plan. A plan that is too detailed goes stale after the first step, so detail the nearest steps and leave the far ones rough. If during execution the plan turns out to be wrong, stop and make a new one instead of patching on the go. For small tasks the alternative works: a short task with a definition of done and a diff check.
Common mistakes.
- Approving a plan without reading it: a missed assumption surfaces in code, when fixing is more expensive.
- Asking for a plan for a one-line task: extra cost with no benefit.
- Letting the agent run all steps in a row: the checks between steps and the point of small steps vanish.
- Not saving the plan to a file: a new session starts from zero and agreements are lost.
Check yourself
An agent's plan says "Open questions: none" although the discount requirements are incomplete. What does it mean and what do you do?
Answer
The agent filled the gaps with assumptions and did not show them. Ask it to list assumptions and questions explicitly, answer them and only then approve the plan. Otherwise the assumptions become code.
Why are "input → result" examples in a specification better than the phrase "a discount for regular customers"?
Answer
The phrase can be read in different ways (how many orders, whether cancelled ones count). An example fixes the boundaries and immediately becomes the basis of a test, so the agent and the reviewer check the same thing.