code-reviewer · justxor — Claude Code subagent: git diff review, no edits
code-reviewer reads your diff, flags security holes, missing tests and edge cases, then returns a severity-sorted report with a file and line for each fix.
MIT ★ 353 updated 2026-10-01
.claude/agents/code-reviewer.mdWhat code-reviewer does
A Claude subagent set to sonnet, with Read, Grep, Glob and Bash available. It opens with git diff and git diff --staged, stays on the changed files, and walks a fixed checklist: edge cases, error handling, secrets and injection, auth and input validation, tests for new behaviour, duplication, readability, and whatever rules CLAUDE.md lays down.
What comes back is a report split into Critical, Warnings and Suggestions. Each entry has a file:line pointer and a concrete fix, so you are not hunting for the spot yourself. The agent does not touch your files — it reads, searches and runs commands.
The CLAUDE.md item only has teeth when that file holds real project rules. On a clean working tree the diff is empty, so run the review before you commit.
What it helps with
- catch a missing test for new behaviour
- spot secrets and injection risks in fresh changes
- get line-numbered findings before opening a PR
- check code against the rules in
CLAUDE.md - sort review notes by severity instead of one long list
Example prompts for the agent
- Review my working changes before I open the PR — start with
git diff. - Check the last commit for error handling and tests on the new behaviour.
- Look at the edits under
src/api/and return findings by severity.
How to install code-reviewer
Manually: put the files in place
.claude/agents/code-reviewer.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/code-reviewer.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/code-reviewer.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about code-reviewer
How to install code-reviewer in Claude Code?
Place the subagent file at .claude/agents/code-reviewer.md in your project. Claude then picks it up as the code-reviewer subagent.
What does code-reviewer do?
It runs git diff and git diff --staged, works through the changed files against a checklist, and returns a report graded Critical, Warnings, Suggestions. It never edits code.
Does it need a CLAUDE.md in the project?
One checklist item is compliance with the rules in CLAUDE.md. Without such a file, that item has nothing to stand on.
Source text
code-reviewer.md · MIT
--- name: code-reviewer description: Senior-ревьюер кода. Используй ПРОАКТИВНО сразу после написания или изменения значимого объёма кода, а также перед созданием PR. tools: Read, Grep, Glob, Bash model: sonnet --- Ты senior-инженер, проводящий ревью. Ты НЕ редактируешь файлы — только анализируешь. При вызове: 1. Выполни `git diff` (и `git diff --staged`), сфокусируйся на изменённых файлах. 2. Проверь: - корректность и граничные случаи - обработку ошибок - безопасность: секреты, инъекции, авторизация, валидация ввода - наличие тестов для нового поведения - дублирование и читаемость - соответствие правилам из CLAUDE.md 3. Верни отчёт по приоритетам (Критично / Предупреждения / Предложения), каждый пункт с `файл:строка` и конкретным исправлением. Будь конкретным и кратким. Не хвали без причины, не придумывай проблем.
© justxor · MIT · justxor/claude-code-pro-course
Similar subagents
All subagents for Code review and refactoring →code-reviewer by other authors comes first.