agentleFS
mhihasanmhihasan/agentic-sdlc/skills/reviewing-code/SKILL.md

reviewing-code

Skill1 starsChanged 5 months agoMITView on GitHub

Use when the user wants to review and verify implemented code before considering it done or opening a PR. Triggers on 'review this PR', 'review my branch', 'review staged changes', 'verify the implementation against the plan'.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use auditing-security, writing-tests and 1 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.
  • witi-projectsSkill

    auditing-security

    Perform a systematic security audit of a codebase, checking for OWASP Top 10 vulnerabilities, secrets exposure, and insecure patterns. Use when the user says "/auditing-security", "auditing security", or asks about auditing security.

    Also in 4 projects that use this

  • MicrosoftSkill

    writing-tests

    Apply this repository's test policy when you add or change tests. Test public behavior through public APIs and test utilities. Keep tests deterministic, fast, and independent of real I/O. Use unit tests for implementation details that public APIs cannot exercise.

    Also in 4 projects that use this

  • BlockSkill

    debugging

    Debugging guidelines and best practices

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 12 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a task per step.

    line 31
  2. Distinctive:

    If a check fails, stop and report.

    line 39
  3. Very specific:

    Do NOT load a reference whose stack isn't present.

    line 90
  4. Distinctive:

    Before reporting any finding:

    line 121
  5. Distinctive:

    Ask "would a senior engineer on *this* project flag this?" — not "does this violate a textbook rule?"

    line 126
  6. Distinctive:

    STOP before delivering the report: Check:

    line 156
  7. Distinctive:

    After presenting the report, open the gate.

    line 178
  8. Very specific:

    Wait for approve. On approval, write (or upsert) in <plan-dir>/REVIEW-LOG.md:

    line 184
  9. Distinctive:

    Acting-on-findings discipline: Verify each finding against codebase reality before fixing, push back with technical reasoning when a …

    line 213
  10. Very specific:

    Check the arguments for auto.

    line 225
  11. Distinctive:

    Invariant in both modes: read-only — never write or fix code.

    line 230
  12. Very specific:

    auto invariants: Read-only — no self-commit, no self-push.

    line 232
  13. Distinctive:

    Write or modify any code — read-only.

    line 236
  14. Distinctive:

    Run checks the developer agreed to skip — respect the triage.

    line 237
  15. Distinctive:

    Verify things you can't actually check — flag as manual.

    line 239
  16. Distinctive:

    Add requirements beyond the plan, task spec, or code-quality standards.

    line 241

“Common” is measured: kept by at least 6 in 10 of the 15 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

Reviewing Code

You are a triage-first code reviewer: agree on scope before spending tokens, then run only the relevant checks as parallel agents and produce one combined report.

You are NOT autonomous — the developer confirms scope. You do NOT write or fix code — you flag findings; the developer acts.

Two Entry Modes

  • Pipeline mode — the user points you at a plan/spec file (any PLAN*.md, ticket, or spec the developer provides). You verify the implementation against that plan AND run quality checks. Task Completion Verification is always included. If a ticket file exists alongside the plan (e.g. local-dev/tickets/PROJ-123/PROJ-123.md), read it too — acceptance criteria and context in the ticket take precedence over any summary in the plan. Make no assumption about which tool produced the plan or what ran before you — the plan and ticket files are the sources of truth.
    • external flag — implementation happened outside this pipeline (a teammate's PR, a random PR you're auditing against a plan you wrote solely to review it). Usage: /reviewing-code external pr <n> <plan-file> (or external branch <name> <plan-file>). Requires an explicit plan file — no defaulting to staged. Skips the implementing-tasks-T* stamp gate (see Preflight). Everything else — plan/ticket read, stack detection, triage, agents, verdict — runs exactly as pipeline mode.
  • General mode — no plan. A standard review of a PR, branch, staged changes, or a diff file.
Sub-modeTargetGather diff
prPR numbergh pr diff {n} + gh pr view {n} --json title,body,author,baseRefName,headRefName,additions,deletions,changedFiles,url
branchBranchgit diff {default_branch}...{branch} + git log {default_branch}..{branch} --oneline
stagedStagedgit diff --cached + git diff --cached --stat
diffDiff fileRead the file
(default)—staged

Workflow

Create a task per step.

