agentleFS
SpencerGossSpencerGoss/agent-engineering/code-review-session/SKILL.md

code-review-session

Skill0 starsChanged 5 months agoMITView on GitHub

Use after writing or modifying code, before committing or merging — to catch bugs, security issues, and quality problems. Trigger on: "review this code", "check my code", "look at what I wrote", "code review", finishing a feature or bug fix, after a tdd-workflow green phase, or before any git commit on non-trivial changes. NOT for design reviews, architecture discussions, or general issue checking — only for reviewing code changes (git diff).

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

23 rules. About 0 are common, 19 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    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:

    Diff >1000 lines: STOP and ask the user to break it into logical chunks before reviewing.

    line 19
  2. Distinctive:

    Do not request architecture changes in a code review — that belongs to a design/architecture pass.

    line 20
  3. Distinctive:

    Do not request refactoring for code NOT in the diff — stay in scope.

    line 21
  4. Distinctive:

    Do not flag style issues if there is a linter/formatter configured — trust the tooling.

    line 22
  5. Distinctive:

    If the diff is >1000 lines, STOP and ask the user to break the review into logical chunks.

    line 29
  6. Distinctive:

    Go through checklist top-down: Don't spend time on LOW if CRITICAL exists.

    line 78
  7. Distinctive:

    After the checklist, flip your mindset.

    line 86
  8. Distinctive:

    If this pass finds something the checklist missed, promote it to the appropriate severity level

    line 92
  9. Distinctive:

    Entire file quality: when only reviewing a diff → stay scoped to what changed

    line 130
  10. Distinctive:

    Do not request architecture changes in a code review — that belongs to a design/architecture pass

    line 131
  11. Distinctive:

    Do not request refactoring for code NOT in the diff — stay in scope

    line 132
  12. Distinctive:

    Do not flag style issues if there's a linter/formatter configured — trust the tooling

    line 133
  13. Distinctive:

    After reviewing individual code quality, zoom out:

    line 158
  14. Distinctive:

    If this pattern were extended to 10 similar cases, would the codebase be better or worse?

    line 160
  15. Very specific:

    After completing the review, consider running an independent reviewer for a different model's perspective — many CLIs expose a one-shot …

    line 168
  16. Distinctive:

    Use this skill when:

    line 188
  17. Distinctive:

    Do NOT use it for design reviews, architecture discussions, or whole-codebase audits — this skill reviews a diff, not a system.

    line 193
  18. Very specific:

    NOT for full codebase security audits — use security-audit instead

    line 197
  19. Very specific:

    NOT for diagnosing root cause of a bug — use debug-session instead

    line 198
  20. Very specific:

    NOT for architectural planning or design decisions — use spec-driven-dev or decision-log instead

    line 199
  21. Distinctive:

    NEVER use this for reviewing an entire repo — scope to the diff only

    line 200
  22. Distinctive:

    Reviewing code you haven't read: Always read the file before commenting — reviewing a diff without understanding the surrounding code leads …

    line 204
  23. Distinctive:

    Suggesting changes that conflict with project rules: Check the project's own conventions and rules files first — the project may have hard …

    line 205

≈ “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

Hard Rules

  • Scope is the diff only — review only what changed (git diff or git diff --staged). Never audit the entire codebase; that is a full security audit, not a code review.
  • Diff >1000 lines: STOP and ask the user to break it into logical chunks before reviewing.
  • Do not request architecture changes in a code review — that belongs to a design/architecture pass.
  • Do not request refactoring for code NOT in the diff — stay in scope.
  • Do not flag style issues if there is a linter/formatter configured — trust the tooling.

Code Review Session

Review changed code systematically. Produce a severity-ranked finding list. Ship confidently.

Diff Size Check: If the diff is >1000 lines, STOP and ask the user to break the review into logical chunks. Large diffs cause reviewers to miss critical issues — smaller reviews are higher quality.

Scope: Review only what changed — git diff or git diff --staged. Never audit the entire codebase; that is a full security audit.


Review Checklist (in priority order)

Work top to bottom. Stop and fix before moving down.

