The short version: Individuals and small teams can set this up with local commands and a single REVIEW.md file, with no need to buy the Team plan. The cloud-based Code Review is only available on the Team and Enterprise plans, but Claude Code ships with its own /code-review and /security-review work locally, and they also run fine against third-party APIs.
We tested this with an AICodeWith key: in a small repo with 3 deliberately planted issues, /code-review found all 3 issues in 25 seconds and also pointed out that the tests hadn't been updated to match. /security-review took 68 seconds to find the SQL injection among them.
How the official team does code review
The Claude Code team, in the official blog post "How the Claude Code team does code review》 lays out their process. The core idea is multiple layers of checks, with humans only reviewing the high-risk areas:
| Stage | Approach | Can it block a merge? |
|---|---|---|
| Self-verify before opening a PR | Have Claude run tests, build, and lint and paste the output instead of just saying “done”; then have a subagent with fresh context review the changes | This step happens locally |
| Required CI | Lint, type checking, multi-platform tests, and build. If any of them is red, the PR can't merge | Yes |
| Every PR goes through AI review | Multiple agents hunt for bugs in parallel, then vote to verify each finding, ranked by severity | Unresolved findings block the merge |
| Security review | Run a separate security pass | Yes. Findings are either fixed or closed with a written reason |
| Number of approvers depends on risk | Low risk (docs, copy, new features behind a flag): passing the automated review and security checks is enough, no human approval needed. Medium risk (ordinary features, caching, auto-updates, system prompts): 1 approver. High risk: 2 approvers | Yes |
| After merge | The merge queue reruns checks on the latest main. Features go out behind a flag for internal use first, so problems can be rolled back quickly | — |
The official write-up also mentions two details: the risk level is decided by a classifier based on the content of the change, not by the author, and an AI approval can never take the place of a required human approval.
Individuals and small teams don't need to copy all of this. The first three layers (self-verification, local AI review, security review) can be done with the methods below.
Step 1: Create an API Key
Create a Key in the AICodeWith console. You'll need it when configuring Claude Code later.
Step 2: Configure a third-party API
Put the URL and Key into ~/.claude/settings.json under the env block, so you don't have to set it in the terminal with export:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.aicodewith.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-你的Key"
}
}
Writing it to settings.json means it takes effect every time you open a terminal and doesn't get lost when you switch windows. For more ways to configure it, see "How to Connect Claude Code to Third-Party APIs".
Step 3: Check your version
claude --version
You need version 2.1.218 or later. Starting with this version, /code-review runs as a subagent and doesn't use up the context of your current conversation. We tested with 2.1.300. If your version is too old, upgrade first:
claude update
Step 4: Spell out how to test in CLAUDE.md
During review, Claude reads the CLAUDE.md in your project root. Put your test, build, and lint commands in it, and Claude will run them to verify the change instead of guessing:
# 项目说明
- 测试:python3 -m unittest
- 构建:无
- lint:python3 -m pyflakes .
In our testing, /code-review actually ran the tests as described here, and states in its findings, "test_total returns 5 instead of 6, so the test fails."CLAUDE.md is covered in full in "CLAUDE.md Writing Guide".
Step 5: Write REVIEW.md
REVIEW.md goes in the project root and tells the reviewer what counts as a problem in this repo. The official advice is to keep it short, spell out what a failure looks like, and move recurring review comments into it.
Here is a template you can copy as is:
# 代码审查规则
## 什么算失败(必须报)
- 逻辑错误:结果算错、边界条件漏掉
- 安全问题:SQL 注入、命令注入、密钥写进代码
- 改了行为却没改测试
## 不要报
- 纯风格问题(命名、空行、引号),最多提 3 条
- tests/fixtures/ 目录和 *.lock 文件
## 证据要求
- 每条问题写清文件名和行号,说明怎么触发
- 没有证据的猜测不要写
The four sections each do one job:
- What counts as a failure: lists the issue types that must be reported. The reviewer looks for these first
- Cap on nitpicks: sets a limit on style comments so important issues don't get buried
- Paths to skip: test data, lockfiles, and generated code don't need review
- Evidence requirements: asks for the file and line number and how to trigger the issue, so you can go straight to the fix
In our test, every finding from /code-review came with a location and trigger like store.py:4, and it also cited the REVIEW.md rule about "changed behavior without updating tests."
Step 6: Run /code-review and /security-review locally
Open Claude Code on the branch you want reviewed and enter:
/code-review
It checks the current changes for correctness problems. Add --fix to have it fix the issues it finds, or pass a PR number (for example /code-review high 1234) to review that PR instead.
Run the security review separately:
/security-review
It compares the current branch against the origin default branch and looks for injection, permission, and data leak issues. So the repo needs an origin remote.
Test results
We built a small repo with a clean main branch and a feature branch with 3 deliberate bugs: a query changed from parameterized to string concatenation (SQL injection), a sum loop starting at index 1 (skipping the first item), and a discount divided by 10 instead of 100.
| Command | Time | Result |
|---|---|---|
| /code-review | 25 seconds | Reported 6 findings and caught all 3 planted bugs. It also flagged that the discount has no range validation, the new parameter has no tests, and a hand-written loop would be better replaced with sum() |
| /security-review | 68 seconds | Reported 1 high-severity finding: store.py:4 SQL injection, with an example attack input and a fix. The two calculation errors aren't security issues, so it didn't report them |
Both commands ran cleanly on the first try with no errors.
The two commands split the work:/code-reviewchecks whether the code is correct, and/security-reviewlooks only at security. Security issues can show up in either one, but calculation errors only show up in/code-review, so we recommend running both.
Step 7 (optional): Hook up a GitHub Action
To review every PR automatically, you can use the official Claude Code GitHub Action. There is also an open-source security review GitHub Action for security reviews. The official advice is to try it on one repo first, spend a few weeks tuning REVIEW.md, and then roll it out to other repos.
Automated review runs on GitHub, so store the key in the repo's Secrets. Don't put it in the workflow file.
Step 8: Review at most 3 rounds
The official team ran into a trap: when you keep asking AI to review the same PR, every round finds something new. One PR got reviewed more than fifty times in a single night. When they dug into it, about 59% of what the later rounds reported was old code that had been there from the start, not new problems.
So the rules now are:
- At most 3 rounds. If it still doesn't pass after 3 rounds, step back and ask whether the approach itself is wrong
- After the first few rounds, review only the new changes instead of re-reviewing the whole diff
- When you find one kind of problem, fix every similar spot, not just that one line
- Don't re-report issues that have already been reported
Follow the same approach when you use it on your own: in the first round, run the full /code-review, then have it look only at the newly committed changes.
FAQ
Can the personal plan use the cloud Code Review?
No. Code Review for Claude Code in the cloud is currently available only on Team and Enterprise plans. For individuals and small teams, the local /code-review and /security-review, combined with a GitHub Action, cover most needs.
What's the difference between /review and /code-review?
There's no difference. /review is an alias for /code-review.
One thing to watch for: if you write your own Skill named code-review in your project, it replaces/code-review, but/reviewstill uses the built-in version. For how to write your own Skill, see "How to Create Your Own Skill".
What errors do you get with a third-party Key?
We ran into this once during testing:
Not logged in · Please run /login
The cause is that ~/.claude/settings.json doesn't exist, so Claude Code couldn't read the Key. Follow step two and write env into it. You don't need to run /login.
Another common error comes from /security-review: if the repository has no origin remote, it can't find the default branch to compare against and will throw an error like ambiguous argument. Add a remote first:
git remote add origin 你的仓库地址
git fetch origin
Which model is best for reviews?
Review is bug-hunting work, so the stronger the model, the better. For choosing a model, see "Which Model Is Best for Claude Code". To save money, you can have subagents use a cheaper model; see "Configuring Haiku for Claude Code Subagents".
What other related workflows are there?
- Check for vulnerabilities before installing dependencies: "Running npm audit with Claude Code"
- Have AI fix real bugs and run tests: "Codex Fixes Real Bugs and Runs Tests"
Sign up now and start reviewing code with Claude Code →
Related Scenarios
For more hands-on ways to check code with AI, see the AI Code Review scenario page.