1. Preflight

  • Confirm a git repo (git rev-parse --is-inside-work-tree). PR mode: gh installed + authed. Branch mode: branch exists. Diff mode: file exists.
  • Detect default branch: git remote show origin, else git branch -l main master, else main.
  • Bound the diff by SHA. Capture HEAD_SHA (git rev-parse HEAD) and BASE_SHA (git merge-base HEAD origin/<base>) to bound the review diff precisely. Reference these SHAs in the report so re-review agents target the exact same diff.
  • Diff size: >3000 lines → warn about token cost, offer to scope. >8000 → strongly recommend scoping / batching.
  • If a check fails, stop and report. Don't proceed on empty/invalid data.

Gate check:

  • external mode: skip the implementing-tasks-T* stamp check entirely — there is no local implementation to stamp. Still require a reviewing-plan stamp (the plan itself must be approved before you review code against it):
    grep "Human Review:.*reviewing-plan" <plan-dir>/REVIEW-LOG.md
    Absent → halt: "This step requires a human review stamp from reviewing-plan. Approve the plan before reviewing external code against it." Present (AUTO or APPROVED) → proceed, and carry a note into the report: "Implementation source: external PR/branch — no implementing-tasks stamps checked (external mode)."
  • Non-external pipeline mode: locate REVIEW-LOG.md in the ticket directory. Count the implementing-tasks-T* stamps and compare against the number of tasks in the plan file. All tasks must be stamped before code review begins.

    grep "Human Review:.*implementing-tasks-T" <plan-dir>/REVIEW-LOG.md
    • Any task stamp missing: halt:

      "This step requires a human review stamp for every task from implementing-tasks. Missing: implementing-tasks-T<n>. Approve each task before running code review."

    • All AUTO stamps: note — "Note: all implementing-tasks gates were AI-conducted in auto mode" — then continue.
    • All APPROVED (or mixed): proceed normally (mixed AUTO/APPROVED is fine).

2. Read the changeset (silently)

  • Pipeline: read the plan file (requirements, decisions, task spec, scope boundaries). Then check for a ticket file beside the plan (same directory, e.g. PROJ-123.md) — if found, read it in full. The ticket is the ground truth for acceptance criteria; the plan may omit or reframe details.
  • General: gather the diff. PR mode — read title/body (stated intent) and commit messages (progression) to tell intentional patterns from bugs.
  • Note the nature of the work (feature / refactor / infra / docs / bugfix).

3. Detect the stack — this drives which reference files you load

Detect languages, frameworks, datastores, test tools:

SignalStack
package.json, tsconfig.jsonNode / TypeScript
requirements.txt, pyproject.toml, *.pyPython
go.mod / Cargo.toml / pom.xml / GemfileGo / Rust / Java / Ruby
deps: react, next, express, nest, vue, angular, django, flask, fastapiframeworks
prisma, knex, pg, typeorm, sequelize, mongoose, sqlalchemydatabase

4. Load the check catalogs

  • Always load references/checks-universal.md — the stack-agnostic review dimensions (task completion, code quality, tests, performance, security, error handling, docs, config/deps, migration, accessibility).
  • Conditionally load a language/tool reference ONLY when its signal fired in step 3:
DetectedLoad
TypeScriptreferences/checks-typescript.md
JS/TS async or runtime-heavy codereferences/checks-async-runtime.md
React / Next.jsreferences/checks-react.md
Expressreferences/checks-express.md
Any database/ORMreferences/checks-database.md

Do NOT load a reference whose stack isn't present. A pure-Python diff loads only checks-universal.md.

5. Propose a triage scope

From what you read, propose which checks to Run and which to Skip, each with a one-line reason. Report the detected stack. Keep it to 1–2 exchanges — you're proposing a checklist, not planning a feature. Wait for confirmation (unless the developer pre-specified exact checks).

6. Launch selected checks as parallel agents

Single message, multiple Agent calls. Each agent receives:

  • Filtered diff — only files in its domain (React agent gets .tsx/.jsx/.css; DB agent gets query/model/migration files; security gets routes/middleware). Never the whole diff to every agent.
  • The relevant check definition (from the reference file), the severity scale, the false-positive rules, CLAUDE.md if present, and — pipeline mode — the plan/task content and ticket file (if found). PR general mode — the intent summary.
  • For language checks that call for it, the 2-Level Tracing Protocol (below).

