Claude Code Direction Correction
Course-correct Claude Code when it edits the wrong files, over-engineers a solution, misses constraints, or drifts away from the task.
Direction correction is the skill of stopping Claude Code early, restating the target, and narrowing the next action before the session drifts. The best correction is short, specific, and tied to files, constraints, and success criteria.
Quick Answer
Interrupt as soon as Claude Code is moving in the wrong direction. Tell it what to stop doing, what file or behavior matters, what not to change, and what the next smallest step should be.
Stop. The current approach is too broad.
Focus only on src/components/UserList.tsx.
Do not refactor the data layer or add dependencies.
First explain the smallest change needed, then wait.When To Correct Direction
| Signal | What it usually means | Best response |
|---|---|---|
| Claude opens unrelated files | Scope is unclear | Name the exact files or ask for a file map. |
| It proposes a broad rewrite | The task goal is too vague | Ask for the smallest safe change. |
| It changes patterns | It missed local conventions | Point to the existing pattern to copy. |
| It skips tests | Verification was not explicit | Name the exact command or manual check. |
| It assumes product behavior | Requirements are ambiguous | Pause and define the user-facing rule. |
| It keeps going after uncertainty | The session needs a checkpoint | Ask for a summary and remaining assumptions. |
The Four-Part Correction Prompt
Use this structure when you need to redirect quickly:
| Part | Example |
|---|---|
| Stop | "Stop editing for now." |
| Clarify | "The bug is only in mobile filtering, not the API." |
| Constrain | "Do not change the database, route names, or component API." |
| Next step | "Inspect the current filter component and propose a minimal fix." |
Full prompt:
Stop editing for now. The bug is only in mobile filtering, not the API. Do not change the database, route names, or component API. Inspect the current filter component and propose a minimal fix before editing.Correction Patterns
Wrong File
Stop working on those files. The issue is in src/components/UserList.tsx. Explain what this file currently does and propose a one-file fix.Over-Engineering
This is more architecture than the task needs. Solve the visible bug with the smallest change. Do not add state management, new services, or new dependencies.Pattern Drift
Use the same error-handling pattern as src/services/auth.ts. Do not introduce a new response wrapper. Show the matching pattern before editing.Missing Requirement
You missed the requirement that anonymous users must not see this CTA. Update the plan with that constraint and list the affected files again.Too Much Diff
Pause. Summarize the diff so far, separate required changes from optional cleanup, and revert the optional cleanup from the plan.Use Plan Mode For Recovery
If the session has already drifted, move back into planning:
/plan We need to recover from a too-broad implementation. Inspect the current diff, identify which changes are necessary for the original task, and propose a rollback or cleanup plan. Do not edit files.Then approve one step at a time. This is safer than asking Claude Code to "fix everything" after the diff has grown.
Use Checkpoints And Diffs
Before accepting more edits, ask for a diff review:
Review the current diff. Group changes into required, unrelated, risky, and safe-to-keep. Do not edit files yet.If checkpointing is available in your environment, use /rewind or press Esc twice while the prompt input is empty to open the rewind menu. If the prompt already has text, double Esc clears that draft instead of opening the menu.
Choose the recovery action based on what drifted:
| Situation | Better checkpoint action |
|---|---|
| Code and conversation both drifted | Restore code and conversation to the last good prompt. |
| The conversation drifted, code is ok | Restore conversation only, then re-send a narrower prompt. |
| Code drifted, discussion is useful | Restore code only, then keep the diagnosis and update scope. |
| Context got noisy | Summarize from or up to a checkpoint instead of restoring. |
Checkpointing is a session-level safety net, not version control. It tracks file edits made through Claude Code editing tools, but it does not reliably undo file changes made by Bash commands, external editors, other sessions, package installs, database migrations, or deployment actions. For risky work, pair checkpoints with git status, git diff, and a small approval step before continuing.
Prevent Drift Up Front
Give Claude Code a narrow first task:
Find the files involved in the checkout success page. Do not edit files. Return the file map, current behavior, and the smallest safe change to update the thank-you copy.Then approve only the next step:
Edit only the thank-you copy in that file. Do not change layout, tracking, checkout logic, or tests.Related Pages
- Plan Mode workflow
- Explore-Plan-Code workflow
- Context management
- Tools allowlist
- Architecture analysis
Official Sources
Next: Explore-Plan-Code - Prevent most drift by separating discovery, planning, and implementation.