Lesson 11
Making Code Changes
AI-generated
Making Code Changes
Describe code changes you want in plain language
Review proposed diffs before accepting them
Accept or reject individual changes
Use accept-all mode for faster workflows
Undo changes when things go wrong
Claude Code does not just suggest code. It actually makes changes to your files. This is what makes it powerful and what requires your attention. When Claude proposes an edit, you decide whether to accept it.
This lesson covers the approval workflow. You will learn how to request changes, review what Claude proposes, and accept or reject edits. You will also learn to undo changes and handle situations where Claude's edits are not what you wanted.
The key idea: Claude proposes, you approve. You stay in control of what happens to your code.
To make changes, describe what you want in plain English. Be specific about what should change and where.
Good change requests:
More specific is better:
Instead of:
Try:
The more context you provide, the better Claude understands what to do.
Referencing files:
Using @ tells Claude exactly which file to modify.
Describing constraints:
Constraints help Claude make changes that fit your requirements.
When Claude wants to edit a file, it shows you a diff. This is a side-by-side or inline view of what will change.
Reading diffs:
Lines with + (or in green) are being added
Lines with - (or in red) are being removed
Context lines show surrounding code that is not changing
File paths and line numbers indicate where changes occur
Take time to read the diff. Does it do what you asked? Are there side effects you did not expect? Does it match your coding style?
Multiple files:
If Claude needs to change several files, it shows each diff. Review them all. Sometimes one file's changes depend on another's.
Questions about changes:
If something is unclear, ask before accepting:
Claude explains its reasoning. This helps you decide whether to accept.
After reviewing, you choose what to do:
Accept the change: Press Enter or type 'y' when prompted. The file is modified.
Reject the change: Type 'n' when prompted. The file stays unchanged.
Accept all changes: If Claude made multiple changes and you want all of them, you can accept them together rather than one by one.
Partial acceptance: You can accept some changes and reject others. Claude handles each diff independently.
For trusted tasks where you want Claude to move quickly, you can enable accept-all mode:
Toggle with Shift+Tab:
Press Shift+Tab to cycle through permission modes. When you see "accept edits on" at the bottom, Claude will apply edits without asking.
This is useful when:
You are making many small changes
You trust Claude's judgment on this task
You want to see results quickly and can review afterward
Important: Accept-all mode means Claude modifies files without your approval. Use it when you are comfortable with the task and can review changes later.
To disable, press Shift+Tab again to return to normal mode.
Things go wrong sometimes. Claude makes a change that breaks something. You accepted without reading carefully. The code worked better before.
Undo with /rewind:
This opens the checkpoint menu. Every change Claude makes creates a checkpoint. You can go back to any previous state.
Select the checkpoint before the bad change and restore both code and conversation.
Ask Claude to undo:
Claude can revert its own changes. This is simpler than /rewind for the most recent edit.
Git as backup:
If you committed before the change, you can always restore from Git:
This restores the file to the last committed state. Claude Code's checkpoints track changes from the session, but Git tracks your committed history.
When Claude's changes are wrong, you have options:
Reject and explain:
Rejecting with an explanation helps Claude try again with better understanding.
Redirect:
Sometimes Claude's direction is wrong. Redirect rather than correcting details.
Start fresh:
If Claude is stuck or confused, /clear and rephrase your request:
Then:
A clear context with a better-phrased request often works better than continued correction.
Review before accepting. Even when you trust Claude, a quick review catches mistakes early.
Test after changes. Run your tests, try the feature, verify the change works as expected.
Commit frequently. After accepting changes that work, commit them. This gives you restore points.
Be specific. Vague requests lead to uncertain changes. Specific requests get precise results.
Ask for explanations. If you do not understand why Claude changed something, ask. Understanding helps you evaluate.
Describe changes in plain language with as much context as possible
Review diffs carefully before accepting
Accept, reject, or ask questions about proposed changes
Use accept-all mode (Shift+Tab) for trusted, rapid workflows
Undo mistakes with /rewind, "undo that," or Git restore
When Claude is wrong, reject with explanation or start fresh with /clear
Practice the change workflow:
Start Claude Code in a project with some code.
Ask Claude to make a small change: "add a comment explaining what this function does."
Review the diff Claude shows you.
Accept the change.
Ask Claude to make another change.
Reject it and explain why.
Ask Claude to try a different approach.
Run /rewind to see the checkpoints.
Restore to before any changes were made.
This exercise builds comfort with the approval workflow.
https://code.claude.com/docs/en/quickstart - Basic change workflow and approval process
https://code.claude.com/docs/en/common-workflows - Change patterns and best practices
https://code.claude.com/docs/en/best-practices - Being specific with change requests