code-review
Skill0 starsChanged 7 months agoMITView on GitHub
Staged code review — runs tests, extracts intent, dispatches 3 specialist agents (state-enumeration bug detection, project rule compliance, history + regression detection), then verifies findings with type-stratified confidence thresholds. Works on git diff (pre-commit) or PR diff. Use when user says 'code review', 'review this code', 'review changed code', 'review for regressions', 'check for bugs', 'is this good code', 'review what I just wrote'. Do NOT use for plan review (use /plan-review). Do NOT use for security/dead code scanning (use /code-security). Do NOT use for edge case auditing (use /code-edges). Do NOT use for pre-refactor impact analysis (use /code-blast-radius). Do NOT use for style cleanup or simplification (use /code-review).
194 other projects use a version of this.
Adopted by
Most recently taken up by
- doggy8088/spec-kittheir own version, first seen Nov 9, 2026
- strelov1/freehiretheir own version, first seen Nov 9, 2026
- storybookjs/storybooktheir own version, first seen Nov 8, 2026
- codewithmukesh/dotnet-claude-kittheir own version, first seen Nov 8, 2026
- supabase/supabasetheir own version, first seen Nov 8, 2026
- The-Vibe-Company/quivrtheir own version, first seen Nov 8, 2026
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.
dzhngSkillclose-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
dzhngSkilldesign-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
PydanticSkilladd-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-bullshitSkillcompare-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 AzureSkillazsdk-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 AzureSkillazsdk-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
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- mattpocock/skills★ 309ksame name
- TheAlgorithms/Python★ 226ksame name
- microsoft/vscode★ 195ksame name
- github/spec-kit★ 149ksame name
- ggml-org/llama.cpp★ 134ksame name
- supabase/supabase★ 115ksame name
- storybookjs/storybook★ 91ksame name
- shareAI-lab/analysis_claude_code★ 80ksame name
- shareAI-lab/learn-claude-code★ 80ksame name
- vectorize-io/hindsight★ 60ksame name
184 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- 5x5Skill
- business-planSkill
- chart-forgeSkill
- code-blast-radiusSkill
- code-edgesSkill
- code-preflightSkill
- code-securitySkill
- hail-marySkill
- organizeSkill
- plan-capacitySkill
- plan-directionsSkill
- plan-reviewSkill
- postmortemSkill
- research-critiqueSkill
- research-searchSkill
- session-auditSkill
- session-driftSkill
- skill-builderSkill
- skill-evalSkill
- ui-ideasSkill
- update-prSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
39 rules. 0 are common, 30 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 184 edited versions we read keep these.
30
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Read CLAUDE.md, REVIEW.md, and all @-imported rules files BEFORE launching review agents.
- Distinctive: line 32
Never invent data. If you need to reference a function's output or API response, read the actual source — do not estimate or fabricate.
- Very specific: line 51
Check REVIEW.md for a test_command: directive → run that command
- Distinctive: line 52
No runner found → skip with note "No test runner detected — skipping baseline"
- Distinctive: line 56
If tests FAIL: record the failure output.
- Very specific: line 58
If tests PASS: record Tests: PASS for the report header.
- Distinctive: line 59
If linter/analyzer has errors (not warnings): record as context for agents.
- Distinctive: line 61
Do NOT abort the review if tests fail — the diff may contain the fix.
- Very specific: line 66
Run gh pr diff to get the changes
- Very specific: line 67
Run gh pr view to get the PR description and title
- Distinctive: line 71
Use that as the scope
- Distinctive: line 75
Run git diff for unstaged changes
- Distinctive: line 76
If empty, run git diff --cached for staged changes
- Very specific: line 77
If empty, run git diff HEAD~1 for the most recent commit
- Distinctive: line 78
If all empty, ask the user what to review
- Very specific: line 109
Read CLAUDE.md in the project root.
- Distinctive: line 112
Read REVIEW.md in the project root if it exists.
- Distinctive: line 192
If state A and state B must be consistent, is there a window where they aren't?
- Distinctive: line 193
If a resource is held, is it held across the entire critical section?
- Distinctive: line 202
If function A must be called before function B, is that enforced?
- Distinctive: line 208
Do NOT report style issues, naming preferences, or simplification opportunities.
- Distinctive: line 209
Only report bugs traceable to a specific state violation through a specific path.
- Distinctive: line 211
If Phases 1-3 found no violations, report "CLEAN — no state-based bugs found."
- Distinctive: line 221
If REVIEW.md exists and contains causal bug patterns ("when you see X, check for Y because Z"), actively check for Y in the diff — these …
- Very specific: line 233
Run git log --oneline -20 -- <file> and git blame on the modified files
- Distinctive: line 234
Check: was this code recently fixed for the same kind of issue?
- Distinctive: line 235
Check: does the blame show this area has been a repeated source of bugs?
- Distinctive: line 236
Check: are the changes reverting or contradicting recent intentional fixes?
- Very specific: line 241
Read comments on those PRs (use gh api repos/{owner}/{repo}/pulls/{number}/comments)
- Distinctive: line 242
Check if any prior review comments apply to the current changes — is the author making the same mistake that was flagged before?
- Very specific: line 250
If gh CLI is not available, skip the PR comment analysis and note it in the output.
- Distinctive: line 251
If no prior PRs touched these files, return only git history findings (or empty if none).
- Distinctive: line 261
If irrelevant to the change's goal → cap at 50
- Distinctive: line 263
If untraceable or speculative → cap at 50
- Distinctive: line 265
If pre-existing → cap at 50
- Distinctive: line 276
Test failure from Step 0 that correlates with the diff is automatic 100.
- Distinctive: line 326
If no findings survived verification: "No issues found.
- Distinctive: line 336
Never apply fixes to code outside the reviewed scope.
- Distinctive: line 343
CLAUDE.md not found: Run Agents A and C only. Note: "No CLAUDE.md found — skipping compliance check (Agent B)."
“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.
Files
Code Review
Staged pipeline: test → scope → intent → rules → analysis → verification → report. Finds bugs through state enumeration, not pattern matching. Catches regressions through git history, not guessing. Kills false positives through intent-anchored verification.
Scope argument: "$ARGUMENTS"
Important
- False positives are the enemy. Every finding must survive a verification pass with type-stratified confidence thresholds. Findings below threshold are discarded.
- This skill finds BUGS, not style issues.
- Read CLAUDE.md, REVIEW.md, and all @-imported rules files BEFORE launching review agents.
- Never invent data. If you need to reference a function's output or API response, read the actual source — do not estimate or fabricate.
- This skill reviews code, not plans. For plan review use
/plan-review.
Instructions
Step 0: Test Baseline
Auto-detect and run the project's test suite and linter/analyzer before reviewing any code. This gives agents factual ground truth about whether the code under review is broken.
Detection order (stop at first match):
pubspec.yamlexists → runflutter analyzethenflutter testpackage.jsonexists with ascripts.testkey that is NOT the default npm placeholder (echo "Error: no test specified" && exit 1) → runnpm test(oryarn testifyarn.lockpresent, orbun testifbun.lockbpresent)Cargo.tomlexists → runcargo clippythencargo testgo.modexists → rungo vet ./...thengo test ./...pyproject.tomlorsetup.pyexists → runpytest- Check REVIEW.md for a
test_command:directive → run that command - No runner found → skip with note "No test runner detected — skipping baseline"
Capture output and exit codes.
- If tests FAIL: record the failure output. This becomes mandatory CRITICAL context injected into every agent in Step 4. The test failure itself is a finding — include it in the report.
- If tests PASS: record
Tests: PASSfor the report header. - If linter/analyzer has errors (not warnings): record as context for agents.
Do NOT abort the review if tests fail — the diff may contain the fix.
Step 1: Determine Review Scope
If $ARGUMENTS is a PR number or "PR":
- Run
gh pr diffto get the changes - Run
gh pr viewto get the PR description and title - Extract the PR description as raw text for Step 2
If $ARGUMENTS is a file path or glob:
- Use that as the scope
- Extract the most recent commit message touching those files via
git log -1 -- <file>
If $ARGUMENTS is empty:
- Run
git difffor unstaged changes - If empty, run
git diff --cachedfor staged changes - If empty, run
git diff HEAD~1for the most recent commit - If all empty, ask the user what to review
- Extract the commit message via
git log -1 --format=%B
State what you found: "Reviewing N changed files: [list]."
Step 2: Intent Extraction
Launch a single agent (not parallel) to determine what the change is trying to accomplish.
Input: the diff from Step 1 + the commit message or PR description.
Agent prompt:
Analyze this diff and its commit message / PR description. Answer:
- Intent: What is this change trying to accomplish? State the goal in one paragraph.
- Scope: List the files being modified and their roles.
- Constraints: List any constraints mentioned in the commit message, PR description, or comments in the diff (e.g., "must not change public API", "backwards compatible").
- Confidence: Rate your confidence in understanding the intent:
clear— the commit message explains the goal and the diff matchesambiguous— the diff does multiple things or the message is vaguemissing— no commit message, or the message doesn't match the diffReturn a structured response with these four fields.
Store the intent artifact. It is passed to every subsequent agent and to the verification
step. If confidence is missing, all downstream findings receive a -15 confidence penalty
(they cannot be as confidently judged without knowing the author's goal).
Step 3: Load Project Rules
Read CLAUDE.md in the project root. If it contains @-imports (lines like @~/.claude/rules/foo.md),
read each imported file. Collect all explicit rules into a rules set.
Read REVIEW.md in the project root if it exists. REVIEW.md contains review-specific rules and causal bug patterns ("when you see X, check for Y because Z"). These are injected as highest-priority context to all agents — they take precedence over default behavior.
Identify which CLAUDE.md files exist in directories whose files were changed — these are also relevant and should be loaded.
This step is mandatory. Skipping this produces opinions, not compliance checks.
Step 4: Domain Analysis
Launch 3 agents in parallel. Each agent receives:
- The diff from Step 1
- The test baseline results from Step 0
- The intent artifact from Step 2
- The project rules from Step 3
Each agent returns a list of findings. Each finding must include: file path, line number(s), description, category, and the evidence (specific code, state combination, or historical pattern that supports the finding).
Agent A — State Enumeration Bug Detection
You detect bugs by systematically tracking every possible value of every variable at every program point. You do not pattern-match against bug categories. You trace state.
For each changed function or method in the diff, execute the following phases IN ORDER. Show your work at each phase. Do not skip to conclusions.
Phase 1 — State Inventory
Build a state table for the function:
| Variable/Field | Type | Possible Values | Read/Written | Lifecycle |
| ... | ... | ... | ... | ... |
"Possible Values" means the ACTUAL set, not just the type:
bool: {true, false}String?/string | null: {null, empty, non-empty}List<T>/T[]: {null, empty, single-element, many}- Controller/resource: {uninitialized, initialized, disposed/closed}
- Promise/Future state: {pending, resolved, rejected}
"Lifecycle": when created, when it can become invalid, who owns disposal.
Include: all locals, all fields/properties touched, all parameters, any global/singleton state, any async state (Futures, Streams, Promises, pending callbacks), external state (DB, network, file system).
Phase 2 — Transition Tracing
For each execution path through the function:
- ENTRY STATE: what combinations of variable values can exist at entry?
- Walk each branch. At each decision point, fork:
- Condition-true path: what does the state table look like now?
- Condition-false path: what does the state table look like now?
- At each WRITE: is the new value consistent with what other variables expect?
- At each AWAIT / ASYNC BOUNDARY: any state read before the await may have changed after it. Re-examine the state table post-await.
- At EXIT: does the final state satisfy the caller's expectations?
For each path, check:
- Can this path be reached? (dead code)
- Is state ever partially updated? (field A changed, dependent field B not yet updated)
- Is there a window where invariants don't hold? (between two writes)
Phase 3 — Invariant Checking
State invariants that must hold for this function:
ENTRY (preconditions):
- Is the object/widget still alive (mounted, not disposed)?
- Are required fields non-null / initialized?
- Are resources in the expected state?
MAINTAINED (during execution):
- If state A and state B must be consistent, is there a window where they aren't?
- If a resource is held, is it held across the entire critical section?
- Across async boundaries, is re-validation performed?
EXIT (postconditions):
- Are all acquired resources released on every path (including error paths)?
- Is the return value in the expected range/type on every path?
- Are listeners/subscriptions properly managed?
CROSS-FUNCTION:
- If function A must be called before function B, is that enforced?
- Does this function's output match its callers' expectations?
For each invariant: does every traced path maintain it?
Output rules:
- Do NOT report style issues, naming preferences, or simplification opportunities.
- Only report bugs traceable to a specific state violation through a specific path.
- Each finding must reference: the state variable(s), the path, and the invariant violated.
- If Phases 1-3 found no violations, report "CLEAN — no state-based bugs found."
Agent B — Project Rules + Compliance
- Audit the changes against every rule in the loaded CLAUDE.md rules set
- For each violation, quote the specific rule and its source file
- Focus on rules that constrain the CODE itself (naming, patterns, forbidden practices), not rules about workflow or process
- If REVIEW.md exists and contains causal bug patterns ("when you see X, check for Y because Z"), actively check for Y in the diff — these are the highest-priority checks
- Note: CLAUDE.md is guidance for Claude writing code — not all rules apply during review
Agent C — History + Regression Detection
This agent holds both git history context AND prior PR patterns in a single context, enabling cross-cutting findings that isolated agents would miss.
Git history analysis:
- Run
git log --oneline -20 -- <file>andgit blameon the modified files - Check: was this code recently fixed for the same kind of issue?
- Check: does the blame show this area has been a repeated source of bugs?
- Check: are the changes reverting or contradicting recent intentional fixes?
Prior PR comment replay:
- Find previous PRs that touched the same files:
gh pr list --state merged --search "file:path"orgit log --oneline --follow -- <file>thengh pr listto find associated PRs - Read comments on those PRs (use
gh api repos/{owner}/{repo}/pulls/{number}/comments) - Check if any prior review comments apply to the current changes — is the author making the same mistake that was flagged before?
Regression detection:
- Cross-reference: does this diff re-introduce a pattern that was previously fixed (visible in git log) AND flagged in a prior PR comment? That's a high-confidence regression.
- Are historically buggy files being modified without corresponding test changes?
If gh CLI is not available, skip the PR comment analysis and note it in the output.
If no prior PRs touched these files, return only git history findings (or empty if none).
Step 5: Verification
Launch a single sequential agent that receives ALL findings from Step 4 plus the intent artifact from Step 2. This agent verifies each finding and assigns a confidence score.
For each finding, the verifier checks:
- Intent relevance: "Does this finding affect the stated intent from Step 2?"
- If irrelevant to the change's goal → cap at 50
- Traceability: "Can I trace this to a specific line, path, or state combination?"
- If untraceable or speculative → cap at 50
- Scope: "Is this pre-existing (on lines the user didn't modify) or introduced by this change?"
- If pre-existing → cap at 50
Confidence rubric (pass verbatim to the verifier):
- 0: False positive. Does not stand up to scrutiny, or is a pre-existing issue unrelated to the change.
- 25: Might be real, but could be a false positive. Unable to verify from the diff.
- 50: Verified as real, but irrelevant to the stated intent, or rarely hit in practice.
- 75: Real issue that will be hit in practice. Important and will directly impact functionality, OR directly violates a CLAUDE.md / REVIEW.md rule.
- 100: Definitely real, directly impacts the stated intent, evidence confirms it. Test failure from Step 0 that correlates with the diff is automatic 100.
Type-stratified thresholds — findings below these are discarded:
| Source | Threshold | Rationale |
| Agent A (state bugs) | 65+ | Real bugs are hard to express with high confidence from static analysis — a 70-confidence state violation is more valuable than a 95-confidence naming nit |
| Agent B (compliance) | 80+ | Rules are deterministic — if the rule exists and applies, confidence should be high |
| Agent C (regression/history) | 70+ | Historical patterns are probabilistic — a reintroduced anti-pattern is likely but not certain to be a bug |
These are always false positives — discard regardless of score:
- Things a linter, typechecker, or compiler would catch (imports, types, formatting)
- Pedantic nitpicks a senior engineer wouldn't flag
- General code quality concerns (test coverage, documentation) unless required in CLAUDE.md
- Issues silenced in code (lint ignore comments, type: ignore)
- Style preferences, naming opinions, simplification suggestions
- Runtime-state claims the verifier cannot trace from the diff — if verification would require reading code outside the diff and the verifier can't do so in 1-2 reads, the finding is speculative
Cap at 50 (never escalate above) when:
- The only evidence is a deleted comment or removed block from a prior fix commit. Removals of prior-fix code are often revised tradeoffs. Report at 50 as "UNCERTAIN — verify on-device before fixing," never higher. Only escalates if reproduced on a running build.
- Claims that depend on controller/animation resting values without reading the underlying Tween/animation definition
- "Missing dismiss/cleanup" claims when the parent controller manages lifecycle
Step 6: Report
CODE REVIEW — [N files reviewed, 3 agents dispatched, tests: PASS/FAIL/SKIPPED]
CRITICAL (confidence 90-100) — [count]
* [file:line] [description]
Source: [Agent A|B|C] | Type: [state-bug | compliance | regression]
Path: [execution path or state combination that triggers this]
Fix: [specific change]
IMPORTANT (confidence 65-89) — [count]
* [file:line] [description]
Source: [Agent A|B|C] | Type: [state-bug | compliance | regression]
Fix: [specific change]
CLEAN AREAS: [agents that returned no findings above threshold]
SUMMARY: [1-sentence assessment anchored to the stated intent from Step 2]If no findings survived verification: "No issues found. Reviewed [N] files against stated intent: [one-line intent summary]. Checked for state-based bugs, project rule compliance, and regressions. Tests: [PASS/FAIL/SKIPPED]."
Step 7: Apply Fixes
For CRITICAL findings (90+): apply fixes immediately unless the user said "report only."
For IMPORTANT findings (65-89): offer to apply: "Want me to apply these fixes?"
Never apply fixes to code outside the reviewed scope.
Error Handling
- No changes found: "No changed files found. Provide a file path, PR number, or run after
making changes. Example:
/code-review src/bot.pyor/code-review 42" - Scope argument doesn't exist: "File
$ARGUMENTSnot found. Check the path." - CLAUDE.md not found: Run Agents A and C only. Note: "No CLAUDE.md found — skipping compliance check (Agent B)."
- REVIEW.md not found: Normal — most projects won't have one. No note needed.
- No prior PRs for Agent C: Agent C reports only git history findings. Note in report: "No prior PR comments found for these files."
- gh CLI not available: Agent C skips PR comment analysis. Note in report.
- Binary or generated files in diff: Skip silently. Note excluded files in summary.
- Test runner not detected: Skip Step 0 with "Tests: SKIPPED (no runner detected)."
- Tests timeout or error: Record as test infrastructure issue, not a code finding. Note in report header and proceed with review.
Examples
Example 1: State bug caught via enumeration
Input: /code-review
Process: git diff shows changes to an auth guard. Step 0 runs tests (pass). Step 2
extracts intent: "Fix null dereference when anonymous session expires." Agent A builds
the state table, traces the session token through the guard, and finds that ref.read(authProvider)
is used post-await without re-read — the session can change across the async boundary.
Verifier scores 85 (state bug, traceable path, relevant to intent). Reports as IMPORTANT.
Example 2: Regression caught via merged history agent
Input: /code-review 42
Process: Fetches PR #42 diff. Agent C finds via git blame that line 47 was fixed for an
off-by-one last month. A prior PR comment on PR #38 says "watch the boundary condition here."
The current diff reintroduces the same pattern. Cross-referencing history + prior comment
gives high confidence. Verifier scores 90. Reports as CRITICAL, auto-fixes.
Example 3: Clean review
Input: /code-review
Process: Step 0 tests pass. 3 agents review 2 changed files. No findings survive verification.
Output: "No issues found. Reviewed 2 files against stated intent: 'Add retry logic to API client.'
Checked for state-based bugs, project rule compliance, and regressions. Tests: PASS."
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
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.

