agentleFS
VictoriakaeyVictoriakaey/build-reliable-agents/skills/code-review/SKILL.md

code-review

Skill0 starsChanged 8 months agoMITView on GitHub

Use when reviewing code — either Claude reviews your code and produces a structured report, or Claude guides you through reviewing someone else's code. Default mode: Claude performs the review and produces a report organized by severity. Second mode: guided self-review with a structured checklist and probing questions. Covers correctness, security, performance, maintainability, and AI-specific concerns for LLM applications.

188 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use starter, media-processing and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ww-w-aiSkill

    starter

    Static web development guide for beginners. Covers HTML/CSS/JavaScript and Next.js App Router basics. Project initialization with "init starter". Triggers: static website, portfolio, landing page, HTML CSS, beginner, 정적 웹, 포트폴리오, 초보자, 静的サイト, 初心者, 静态网站, 初学者, sitio web estático, site statique, statische Website, sito web statico Do NOT use for: fullstack apps (use $dynamic), enterprise (use $enterprise).

    Also in 4 projects that use this

  • mrgoonieSkill

    media-processing

    Process multimedia files with FFmpeg (video/audio encoding, conversion, streaming, filtering, hardware acceleration) and ImageMagick (image manipulation, format conversion, batch processing, effects, composition). Use when converting media formats, encoding videos with specific codecs (H.264, H.265, VP9), resizing/cropping images, extracting audio from video, applying filters and effects, optimizing file sizes, creating streaming manifests (HLS/DASH), generating thumbnails, batch processing images, creating composite images, or implementing media processing pipelines. Supports 100+ formats, hardware acceleration (NVENC, QSV), and complex filtergraphs.

    Also in 5 projects that use this

  • loulanyueSkill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 15 projects that use this

  • mrgoonieSkill

    aesthetic

    Create aesthetically beautiful interfaces following proven design principles. Use when building UI/UX, analyzing designs from inspiration sites, generating design images with ai-multimodal, implementing visual hierarchy and color theory, adding micro-interactions, or creating design documentation. Includes workflows for capturing and analyzing inspiration screenshots with chrome-devtools and ai-multimodal, iterative design image generation until aesthetic standards are met, and comprehensive design system guidance covering BEAUTIFUL (aesthetic principles), RIGHT (functionality/accessibility), SATISFYING (micro-interactions), and PEAK (storytelling) stages. Integrates with chrome-devtools, ai-multimodal, media-processing, ui-styling, and web-frameworks skills.

    Also in 4 projects that use this

  • AWSSkill

    ask-matt

    Ask which skill or flow fits your situation. A router over the skills in this repo.

    Also in 32 projects that use this

  • AWSSkill

    resolving-merge-conflicts

    Use when you need to resolve an in-progress git merge/rebase conflict.

    Also in 48 projects that use this

  • +1 more from mrgoonie
  • +2 more from aws

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No timeout on LLM API calls

    line 104
  2. Distinctive:

    Use this when you want to review code yourself — your own code before committing, a colleague's PR, or code you're inheriting.

    line 111
  3. Distinctive:

    Before looking for problems, understand what the code does.

    line 115
  4. Distinctive:

    If you can't answer these, ask before reviewing.

    line 123
  5. Distinctive:

    Don't read top to bottom — read in order of importance:

    line 127
  6. Distinctive:

    Use these consistently so the person receiving the review knows what must be fixed vs.

    line 215

“Common” is measured: kept by at least 6 in 10 of the 175 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code Review

Two Modes

Mode 1 (Default): Claude Reviews Your Code Provide the code and Claude produces a structured review report organized by severity. → Say "review this code" or paste code directly.

Mode 2: Guided Self-Review Claude guides you through reviewing code yourself with a structured checklist and probing questions. → Say "help me review this" or "walk me through reviewing this PR."


Mode 1: Claude Reviews Your Code

How to Provide Code for Review

