agentleFS
magnus919magnus919/agent-skills/code-review/SKILL.md

code-review

Skill172 starsChanged 4 months agoMITView on GitHub

Review a code change for correctness, security, maintainability, and test adequacy, and reach a defensible verdict. Use when reviewing a pull request, diff, patch, or AI-generated change; when scoping an oversized review into reviewable units; when writing or triaging review comments; when assigning reviewers or setting review policy; or when investigating why a defect escaped review. Covers change sizing and attention budgets, risk-tiered checklists, severity-labeled comments, verdict and residual-risk records, review metrics that resist gaming, and the measured limits of checklists and AI reviewers. Do not use for implementing the requested change, root-cause debugging of a failing test or incident (use systematic-debugging), security assessment of a whole system (use security-audit-methodology), designing new code securely (use secure-software-engineering), architecture review across systems (use software-architecture), or reverse-engineering an unfamiliar codebase (use software-architecture-analysis).

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

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 14 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 184 edited versions we read keep these.

  • 14

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before reading the diff, establish four things.

    line 68
  2. Distinctive:

    Read what the change claims to do, then read the diff.

    line 84
  3. Very specific:

    If the description is a restatement of the code ("adds parseHeader"), it is not intent.

    line 88
  4. Distinctive:

    Run the scope tool. It reports size, file classes, risk-bearing paths by convention, whether source files moved with tests, and an …

    line 93
  5. Distinctive:

    Use its output for three decisions:

    line 107
  6. Distinctive:

    If the change is oversized, write a review plan and ask for it to be split or stacked.

    line 119
  7. Distinctive:

    Do not review formatting a linter already enforces.

    line 144
  8. Distinctive:

    Run the test that is supposed to prove the behavior, and confirm it fails without the change when that is cheap to do.

    line 152
  9. Distinctive:

    Read the code the change calls, not just the code it modifies.

    line 156
  10. Distinctive:

    Check the rollback path actually exists.

    line 157
  11. Distinctive:

    Every finding carries a severity label, and blocking findings carry both evidence and a verification method:

    line 164
  12. Distinctive:

    If the change grows materially after approval, the approval lapses.

    line 202
  13. Distinctive:

    When a defect escapes, treat the escape as evidence about the review process, not about the reviewer's character: see the review metrics …

    line 203
  14. Distinctive:

    Do not credit a model's review of its own output as independent verification.

    line 219
  15. Distinctive:

    Read the routing table as ownership, not as prerequisites: review judgment stays here, and the specialist skill supplies the depth for its …

    line 244

“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

Review is a decision about a change, supported by evidence a second person gathered independently. Everything else — the comment count, the approval ritual, the review template — is scaffolding around that decision.

Two facts shape the method in this skill:

  • Review catches what a reviewer can hold in working memory. Effectiveness falls as changes grow and sessions run long, so scope and attention are the first decisions, not the last.
  • Most review comments are about evolvability, not defects. That is a fine use of review, but it means "approved" is a statement about the evidence examined, never proof that the change is correct.

The reviewer's job is to say precisely what was examined, what was found, what was decided, and what remains unknown.

When to use this skill

  • A pull request, patch, or diff needs a verdict.
  • A change is too large to review in one pass and needs scoping or splitting.
  • Review comments need triage, severity labels, or rewriting so they are actionable.
  • A team needs reviewer assignment, review policy, or review-latency norms.
  • A defect reached production and the question is what review missed.
  • A model produced candidate review comments that a human must accept or discard.

When not to use this skill

  • The task is to fix the defect the review found — that is implementation work in the owning engineering skill.
  • The task is to find the cause of a failure: route to systematic-debugging.
  • The task is a whole-system security assessment: route to security-audit-methodology.
  • The task is to design a new system or subsystem securely: route to secure-software-engineering and software-architecture.
  • The task is architecture review across systems rather than a change: route to software-architecture.
  • The task is to understand an unfamiliar codebase: route to software-architecture-analysis.

The review contract

Before reading the diff, establish four things. If any is missing, ask for it — this is the cheapest possible review comment.

ElementQuestionFailure if missing
DecisionWhat will this review authorise — merge, promote, release, incident closure?The review optimizes for the wrong risk
AuthorityComment-only, approve, or approve-and-merge?Reviewer implies authority they lack
Intent artifactIssue, spec, ADR, or PR description stating the intended behaviorReviewer reviews the code against their imagination
EvidenceTest output, runnable command, or artifact the author supplied"Tests pass" is taken on faith

