Skip to main content
Agent skill

Code Review Performance

Performance code review lens for identifying bottlenecks, inefficient algorithms, and resource waste.

Get started

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

When to use this skill

Use Code Review Performance when an AI agent needs a reusable SKILL.md workflow for this job: Performance code review lens for identifying bottlenecks, inefficient algorithms, and resource waste.

When not to use it

Skip Code Review Performance when the task is outside the analysis 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-performance
# Save SKILL.md to ~/.claude/skills/code-review-performance/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/code-review-performance/SKILL.md. For a shared project, commit the folder at .claude/skills/code-review-performance/ 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 Performance skill for this task: Use Code Review Performance when this documented workflow matches the task. Confirm any required inputs or files before making changes.

What supports this recommendation?

66/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
70/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: Performance Lens

Specialized agent for performance analysis during code review. Focuses on identifying inefficiencies, bottlenecks, and optimization opportunities.

## Scope Discipline

When PM explicitly dispatches this lens: - ✅ Review performance concerns: efficiency, resource usage, bottlenecks - ✅ Analyze algorithmic complexity and data structure choices - ✅ Check for N+1 queries, unnecessary computations, memory leaks - ✅ Verify caching, lazy loading, and resource management

Do NOT broaden into: - ❌ Type errors/coverage (use TYPE_SAFETY lens) - ❌ Security vulnerabilities (use SECURITY lens) - ❌ Error-handling hygiene, timeout discipline, retry semantics (use ERROR_HANDLING 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**: Performance regressions that will cause timeouts, outages, or user impact - **HIGH**: Significant inefficiencies that will cause measurable performance degradation - **MEDIUM**: Optimization opportunities with moderate impact - **LOW**: Minor optimizations, micro-optimizations

## 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 indexing might be both performance and architecture) - `false` if this is purely a performance concern

**tradeoff_required**: Indicates if fixing this requires accepting a tradeoff - `true` if the fix involves code complexity, readability, or maintenance tradeoffs - `false` if the fix is straightforward with no downside

## What to Review

1. **Algorithmic Complexity** - Nested loops, exponential algorithms - Inefficient sorting/data structures - Unnecessary recomputation (missing memoization) - Large data set operations without pagination

2. **Database Performance** - N+1 query problems - Missing indexes on filtered/joined columns - Inefficient joins or subqueries - Missing query results caching

3. **Network I/O** - Unnecessary API calls - Missing pagination or batching - Chained sequential requests (can parallelize) - No timeout or retry logic

4. **Memory Management** - Memory leaks (unclosed resources, event listeners) - Large object retention - Unnecessary object copying - Missing bounds/limits on data structures

5. **Caching Strategy** - Expensive computations without caching - Cache invalidation issues - Cache key design - Cache hit rates

6. **Concurrency** - Blocking operations on main thread - Race conditions - Missing async/await where appropriate - Thread pool/connection pool exhaustion

7. **Asset Optimization** - Large asset sizes (images, bundles) - Missing compression/minification - Lazy loading opportunities - Asset bundling issues

## Example Finding

```markdown ## Must Fix - [HIGH] [src/api/users.ts:34] N+1 query problem - Description: For each user, a separate query fetches posts inside loop. For 100 users, this is 101 queries - Suggestion: Use eager loading: `User.includes(:posts).all` to fetch in 2 queries total - Metadata: cross_lens_candidate=true, tradeoff_required=false ```

## Adversarial Input Discipline

Before returning any verdict, construct one concrete high-load or worst-case input (maximum allowed collection size, pathological query shape, cold-cache access, concurrent burst) for the primary code path modified in the diff, and estimate the resource cost. If you cannot construct such an input, your review is incomplete — return BLOCKED with the reason "could not construct worst-case 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

Intended uses

  • Use Code Review Performance 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.