Loading learning content…
Loading learning content…
Master how Claude Code edits files — understanding the diff-based approach, reviewing changes, and handling conflicts.
Read through the lesson, mark it complete when the concept is clear, then move to the next lesson in the sequence or jump back to the module map.
Claude Code never edits files silently. Every file modification goes through the Edit tool, which shows you a diff-style preview before writing the change. You can approve, reject, or modify proposed edits.
When Claude proposes an edit, you'll see:
Never feel pressured to approve edits you don't understand. Ask Claude to explain the change first.
Be specific about scope:
In src/lib/auth.ts, change the JWT expiry from 24 hours to 7 days. Only touch that specific constant.
Specificity prevents Claude from making unrelated "improvements" you didn't ask for.
For changes that span files, Claude will present each file's diff separately:
Rename the UserProfile interface to UserAccount across all TypeScript files. Update all imports.
Claude will read all affected files, propose each change in sequence, and let you approve each one.
If an edit is wrong, reject it and give feedback:
That edit introduced a bug — the function signature changed but the callers weren't updated. Fix the callers too.
Claude maintains context across the rejection and will retry with the corrected approach.
Always re-read a file after editing it, especially in long sessions. Claude Code's memory of file state can drift if many edits have happened:
Re-read src/lib/auth.ts and confirm the changes look correct.
Ask Claude to describe what it would do before doing it:
Don't make any changes yet. Just describe exactly what edits you'd make to implement this feature.
This is useful for reviewing a plan before committing to execution.