Skip to content

Review Claude Code’s changes before you commit

Author of DiffHubLast updated

Run npx diffhub@latest in the repository Claude Code is working in. Every file it has changed and you haven’t committed, new files included, opens in a browser tab on localhost. Comment on the lines you want changed, press Copy & clear, and paste the prompt back into Claude Code.

npx diffhub@latest

DiffHub isn’t made by Anthropic and isn’t part of Claude Code. It doesn’t talk to Claude Code at all: no plugin, no API key. It works with Claude Code’s output because Claude Code edits files in your repository, and DiffHub reads the repository.

Why read Claude Code’s diff outside the terminal?

Because the question changes once it says it’s done. While it works, Claude Code shows you each edit in the conversation, one at a time. Before you commit, you want the total: every file that’s different from your last commit, in one place, in an order you choose. By then the first edits have scrolled a long way up.

A diff viewer answers that from git, so it doesn’t matter how long the session was or how many times Claude Code changed its mind about a file. You see where it ended up.

Which view shows what Claude Code changed?

The default one. DiffHub opens on Touched: HEAD against your working tree, plus untracked files. If Claude Code hasn’t committed, that’s exactly its work.

Commit your own changes before you start a session and Touched shows nothing but Claude Code’s edits. If you let it commit on a branch, switch the scope to All for the whole branch since it left main, or Committed for just the commits. The git diff viewer guide lists all five scopes.

Can you review while Claude Code is still working?

Yes. DiffHub watches the repository, and when Claude Code writes another file the status bar says Updates available. The diff doesn’t move until you press r, so you can finish the file you’re reading, then refresh and carry on.

How do you send your review back to Claude Code?

  1. Hover a line in the diff, click the plus and write the note.
  2. Save it with Cmd+Enter or the Comment button. Repeat for every line you want changed.
  3. Press Copy & clear in the status bar. Every comment becomes one Markdown prompt, and the list empties so the next pass starts clean.
  4. Paste the prompt into Claude Code.

Two comments come out like this:

## Code Review Comments

Please address the following:

- **lib/sync.ts:88** (new side): [must-fix] This adds a retry loop I didn’t ask for. Take it out and keep the original single request.
- **lib/invoices.ts:12** (new side): [nit] Rename to fetchInvoices so it matches the other loaders.

The prompt says what to fix. It doesn’t say how to behave, so it’s worth adding a line or two after it:

Address these review comments in this checkout. Read the diff
and the surrounding code first. Leave unrelated changes alone.
Run the relevant tests and tell me what passed and what didn't.
Don't commit.

Copy & clear empties the list as it copies. Paste the prompt before you copy anything else.

Why not ask Claude Code to review its own work?

You can, and it’ll find things. It’s a second opinion from the same kind of model that wrote the code, working from the same conversation, so it tends to agree with the choices it already made. It can’t tell you whether those were the choices you wanted. That read is yours, and it’s faster with the whole diff in front of you. What to check in AI-generated code is a short list to read it against.

What are the limits?

  • It only sees what’s in git. Changes Claude Code made outside the repository won’t show.
  • The prompt goes back by paste. Nothing reaches Claude Code unless you put it there.
  • It needs Node 20.11+ or Bun 1.0.23+, and it runs on your machine only.
  • A file with 500 or more changed lines isn’t rendered inline, so a regenerated lockfile won’t fill the page.
Open the live demo

See the viewer on a real pull request before you install it.

What else do people ask about reviewing Claude Code?

Is DiffHub an Anthropic product or a Claude Code feature?

No. DiffHub is an independent, MIT licensed tool by Matthew Blode. It isn’t made by Anthropic and isn’t part of Claude Code. It works with Claude Code because it reads the same git working tree Claude Code edits.

Does DiffHub need a plugin or an API key?

No. DiffHub never talks to Claude Code or to any model, so there’s nothing to install into Claude Code and no key to set. You paste the prompt into Claude Code yourself.

Will DiffHub show files Claude Code just created?

Yes. The default Touched view includes untracked files, so a file Claude Code created shows up before anyone runs git add.

What if Claude Code already committed its changes?

Yes. Switch the scope to All to see the whole branch since it left main, or Committed for the commits alone. Pass --base <branch> if your base isn’t main, master, develop or dev.

Can you run DiffHub next to Claude Code in cmux?

Yes, on macOS with cmux installed. npx diffhub@latest cmux opens the viewer in a browser split beside the terminal Claude Code is running in.