code-review · anthropics — Claude Code skill: review code before you merge
The skill reviews diffs and pull requests for security, performance and correctness. Useful when a change needs a look before merging.
npx skills add anthropics/knowledge-work-plugins --skill code-review -a claude-codeWhat code-review does
code-review inspects code changes along four axes. Security covers SQL injection, XSS, CSRF, auth flaws, secrets in code, insecure deserialization, path traversal and SSRF. Performance looks for N+1 queries, unnecessary allocations, quadratic complexity in hot paths, missing indexes, unbounded queries and resource leaks. Correctness checks empty input, null, overflow, race conditions, error propagation and off-by-one errors. Maintainability covers naming, single responsibility, duplication and test coverage.
You invoke it as /code-review with a PR URL, a diff or a file path. Pass nothing and it asks what to review. The output is a markdown report: a short summary, a table of critical issues with file, line and severity, categorised suggestions, a section on what looks good, and a verdict — approve, request changes or needs discussion.
It works standalone: paste a diff or point at files and you get the full review. Connect source control and it pulls the PR diff itself and checks CI status. Connect a project tracker and findings get linked to tickets; connect a knowledge base and changes are checked against team coding standards. Without those connectors you handle those steps by hand.
What it helps with
- check a pull request for injection risks and leaked secrets
- spot N+1 queries in new code
- catch race conditions and unhandled errors before merge
- compare changes against team coding standards
- get a list of fixes with code examples
Example prompts for the agent
- Run
/code-reviewon this diff before I merge - Review this PR URL with
/code-review, focus on security - Use
/code-reviewonsrc/api/orders.ts, check the error handling
How to install code-review
1Skills CLI (Vercel)
npx skills add anthropics/knowledge-work-plugins --skill code-review -a claude-code2Manually: put the files in place
~/.claude/skills/code-review/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/code-review/
1Skills CLI (Vercel)
npx skills add anthropics/knowledge-work-plugins --skill code-review -a codex2Manually: put the files in place
.agents/skills/code-review/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add anthropics/knowledge-work-plugins --skill code-review -a cursor2Manually: put the files in place
.cursor/skills/code-review/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install anthropics/knowledge-work-plugins code-review2Manually: put the files in place
.github/skills/code-review/SKILL.md1Skills CLI (Vercel)
npx skills add anthropics/knowledge-work-plugins --skill code-review -a gemini-cli2Platform CLI
gemini skills install https://github.com/anthropics/knowledge-work-plugins --path engineering/skills/code-reviewManually: put the files in place
.devin/skills/code-review/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add anthropics/knowledge-work-plugins --skill code-review -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about code-review
How do I install code-review in Claude Code?
Run npx skills add anthropics/knowledge-work-plugins --skill code-review -a claude-code. The skill lands at ~/.claude/skills/code-review/SKILL.md.
What does code-review do?
It reviews code changes for security, performance, correctness and maintainability, then returns a report with critical issues, suggestions and a verdict.
What do I need for it to pull the PR diff automatically?
A connected source control tool. With it, the skill fetches the diff from the URL and checks CI status. Otherwise paste the diff or file paths yourself.
Source text
SKILL.md · Apache-2.0
--- name: code-review description: Review code changes for security, performance, and correctness. Trigger with a PR URL or diff, "review this before I merge", "is this code safe?", or when checking a change for N+1 queries, injection risks, missing edge cases, or error handling gaps. argument-hint: "<PR URL, diff, or file path>" --- # /code-review > If you see unfamiliar placeholders or need to check which tools are connected, see [CONNECTORS.md](../../CONNECTORS.md). Review code changes with a structured lens on security, performance, correctness, and maintainability. ## Usage ``` /code-review <PR URL or file path> ``` Review the provided code changes: @$1 If no specific file or URL is provided, ask what to review. ## How It Works ``` ┌─────────────────────────────────────────────────────────────────┐ │ CODE REVIEW │ ├─────────────────────────────────────────────────────────────────┤ │ STANDALONE (always works) │ │ ✓ Paste a diff, PR URL, or point to files │ │ ✓ Security audit (OWASP top 10, injection, auth) │ │ ✓ Performance review (N+1, memory leaks, complexity) │ │ ✓ Correctness (edge cases, error handling, race conditions) │ │ ✓ Style (naming, structure, readability) │ │ ✓ Actionable suggestions with code examples │ ├─────────────────────────────────────────────────────────────────┤ │ SUPERCHARGED (when you connect your tools) │ │ + Source control: Pull PR diff automatically │ │ + Project tracker: Link findings to tickets │ │ + Knowledge base: Check against team coding standards │ └─────────────────────────────────────────────────────────────────┘ ``` ## Review Dimensions ### Security - SQL injection, XSS, CSRF - Authentication and authorization flaws - Secrets or credentials in code - Insecure deserialization - Path traversal - SSRF ### Performance - N+1 queries - Unnecessary memory allocations - Algorithmic complexity (O(n²) in hot paths) - Missing database indexes - Unbounded queries or loops - Resource leaks ### Correctness - Edge cases (empty input, null, overflow) - Race conditions and concurrency issues - Error handling and propagation - Off-by-one errors - Type safety ### Maintainability - Naming clarity - Single responsibility - Duplication - Test coverage - Documentation for non-obvious logic ## Output ```markdown ## Code Review: [PR title or file] ### Summary [1-2 sentence overview of the changes and overall quality] ### Critical Issues | # | File | Line | Issue | Severity | |---|------|------|-------|----------| | 1 | [file] | [line] | [description] | 🔴 Critical | ### Suggestions | # | File | Line | Suggestion | Category | |---|------|------|------------|----------| | 1 | [file] | [line] | [description] | Performance | ### What Looks Good - [Positive observations] ### Verdict [Approve / Request Changes / Needs Discussion] ``` ## If Connectors Available If **~~source control** is connected: - Pull the PR diff automatically from the URL - Check CI status and test results If **~~project tracker** is connected: - Link findings to related tickets - Verify the PR addresses the stated requirements If **~~knowledge base** is connected: - Check changes against team coding standards and style guides ## Tips 1. **Provide context** — "This is a hot path" or "This handles PII" helps me focus. 2. **Specify concerns** — "Focus on security" narrows the review. 3. **Include tests** — I'll check test coverage and quality too.
© anthropics · Apache-2.0 · anthropics/knowledge-work-plugins
Similar skills
Everything for Code review and refactoring →code-review by other authors comes first.