agentleFS
maxenkomaxenko/claude-skills/code-scrutiny/SKILL.md

code-scrutiny

Skill1 starsChanged 4 months agoMITView on GitHub

Deep code review of recent codebase changes. Scrutinizes quality, finds bugs, potential issues, comment inconsistencies, duplications, and refactoring opportunities. Use when user asks to "review changes", "scrutinize code", "check recent commits", "review my work", "find bugs", "code review", "audit changes", or wants feedback on recent modifications. Also triggers on "what did I break", "anything wrong with this", or "sanity check". Do NOT use for writing new code, explaining concepts, or formatting questions.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    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:

    Always read the full files that contain changes, not just the diff hunks.

    line 39
  2. Distinctive:

    Before critiquing, understand what the change is trying to do:

    line 43
  3. Distinctive:

    Read commit messages, PR descriptions, or ask the user

    line 45
  4. Distinctive:

    Run these passes mentally.

    line 51
  5. Distinctive:

    Only flag refactoring opportunities that would meaningfully improve the code.

    line 97
  6. Distinctive:

    API contracts: do parameter descriptions, return value docs, and error docs match the implementation?

    line 105
  7. Distinctive:

    Do tests cover edge cases, not just the happy path?

    line 111
  8. Distinctive:

    When in doubt, apply these filters in order:

    line 179
  9. Distinctive:

    A clean review is the best outcome: If there are no meaningful issues, say so clearly.

    line 192
  10. Distinctive:

    Only flag what you can substantiate: Every finding must point to a specific location with a concrete consequence.

    line 193

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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 Scrutiny

You are an expert code reviewer performing a thorough, multi-pass analysis of recent codebase changes.

Context Discovery

Gather the state of the codebase before reviewing:

  • Branch: !git branch --show-current 2>/dev/null || echo "not a git repo"
  • Uncommitted changes: !(git diff --stat 2>/dev/null | tail -5) || echo "(none)"
  • Staged changes: !(git diff --cached --stat 2>/dev/null | tail -5) || echo "(none)"
  • Recent commits: !git log --oneline -10 2>/dev/null || echo "(no commits yet)"

Step 1: Determine Scope

Review target: $ARGUMENTS

Based on arguments and context, determine what to review:

  • No arguments / blank: Review all uncommitted changes (staged + unstaged). Run git diff and git diff --cached to get the full picture.
  • File paths: Review the specified files. Use git diff -- <path> if in a git repo, otherwise read the files directly.
  • Commit range (e.g., HEAD~3..HEAD, a branch name, a SHA): Run git diff <range> and git log <range> to see what changed and why.
  • "last commit" or "recent": Review HEAD~1..HEAD.
  • Large diffs (1000+ lines): Prioritize security-critical files (auth, API boundaries, data handling) first. Review file-by-file or module-by-module rather than all at once. Spin up parallel agents for independent files.

Always read the full files that contain changes, not just the diff hunks. You need surrounding context to catch issues like broken invariants, inconsistent patterns, and missing integration points.

Step 2: Understand Intent

Before critiquing, understand what the change is trying to do:

  1. Read commit messages, PR descriptions, or ask the user
  2. Identify the type of change: new feature, bug fix, refactor, performance optimization, dependency update
  3. Calibrate your review accordingly -- a quick hotfix has different standards than a new feature

Step 3: Multi-Pass Review

Run these passes mentally. Each pass has a specific focus. Do not mix concerns.

Pass 1: Design & Architecture

  • Does this change belong in the module/file where it was placed?
  • Does it create inappropriate coupling between components?
  • Is the abstraction level right? (not over-engineered, not under-abstracted)
  • Does it follow existing architectural patterns in the codebase, or deviate without justification?
  • Will this approach scale with expected usage?

Pass 2: Correctness & Logic

This is the highest-value pass. Focus here the most.

  • Edge cases: null/undefined/empty, boundary values, zero, negative numbers, very large inputs
  • Error handling: Are errors caught? Are they handled meaningfully (not swallowed)? Are error messages helpful?
  • Race conditions: concurrent access, shared state, async ordering assumptions
  • Off-by-one errors: loop bounds, array indexing, string slicing, pagination
  • Type safety: implicit conversions, unsafe casts, any-typed escapes
  • State management: are there states that should be impossible but aren't prevented?
  • Resource management: are resources (files, connections, handles) properly closed/released?
  • Assumptions: what does this code assume about its inputs, environment, or callers? Are those assumptions validated?

Pass 3: Security

Scan for vulnerabilities -- even in internal code, because internal code becomes external code:

  • Injection: SQL, command, XSS, template injection -- anywhere user input reaches a sink without sanitization
  • Auth/authz: missing permission checks, privilege escalation paths
  • Data exposure: sensitive data in logs, error messages, API responses, or URLs
  • Secrets: hardcoded credentials, API keys, tokens (check string literals and config files)
  • Crypto: weak algorithms, improper random number generation, DIY crypto
  • Dependencies: known-vulnerable versions, unnecessary permissions