For best results, provide:

  1. The code to review
  2. What it's supposed to do (one sentence is enough)
  3. Any specific concerns you have (optional)
  4. The language/framework if not obvious

Review Report Format

Claude produces a report in this structure:

## Code Review: [filename or description]

### Summary
[2-3 sentence overview of the code quality and main findings]

### CRITICAL Issues
[Issues that will cause bugs, security vulnerabilities, or data loss]

### HIGH Issues
[Issues that will likely cause problems in production]

### MEDIUM Issues
[Issues that reduce quality, maintainability, or performance]

### LOW Issues / Style
[Minor improvements, style suggestions, nitpicks]

### Positive Observations
[What's done well — always include this]

### Recommended Next Steps
[Prioritized list of what to fix first]

What Claude Checks

Correctness

  • Logic errors and off-by-one errors
  • Edge cases not handled (empty input, null values, boundary conditions)
  • Incorrect assumptions about data types or formats
  • Race conditions in concurrent code
  • Error handling — are exceptions caught and handled appropriately?
  • Return values — are all return paths handled?

Security

  • Hardcoded secrets, API keys, passwords
  • SQL injection (string concatenation in queries)
  • Input not validated or sanitized before use
  • Sensitive data logged or exposed in error messages
  • Authentication/authorization checks missing
  • Dependencies with known vulnerabilities (flagged if obvious)
  • Data sent to external APIs without considering compliance requirements (GDPR, HIPAA, data residency)

Performance

  • N+1 query patterns (loop containing a database query)
  • Missing indexes on frequently queried columns
  • Unnecessary data loaded (SELECT * when specific columns needed)
  • Blocking calls in async context
  • Large objects held in memory unnecessarily
  • Missing caching where it would clearly help

Maintainability

  • Functions doing more than one thing
  • Magic numbers and strings without named constants
  • Deeply nested code (> 3 levels)
  • Duplicated logic that should be extracted
  • Missing or misleading comments on complex logic
  • Variable names that don't communicate intent
  • Dead code

AI-Specific (for LLM applications)

  • Prompt injection vulnerabilities (user input directly in prompts without sanitization)
  • Missing token limit enforcement
  • LLM errors not caught (network errors, rate limits, context length errors)
  • Sensitive data sent to external API without awareness
  • Non-deterministic behavior not accounted for (same input can produce different output)
  • Missing fallback when LLM call fails
  • Swallowed exceptions in LLM call wrappers
  • Blocking LLM calls in async handlers
  • No timeout on LLM API calls
  • Cost not considered (unbounded loops with LLM calls)

Mode 2: Guided Self-Review

Use this when you want to review code yourself — your own code before committing, a colleague's PR, or code you're inheriting.

Phase 1: Understand Before Judging

Before looking for problems, understand what the code does.

Questions to answer first:

  • What is this code supposed to do? (read the PR description, ticket, or ask)
  • What are the inputs and outputs?
  • What are the external dependencies (database, APIs, other services)?
  • What could go wrong at runtime?

If you can't answer these, ask before reviewing.

Phase 2: Read the Code in the Right Order

Don't read top to bottom — read in order of importance:

  1. Public interface first — function signatures, class methods, API endpoints. Do they make sense?
  2. Error handling paths — what happens when things go wrong?
  3. Main logic — the happy path
  4. Helper functions — only if the main logic calls them and you need to understand them

Phase 3: Checklist

Work through this checklist. For each item, either confirm it's fine or flag it.

Correctness

  • Does the code do what it's supposed to do?
  • Are edge cases handled? (empty input, null/undefined, zero, negative numbers, very large values)
  • Are all error paths handled? (what happens if a dependency fails?)
  • Are there any obvious logic errors?
  • Are async operations awaited correctly?

Security

  • Are there any hardcoded secrets or credentials?
  • Is user input validated before use?
  • Is user input sanitized before going into SQL queries or prompts?
  • Are sensitive values (passwords, tokens) avoided in logs?
  • Are authentication/authorization checks in place where needed?
  • Is data sent to external APIs (especially LLM providers) compliant with data residency/privacy requirements?

Performance

  • Are there database queries inside loops?
  • Is more data loaded than needed?
  • Are there blocking operations in async code?
  • Is there anything that will get significantly slower as data grows?

Maintainability

  • Can you understand what each function does from its name alone?
  • Are there any functions longer than ~50 lines? (flag for potential splitting)
  • Is there duplicated logic that could be extracted?
  • Are complex sections commented?
  • Are magic numbers or strings given names?

Tests

  • Are there tests for the main logic?
  • Are edge cases tested?
  • Do the tests actually test behavior, or just implementation details?
  • If no tests, is the code at least testable (dependency injection, no hidden globals)?

AI-Specific (if applicable)

  • Is user input sanitized before being added to a prompt?
  • Are LLM API calls wrapped in try/except?
  • Is there a timeout on LLM calls?
  • Is there a fallback if the LLM call fails?
  • Are token limits enforced?
  • Is there a guard against unbounded LLM call loops?

Phase 4: Writing the Review

Tone principles

  • Be specific — "this function is hard to read" is not actionable. "This function does three things (parse, validate, save) — consider splitting" is.
  • Explain the why — don't just say what's wrong, say why it matters.
  • Separate must-fix from nice-to-have — be explicit about severity.
  • Acknowledge what's good — a review with only negatives is demoralizing and misses important signal.
  • Ask questions instead of making accusations — "did you consider X?" is better than "you forgot X."

Comment format

[CRITICAL] This SQL query is vulnerable to injection — user input is concatenated
directly into the query string. Use parameterized queries instead:
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))

