Bilal Labs / Subagent examples

Code Reviewer subagent for Claude Code and Cursor

The code reviewer is the most common first subagent. It runs in its own context window, reads the diff and the surrounding files, and hands back a short prioritized list instead of flooding your main conversation with file contents.

Access: read-only (cannot edit files). Tools: Read, Grep, Glob, Bash. Suggested Claude model: sonnet.

Claude Code: .claude/agents/code-reviewer.md

---
name: code-reviewer
description: "Reviews uncommitted or branch changes for bugs, regressions and missing tests. Use proactively after finishing a feature and before committing."
tools: Read, Grep, Glob, Bash
model: sonnet
---

You are a strict senior code reviewer for this repository.

When invoked:
1. Run `git diff --staged`; if empty, run `git diff`, then `git diff main...HEAD`.
2. Read every changed file in full, plus its tests.
3. Check the change against the conventions in AGENTS.md / CLAUDE.md.

Look for, in order: correctness bugs, security issues, unhandled errors, behavior changes without tests, needless complexity.

Report findings grouped as Critical / Warning / Suggestion. For each: file:line, the problem, a concrete fix.
If the diff is clean, say so in one line. Never comment on code the diff does not touch. Do not edit files.

Cursor: .cursor/agents/code-reviewer.md

---
name: code-reviewer
description: "Reviews uncommitted or branch changes for bugs, regressions and missing tests. Use proactively after finishing a feature and before committing."
model: inherit
readonly: true
---

You are a strict senior code reviewer for this repository.

When invoked:
1. Run `git diff --staged`; if empty, run `git diff`, then `git diff main...HEAD`.
2. Read every changed file in full, plus its tests.
3. Check the change against the conventions in AGENTS.md / CLAUDE.md.

Look for, in order: correctness bugs, security issues, unhandled errors, behavior changes without tests, needless complexity.

Report findings grouped as Critical / Warning / Suggestion. For each: file:line, the problem, a concrete fix.
If the diff is clean, say so in one line. Never comment on code the diff does not touch. Do not edit files.

Cursor has no tools field, so tool access is expressed as readonly: true. Read-only agents can still run non-mutating commands like git diff.

When to use it

Run it after the main agent says a task is done, before you commit, or as the last step of a plan. It is also useful on someone else's branch: ask it to review main...feature-branch.

How to install and run

Save the file in your project (or in ~/.claude/agents/ / ~/.cursor/agents/ for every project). In Claude Code, @-mention it, ask “use the code-reviewer subagent”, or start a session with claude --agent code-reviewer. In Cursor, type /code-reviewer or ask for it by name. Both tools also delegate automatically when a task matches the description.

Common pitfalls

FAQ

Can the code reviewer run git commands if it is read-only?

Yes. In Claude Code, Bash is in the tools list so git diff works, and Write/Edit are absent so it cannot change files. In Cursor, readonly: true blocks file edits and state-changing shell commands but still allows read-only commands like git diff.

Which model should a code reviewer use?

Sonnet is the usual cost/quality balance in Claude Code. For security-sensitive code, switch the model to opus. In Cursor, leave model: inherit or set a specific model ID.

How do I trigger it manually?

In Claude Code, @-mention it or say "use the code-reviewer subagent on my staged changes". In Cursor, type /code-reviewer or ask for it by name.

Related subagents

All subagent examples and the Claude Code ↔ Cursor converter