Code reviewer

From KjellKod/quest · View interactive version

Code reviewer is an AI agent skill from the GitHub repository KjellKod/quest. Review actual code implementations (Python, JavaScript, TypeScript, React) for correctness, maintainability, security hygiene, and adherence to project patterns. Use when reviewing pull requests to ensure code quality, proper error handling, adequate test coverage mapped to acceptance criteria, and

How to use this skill

Skill file

Code Reviewer

Review actual code implementations for correctness, maintainability, security hygiene, and adherence to project patterns.

This skill focuses on the code itself and the tests that ship with it, but it must validate test coverage against the acceptance criteria from the plan/spec.

At activation, announce the skill name and scope in one line. Example: [code-reviewer] reviewing PR #97 against .quest/example/phase_01_plan/plan.md.

See .skills/review-anti-patterns.md for the shared rule set.


Required Inputs (Do Not Start Without These)

To run this review properly, you need:

  1. The PR diff
  2. The implementation plan or feature spec that includes acceptance criteria

If acceptance criteria are unavailable, you may still review code quality and safety, but you must clearly label the review as incomplete and explain what you could not validate.


When to Use This Skill

Use this skill when:

Do not use for:


Severity Model (Use in PR Comments)

Classify findings using these levels, and include the level in each PR comment:

Rule: Avoid comment-only “style polish” and trivial corrections. Prefer high signal feedback.

Comment Placement

Default to inline review comments for code-specific feedback. If a finding refers to a concrete file, function, branch, or line range, attach it to that code instead of posting it in the main PR discussion.

Use top-level PR comments/reviews only for:

If a code-specific issue is fixed before you comment, do not repost stale feedback as a top-level comment.


Review Process

Step 1: Architecture Boundaries and Standards

Enforce boundaries and conventions defined in:

Check:

If the boundary rules are unclear or missing, flag this as a Must fix documentation gap.


Step 2: Correctness and Contracts

Verify the implementation matches intended behavior:

Focus on correctness of the behavior, not micro refactors.


Step 3: Code Quality and Maintainability

Review for readability, maintainability, and consistency. See AGENTS.md for coding and architecture philosophy.

Strive for simple code that is high quality and easy to read. SRP, DRY, KISS, YAGNI are fundamental pillars to follow.

Typing discipline

Prefer clear, concrete types over catch-all / escape-hatch types. This principle is language-agnostic: types and type checking drive quality, and escape hatches should be a deliberate, justified choice rather than a default. When a catch-all is genuinely the best option (boundary deserialization, true generic plumbing, gradual typing of legacy code), expect a one-line comment explaining why.

Per-language reference:

| Language | Catch-all / escape hatch | Typical concrete alternative |

|-------------|-----------------------------------------------------------------------|------------------------------------------------------------------------|

| Python | Any, untyped dict/list, missing annotations, # type: ignore | precise types, TypedDict, Protocol, dataclass, generics |

| TypeScript | any, as any, Object, {}, Function | unknown + narrowing, discriminated unions, generics, Record<K,V> |

| C# | object, dynamic | concrete class/interface, generics |

| Java | Object, raw List (no <T>), @SuppressWarnings("unchecked") | parametric generics, sealed types |

| C++17 | void*, std::any, untyped auto at API boundaries | concrete templates, std::variant, strong typedefs |

| Rust | Box<dyn Any>, mem::transmute, raw pointers, unsafe casts | enums, dyn Trait with concrete bounds, generics |

Not all catch-alls are equally lazy. TypeScript unknown paired with proper narrowing, and Rust dyn Trait with real trait bounds, are usually fine — they preserve type-checker leverage. The lazy patterns are the ones that erase information entirely: any / Any / raw Object / void* / dynamic. For Python specifically, also flag untyped dict / list parameters and return types, and overuse of # type: ignore (each one should have a comment explaining why the checker is wrong or the fix is deferred).

Python

JavaScript/TypeScript

React

Minimal diff rule

Prefer the smallest change that is correct.

Suggest refactors only when they reduce risk, reduce future change cost, or unblock correctness.


Step 4: Error Handling and Failure Modes

Check:


Step 5: Test Coverage (Must Map to Plan Acceptance Criteria)

This is required.

  1. Extract acceptance criteria from the plan/spec
  2. For each acceptance criterion, verify at least one of:

Review tests for:

If acceptance criteria exist but tests do not map to them, this is at least a Must fix, and often a Blocker.


Step 6: Security Hygiene (Tight Scope)

Security review is intentionally narrow and PR-focused:

Do not attempt full dependency audits or broad security assessments here.


Step 7: Observability (When It Matters)

If the code changes production behavior or affects critical workflows, check:

If observability is missing for a risky change, flag as Should fix or Must fix depending on impact.


Review Output Structure (PR Comment)

Write a PR review that is short and high signal:

1. Summary

2. Blockers

3. Must Fix

4. Should Fix

Finding numbers are review-local indices. Keep numbering stable within the current review and use [N] format for every finding that appears in Blockers, Must Fix, or Should Fix.

5. Test Coverage vs Acceptance Criteria

6. Questions


Principles

  1. Correctness over style
  2. Boundaries are real: Enforce architecture rules
  3. Tests must match acceptance criteria
  4. Security hygiene is non-negotiable
  5. Prefer minimal diffs
  6. High signal comments only
  7. Be explicit about severity

Success Criteria

A good code review should:


Common Pitfalls

| Shortcut | Why It Fails | Red Flag |

|----------|-------------|----------|

| "While you're here, also change..." | Scope creep disguised as review feedback. Refactor suggestions unrelated to the PR add noise and expand scope. | Review comments referencing code outside the diff |

| Marking missing AC tests as "Should fix" | Untested acceptance criteria ship to production. If an AC exists but has no test, that is a "Must fix", not a suggestion. | AC exists but test coverage column is empty |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.