AI Coding Tip 003 - Force Read-Only Planning
Source: Dev.to
TL;DR
Set your AI code assistant to a read‑only state before it touches your files.
Common Mistake ❌
You paste a failing call stack to the AI assistant without further instructions.
The copilot immediately begins modifying multiple source files, creates new issues because it doesn’t understand your full architecture yet, and you spend the next hour undoing its messy changes.
Problems Addressed 😔
- The AI modifies code that doesn’t need changing.
- The copilot starts typing before it reads the relevant functions.
- The AI hallucinates when assuming a library exists without checking your package.json.
- Large changes make code reviews and diffs a nightmare.
How to Do It 🛠️
- Enter Plan Mode – use “Plan Mode/Ask Mode” if your tool has it.
- If no built‑in mode – add a meta‑prompt such as:
Read this and wait for instructions. Do not change any files yet.
- Ask the AI to read specific files and explain the logic.
- Request a step‑by‑step implementation plan for you to approve.
- When you like the plan, tell the AI: “Now apply step 1.”
Benefits 🎯
- Better Accuracy – the AI reasons better when focusing only on the “why.”
- Full Control – you catch logic errors before they enter your codebase.
- Lower Costs – fewer tokens are used when you avoid trial‑and‑error loops.
- Clearer Mental Model – you understand the fix as well as the AI does.
Context 🧠
AI models prefer “doing” over “thinking” to feel helpful. This is called impulsive coding.
Forcing a read‑only phase simulates a senior developer’s workflow: first act as a consultant, then as a developer.
Prompt Reference 📝
Bad prompt 🚫
Fix the probabilistic predictor
in the Kessler Syndrome Monitor component
using this stack dump.
Good prompt 👉
Read @Dashboard.tsx and @api.ts. Do not write code yet.
Analyze the stack dump.
When you find the problem, explain it to me.
Then, write a Markdown plan to fix it, restricted to the REST API.
[Activate Code Mode]
Create a failing test representing the error.
Apply the fix and run the tests until all are green.
Considerations ⚠️
- Some simple tasks do not need a plan.
- You must actively read the plan the AI provides.
- The AI might still hallucinate the plan, so verify it.
Type 📝
- Semi‑Automatic
Limitations ⚠️
- Suitable for refactoring and complex features.
- May feel too slow for simple CSS tweaks or typos.
- Some AIs are overly confirmative before changing anything; be patient.
Tags 🏷️
- Complexity
Level 🔋
- Intermediate
Related Tips 🔗
- Request small, atomic commits.
Conclusion 🏁
Thinking first saves time. Force the AI to be your architect before letting it be your builder. This simple strategy prevents hours of debugging later. 🧠
More Information ℹ️
- GitHub Copilot: Ask, Edit, and Agent Modes – What They Do and When to Use Them
- Windsurf vs Cursor: Which AI Coding App is Better
- Aider Documentation: Chat Modes
- OpenCode Documentation: Modes
Also Known As 🎭
- Read‑Only Prompting
- Consultant Mode
Tools 🧰
| Tool | Read‑Only Mode | Write Mode | Mode Switching | Open Source | Link |
|---|---|---|---|---|---|
| Windsurf | Chat Mode | Write Mode | Toggle | No | windsurf.com |
| Cursor | Normal/Ask | Agent/Composer | Context‑dependent | No | cursor.com |
| Aider | Ask/Help Modes | Code/Architect | /chat-mode | Yes | aider.chat |
| GitHub Copilot | Ask Mode | Edit/Agent Modes | Mode selector | No | github.com/features/copilot |
| Cline | Plan Mode | Act Mode | Built‑in | Yes (extension) | cline.bot |
| Continue.dev | Chat/Ask | Edit/Agent Modes | Config‑based | Yes | continue.dev |
| OpenCode | Plan Mode | Build Mode | Tab key | Yes | opencode.ai |
| Claude Code | Review Plans | Auto‑execute | Settings | No | code.claude.com |
| Replit Agent | Plan Mode | Build/Fast/Full | Mode selection | No | replit.com/agent3 |
Disclaimer 📢
The views expressed here are my own. I used AI proofreading tools to improve some texts. I welcome constructive criticism and dialogue. This article is part of the AI Coding Tip series.