Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Created June 21, 2026 04:54
Show Gist options
  • Select an option

  • Save changtimwu/b8f0e39fc1260dc9f40c72e870bc486b to your computer and use it in GitHub Desktop.

Select an option

Save changtimwu/b8f0e39fc1260dc9f40c72e870bc486b to your computer and use it in GitHub Desktop.
Code Review Tutorial

Using /code-review in a Solo GitHub Workflow

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.

What it does

/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.

Before you start

  • 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

The workflow

1. Start a feature branch

Never work directly on main.

git checkout -b add-login-form

2. Write your code and commit

git add .
git commit -m "Add login form"

3. Review locally before pushing

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.

4. Push and open the pull request

git push -u origin add-login-form
gh pr create --fill

5. (Optional) Post the review onto the PR

If 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

6. Merge

Once you're happy and any checks pass, merge the PR and delete the branch.

gh pr merge --squash --delete-branch

That's the full loop: branch → commit → /code-review → push → PR → merge.

Handy variations

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.
  • high through max give 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

Cheat sheet

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

Why bother as a solo dev?

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.

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