Plan First, Then Code
The fastest way to get a bad result on a real feature is to let the agent start editing immediately. The fix is to separate thinking from doing: have the agent investigate and propose a plan first, you approve or adjust it, and only then does it write code. This catches misunderstandings before they become 400 lines of wrong.
Step 1: Ask for a plan, not a patch
Tell the agent explicitly to explore and plan without editing yet. Claude Code has a plan mode (toggled with Shift+Tab) that prevents edits until you approve.
Before writing any code, read the relevant files and give me a short plan
to add rate limiting to the API: which files change, what the approach is,
and what could break. Wait for my approval before editing.Step 2: Review the plan like a teammate
Read the plan and push back where it is wrong or risky. This is where you add the context the agent lacks: "We already have a Redis client, use that" or "Do not touch the legacy auth path." Five minutes here saves an hour of rework.
Step 3: Implement in reviewable chunks
Once approved, let it implement. If the change is large, ask it to do one piece at a time and stop for review between pieces. Small, reviewable diffs keep you in control and make bugs easy to trace.