code-reviewer · chriswiles — Claude Code subagent: code review and security
code-reviewer — a subagent for Claude Code that checks newly written or modified code against project standards, TypeScript strict mode, and security patterns.
no license ★ 6,091 updated 2026-01-06
.claude/agents/code-reviewer.mdWhat code-reviewer does
The subagent targets Claude Code and kicks in right after any edit. It opens with git diff to focus on changed files, then runs npm run lint before going through the diff line by line.
TypeScript checks cover three things: any is banned in favour of unknown, interface is preferred over type for plain shapes, and as Type assertions must be justified. Loading and empty states get their own critical category — a bare if (loading) without !data causes a spinner flash on every refetch, and a FlatList missing ListEmptyComponent is flagged the same way. For mutations, the subagent checks that buttons carry both isDisabled={loading} and isLoading={loading}, and that onError shows a toast.
The agent runs on the opus model and lives at .claude/agents/code-reviewer.md. The same rules can be applied from .codex/agents/code-reviewer.toml or .cursor/agents/code-reviewer.md depending on your editor.
What it helps with
- Catch exposed API keys and missing input validation at boundaries
- Flag direct data mutation instead of immutable spread updates
- Enforce the correct state order: Error → Loading → Empty → Success
- Detect missing
isDisabledon mutation buttons that allow double-clicks - Verify every
FlatListhas aListEmptyComponent
Example prompts for the agent
- Review the changes in
UserList.tsxagainst project standards - Run a code review after edits to the auth module
- Analyse the latest
git diffand report TypeScript violations
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 do I install code-reviewer in Claude Code?
Place the agent file at .claude/agents/code-reviewer.md in the project root. Claude Code picks up subagents from that directory automatically.
What does the code-reviewer subagent do?
After each code change it runs git diff and npm run lint, then checks typing, loading states, error handling, mutation UI patterns, and security, grouping findings by severity.
Which model does code-reviewer use?
The frontmatter sets model: opus. Change that field to switch to a different model.
Similar subagents
All subagents for Code review and refactoring →code-reviewer by other authors comes first.