Skip to content

Instantly share code, notes, and snippets.

@justincampbell
Last active February 12, 2026 14:51
Show Gist options
  • Select an option

  • Save justincampbell/3da201bdbe8b9d099da8a4a5db94f48c to your computer and use it in GitHub Desktop.

Select an option

Save justincampbell/3da201bdbe8b9d099da8a4a5db94f48c to your computer and use it in GitHub Desktop.
Claude Code skill: local code review with difit

difit Reference

A lightweight Git diff viewer with a GitHub-like interface. Runs a local web server and opens a browser.

Usage

npx difit@3.1.7 [options] [commit-ish] [compare-with]

Arguments

  • commit-ish — Git commit, tag, branch, HEAD~n, or special values: working, staged, . (default: HEAD)
    • . is shorthand for staged + working directory changes
  • compare-with — Compare with this commit/branch (shows diff between commit-ish and compare-with)

Options

Flag Description
--mode <mode> split (default) or unified
--include-untracked Include untracked files in diff
--port <port> Preferred port (auto-assigned if busy)
--host <host> Host address to bind
--no-open Don't auto-open browser
--tui Terminal UI instead of web
--pr <url> Review a GitHub PR by URL
--clean Clear all existing comments

Common Invocations

# Working directory + staged + untracked changes
npx difit@3.1.7 --include-untracked --mode unified .

# Everything on this branch vs main
npx difit@3.1.7 --include-untracked --mode unified . $(git merge-base HEAD $(git symbolic-ref refs/remotes/origin/HEAD --short))

# Review a GitHub PR
npx difit@3.1.7 --pr https://github.com/owner/repo/pull/123

Environment Notes

  • Requires a TTY to use git mode. Without one, it falls back to reading diff from stdin.
  • In Claude Code's Bash tool (no TTY), wrap with script -q /dev/null to provide a pseudo-TTY.
  • The server stays running until stopped — use run_in_background when launching from Claude.
  • Auto-selects next available port if preferred port is busy.
name description disable-model-invocation
local-review
Launch a local code review UI (difit) to review the current branch's diff against main, then address pasted review comments.
true

Local Review

Launch a diff review UI for the current branch, then address review feedback.

Step 1: Launch the review UI

Run with run_in_background (the server stays running). Wrap with script -q /dev/null to provide a pseudo-TTY — difit requires one to use git mode instead of stdin mode.

script -q /dev/null npx difit@3.1.7 --include-untracked --mode unified . $(git merge-base HEAD $(git symbolic-ref refs/remotes/origin/HEAD --short))

Tell the user the review UI is open. Instruct them to review the diff, add comments, then use the copy button to copy the review prompt.

Step 2: Address review comments

When the user pastes the review comments, address each concern:

  1. Read each comment and the referenced code
  2. Make the requested changes (or explain why a change is unnecessary)
  3. Summarize what was addressed

Reference

See references/difit.md for full difit CLI options and usage examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment