---
title: "Plan before the agent writes code · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/plan-first
updated: 2026-10-20
licence: "All rights reserved"
---

# Plan before the agent writes code

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Working in small steps](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps)
- Rule: 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: 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.
- 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.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers ai development playbook: https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/plan-first`.

- Next: [Give every task acceptance criteria](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/acceptance-criteria)
- [Working in small steps](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps)
