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

code-review

Skill2 starsChanged 51 days agoMITView on GitHub

Use when requesting review for code changes, evaluating review feedback, pushing back against incorrect suggestions, or verifying review fixes. Don't use for automated test execution (use testing-patterns) or lint fixing (apply the lint fix directly and verify with the linter's own command).

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

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

  • 0

    Common

    Most of the 184 edited versions we read keep these.

  • 13

    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:

    Follow these core principles:

    line 14
  2. Distinctive:

    Verify before implementing.

    line 17
  3. Distinctive:

    Do not interleave modes. Steps 1 through 4 belong exclusively to Request mode or the first half of End-to-end mode.

    line 35
  4. Distinctive:

    Follow this procedure to extract commit boundaries and validate git references:

    line 43
  5. Distinctive:

    If git rev-parse fails or if the diff contains zero changes, stop execution immediately.

    line 56
  6. Distinctive:

    When no spec exists, ask the user.

    line 68
  7. Distinctive:

    If the specification is marked unavailable, dispatch only the Standards sub-agent.

    line 117
  8. Distinctive:

    Never rerank findings across axes.

    line 126
  9. Distinctive:

    Follow this six-step loop for every review item:

    line 141
  10. Distinctive:

    Read. Process the entire review item without defensive or emotional reactions.

    line 142
  11. Distinctive:

    Verify. Inspect the codebase, git history, and tests to confirm whether the premise matches reality.

    line 144
  12. Very specific:

    If taking an intentional shortcut with a known limit, mark it in code using shortcut: <the limit>, <when to upgrade>.

    line 158
  13. Distinctive:

    Test each fix individually.

    line 160
  14. Distinctive:

    Verify failure behavior. Inspect whether the code fails loudly and safely when downstream services, network calls, or invalid parameters …

    line 171

“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

Unify requesting and receiving code review into a single disciplined workflow. Catch regressions early, protect architectural boundaries, and evaluate all review feedback against codebase reality before applying fixes.

Overview and core principles

Review code with technical rigor rather than emotional performance or unverified agreement.

Follow these core principles:

  • Review early, review often. Request review after each discrete task or major feature to prevent compounding defects.
  • Two-axis separation. Review changes independently across Standards (repo standards and baseline code smells) and Spec (originating issue or requirements). Run axes in parallel sub-agents to prevent context pollution.
  • Verify before implementing. Never accept reviewer suggestions blindly. Check codebase truth and test suites first.
  • Technical correctness over social comfort. Maintain skepticism. Push back with concrete facts when suggestions degrade architecture.
  • Adversarial disproof. Apply doubt-driven evaluation. Never assume code is correct because it looks clean or passes happy-path tests. Actively formulate disproof hypotheses showing where invariants could break.
  • Structural audit depth. Consult references/architectural-lenses.md for classical engineering lenses, logic defects, and Fowler code smell baseline.
  • Comment hygiene. Consult references/comment-hygiene.md to prune AI conversational narration while preserving critical business context.
  • Feedback discipline. Consult references/feedback-protocol.md for counter-arguments, YAGNI verification, and anti-performative response rules.
<HARD-GATE> Write-Target Boundary. In Request mode, write only to `.agents/state/code-review/`. In Feedback mode, modify only files that appear in the reviewed commit range. Never refactor working logic outside the reviewed commit range, change formatting conventions across unreviewed files, or run destructive git commands (`reset --hard`, `rebase -i`, `push --force`). Do not modify files owned by the `conventional-commit` or `pull-request` skills' write targets. </HARD-GATE>

Modes

Select one operating mode before Step 1:

  • Request mode (default). Run Steps 1 through 4 to dispatch and aggregate review findings. Emit .agents/state/code-review/review.md.
  • Feedback mode. Run Steps 5 and 6 only, consuming .agents/state/code-review/review.md if it exists. Emit .agents/state/code-review/feedback-response.md.
  • End-to-end mode. Run Steps 1 through 6 in sequence.

Do not interleave modes. Steps 1 through 4 belong exclusively to Request mode or the first half of End-to-end mode. Steps 5 and 6 belong exclusively to Feedback mode or the second half of End-to-end mode.