Record the contract in the review record. See the review record template.

The review loop

1. Read the intent before the diff

Read what the change claims to do, then read the diff. The gap between them is a finding class of its own: behavior described but not implemented, implementation that does more than described, and scope that drifted into unrelated files.

If the description is a restatement of the code ("adds parseHeader"), it is not intent. Ask what problem the change solves and who is affected.

2. Scope the change with evidence, not impressions

Run the scope tool. It reports size, file classes, risk-bearing paths by convention, whether source files moved with tests, and an attention budget:

python3 scripts/review_scope.py --base origin/main --head HEAD --markdown
python3 scripts/review_scope.py --base origin/main --head HEAD --json

# Reviewing an already-merged squash commit (or any single commit)
python3 scripts/review_scope.py --base <merge-sha>^ --head <merge-sha>

# Project-specific build output that the default markers do not know
python3 scripts/review_scope.py --base origin/main --head HEAD --exclude 'reports/*.json'

Use its output for three decisions:

  • Tier the risk. A 40-line authorization change outranks a 900-line test refactor. Risk-bearing paths and change type set the tier, not line count. Use the risk-tiered checklist.
  • Set the budget. Roughly 300 effective lines per hour is the conservative planning rate; sessions past about an hour stop paying. If the estimate exceeds one session, split the review or ask for a split change.
  • Order attention. Risk-bearing and behavioral code first. Generated files, lockfiles, and vendored code are inspected for provenance, not read line by line. Exclusion is a claim about provenance: if a path is generated, say what generates it.

If the change is oversized, write a review plan and ask for it to be split or stacked. Reviewing an oversized diff in one pass produces an approval that covers less than it appears to.

3. Orient in one pass

Skim the whole diff once, without commenting, to learn its shape: entry points, changed interfaces, new dependencies, data changes, test changes. Note file names as you go. This pass exists so the second pass has a map.

4. Review in depth by attention order

Work through units in the order the scope tool suggests. For each unit, ask the questions in the defect taxonomy rather than reading line by line:

  1. Correctness — does it do the stated thing for valid input, and what happens at the boundaries?
  2. Failure paths — errors, timeouts, partial writes, retries, cancellation.
  3. Trust boundaries — untrusted input reaching a privileged sink; identity and authorization checked on the object being touched.
  4. Compatibility — callers, stored data, wire contracts, configuration defaults.
  5. Test adequacy — do the tests assert the behavior, including the denial and failure cases?
  6. Operability — can an operator distinguish success from failure later?

Do not review formatting a linter already enforces. Do not restate the diff as comments. If a unit is too large to hold, stop and ask for a split.

5. Gather independent evidence

Review is weaker than it looks when the reviewer only reads. Add at least one piece of evidence the author did not supply when the change is T2 or above:

  • Run the test that is supposed to prove the behavior, and confirm it fails without the change when that is cheap to do.
  • Exercise the boundary the change claims to guard — empty input, wrong tenant, missing header.
  • Read the code the change calls, not just the code it modifies.
  • Check the rollback path actually exists.

State what you could not verify. "Not exercised in this environment" is an honest and useful line in a review record; silence implies coverage you did not have.

6. Write findings the author can act on

Every finding carries a severity label, and blocking findings carry both evidence and a verification method:

- [blocking] <claim> — evidence: <path:line or observation> — verify: <test or check>
- [should-fix] <claim> — evidence: <...>
- [question] <what the diff cannot tell you>
- [nit] <optional polish>
- [praise] <what to keep>

One claim per comment. Name the requirement, not a rewrite. A comment that says "this is confusing" transfers the analysis back to the author; a comment that names the missing case does not.

Comment discipline, tone, and disagreement handling: see the comment quality reference. Reusable sheet: comment set template.

7. Decide the verdict

VerdictAssertsRequires
APPROVEExamined scope is correct and complete enough for the decisionNo open blocking findings; residual risk recorded
APPROVE WITH COMMENTSMergeable now; the comments do not need to blockNo open blocking findings; non-blocking items have owners
REQUEST CHANGESAt least one finding must be fixed before mergeEvery blocking finding has evidence and a verification method
NEEDS MORE EVIDENCEYou cannot decide yet, and here is what is missingThe specific evidence gap, and who can supply it

A verdict is a claim about the evidence you examined. It is not a claim about the whole system, and it does not transfer to changes you did not see. Record residual risk and explicitly unreviewed scope with the verdict; run python3 scripts/review_record_check.py <record.md> to confirm the record does not contradict itself.