[HIGH] LLM call on line 47 has no exception handling. If the API is unavailable
or returns a rate limit error, this will crash the entire request. Wrap in
try/except and return a graceful fallback.

[MEDIUM] The process_items() function does both filtering and transformation.
Consider splitting into filter_items() and transform_items() for testability
and clarity.

[LOW] Magic number 50 on line 23 — consider defining MAX_RESULTS = 50 at the
top of the file.

[POSITIVE] Good use of TypedDict for the agent state — makes the state contract
explicit and easy to understand.

Severity Definitions

Use these consistently so the person receiving the review knows what must be fixed vs. what's optional.

SeverityDefinitionMust fix before merge?
CRITICALWill cause data loss, security vulnerability, or crash in productionYes — block merge
HIGHWill likely cause bugs or failures in productionYes — fix before merge
MEDIUMReduces quality, maintainability, or performanceRecommended — discuss if not fixing
LOWStyle, minor improvements, personal preferenceOptional
POSITIVESomething done well — worth calling outN/A

AI Code Review: Extra Checklist

For code that involves LLM calls, agents, or AI pipelines, run this additional checklist:

Prompt safety

  • User input is never directly concatenated into a prompt without sanitization
  • System prompts are not exposed to users
  • Prompt injection attack surface is minimized

Reliability

  • Every LLM call has a try/except
  • Every LLM call has a timeout
  • There is a fallback response when the LLM fails
  • Retry logic exists for transient failures (rate limits, network errors)
  • There is a hard limit on retry attempts

Cost and performance

  • LLM calls are not made inside unbounded loops
  • Token counts are tracked and logged
  • Context window limits are enforced before making calls
  • Expensive LLM calls are not on hot paths that run on every request

State and determinism

  • LLM outputs are not assumed to be deterministic
  • Structured output parsing has a fallback for malformed responses
  • Agent state is not shared across user sessions
  • Sensitive user data is not persisted in agent state unnecessarily

Observability

  • LLM calls are logged with input/output (or at least metadata)
  • Errors from LLM calls produce useful log messages
  • Token usage is tracked for cost monitoring

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.