Phase 1. Requesting code review

Dispatch isolated reviewer sub-agents across Standards and Spec axes to catch defects before they cascade downstream.

Step 1. Commit boundary extraction and pre-flight validation

Follow this procedure to extract commit boundaries and validate git references:

  1. Identify the fixed point reference, such as a commit SHA, branch name, tag, or merge base. When unspecified, prompt the user for the reference.
  2. Resolve commit references:
git rev-parse --verify "${FIXED_POINT}"
BASE_SHA=$(git merge-base "${FIXED_POINT}" HEAD)
HEAD_SHA=$(git rev-parse HEAD)
  1. Inspect diff statistics and verify that the target diff is non-empty:
git diff --stat "${BASE_SHA}"..."${HEAD_SHA}"

If git rev-parse fails or if the diff contains zero changes, stop execution immediately.

Completion criterion. Target ref is verified with git rev-parse, merge base is resolved, and the diff is confirmed non-empty.

Step 2. Spec and standards discovery

Identify the inputs for each review axis before dispatching sub-agents:

  1. Identify specification sources in order of priority:
  • Issue references in commit messages matching patterns like #123, Closes #45, or GitLab !67.
  • Explicit path or URL passed by the user.
  • Spec files in docs/ or specs/ matching the branch or feature name. When no spec exists, ask the user. If unavailable, mark the Spec axis as skipped.
  1. Identify standards sources:
  • Repo guideline files including CODING_STANDARDS.md or CONTRIBUTING.md.
  • Baseline Fowler code smells in references/architectural-lenses.md section 3. Repo standards always override the baseline.

Completion criterion. Specification text and repository standards files are located or explicitly marked unavailable.

Step 3. Two-axis parallel reviewer dispatch

Dispatch the Standards and Spec reviewer sub-agents in parallel using templates in references/code-reviewer-prompt.md. Pass each sub-agent the following invariant envelope without paraphrasing or summarizing:

# STANDARDS ENVELOPE (DO NOT MODIFY)
axis: standards
diff_command: "git diff BASE_SHA...HEAD_SHA"
commit_log_command: "git log BASE_SHA..HEAD --oneline"
base_sha: "<sha>"
head_sha: "<sha>"
standard_files:
  - "<explicit path 1>"
  - "<explicit path 2>"
smell_reference: "skills/code-review/references/architectural-lenses.md#section-3"
required_output_schema:
  - "id"
  - "tier"
  - "file"
  - "line"
  - "finding"
  - "suggested_fix"
word_budget: 400
# SPEC ENVELOPE (DO NOT MODIFY)
axis: spec
diff_command: "git diff BASE_SHA...HEAD_SHA"
spec_source: "<explicit path or URL or 'unavailable'>"
required_output_schema:
  - "id"
  - "tier"
  - "file"
  - "line"
  - "spec_quote"
  - "finding"
  - "suggested_fix"
word_budget: 400

If the specification is marked unavailable, dispatch only the Standards sub-agent.

Completion criterion. Both sub-agents are dispatched concurrently with verified diff parameters and strict 400-word budget constraints.

Step 4. Independent axis aggregation and triage

Aggregate findings from both sub-agents without merging or cross-ranking findings:

  1. Present findings under separate ## Standards and ## Spec markdown sections.
  2. Never rerank findings across axes. Code that follows all standards may still fail the specification, and code that implements the specification may violate repository conventions.
  3. Conclude with a single summary line reporting total findings per axis and the highest-severity issue within each separate axis.
  4. Categorize findings within each axis into three priority tiers:
  • Critical. Bugs, broken functionality, security risks, or violated specification invariants. Fix these immediately.
  • Important. Missing error handling, architectural debt, smell baseline issues, or test gaps. Address these before merging.
  • Minor. Style inconsistencies or documentation improvements. Address these after functional items pass.

Completion criterion. .agents/state/code-review/review.md exists on disk. The file contains two top-level sections, ## Standards and ## Spec. Every finding under each section is a table row with columns ID | Tier (Critical|Important|Minor) | File | Line | Finding | Suggested fix. The ## Spec section is omitted (with an explicit spec: skipped line) only if Step 2 marked the Spec axis unavailable.

