Code Reviewer
Automated code review skill that provides inline feedback, flags anti-patterns, identifies bugs, and suggests concrete improvements aligned with language-specific style guides and best practices.
When to Use
- User asks to "review this code", "check my PR", or "audit this file"
- A pull request diff is provided and feedback is requested
- User wants to ensure code meets team style guides before merging
- User asks for a second opinion on implementation choices
- Code quality gates are failing and root cause is unclear
- User wants to identify potential bugs before shipping
Process
Identify the language and framework from file extensions, imports, or explicit context. Note any relevant style guide (ESLint config, .editorconfig, pyproject.toml, golangci.yml, etc.).
Parse the full scope of changes — read the entire file or diff, not just the changed lines, to understand surrounding context, imports, and data flow.
Run through the review checklist for each function/block:
- Correctness: Does the logic match the stated intent? Are edge cases handled?
- Naming: Are variables, functions, and classes named clearly and consistently?
- Complexity: Is cyclomatic complexity high? Can it be simplified?
- Duplication: Is logic copy-pasted from elsewhere? Extract shared helpers.
- Error handling: Are errors caught, logged, and handled gracefully?
- Security: Any injection risks, untrusted input used unsafely, secrets in code?
- Performance: Any N+1 queries, unnecessary loops, or expensive operations in hot paths?
- Tests: Are new code paths covered? Are existing tests updated?
- Documentation: Are public APIs, complex logic, and non-obvious decisions documented?
Categorize each finding by severity:
- 🔴 Blocker — must be fixed before merge (bug, security issue, data loss risk)
- 🟡 Warning — should be addressed (style violation, missing error handling, test gap)
- 🟢 Suggestion — nice to have (readability, minor optimization, alternative approach)
- 💬 Nit — trivial style/formatting issue
Write inline comments referencing specific line numbers or code snippets.
Provide a summary section with an overall verdict (Approve / Request Changes / Needs Discussion), a count of findings by severity, and 2–3 high-level themes observed across the review.
Suggest concrete fixes — don't just flag problems; show corrected code snippets where possible.
Output Format
## Code Review Summary
**Verdict:** Request Changes | Approve | Needs Discussion
**Findings:** 🔴 2 blockers · 🟡 3 warnings · 🟢 5 suggestions · 💬 2 nits
### Key Themes
- Error handling is inconsistent across service layer methods
- Several functions exceed 50 lines and could be decomposed
- Missing input validation on user-facing endpoints
---
### Inline Findings
#### `src/users/userService.ts` — Line 42
🔴 **Blocker: SQL Injection Risk**
The `userId` parameter is interpolated directly into the query string.
```ts
// ❌ Current
const q = `SELECT * FROM users WHERE id = ${userId}`;
// ✅ Fix
const q = `SELECT * FROM users WHERE id = ?`;
db.query(q, [userId]);
src/utils/formatDate.ts — Line 17
🟡 Warning: No null check before .toISOString()
If date is null or undefined, this will throw at runtime.
...
## Examples
### Example Input
Review this Python function:
def get_user(user_id):
result = db.execute("SELECT * FROM users WHERE id = " + user_id)
return result[0]
### Example Output
Code Review Summary
Verdict: Request Changes
Findings: 🔴 1 blocker · 🟡 1 warning
Line 2
🔴 Blocker: SQL Injection
String concatenation into a SQL query allows injection attacks.
✅ Fix: Use parameterized queries — db.execute("SELECT * FROM users WHERE id = %s", (user_id,))
Line 3
🟡 Warning: IndexError if user not found
result[0] raises IndexError if the query returns no rows.
✅ Fix: Return result[0] if result else None and handle the None case in the caller.
## Boundaries
- Do NOT rewrite entire files unless explicitly asked — provide targeted inline feedback only.
- Do NOT assume a style guide exists if none is provided; fall back to community defaults (PEP 8, Airbnb, Google style, etc.).
- Do NOT flag third-party library internals or auto-generated files.
- Do NOT run code or attempt execution — analysis is static only.
- Do NOT make subjective architectural decisions on behalf of the team (e.g., "you should use microservices").
- Limit review depth to files/diffs explicitly provided; do not speculatively fetch other files unless they are directly referenced and relevant.
- Keep nit count reasonable — avoid overwhelming feedback with trivial formatting issues if blockers are present.
1---2name: code-reviewer3description: Performs automated code review with inline comments, flags anti-patterns, and suggests improvements against style guides. Invoke when asked to review code, check a pull request, audit code quality, or find issues in a file or diff.4---56# Code Reviewer78Automated code review skill that provides inline feedback, flags anti-patterns, identifies bugs, and suggests concrete improvements aligned with language-specific style guides and best practices.910## When to Use1112- User asks to "review this code", "check my PR", or "audit this file"13- A pull request diff is provided and feedback is requested14- User wants to ensure code meets team style guides before merging15- User asks for a second opinion on implementation choices16- Code quality gates are failing and root cause is unclear17- User wants to identify potential bugs before shipping1819## Process20211. **Identify the language and framework** from file extensions, imports, or explicit context. Note any relevant style guide (ESLint config, `.editorconfig`, `pyproject.toml`, `golangci.yml`, etc.).22232. **Parse the full scope of changes** — read the entire file or diff, not just the changed lines, to understand surrounding context, imports, and data flow.24253. **Run through the review checklist** for each function/block:26 - Correctness: Does the logic match the stated intent? Are edge cases handled?27 - Naming: Are variables, functions, and classes named clearly and consistently?28 - Complexity: Is cyclomatic complexity high? Can it be simplified?29 - Duplication: Is logic copy-pasted from elsewhere? Extract shared helpers.30 - Error handling: Are errors caught, logged, and handled gracefully?31 - Security: Any injection risks, untrusted input used unsafely, secrets in code?32 - Performance: Any N+1 queries, unnecessary loops, or expensive operations in hot paths?33 - Tests: Are new code paths covered? Are existing tests updated?34 - Documentation: Are public APIs, complex logic, and non-obvious decisions documented?35364. **Categorize each finding** by severity:37 - 🔴 **Blocker** — must be fixed before merge (bug, security issue, data loss risk)38 - 🟡 **Warning** — should be addressed (style violation, missing error handling, test gap)39 - 🟢 **Suggestion** — nice to have (readability, minor optimization, alternative approach)40 - 💬 **Nit** — trivial style/formatting issue41425. **Write inline comments** referencing specific line numbers or code snippets.43446. **Provide a summary section** with an overall verdict (Approve / Request Changes / Needs Discussion), a count of findings by severity, and 2–3 high-level themes observed across the review.45467. **Suggest concrete fixes** — don't just flag problems; show corrected code snippets where possible.4748## Output Format4950```51## Code Review Summary52**Verdict:** Request Changes | Approve | Needs Discussion53**Findings:** 🔴 2 blockers · 🟡 3 warnings · 🟢 5 suggestions · 💬 2 nits5455### Key Themes56- Error handling is inconsistent across service layer methods57- Several functions exceed 50 lines and could be decomposed58- Missing input validation on user-facing endpoints5960---6162### Inline Findings6364#### `src/users/userService.ts` — Line 4265🔴 **Blocker: SQL Injection Risk**66The `userId` parameter is interpolated directly into the query string.67```ts68// ❌ Current69const q = `SELECT * FROM users WHERE id = ${userId}`;7071// ✅ Fix72const q = `SELECT * FROM users WHERE id = ?`;73db.query(q, [userId]);74```7576#### `src/utils/formatDate.ts` — Line 1777🟡 **Warning: No null check before `.toISOString()`**78If `date` is `null` or `undefined`, this will throw at runtime.79...80```8182## Examples8384### Example Input85```86Review this Python function:8788def get_user(user_id):89 result = db.execute("SELECT * FROM users WHERE id = " + user_id)90 return result[0]91```9293### Example Output94```95## Code Review Summary96**Verdict:** Request Changes97**Findings:** 🔴 1 blocker · 🟡 1 warning9899#### Line 2100🔴 **Blocker: SQL Injection**101String concatenation into a SQL query allows injection attacks.102✅ Fix: Use parameterized queries — `db.execute("SELECT * FROM users WHERE id = %s", (user_id,))`103104#### Line 3105🟡 **Warning: IndexError if user not found**106`result[0]` raises IndexError if the query returns no rows.107✅ Fix: Return `result[0] if result else None` and handle the None case in the caller.108```109110## Boundaries111112- Do NOT rewrite entire files unless explicitly asked — provide targeted inline feedback only.113- Do NOT assume a style guide exists if none is provided; fall back to community defaults (PEP 8, Airbnb, Google style, etc.).114- Do NOT flag third-party library internals or auto-generated files.115- Do NOT run code or attempt execution — analysis is static only.116- Do NOT make subjective architectural decisions on behalf of the team (e.g., "you should use microservices").117- Limit review depth to files/diffs explicitly provided; do not speculatively fetch other files unless they are directly referenced and relevant.118- Keep nit count reasonable — avoid overwhelming feedback with trivial formatting issues if blockers are present.