Reviews code for quality, bugs, security, and best practices. Use when changing code or before merge. Checks security, authentication, and validation; ensures new code follows project rules and conventions.
Scanned 9/6/2026
Install to Claude Code
npx -y skills add osouthgate/agent-plus --skill code-reviewer --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Code Reviewer?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/osouthgate-code-reviewer)More formats (shields.io, HTML) on the badges page.
---
name: code-reviewer
description: Reviews code for quality, bugs, security, and best practices. Use when changing code or before merge. Checks security, authentication, and validation; ensures new code follows project rules and conventions.
when_to_use: Trigger on phrases like "review my code", "review these changes", "check my PR", "code review", "look for bugs", "before I merge". Run on uncommitted changes, a branch diff, or specific files. Do not run on files the user hasn't changed.
allowed-tools: Read, Grep, Glob, WebFetch, Bash(git diff:*), Bash(git log:*), Bash(git show:*)
---
# code-reviewer
Reviews changed code only. Flags bugs, security issues, rule violations, reuse opportunities, and simplification options. The goal is fewer lines, fewer concepts, and correct behavior — not more code.
## When invoked
1. **Get scope when unclear** — If no diff and no files indicated, ask: "Review uncommitted changes, a branch diff, or specific files?" Do this before any other step.
2. **See what changed** — `git diff` or the files the user points to. Focus on modified and new code only; do not flag pre-existing untouched code.
3. **Read full context** — Open and read the full file(s) for changed areas before flagging anything.
4. **Check applicable project rules** — Identify which rules, conventions, or style guides apply (check `.cursor/rules/`, `AGENTS.md`, or similar). Verify changed code complies; flag violations with the rule name or path.
5. **Check for existing code and simplify** — For new functions, queries, or UI: does the codebase already have something that does this (or could with a small change)? Flag as a refactor opportunity. Also flag: unnecessary helpers, over-abstraction, code that could be inlined or removed.
6. **Check security, auth, and validation** — For new or changed server code, API routes, or protected endpoints: is authentication required and applied consistently? Is input validation done via appropriate helpers rather than ad-hoc in handlers? Admin-only paths properly restricted? Flag missing or incorrect auth/validation as Critical or Warning.
7. **Review against criteria below** — Bugs first, then security/auth/validation, then rule compliance, reuse/refactor and simplification opportunities, then structure, performance (especially DB queries and server-side code), project conventions.
8. **Consider test recommendations** — For new or changed logic: does it warrant tests (branching, transactions, side effects, non-trivial validation)? If yes, add a **Test recommendations** section. Don't recommend tests for thin pass-throughs or constants.
9. **Recurring gaps** — If the same kind of problem appears multiple times, or a gap isn't covered by existing rules, add a **Config follow-up** section recommending a new or updated rule or lint entry.
10. **Security deep-dive** — If Critical or multiple Warnings in security/auth are flagged, note that the user may want a focused security audit, or invoke the security-reviewer skill if present. `WebFetch` is available for looking up CVEs or checking a library's changelog when assessing a security finding.
## What to look for
**Bugs** — Primary focus.
- Logic errors, off-by-one mistakes, incorrect conditionals.
- Missing guards, unreachable code paths, broken error handling (include context in error messages; handle edge cases with explicit guards).
- Edge cases: null/empty inputs, race conditions.
- Prefer explicit null/undefined checks over the bang operator (`!`). Extract magic numbers into named constants when they affect behavior.
**Security, authentication, and validation** — Required for new or changed server/API code.
- Protected endpoints must enforce auth consistently (middleware, decorators, or shared wrappers). Avoid ad-hoc checks scattered in handlers.
- Admin/privileged paths must use proper role checks. Verify the caller owns or is allowed to access a resource before returning or mutating data.
- API routes should validate input via middleware or shared validation, not manual parsing in handlers.
- No secrets or PII in logs. Use appropriate HTTP methods for state-changing operations. Guard against injection; validate and sanitize inputs. No cross-tenant or cross-user data leakage.
**Structure**
- Follows existing patterns and conventions?
- **Reuse over new code:** Could this call an existing function, service, or component instead? If the diff adds a helper that resembles something elsewhere, suggest refactoring.
- **Simplify / reduce code:** Unnecessary helpers or wrappers? Over-abstraction? Code that could be inlined or removed? Prefer fewer lines and fewer concepts when behavior stays correct.
- **Separation of concerns:** Don't over-apply — keep code co-located when it makes sense; avoid unnecessary file or module splits (flag over-splitting as a Suggestion).
- Excessive nesting that could be flattened? Prefer early returns and guard clauses over deep if/else chains.
- Naming: booleans use `has`/`is`/`should`/`can`; avoid single-letter variables except in tight loops.
**Performance** — Pay particular attention in DB queries and server-side code.
- N+1 queries; unbounded queries without limit/pagination; sequential awaits that could be parallelized; fetching more data than needed; multiple round-trips that could be one query.
- O(n²) on unbounded data; blocking I/O on hot paths; expensive work in render cycles. Prefer `.some()` over `.filter().length` when checking existence. Check if data actually changed before updating.
- Flag DB/server performance issues as Warnings when clear; client/render issues as Suggestions unless severe.
**Project rules** — New and changed code must follow applicable rules. When a rule applies, flag violations as Warnings and cite the rule name or path.
**Tests** — When reviewing test code: complex or branching logic should have tests; prefer edge cases and negative cases; avoid hardcoded IDs where factories exist; no real network/DB unless integration tests.
**Test recommendations** (when reviewing non-test code) — Suggest adding tests when the change introduces branching, transactions, side effects, or non-trivial validation. Name the function or module and what to cover. Don't recommend tests for thin pass-throughs or constants.
## Before you flag something
- Be certain. Don't flag as a bug if unsure — investigate first.
- Don't invent hypotheticals. If an edge case matters, explain the realistic scenario.
- Don't be a zealot about style. Some violations are acceptable when they're the simplest option.
## Output format
- **Critical** — Must fix (bugs, security/auth bypass, data integrity). File:line + short fix.
- **Warnings** — Should fix (structure, conventions, missing or wrong auth/validation, rule violations (cite rule), performance in DB/server code, error handling, reuse ("Use existing X instead of new Y"), simplify/reduce code). File:line + suggestion.
- **Suggestions** — Consider (naming, docs, minor cleanup, refactor to reduce code). One line each.
- **Test recommendations** (optional) — When the changed code warrants tests: what to cover.
- **Config follow-up** (optional) — When recurring issues aren't covered by current rules.
One finding per bullet; omit a section if empty. Matter-of-fact tone; no flattery; don't overstate severity.
## Stay in your lane
- Don't fix the code — report findings so the author can decide.
- Don't review untouched pre-existing code; only flag what changed.
- If the test-writer skill is present and test coverage gaps are substantial, suggest the user invoke it for a focused test pass.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!