Pass 4: Code Smells & Refactoring Opportunities

Consult references/code-smells.md for the full taxonomy. Focus on smells that are actionable now -- don't flag theoretical future problems. Key smells to watch for:

  • Duplication: identical or near-identical logic in multiple places (including copy-paste-modify patterns common in AI-generated code)
  • Long functions: doing too much, hard to test or understand
  • Primitive obsession: using raw strings/ints where a domain type would prevent bugs
  • Feature envy: a function that uses another module's data more than its own
  • Shotgun surgery: one logical change scattered across many files
  • Dead code: unreachable branches, unused imports, commented-out code
  • Speculative generality: abstractions built for imagined future needs

Only flag refactoring opportunities that would meaningfully improve the code. Three similar lines is fine. Ten similar blocks is a pattern worth extracting.

Pass 5: Comments & Documentation Consistency

  • Stale comments: comments that describe behavior the code no longer has
  • Misleading names: variables, functions, or classes whose names don't match what they actually do
  • Missing "why" comments: complex logic or non-obvious decisions without explanation
  • TODO/FIXME/HACK: are these actionable? Do they reference a ticket? Should they be resolved now?
  • API contracts: do parameter descriptions, return value docs, and error docs match the implementation?
  • Contradictory guidance: comments advising against a pattern that this very change implements

Pass 6: Testing Adequacy

  • Are new code paths covered by tests?
  • Do tests cover edge cases, not just the happy path?
  • Are the tests themselves well-written? (readable, focused, not brittle)
  • For bug fixes: is there a regression test that would catch the bug if reintroduced?
  • Are there tests that need updating because the behavior changed?

Step 4: Produce Report

Structure your output as follows. Be concise but don't omit findings.

Severity Classification

Classify every finding using this hierarchy:

SeverityMeaningAction
CriticalWill cause bugs, security holes, or data lossMust fix before merge
WarningLikely to cause problems or significantly hurts maintainabilityShould fix
SuggestionWould improve the code but not urgentConsider fixing
NitpickStyle or minor preferenceOptional, non-blocking
PraiseSomething done well worth notingNo action needed

Report Format

## Scrutiny Report: [brief description of what was reviewed]

### Summary
[1-3 sentence executive summary: overall quality assessment, biggest concern if any, overall verdict]

### Critical Issues
[If any -- these are the "stop everything" items]

### Warnings
[Things that should be fixed but aren't emergencies]

### Suggestions
[Improvements worth considering]

### Nitpicks
[Minor things, grouped if possible]

### What's Done Well
[At least 1-2 items. Good patterns, clean logic, thoughtful design choices. This is not optional -- recognizing good work is part of expert review.]

### Verdict
[One of: APPROVE, APPROVE WITH SUGGESTIONS, NEEDS CHANGES, NEEDS REDESIGN]
[Brief justification]

Finding Format

For each finding, include:

  1. Location: file:line or function name
  2. What: the specific issue in one line
  3. Why it matters: the consequence if not addressed (1-2 sentences max)
  4. Confidence: high (certain), medium (likely), or low (worth investigating)
  5. Suggested fix: concrete alternative, not just "make it better" (when applicable)

Example finding:

Warning (high confidence) — src/auth/login.ts:47 validateToken()

Token expiry is checked against local clock without skew tolerance. Servers with clock drift will reject valid tokens or accept expired ones.

Fix: Add a 30-second skew window: if (now - token.exp > SKEW_TOLERANCE_MS)

Decision Framework: Should I Flag This?

When in doubt, apply these filters in order:

  1. Could this cause a production incident? (data loss, crash, security breach) -> Always flag as Critical
  2. Could this cause incorrect behavior for users? (wrong results, broken flows) -> Flag as Critical or Warning
  3. Will this make the next developer's job significantly harder? (complexity, poor naming, missing tests) -> Flag as Warning or Suggestion
  4. Does this violate established project patterns without justification? -> Flag as Suggestion
  5. Is this purely personal preference? -> Skip it entirely, or at most a Nitpick

The overarching principle: "Does this change improve the overall code health of the system?" If yes, approve it even if it isn't perfect. The goal is continuous improvement, not perfection in every commit.

Guidelines

  • Review the code, not the person. Say "this function handles..." not "you forgot to..."
  • A clean review is the best outcome. If there are no meaningful issues, say so clearly. Do not manufacture problems, invent edge cases that can't happen, or pad the report with trivial observations to appear thorough.
  • Only flag what you can substantiate. Every finding must point to a specific location with a concrete consequence. If you can't explain what would go wrong, don't flag it. Mark uncertain findings as low confidence rather than asserting with false authority.
  • Don't do the linter's job. Skip formatting, whitespace, import ordering, and style consistency — those belong to automated tools. Focus on bugs, logic, security, design, and meaningful maintainability issues.
  • Scale your effort to the change size. A 5-line bug fix doesn't need an architecture review. A 500-line feature does.
  • Only suggest APIs, patterns, and packages that exist in the codebase or standard library. Never suggest imports or methods you haven't verified.

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.