From nexus-agents
Reviews code changes for correctness, readability, architecture, security, and performance. Checks lint, type safety, test coverage, and security issues. Use for PRs, audits, or pre-merge reviews.
How this skill is triggered — by the user, by Claude, or both
Slash command
/nexus-agents:reviewing-codeThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!--
This skill is the post-hoc review gate — evaluating someone else's diff after it lands as a PR. The complementary pre-emit gate is self-critique, which the author runs on their own work before submitting:
| Skill | Reviews | When |
|---|---|---|
self-critique | Your own output | Before you emit anything |
reviewing-code (this) | Others' code (PRs, commits) | After someone else writes code |
Both use the same five-axis framework below. Both can apply to the same artifact at different lifecycle points — author self-critiques before PR; reviewer applies this skill on the resulting diff.
Evaluate every change across these dimensions. The order matters — correctness gates merge; the rest are quality.
CLAUDE.md "Canonical Paths") or introduce a new one? Module boundaries respected? No circular deps? Abstraction level appropriate?.rules/untrusted-input.md)? Secrets out of code/logs? Auth/authz where needed? Parameterized queries? See security-checklist.performance-optimization skill.Full documentation:
| Criterion | Limit |
|---|---|
| File | ≤ 400 lines |
| Function | ≤ 50 lines |
| Nesting | ≤ 4 levels |
any typesResult<T, E> for fallible opsSee SECURITY.md for full threat model.
# 1. Run quality gates
pnpm lint && pnpm typecheck && pnpm test
# 2. Check coverage
pnpm test:coverage
For any non-trivial PR, run one blind review by a fresh subagent after the local gates are green and before you merge — including when merging your own change. "Blind" = the reviewer gets the diff and the repo, not your reasoning for writing it; that's what catches the bugs your own mental model is blind to. In a 22-PR autonomous session this caught a real, merge-blocking bug on 6 of 22 PRs (27%) that green gates plus author self-review had missed (#3074).
Trigger: pnpm lint && pnpm typecheck && pnpm test green → before gh pr merge.
Mechanism:
code-reviewer (or Explore) subagent scoped to the diff
(git diff --stat <base> for the file list, then the changed files in full).
Give it the intended contract, not your implementation rationale.file:line and the observable
failure. Bound its output (≤ ~400 words) so it triages rather than dumps.Bug-shape classes to prime the reviewer on — shapes, not a frozen list; the specific instance varies by stack. Prime with the class, let the reviewer find the instance (a checklist of last session's bugs overfits and misses the next):
This pass is the same rubric as the rest of this skill, run by fresh eyes at the merge boundary — not a second taxonomy. Every finding it returns still passes the Verification Gate before it blocks anything.
A 2026-04-25 audit (#2225) found a 100% false-positive rate in second-pass code-review findings. Each false positive cost ~5min of triage. The fix is a stricter pre-file gate.
Before flagging any finding, run this checklist:
.slice(0, 20) cap on the line above.isValidCommand, Zod schema)
already filter the input?await between read and write —
JS is single-threaded; sync code is atomic at microtask levelNaN comparisons fail closed silently (no observable bad state)as Record<string, unknown> is safe IF every access has typeof
guards — read the whole function before flagging the castIf any check raises "wait, actually..." → drop the finding. Don't file, don't include in the report. False positives compound: pollute the backlog, train future agents on noise, erode trust in tooling.
| Excuse | Counter |
|---|---|
| "It's a small change, no need for thorough review" | Small changes hide subtle bugs: off-by-one, missed null check, type narrowing slipped. Apply the 4-point gate to every finding regardless of diff size. |
| "Tests pass, so it's correct" | Tests verify what was tested. Edge cases the tests don't cover are still bugs. Use the five-axis framework — correctness ≠ "tests green." |
| "I trust the author" | Trust is for the human relationship; the review is for the code. Apply the same gate to senior contributors as to first-timers. |
| "The CI gates would catch any real issue" | CI catches a known set of failure modes. Reviews catch the ones CI doesn't model — architecture drift, unclear naming, subtle security gaps, unintended public-API changes. |
| "I'd refactor this differently, but it works" | If the existing pattern is canonical (per CLAUDE.md), don't fight it. If your way is genuinely better, file a follow-up — don't gate the merge. |
| "I'll flag it; the author can decide" | Every flagged finding costs review-cycle time. Apply the 4-point gate first; only flag what passed all four. |
Every finding gets one of three tags. The bar matters — over-flagging dilutes the signal.
If you tag everything Critical, nothing is Critical. Three or more Critical findings on a non-emergency PR usually means the PR is too big — split it.
## Code Review: [File/PR]
### Critical (Must Fix)
- [ ] Issue at `file:line`
### Important (Should Fix)
- [ ] Issue
### Recommendation
[ ] APPROVE / [ ] REQUEST_CHANGES
See CODING_STANDARDS.md for common issues and patterns.
file:line citationsnpx claudepluginhub nexus-substrate/nexus-agentsConducts multi-axis code reviews evaluating correctness, readability, architecture, security, and performance before merging changes.
Reviews diffs and PRs for bugs, security issues, mocks, and placeholders. Useful for pre-commit code review or auditing agent output.
Reviews code changes, PRs, and diffs for security vulnerabilities, performance issues, correctness bugs, and maintainability problems with tables for issues and suggestions.