skills/code-review/SKILL.md
Use when reviewing code changes before committing or merging — staged diffs, branch diffs, or PR readiness checks. Triggers: 'review my code', 'check these changes', 'review this branch', 'give feedback on my diff', 'is this PR ready?'. Not for implementing features, running test suites, or formatting-only passes.
npx skillsauth add ahgraber/skills code-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
code-review.Structured, actionable code review focused on correctness, bugs, style, and maintainability. Act as a senior engineer: thorough, pragmatic, impact-first.
#pragma warning disable).When NOT to use:
python-testing or equivalent).| Area | Look for |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Correctness & Logic | Wrong behavior, broken contracts, off-by-one |
| Bugs & Edge Cases | Nil/null paths, boundary values, error propagation |
| Code Quality & Style | Naming, readability, idiomatic usage |
| Structure & Maintainability | Coupling, duplication, separation of concerns |
| Best Practices | Language/framework conventions, SOLID, DRY |
| Test Adequacy | Missing tests for behavior changes, regression gaps |
| Performance | N+1 queries, unbounded loops/fan-out, missing pagination, sync calls in hot paths, large allocations, missed async |
| Security & Risk | OWASP Top 10: access control, injection, crypto, auth, supply chain, logging, error handling — use securing-code checklist |
| Documentation | Misleading comments, missing doc for public API |
Determine review scope and available tooling before doing any analysis.
Scope detection:
Identify whether this is a pre-commit or pre-merge review, then set the base ref accordingly.
Pre-commit (staged changes):
# List staged files
git diff --cached --name-status
# View staged diff
git --no-pager diff --cached
Pre-merge (branch vs. target):
# Resolve target base branch from origin/HEAD when available
BASE_BRANCH=$(git rev-parse --abbrev-ref origin/HEAD 2>/dev/null)
BASE_BRANCH=${BASE_BRANCH#origin/}
BASE_BRANCH=${BASE_BRANCH:-main}
MERGE_BASE=$(git merge-base "$BASE_BRANCH" HEAD)
# List changed files on this branch relative to the target base
git diff --name-status "$MERGE_BASE"...HEAD
# View full branch diff
git --no-pager diff "$MERGE_BASE"...HEAD
If the user does not specify scope, infer from context:
Graph-enhanced tooling gate:
If the code-review-graph MCP plugin is available, probe and ensure freshness:
build_or_update_graph_tool() to run an incremental update.list_graph_stats_tool() to verify the graph has nodes and check last_updated.When the graph is available, follow references/code-review-graph-integration.md for enhanced analysis at each subsequent step.
The reference doc specifies required and optional tool calls per phase, with decision criteria for when to use each.
Parallel subagent gate:
If the Agent tool is available and the change is non-trivial, plan to use the parallel-subagent path in Step 2.
See references/parallel-subagent-review.md for the thresholds, dispatch pattern, and prompt templates.
Otherwise continue with the single-agent path.
Build a prioritized review plan before reading any code in detail.
Always (git-based):
Git diagnostics (useful for unfamiliar codebases or large diffs — see references/git-diagnostics-before-review.md):
When graph is available (see references/code-review-graph-integration.md Phase 1):
detect_changes_tool(base=<base>) for risk-scored, priority-ordered triage.
Use its risk scores to order files highest-risk first.get_review_context_tool(base=<base>) for token-efficient structural context instead of reading entire changed files.get_affected_flows_tool (change touches 2+ files), get_architecture_overview_tool (change spans 3+ directories), or get_impact_radius_tool (need raw blast-radius data) as the scope warrants.Triage output: Produce a prioritized file list and a brief review plan identifying the highest-risk areas to focus on.
Pick the path set at the Step 0 parallel subagent gate.
Parallel-subagent path (when gate is active):
Follow references/parallel-subagent-review.md — fan out quality, spec-compliance, and security subagents in parallel (plus architecture when warranted), synthesize, dispatch a devil's-advocate subagent for a challenge pass, then do final synthesis and tiebreak yourself.
The security subagent (Agent 4) is always dispatched; it uses the OWASP Top 10:2025 checklist from securing-code skill references.
Include the architecture subagent when: pre-merge / pre-PR review, the user mentions "merge", the user explicitly requests architectural review, or you judge it necessary (confirm with the user before dispatching).
Clarify author intent with the user before dispatching; subagents have no conversation history.
Skip the single-agent steps below — the reference doc drives this path end-to-end through Step 3.
Single-agent path (default):
For each changed file or module, summarize what changed and why. Review tests before implementation: do tests exist for the changed behavior, do they assert behavior (not internals), do they cover edge cases and regressions? Test gaps shape what to scrutinize in the implementation pass. Then evaluate each area in the Quick Reference table above.
Rules:
securing-code skill's references/tier2-review.md checklist (OWASP-mapped) as the evaluation framework.When graph is available (see references/code-review-graph-integration.md Phase 2):
query_graph_tool(pattern="tests_for", target=<function>) to flag test coverage gaps.query_graph_tool(pattern="callers_of", target=<function>) to verify consumers are updated.query_graph_tool("importers_of") for module-level API changes, query_graph_tool("inheritors_of") for base class changes, find_large_functions_tool for complexity flags, semantic_search_nodes_tool to check for duplication, and refactor_tool("dead_code") to catch orphaned code.Compile findings into issues using the template in assets/issue-template.md.
Sort issues by priority: critical > high > medium > low.
For each issue, include blocking status, confidence, and evidence.
Present the review as a prioritized list of issues from Step 2.
When graph was used, append:
Proceed only when the user asks to "apply changes", "fix issues", "implement suggestions", or similar.
Treat these recommendations as preferred defaults. When a default conflicts with project constraints, suggest a better-fit alternative, call out tradeoffs, and note compensating controls.
assets/issue-template.md — issue type/priority legends and suggestion format.references/review-best-practices-links.md — external review best-practice links used by this skill.references/git-diagnostics-before-review.md — git commands for assessing codebase health before reviewing.references/code-review-graph-integration.md — tool dispatch playbook for code-review-graph MCP plugin (required + optional tools per phase, decision guide).references/parallel-subagent-review.md — parallel-subagent dispatch path: thresholds, agent prompt templates, synthesis and red-team steps.securing-code skill (references/tier2-review.md, references/tier3-*.md) — OWASP-mapped security checklist used by the security subagent and single-agent security lens.development
Use when writing or reviewing tests for Python behavior, contracts, async lifecycles, or reliability paths. Also use when tests are flaky, coupled to implementation details, missing regression coverage, slow to run, or when unclear what tests a change needs. Use for multi-Python version testing (nox) and free-threaded Python thread-safety validation.
development
Use when the user wants rigorous, non-sycophantic editorial feedback on a draft, essay, blog post, or argument through back-and-forth dialogue — pressure-testing thesis, structure, argument, clarity, tone, and evidence. Triggers: "be my sparring partner", "pressure-test this draft", "poke holes in my argument", "is this ready to publish", "sharpen this post", "where is this weak". Not for one-shot copyediting, proofreading, or ghostwriting.
testing
Use when distilling the through-line gist of one or more sources — the spine, argument, tension, or recurring frame running through a set of documents, notes, research, or transcripts, OR across the ideas within a single rich piece — into a few concise paragraphs. Triggers: "synthesize", "what's the through-line/gist", "extract the insight", "pull these together". Not for faithful summary or condensation that covers what a source says, nor for comparisons or catalogs where enumeration is the deliverable.
development
Use when writing or reviewing tests in any language, or diagnosing a suite that is slow, brittle, or hard to read. Triggers: "write tests", "how should I test this", "what kind of test", "test is flaky/fragile", "should I mock this", "test is hard to read". For Python-specific guidance see `python-testing`.