A quick guide to catching bugs with Claude Code's /code-review command — even when you're the only developer. The idea: never merge straight to main. Always go through a branch and a pull request, and let /code-review be your second pair of eyes before you do.
/code-review runs inside any Claude Code session and reviews a diff right in your terminal. It looks for correctness bugs, plus reuse, simplification, and efficiency cleanups. No GitHub App or paid plan required — it works on solo repos out of the box.
By default it reviews your branch's commits ahead of its upstream, plus any uncommitted changes in your working tree.
- Claude Code installed and working
- You're inside a git repository connected to GitHub
- The GitHub CLI (
gh) installed if you want to open PRs from the terminal
Never work directly on main.
git checkout -b add-login-formgit add .
git commit -m "Add login form"Open Claude Code in the repo and run:
/code-review
Claude reviews everything your branch changed and reports findings by severity. Read them, decide what's worth fixing.
To have Claude apply its suggestions directly to your working tree instead of just listing them:
/code-review --fix
Then review the changes it made, and commit anything you want to keep.
git push -u origin add-login-form
gh pr create --fillIf you'd like the findings recorded as inline comments on the PR itself — useful as a paper trail or future reference — run:
/code-review --comment
Once you're happy and any checks pass, merge the PR and delete the branch.
gh pr merge --squash --delete-branchThat's the full loop: branch → commit → /code-review → push → PR → merge.
You can point the review at something other than the default diff by passing a target:
/code-review src/auth.js # a single file
/code-review 42 # PR number 42
/code-review main...add-login # the diff a PR from this branch into main would contain
You can also dial the effort:
- Lower effort returns fewer, higher-confidence findings.
highthroughmaxgive broader coverage and may surface more uncertain issues.
/code-review high
For a deeper cloud-based review that applies its findings back to your working tree:
/code-review ultra --fix
| Command | What it does |
|---|---|
/code-review |
Review the current branch diff + uncommitted changes |
/code-review --fix |
Review, then apply the suggestions to your files |
/code-review --comment |
Post findings as inline comments on the PR |
/code-review <file> |
Review a specific file |
/code-review <PR#> |
Review a specific pull request |
/code-review main...branch |
Review the diff a PR would contain |
/code-review ultra --fix |
Deeper cloud review, applies fixes |
The PR step feels redundant when no one's reviewing — but it gives you a clean diff to look at, a place for /code-review to comment, and a history of why each change landed. Running /code-review on every branch before merge means you catch logic errors and regressions while they're still cheap to fix.