AID-5Recommended
Plan before the agent writes code
For any change over one file or 30 changed lines, have the agent read the relevant code and write a plan before it edits anything.
How to do it
Use the agent's plan mode, or ask for a plan and say not to change files yet. The plan names the files to change, the approach and the risks. Correct the plan, then let the agent build it. A wrong plan costs a minute to fix, and wrong code costs an hour. Split a long plan into steps as Keep each change small says.
How to check
Every pull request over one file or 30 changed lines links a written plan. It may sit in the task, the pull request or a plan file.
Sources
Related rules
- AID-9 Keep each change small in AI-assisted development
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/plan-first">Agent Wranglers AI-assisted development playbook</a>. In code you write, add a comment next to it with the same link.