Skip to main content
Agent skill

Code Review Security

Security-focused code review lens for identifying vulnerabilities, injection risks, auth flaws, and unsafe patterns.

Get started

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use Code Review Security when an AI agent needs a reusable SKILL.md workflow for this job: Security-focused code review lens for identifying vulnerabilities, injection risks, auth flaws, and unsafe patterns.

When not to use it

Skip Code Review Security when the task is outside the coding category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
Claude Code folder setup
mkdir -p ~/.claude/skills/code-review-security
# Save SKILL.md to ~/.claude/skills/code-review-security/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/code-review-security/SKILL.md. For a shared project, commit the folder at .claude/skills/code-review-security/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the Code Review Security skill for this task: Use Code Review Security when this documented workflow matches the task. Confirm any required inputs or files before making changes.

What supports this recommendation?

67/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
72/100
Practical detail
68/100
Source evidence
53/100
Source signals
72/100
Model compatibility evidence
  • claudeuntested

    No model-specific signal or recorded compatibility test was found.

  • chatgptuntested

    No model-specific signal or recorded compatibility test was found.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# Code Review: Security Lens

Specialized agent for security analysis during code review. Focuses on identifying vulnerabilities, security best practices, and proper data handling.

## Scope Discipline

When PM explicitly dispatches this lens: - ✅ Review security concerns: vulnerabilities, injection risks, data leaks - ✅ Analyze authentication, authorization, and access control - ✅ Check for sensitive data exposure and encryption issues - ✅ Verify input validation and sanitization

Do NOT broaden into: - ❌ Type errors/coverage (use TYPE_SAFETY lens) - ❌ Error-handling hygiene, timeout discipline, retry semantics (use ERROR_HANDLING lens) - ❌ Performance characteristics (use PERFORMANCE lens) - ❌ Architectural patterns (use ARCHITECTURE lens) - ❌ Code complexity/readability (use SIMPLICITY lens)

## Output Format

All findings must follow this structure:

```markdown ## Must Fix - [CRITICAL|HIGH] [path:line] Title - Description: What is wrong and why it matters - Suggestion: Specific fix with code example - Metadata: cross_lens_candidate=true/false, tradeoff_required=true/false

## Observations - [MEDIUM|LOW] [path:line] Title - Description: Informational finding - Metadata: cross_lens_candidate=true/false, tradeoff_required=true/false

## Summary [One paragraph overall assessment] ```

## Severity Scale

- **CRITICAL**: An exposure an attacker can actually reach — the finding names the entry point and what they gain (data they should not read, actions they can perform without authorisation, code executed). - **HIGH**: A security exposure an attacker can actually reach, with the path stated — an unvalidated parameter that reaches a shell in a route the caller controls. "Could lead to vulnerabilities" without a stated path is a MEDIUM hardening suggestion. - **MEDIUM**: Security best-practice and defence-in-depth improvements with no demonstrated reach — missing rate limits, weak-but-unreached defaults, hardening opportunities. - **LOW**: Minor security hardening opportunities.

## Metadata Guidance Tags

When reporting findings, always include:

**cross_lens_candidate**: Indicates this finding might also be relevant to other lenses - `true` if this finding could trigger other lens checks (e.g., missing input validation might be both security and type safety) - `false` if this is purely a security concern

**tradeoff_required**: Indicates if fixing this requires accepting a tradeoff - `true` if the fix involves usability, performance, or architectural tradeoffs - `false` if the fix is straightforward with no downside

## What to Review

1. **Injection Vulnerabilities** - SQL injection (raw queries with user input) - Command injection (shell execution with user input) - XSS vulnerabilities (unsanitized output) - Path traversal attacks

2. **Authentication & Authorization** - Password storage and hashing - Session management - Access control checks - JWT/token security

3. **Data Protection** - Sensitive data exposure (logs, error messages, API responses) - Encryption at rest and in transit - PII handling - Secret management

4. **Input Validation** - Whitelisting vs blacklisting - Type and range validation - Sanitization of user input - Length limits and bounds checking

5. **Dependencies** - Known vulnerabilities in dependencies - Outdated security patches - Supply chain risks

6. **Configuration Security** - Hardcoded secrets or credentials - Insecure defaults - Debug/exposed endpoints - CORS misconfiguration

## Example Finding

```markdown ## Must Fix - [CRITICAL] [src/auth/login.ts:56] SQL injection in the unauthenticated login route - Description: `email` from the request body is interpolated into the query at line 56; `email = 'x' OR 1=1--` authenticates as the first user without a password — the route needs no session, so any network client can send it. - Suggestion: Use parameterized queries: `db.query('SELECT * FROM users WHERE email = ?', [email])` - Metadata: cross_lens_candidate=true, tradeoff_required=false ```

## Adversarial Input Discipline

Before returning any verdict, construct one concrete adversarial input (malformed payload, oversize value, injection string, missing auth header, crafted path, race condition trigger) that exercises the primary code path modified in the diff, and trace what happens. If you cannot construct an adversarial input, your review is incomplete — return BLOCKED with the reason "could not construct adversarial input" rather than APPROVED.

## Integration Notes

This lens is part of the six-pass code review protocol. Findings are merged with other lenses via deterministic synthesis: - Dedupe by (path, line, title) - Precedence: SECURITY > ERROR_HANDLING > TYPE_SAFETY > PERFORMANCE > ARCHITECTURE > SIMPLICITY - Any CRITICAL finding from this lens blocks APPROVED verdict

Intended uses

  • Use Code Review Security when this documented workflow matches the task.

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.