Code Changes
Best practices for making code changes with Claude Code.
Review Before Approve
Claude always shows proposed changes before execution. Review carefully:
> Add input validation to the form
[Claude shows proposed changes]
[Review the diff]
[Accept or reject]Accept Modes
Press Shift+Tab to cycle through modes:
- Normal Mode: Confirm each operation
- Accept Edits Mode: Auto-accept file edits
- Plan Mode: Read-only exploration
Safe Editing Workflow
- Explore first: Understand the code before changing
- Small changes: Make incremental modifications
- Test after: Run tests to verify changes
- Commit often: Save progress with version control
Common Edit Operations
Adding Code
> Add a new function to handle user logoutModifying Code
> Update the API endpoint to use the new formatRemoving Code
> Remove the deprecated login methodRefactoring
> Refactor to use async/await instead of callbacksMulti-File Changes
Claude can coordinate changes across files:
> Rename the User model to Account and update all referencesHandling Errors
If something goes wrong:
> Undo the last change
> That didn't work, try a different approach
> Revert to the previous versionBest Practices
- Commit before major changes - Easy to revert
- Review every diff - Catch issues early
- Test after changes - Verify behavior
- Use
git diff- Review all changes before committing