8. Close the loop

  • Re-review increments, not the whole change again. Confirm each blocking finding is fixed and verified, rather than merely edited.
  • Resolve or explicitly defer every non-blocking finding with an owner.
  • If the change grows materially after approval, the approval lapses. Say so.
  • When a defect escapes, treat the escape as evidence about the review process, not about the reviewer's character: see the review metrics reference.

Reviewing AI-generated and AI-reviewed changes

Two distinct problems, often confused:

  • AI wrote the change. The risks are plausible-but-wrong code, tests overfitted to the implementation, invented APIs, and unexamined dependencies. Require the tests to be derived from the requirement, not from the patch, and review provenance and new dependencies explicitly.
  • AI reviewed the change. Model output is a candidate finding list, not a verdict. Findings without a locator and evidence are dropped, not softened. Automation bias — accepting a machine suggestion because it is fluent — is the failure mode to guard against.

Do not credit a model's review of its own output as independent verification. See the AI-assisted review reference and the AI pre-review brief template.

Routing to the skills that own adjacent work

When the review needs…Route to
Judgment about design, naming, coupling, or refactoring qualityprogramming-principles
Independence model, test adequacy, mutation evidence, AI code quality gatesqa-methodology
A pass/fail verdict against explicit acceptance criteriaverification-methodology
Threat modeling or secure design for new codesecure-software-engineering
Whole-system security assessment or vulnerability classificationsecurity-audit-methodology
Root cause of a failure found during reviewsystematic-debugging
Architecture-level tradeoffs or cross-system reviewsoftware-architecture
API or event contract compatibility and deprecationapi-design-and-evolution
Schema, migration, or pipeline correctnessdata-engineering, data-architect
Performance evidence and regression benchmarksperformance-optimization
Release gates, rollout, rollback, and change-failure metricsrelease-engineering
Documentation quality in the changetechnical-documentation
Accessibility review of UI changesweb-accessibility
Privacy impact of data-handling changesprivacy-engineering
Durable decision record for a consequential choiceadr-authoring
Adversarial multi-perspective judgment on a contested changeagent-council
End-to-end delivery discipline for the change itselfneckbeard

Read the routing table as ownership, not as prerequisites: review judgment stays here, and the specialist skill supplies the depth for its own domain.

Honest limits

  • Review is not a defect filter with a known recall. It catches some classes well and misses others; treat a clean review as evidence of examination, not of correctness.
  • Checklist coverage is not defect coverage. A ticked box records that a question was asked.
  • Comment volume, approval rate, and review count are not quality measures. They are activity measures that improve when the process gets worse.
  • The scope tool classifies paths by convention. It cannot see semantics, and a risky change in an innocuously named file will not be flagged.

Completion criteria

The review is complete when the record states scope, evidence, labeled findings with evidence and verification, a verdict consistent with those findings, an explicit coverage level, residual risk, and explicitly unreviewed scope — and the record passes scripts/review_record_check.py. Stop when the budget is spent rather than skimming the remainder; reschedule or split instead of pretending coverage.

Files in this skill

FileUse
references/evidence-base.mdWhat the research actually shows about review effectiveness, size, latency, and AI review
references/review-scoping-and-depth.mdChange sizing, tiers, attention allocation, incremental and stacked review
references/defect-taxonomy.mdWhat to look for by defect class, with detection and false-positive traps
references/comment-quality-and-communication.mdSeverity taxonomy, actionable comment structure, disagreement and tone
references/verdicts-and-evidence.mdVerdict semantics, approval authority, residual risk, evidence boundaries
references/ai-assisted-review.mdModel-written and model-reviewed changes, automation bias, provenance
references/review-metrics.mdReview latency, size, defect escape, and which metrics are gameable
references/source-index.mdDated sources behind the claims in this skill
templates/review-record.mdDurable record of scope, evidence, findings, verdict, residual risk
templates/review-plan.mdSplit and schedule an oversized review
templates/comment-set.mdSeverity-labeled comment sheet with worked examples
templates/risk-tier-checklist.mdRisk-tiered questions, each naming the evidence that answers it
templates/ai-review-brief.mdBrief for a model doing candidate-finding pre-review
scripts/review_scope.pyDeterministic diff scope, risk flags, test mapping, attention budget
scripts/review_record_check.pyValidate a review record for completeness and verdict consistency
scripts/test_review_scope.pyTests for the scope tool against real temporary repositories
scripts/test_review_record_check.pyTests for the record checker, including the shipped template

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.