Phase 2. Evaluating and receiving feedback

Review comments represent hypotheses to evaluate, not unilateral commands to execute. Process every piece of feedback through deliberate verification. Consult references/feedback-protocol.md for detailed rules on banned performative agreement, ambiguity clarification, YAGNI verification, and technical pushback.

Step 5. Feedback verification and pushback loop

Follow this six-step loop for every review item:

  1. Read. Process the entire review item without defensive or emotional reactions.
  2. Understand. Restate the core technical requirement in your own words.
  3. Verify. Inspect the codebase, git history, and tests to confirm whether the premise matches reality.
  4. Evaluate. Assess whether the proposed change is technically sound for this specific stack.
  5. Respond. Provide a factual technical response or reasoned pushback.
  6. Plan remediation. Queue approved modifications for Step 6 and run tests after each subsequent edit.

Completion criterion. All review comments verified against codebase truth, recorded in .agents/state/code-review/feedback-response.md, with ambiguous items clarified and grounded counter-arguments formulated where architecture is degraded.

Step 6. Surgical remediation and regression pass

Execute accepted review changes methodically to avoid compound regressions:

  • Clarify ambiguous items first before touching code.
  • Fix blocking and critical bugs first: resolve broken tests and security concerns before other edits.
  • Grep all callers before editing shared functions to fix the root cause once across all call sites.
  • Apply simple localized fixes second, such as typos, imports, or boundary checks.
  • If taking an intentional shortcut with a known limit, mark it in code using shortcut: <the limit>, <when to upgrade>.
  • Address complex refactorings and structural modifications last.
  • Test each fix individually. Run targeted test suites immediately after modifying each file.
  • Execute full test suites and linters after all items are resolved to confirm zero regressions.

Completion criterion. Accepted fixes implemented one by one, each verified by targeted test runs, followed by a clean full test suite pass.

Adversarial falsification protocol

Reviewers must not evaluate code solely on happy-path execution or cosmetic cleanliness. When auditing diffs touching core business logic, permissions, migrations, or shared utilities:

  1. Formulate a failure hypothesis. Ask: under what boundary condition or concurrent state will this change corrupt data or throw unhandled exceptions?
  2. Trace the blast radius. Grep all call sites to verify that changed return types, modified parameter orders, or altered error contracts do not break downstream consumers.
  3. Verify failure behavior. Inspect whether the code fails loudly and safely when downstream services, network calls, or invalid parameters arrive.
  4. Challenge unverified assertions. When a pull request author asserts "this cannot happen", require concrete evidence (a failing-then-passing test or compiler constraint) before accepting the assertion.

Completion criterion. High-stakes review items evaluated with explicit disproof hypotheses and verified downstream blast radius.

Quick audit checklist

Review this table before completing the code review:

IDTitlePattern descriptionWhy it failsConcrete fix
CR-1Performative agreementResponds with "You're absolutely right!" or "Great catch!" instead of a technical statementMasks whether the agent verified the suggestion; trains the user to expect praise instead of evidenceState the factual finding and file path; cite the verification step
CR-2Blind implementationApplies a reviewer suggestion without inspecting codebase truthMay break existing behavior that the reviewer did not considerRun the review protocol Steps 5.1-5.6; verify against tests and callers
CR-3Fix batchingApplies all findings in one edit and tests once at the endRegressions compound and become hard to attributeImplement one item at a time; run targeted test after each
CR-4Unverified claim of fixStates the fix is done without a targeted test runUser deploys broken code believing it is fixedRun verification-before-completion after each fix
CR-5Pushback without factsDisagrees based on preferenceErodes trust and hides real defectsCite tests, benchmarks, or architectural constraints
CR-6Skipped clarificationImplements ambiguous items while others remain unclearOrder of operations may invalidate already-applied fixesApply the clarification protocol; hold all changes until ambiguity resolves
CR-7Speculative abstractionAdds config flags or exports with no call sitesViolates YAGNI and adds maintenance surfaceGrep for call sites first; reject if zero
CR-8Happy-path reviewReviews without adversarial falsification on high-stakes diffsBoundary, permission, or migration defects ship undetectedApply the Adversarial falsification protocol before completion

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.