Sub topic 4
Write the planning request
This chapter assumes you have used a coding agent on a repository, can read a diff, and can run the project's tests. It covers how to write the message that asks for a plan, so the agent reads the code and proposes changes without making any.
What the request must do
A planning request has four jobs. It states the goal, sets constraints, forbids edits, and lists the sections the plan must contain. If you leave one out, the agent fills the gap with its own guess. A missing goal produces a plan for a nearby problem. Missing constraints produce a new dependency you did not want. A missing no-edits rule can produce code before you have seen the plan.
A worked example
Suppose you want to rate limit the /login endpoint. This request covers all four parts.
I want to add rate limiting to the /login endpoint.
Goal: reject more than 5 failed attempts per IP address in 10 minutes.
Constraints: do not add new dependencies; keep the existing error response format.
Do not edit any files yet. Read the relevant code and give me a plan with:
1. The files you expect to change and why
2. Ordered implementation steps
3. Risks and anything you are assuming
4. How we will test that it works
Ask me questions if something is unclear.Why each part is written this way
State the goal as a testable result
"Add rate limiting" is a direction. "Reject more than 5 failed attempts per IP address in 10 minutes" is a result you can check. Numbers, names, and observable behavior let you compare the finished work with the request later.
Name the constraints you would otherwise discover in review
Constraints are the rules you already know and the agent does not. Typical ones are no new dependencies, a fixed response format, a supported language version, or files that must not change. Write them down now. Finding them in a diff costs more.
Make the no-edits rule explicit
Say "Do not edit any files yet." Do not rely on the word "plan" alone, because some agents treat a plan as a preamble to doing the work. The sentence "Read the relevant code" tells the agent that reading is allowed, so the plan can refer to real files instead of invented ones.
List the sections you want
Asking for files, steps, risks, and verification gives you a plan with a predictable shape. The next chapter covers how to review it. If your team needs another section, such as a rollback step, add it to the list.
Invite questions
The last line gives the agent permission to stop and ask. Without it, an agent often resolves ambiguity silently and buries the choice inside the plan.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| No goal, only a topic | Plan solves a nearby problem | State a measurable result |
| No no-edits rule | Agent starts changing files | Add "Do not edit any files yet" |
| No sections listed | Plan is a loose paragraph | Number the sections you want |
| Constraints held back | Plan breaks a rule you knew | List them in the request |
Exercise
You want to add pagination to a /orders API endpoint. Write the four parts of a planning request: a goal, one constraint, the no-edits rule, and the sections the plan must contain.
Show answer
A strong answer has all four parts. Goal: "Return at most 50 orders per request and accept a page parameter." Constraint: "Keep the existing JSON field names and add no new dependencies." No-edits rule: "Do not edit any files yet. Read the relevant code first." Sections: files to change, ordered steps, risks and assumptions, and how to test. The goal should be measurable, not just "add pagination."
Exercise
Why does the example request say "Read the relevant code" and not just "Do not edit any files"?
Show answer
A ban on edits alone could lead the agent to plan without looking at the project. Allowing reading means the plan can name real files and match existing code, while the no-edits rule still keeps the repository unchanged.