CRITICAL — Block commit

  • Secrets exposed: API keys, passwords, tokens hardcoded in source code
  • Data loss: destructive operations (DELETE, DROP, overwrite) without guard
  • Provably wrong logic: off-by-one, inverted condition, wrong operator
  • Security hole: unvalidated user input at a boundary, SQL injection, XSS
  • New code has zero test coverage (unless it's configuration/markup only)

HIGH — Fix before merging

  • Exceptions swallowed: except: pass, .catch(() => {}), silent error discard
  • Null/undefined unguarded: accessing .property on something that could be None/null
  • Breaking change: function signature changed, callers not updated
  • Performance trap: O(n²) in hot path, N+1 queries, blocking the event loop
  • Zero test coverage on new code: If diff introduces new functions/classes with no corresponding tests, flag as HIGH
  • Test tests the mock, not the code: If new tests mock so thoroughly that removing the implementation would still pass, flag as HIGH
  • Coverage regression: If coverage report shows new code is <50% covered, flag as HIGH

MEDIUM — Fix if quick, log if not

  • Misleading names: function or variable name doesn't describe what it does
  • Duplicated logic: same code copy-pasted in 2+ places (extract it)
  • Magic values: hardcoded numbers or strings that should be named constants
  • Function too long: over 50 lines — candidate for splitting

LOW — Note and move on

  • Missing comment on non-obvious logic
  • Formatting inconsistency (prefer linter over manual fix)
  • TODO left in code that should be a tracked ticket

How to Run

  1. Get the diff:
git diff          # unstaged changes
git diff --staged # staged changes
git diff HEAD~1   # last commit
  1. Go through checklist top-down. Don't spend time on LOW if CRITICAL exists.
  2. File each finding with this format:
[SEVERITY] path/to/file.py:42 — what's wrong → specific fix
  1. Adversarial Pass (Devil's Advocate): After the checklist, flip your mindset. You are now an attacker trying to BREAK this code.
  • "What input would crash this?" — pick 3 edge cases and mentally trace them
  • "What assumption is wrong?" — list every implicit assumption, challenge each one
  • "What happens under load/concurrency?" — race conditions, shared state, non-atomic ops
  • "If I deleted the implementation but kept the tests, would tests still pass?" — mock integrity
  • 60%+ of effort here should be DISCONFIRMATION, not confirmation. Ask "why X fails" not "why X works"
  • If this pass finds something the checklist missed, promote it to the appropriate severity level
  1. Output a verdict:
  • ✅ Ship — no CRITICAL or HIGH findings
  • ⚠️ Fix first — HIGH findings present
  • 🚫 Block — CRITICAL found

Output Format

Code Review — <feature or file name>
Reviewed: <git diff range>

CRITICAL (N)
- [CRITICAL] src/auth.py:15 — API key hardcoded → move to os.environ.get("API_KEY")

HIGH (N)
- [HIGH] src/api.js:88 — fetch() not awaited → add await

MEDIUM (N)
- [MEDIUM] src/utils.py:30 — magic number 86400 → extract as SECONDS_PER_DAY

LOW (N)
- [LOW] src/models.py:55 — missing docstring on public method

Verdict: ✅ Ship / ⚠️ Fix HIGH before merge / 🚫 Block

What NOT to Flag

  • Style/formatting a linter handles → run the linter instead
  • "I would have done it differently" preferences → only flag if correctness is affected
  • Architectural concerns already decided → raise separately, don't block this review
  • Test edge cases beyond the spec → nice to have, not a blocker
  • Entire file quality when only reviewing a diff → stay scoped to what changed
  • Do not request architecture changes in a code review — that belongs to a design/architecture pass
  • Do not request refactoring for code NOT in the diff — stay in scope
  • Do not flag style issues if there's a linter/formatter configured — trust the tooling

Quick Reference

SituationAction
Found a CRITICALStop. Fix before anything else.
Found only MEDIUM/LOWShip with notes — document as TODOs
Unsure if it's a bugCheck with a failing test — if you can write one, it's a bug
Hard to review your own codeUse the checklist sequentially — don't free-form
Reviewing a large diffBreak it into logical chunks, review each separately

Review the Review

Before presenting findings:

  1. Re-read your critique. Is each point actionable and specific, or vague?
  2. Did you miss anything by focusing too much on one area?
  3. Are you being performatively thorough (flagging non-issues to seem careful) or genuinely helpful?
  4. Would a senior engineer agree with your top 3 findings? Strip any finding that doesn't pass these checks.

Architecture Step-Back

After reviewing individual code quality, zoom out:

  • Does this change fit well with the existing architecture, or is it fighting it?
  • If this pattern were extended to 10 similar cases, would the codebase be better or worse?
  • Is there a simpler design that achieves the same goal? These are LOW severity observations — note them and move on. But they compound into real architectural improvements over time.

Second Opinion

After completing the review, consider running an independent reviewer for a different model's perspective — many CLIs expose a one-shot review command (e.g. a review --uncommitted or review <diff> subcommand). A second model often catches what the first missed.


Skill Chain

StageSkill
Before (writing the code)tdd-workflow — tests first, then implementation
This skillcode-review-session — review before committing
Next (committing)a git-workflow pass — conventional commit, right branch
If CRITICAL security foundsecurity-audit — full audit if secrets or injection risk
If CRITICAL bug founddebug-session — diagnose root cause before fixing
After fixtdd-workflow — add regression test for the bug found
For deep adversarial scrutinydevil-advocate — stress-test the change against its own assumptions

Trigger Conditions

Use this skill when:

  • You just wrote or modified code and want a pre-commit / pre-merge check ("review this code", "check my code", "look at what I wrote", "code review").
  • You finished a feature or bug fix, or completed a tdd-workflow green phase.
  • You are about to git commit a non-trivial change.

Do NOT use it for design reviews, architecture discussions, or whole-codebase audits — this skill reviews a diff, not a system.

Out of Scope

  • NOT for full codebase security audits — use security-audit instead
  • NOT for diagnosing root cause of a bug — use debug-session instead
  • NOT for architectural planning or design decisions — use spec-driven-dev or decision-log instead
  • NEVER use this for reviewing an entire repo — scope to the diff only

Common Traps

  • Reviewing code you haven't read: Always read the file before commenting — reviewing a diff without understanding the surrounding code leads to incorrect or irrelevant suggestions.
  • Suggesting changes that conflict with project rules: Check the project's own conventions and rules files first — the project may have hard rules that override general best practices.
  • Over-reviewing trivial changes (formatting, style) instead of logic/architecture: Focus on substance — if a linter handles it, don't flag it. Spend review time on correctness, security, and design.

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.