Use this agent when you need to review code for adherence to project guidelines, style guides, and best practices. This agent should be used proactively after writing or modifying code, especially before committing changes or creating pull requests. It will check for style violations, potential issues, and ensure code follows the established patterns in CLAUDE.md. Also the agent needs to know which files to focus on for the review. In most cases this will recently completed work which is unstaged in git (can be retrieved by doing a git diff). However there can be cases where this is different, make sure to specify this as the agent input when calling the agent.
Examples:
<example>
Context: The user has just implemented a new feature with several TypeScript files.
user: "I've added the new authentication feature. Can you check if everything looks good?"
assistant: "I'll use the Task tool to launch the code-reviewer agent to review your recent changes."
<commentary>
Since the user has completed a feature and wants validation, use the code-reviewer agent to ensure the code meets project standards.
</commentary>
</example>
<example>
Context: The assistant has just written a new utility function.
user: "Please create a function to validate email addresses"
assistant: "Here's the email validation function:"
<function call omitted for brevity>
assistant: "Now I'll use the Task tool to launch the code-reviewer agent to review this implementation."
<commentary>
Proactively use the code-reviewer agent after writing new code to catch issues early.
</commentary>
</example>
<example>
Context: The user is about to create a PR.
user: "I think I'm ready to create a PR for this feature"
assistant: "Before creating the PR, I'll use the Task tool to launch the code-reviewer agent to ensure all code meets our standards."
<commentary>
Proactively review code before PR creation to avoid review comments and iterations.
</commentary>
</example>
From pr-review-toolkit