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

code-review

Skill0 starsChanged 7 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.

194 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use close-spec, design-with-images 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.
  • dzhngSkill

    close-spec

    When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

    Also in 5 projects that use this

  • dzhngSkill

    design-with-images

    Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.

    Also in 5 projects that use this

  • PydanticSkill

    add-new-model

    Add support for a newly-released language or image generation model in pydantic-ai (e.g. openai:gpt-5.6, anthropic:claude-sonnet-5, openai:gpt-image-2). Use when a provider ships a new model id and you need to wire literals, profile flags, adapters, and tests to recognize it. Handles SDK-lag, gateway list conventions, capability probing, and direct image-model geometry.

    Also in 9 projects that use this

  • transitive-bullshitSkill

    compare-screenshots

    Compare screenshots against the intended design, distinguishing approved references from historical baselines. Use for iterative implementation matching, before/after visual review, objective image telemetry, or checking a lone capture for flat, empty, or badly framed content.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    azsdk-common-apiview-feedback-resolution

    Analyze and resolve APIView review feedback on Azure SDK PRs. **UTILITY SKILL**. USE FOR: APIView comments, API review feedback, SDK API surface changes. DO NOT USE FOR: general code review, non-APIView feedback. INVOKES: azure-sdk-mcp:azsdk_apiview_get_comments, azure-sdk-mcp:azsdk_customized_code_update, azure-sdk-mcp:azsdk_typespec_delegate_apiview_feedback, azure-sdk-mcp:azsdk_run_typespec_validation, azure-sdk-mcp:azsdk_package_generate_code.

    Also in 6 projects that use this

  • Microsoft AzureSkill

    azsdk-common-generate-sdk-locally

    Generate and finalize Azure SDKs locally from TypeSpec, including build, checks, tests, changelog, metadata, and version updates by default. WHEN: "generate SDK locally", "build SDK", "run SDK tests", "run CI checks", "validate package", "run checks", "update changelog", "fix SDK build errors", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version". INVOKES: azsdk_verify_setup, azsdk_package_generate_code, azsdk_package_build_code, azsdk_package_run_check, azsdk_package_run_tests, azsdk_customized_code_update, azsdk_package_update_changelog_content, azsdk_package_update_metadata, azsdk_package_update_version.

    Also in 6 projects that use this

  • +4 more from dzhng
  • +2 more from Azure

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 184 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 184 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.