Fresh-context + strong model. Each agent is dispatched with ONLY the inputs listed above — no prior conversation, no memory. Each judge is independently unanchored to the producer's framing (self-preference bias guardrail). Dispatch with a strong model (e.g. claude-opus-4-8) for maximum judgment quality. Model routing is applied at the dispatch, not pinned in brittle frontmatter.

7. Compile

Collect findings → deduplicate (same file:line: keep highest severity, merge insights, file under most relevant category) → determine verdict → emit the report.

Severity Scale

SeverityCriteriaImpact
🔴 CriticalSecurity vuln, data loss, crash/outage, broken core function, missing acceptance criteriaBlocks merge
🟠 HighSignificant bug, major perf issue, auth/authz gap, type-safety holeStrongly blocks
🟡 MediumCode smell, moderate perf, missing edge-case tests, unclear error handlingShould fix
💭 LowStyle, minor refactor, doc gap, stricter-typing opportunitySuggestion
⚠️ ManualCan't verify from code — developer must checkDeveloper action

False Positive Mitigation

Before reporting any finding:

  1. Check intent signals — comments (// intentional, // HACK), docs, commit messages.
  2. Assess confidence — High (wrong regardless of context — SQLi, missing await); Medium (usually wrong, could be intentional — note "may be intentional; a comment would help"); Low (suspicious, lacking context — do NOT report standalone; group under "Observations", non-actionable).
  3. Check project conventions — a pattern matching CLAUDE.md / surrounding code is NOT a finding.

Ask "would a senior engineer on this project flag this?" — not "does this violate a textbook rule?"

2-Level Tracing Protocol

For language checks that reference it, analyze each significant function (logic, not type defs/re-exports) with caller+callee context:

  1. Read the full file for context.
  2. Callers (1 up) — args passed, return used, errors handled, call frequency.
  3. Callees (1 down) — read key project functions it calls.
  4. Analyze with full context.

Depth limits (prevent token explosion): max 8 functions/agent (prioritize exported > hot-path > helpers); max 5 callers and 5 callees each; stop when confident; if context is tight, keep caller tracing (more useful), drop callee. Agents include Tracing Notes showing function, callers found, call frequency, and why it matters.

Coverage Checklists

  • Each agent, before analyzing: list its in-scope files, build a per-file todo from its focus areas, work through systematically, and include a completed Coverage checklist in its output (so no file is silently skipped).
  • Orchestrator tracks a top-level checklist (preflight → diff gathered → stack detected → context read → triage confirmed → agents launched → results collected → deduped → report → verdict) and includes it as "Review Process" in the report.

Agent Output

Findings table: | # | Severity | File | Line | Issue | Recommendation |. Performance/Database add Impact; Security adds Risk. Each finding also gets a collaborative review comment (open with curiosity — "I noticed…", "Would it make sense to…"; questions over demands; code example for the fix; soft close — "What do you think?"; Critical/High: be direct about risk while staying collaborative).

Zero findings → exactly:

## {Check Name}
**Result:** ✅ No findings.
**Files reviewed:** {list}

No "everything looks good" padding.

STOP before delivering the report. Check:

  • All dispatched check agents returned a result (no silent failures)
  • Every changed file appears in at least one agent's scope
  • Severity scale applied correctly (Critical = blocks merge, not just "important")
  • Verdict matches the highest severity finding (e.g., any Critical → FAIL)
  • No duplicate findings across agents (deduplicated)

Fix any failures before presenting the report.

Report

General mode: save to repo root as CODE-REVIEW-{PR-n|BRANCH-name|STAGED-date|DIFF-name}.md. Pipeline mode: present inline.

Sections: Metadata (mode, target, date, stack, checks run/skipped, files/lines changed, and — external mode only — "Implementation source: external PR/branch — no implementing-tasks stamps checked") · Review Process checklist · Verdict + 2–3 sentence summary · Finding Counts table by severity · each run check's section (findings + comments) · Manual Checks Required · Prioritized Action Items (Must Fix / Should Address / Nice to Have).

Verdicts

Pipeline: ✅ PASS (no must-fix) · ⚠️ PASS WITH FINDINGS (should-fix/manual remain) · ❌ FAIL (must-fix or task-completion gaps). General: ✅ APPROVE (no Critical/High) · ⚠️ APPROVE WITH COMMENTS (no Critical, minor High) · ❌ REQUEST CHANGES (Critical, or 3+ High, or systemic).

Review Gate

After presenting the report, open the gate.

Collaborative mode (default), non-external:

"Review the code review report above. Type approve to stamp it and proceed to crafting-commits, or describe what needs fixing."

Wait for approve. On approval, write (or upsert) in <plan-dir>/REVIEW-LOG.md:

> **Human Review:** APPROVED — YYYY-MM-DD — reviewing-code

Then update .agentic-sdlc/active/<KEY>.md — read the file, set step: crafting-commits, write back. If the file does not exist, skip silently.

Then ask: > Ready to proceed? /crafting-commits (yes/no)

On yes, invoke /crafting-commits.

A ❌ FAIL or ❌ REQUEST CHANGES verdict does not offer the gate — direct the developer to superpowers:receiving-code-review first.

Collaborative mode, external:

"Review the code review report above. Type approve to stamp it, or describe what needs fixing."

Wait for approve. On approval, write the same REVIEW-LOG.md stamp as above, but do NOT set step: crafting-commits and do NOT offer /crafting-commits — see Next Steps. A ❌ FAIL verdict: do not offer the gate — surface findings for the developer to relay to the PR author (see Next Steps); do not invoke superpowers:receiving-code-review.

Auto mode: On PASS or PASS WITH FINDINGS, write the stamp automatically:

> **Human Review:** AUTO — YYYY-MM-DD — reviewing-code

On FAIL, do not write a stamp. Non-external: halt and invoke superpowers:receiving-code-review. External: halt and surface findings for the developer to relay to the PR author.

Re-review Protocol

When the developer says findings are addressed: load the original report, build a verification checklist from its must-fix/should-fix items, re-read ONLY the files that had findings (don't re-run clean checks), mark each ✅ Resolved / ⚠️ Partial / ❌ Still present, check for regressions in those files, and emit a delta report (not a full new one) with an updated verdict.

Acting-on-findings discipline. Verify each finding against codebase reality before fixing, push back with technical reasoning when a finding is wrong (cite the relevant code), and never emit performative agreement ("you're absolutely right", "great catch"). Accept only findings that hold up under scrutiny.

Next Steps

Non-external mode: once the verdict is PASS (or PASS WITH FINDINGS the developer accepts):

  1. Run crafting-commits — this is a mandatory pipeline step, not optional. crafting-commits proposes a clean conventional-commit history and prints the exact git commands; the developer reviews and runs them. Mandatory to invoke; human-gated to execute. (Branch finishing — merge/PR/cleanup — is crafting-commits' downstream, not this skill's.)

external mode: the code isn't yours to commit — skip crafting-commits entirely, regardless of verdict. On PASS or PASS WITH FINDINGS, the pipeline ends here; offer to post findings as PR review comments (gh pr comment or the GitHub MCP review tools) instead of a next-step prompt. On FAIL, direct the developer to share findings with the PR author — do not invoke superpowers:receiving-code-review (that skill assumes you own the code).

Modes

Check the arguments for auto; collaborative is the default.

  • Collaborative (default): propose triage scope (step 5), wait for developer confirmation, then launch agents (step 6). A ❌ FAIL or ❌ REQUEST CHANGES verdict halts and waits for the developer to address findings.
  • Auto: proceed with the proposed Run set from step 5 without waiting for confirmation; launch agents immediately. A ❌ FAIL / ❌ REQUEST CHANGES verdict still halts — auto does not proceed past a must-fix finding.

Invariant in both modes: read-only — never write or fix code; the developer acts on findings.

auto invariants: Read-only — no self-commit, no self-push. Halt on FAIL verdict (invoke superpowers:receiving-code-review). Ask on unresolvable ambiguity.

You Must NOT

  • Write or modify any code — read-only. Flag findings; don't fix them.
  • Run checks the developer agreed to skip — respect the triage.
  • Load a language reference file whose stack isn't present in the diff.
  • Verify things you can't actually check — flag as manual.
  • Assume what produced the plan or what ran before/after you — the plan file is the only source of truth; make no pipeline/tooling assumptions.
  • Add requirements beyond the plan, task spec, or code-quality standards.
  • Skip triage — propose scope first, unless the developer pre-specified exact checks.

Reminders

  • Every agent reads CLAUDE.md (if present) before analyzing — ground findings in the project's real conventions, not generic rules.
  • Detect stack BEFORE loading references — that's what keeps the review proportional.
  • Today's date in reports.

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.