Keeping changes small and reviewable

10 min read text
Course contents (20 lessons)
  1. Meet Claude Code
  2. What Claude Code is and how it differs from a chat window
  3. Installing Claude Code and signing in
  4. Your first session: explore, ask, change
  5. Asking well and staying in control
  6. Asking for changes: context, goal, constraints and acceptance criteria
  7. Reading and approving edits
  8. Permission modes: how much freedom to give
  9. Project memory and slash commands
  10. CLAUDE.md: teaching the tool about your project
  11. Slash commands and custom commands
  12. Everyday coding workflows
  13. The plan-first workflow
  14. Understanding unfamiliar code
  15. Debugging with Claude Code
  16. Refactoring safely
  17. Writing tests with Claude Code
  18. Git, small changes, cost and security
  19. Git workflows: branches, commits and pull request descriptions
  20. Keeping changes small and reviewable
  21. Context and cost awareness
  22. Security habits: secrets, commands and untrusted input
  23. Extending the tool, teamwork and a final project
  24. Hooks and MCP servers explained
  25. Team practices for AI-assisted coding
  26. Final project: building a small app step by step

The bottleneck is review

The tool can write code faster than you can read it. That means the limit on safe speed is your reviewing, not its typing. If it produces a 1,500-line change, you will skim it, and skimming is how bugs get through. The best fix is to keep each change small enough to review properly.

A rough rule I use: if I cannot review a diff in about 15 minutes, it is too big. Your number may differ. The point is to have one.

Slice the work

Break a feature into steps where each step works on its own and can be tested.

SliceResult you can check
1. Database change and modelMigration runs, model tests pass
2. Service logic with unit testsTests pass, no UI yet
3. API endpointEndpoint tests and a manual call work
4. UIThe screen works in the browser
5. Polish: errors, empty states, docsReview checklist done

Each slice becomes one prompt, one diff, one commit. If slice 3 turns out wrong, slices 1 and 2 are untouched.

Put limits in the prompt

Implement only the service logic (slice 2). Limits:
- Change at most 3 files, plus tests.
- Do not touch controllers, UI or migrations.
- No new dependencies.
- No reformatting of existing code.
If you think more files need to change, stop and tell me why instead of changing them.

Why it works

It sets a measurable boundary and an escape hatch. The tool can say "I need to change the controller" without silently doing it. You then decide. This turns scope creep from a surprise into a decision.

Check the size before you read

Before reading any change line by line, look at its shape:

git diff --stat

This lists the files changed and the number of lines. If the list contains files you did not expect, or a large number of lines in one file, deal with that first. Ask: "Why did you change these files? List each file with a one-line reason." Then decide what to revert.

Separate noise from signal

Formatting changes, import reordering and renames make a diff look much bigger than the real change. Ask for them in separate commits, or not at all. A prompt line such as "Keep the existing formatting and do not reorder imports" avoids a lot of noise.

Stop scope creep in the middle

If you see the tool wandering into other files, press Escape and say:

Stop. You are changing files outside the scope. Revert any changes outside src/Invoices and tests/Invoices, then continue only with the original task.

Write down the "later" list

While working, the tool and you will notice other problems: a bad name, a missing test, an old TODO. Resist fixing them now. Ask the tool to add them to a short list:

Add to a file called notes/later.md a one-line bullet for each unrelated problem you noticed while working on this task. Do not fix them now.

This keeps the current diff clean and makes sure you do not lose good observations.

Why small diffs also help the tool

Small tasks have clear success checks. The tool does better when it can run a test and see a pass. Long tasks drift, fill the context and lose early decisions. Short tasks with a clear end give better results and cost less.

The common mistake

The common mistake is saying "do the whole thing, I will review at the end" and then reviewing for two hours, or not at all. The time you save on prompts is lost, with interest, in review. Smaller steps feel slower and finish sooner.

Try it yourself

Take a feature you would normally do in one go. Write the slices on paper, with the check for each. Run it slice by slice with scope limits in every prompt. After each, run git diff --stat and note the size. Compare the total review time with your last big change.

This course is free to read. Create a free account to enrol, save your progress and pick up where you left off.

Sign up free I already have an account