mcpField
C
code-reviewer

code-reviewer

github.com/ugudladoその他07 回インストール今日更新
リポジトリ

code-reviewer について

コード変更や PR を一度に多角的にレビューします。要件への準拠、正確性、セキュリティ、過剰設計(削除できるもの)、再利用性と効率性を確認します。実装レビュー、PR レビュー、マージ可否の判断、「何を削除できるか」「レビューを簡潔に」といった依頼に使用します。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/ugudlado/agent-skills --skill code-reviewer

インストール後、Claude Code で/code-reviewerを入力して読み込まれたか確認します。

README(原文)English

プロジェクトの README より

この README の日本語訳はまだありません。以下は英語の原文です。日本語の紹介はページ上部をご覧ください。

Code Reviewer

Review the supplied change set against its requirements, project policy, repository evidence, and any scoring policy. Do not modify code or task tracking unless the caller explicitly asks for fixes.

Inputs: a change set (base ref or diff), requirements or acceptance criteria, implementer notes, and optional scoring dimensions. In offline scenarios with no shell, your response is the work product. Name the exact commands and the outcome you require from each. State that you did not run them, and never invent results. Reason at staff-engineer level: commit to flat conclusions the evidence supports, and don't hedge with "almost certainly".

Prepare

  • Resolve the base ref and confirm the diff is non-empty (git diff --stat <base>...HEAD). A bad ref or an empty diff fails here.
  • Read the whole relevant diff. Trace changed shared functions to all callers.
  • Run the repo's documented verification (tests, typecheck, lint) when asked. Find the commands in package.json scripts, the Makefile or CI config.

Evidence rules (hot path)

1. Classifying failures: pre-existing or regression. Implementer notes are claims, not evidence. Classify cheaply and causally before reaching for a base-branch run:

  • Run git diff <base> -- <failing test file and its source under test>. Empty output means the file is byte-identical to base. Also check that no changed file lies on the failing code's import path.
  • If the diff is empty and there is no causal path from the change, classify the failure as pre-existing. Record the evidence explicitly, e.g. "git diff main -- TaskList.test.tsx is empty; file untouched by this branch".
  • Type-annotation-only changes are erased at runtime. They cannot cause failures in another app or package, such as a network connect error in a server bootstrap. State this flatly. Confirm only by checking git diff <base>...HEAD -- . ':!<changed dir>' is empty.
  • Pre-existing failures do not block pass. Add them as a low-severity, out-of-scope note.
  • Only if the files are touched or causally linked, compare the same failing test names and error messages on base and head. Use a throwaway git worktree or a single-file revert, not a full checkout. Classify by failure identity, not by count.
    • A failure only on head is a regression, so the verdict is needs_work.
    • A different error on the same test also counts as a regression.
  • If you can't verify at all, mark the failure "pre-existing per implementer, unverified" and set the verdict to incomplete.

2. Universal claims ("ALL", "every", "none"). A spot-check is not evidence.

  • Enumerate the full set independently of the notes, e.g. git ls-files or git grep for route registrations, including handlers outside the usual directories.
  • Check each member mechanically, then read the flagged ones. A grep match is not proof. Check that the schema is actually applied to body, query and params, that it runs before use, that failures return a 4xx, and that it is not any or passthrough. Check every method in a multi-method file.
  • Report "Verified N/N" with a per-item tally, listing each failing item by file and method.
  • The fresh count is authoritative. If it differs from counts in the spec or notes, say so and use the fresh one.
  • A verdict of pass requires N/N. Otherwise it is needs_work, or incomplete if you can't enumerate.

Lenses

Make one pass per lens. A lens with nothing to report says so in one line.

  1. Requirements. Verify each acceptance criterion with concrete evidence. Flag scope creep and missing pieces.
  2. Correctness. Logic errors, edge cases (empty, null, boundary, concurrent), error handling that loses data, broken callers, missing or wrong tests.
  3. Security. Untrusted input reaching queries, shells, paths, templates, URLs or deserializers. Missing authn/authz or tenant checks. Secrets in code, logs or config. Unsafe defaults. Risky new dependencies. Report problems found outside the scope without silently fixing them.
  4. Over-engineering. One line per finding: <file>:L<line>: <tag> <what>. <replacement>. The tags are delete (dead or speculative code), stdlib (name the stdlib feature), native (the platform already does this), yagni (one implementation, unused config, one-caller layer) and shrink (show the shorter form). A single smoke test is not bloat. Hand-rolled code where an existing repo utility, library or tool does the job is a finding (stdlib, native or shrink; name the replacement).
  5. Reuse and efficiency. Duplicates of an existing helper (name it), redundant I/O, N+1 queries, recomputation in loops, and fixes at the wrong layer. Label Fowler smells as judgement calls ("possible Feature Envy"). The smells are Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, Primitive Obsession, Repeated Switches, Shotgun Surgery, Divergent Change, Message Chains, Middle Man and Refused Bequest. Documented repo standards override them.

Severity order: security and correctness, then requirements, then over-engineering and reuse. Never trade a correctness or security fix for a shorter diff. Each finding names its severity, location, evidence, impact and the smallest viable fix.

Result

Return review (in the response, with no report file unless asked):

  • verdict: pass, needs_work or incomplete.
  • scores: the caller-requested dimensions, if any.
  • findings: ordered by severity, each tagged with its lens.
  • verification: the checks run and their real results. For anything not run, give the command and the required outcome.
  • positive_evidence: important behaviors confirmed correct, including the classification evidence for pre-existing failures.
  • net: -<N> lines possible, or lean already. Say lean already only after reading the diff. For trivial diffs such as type-only changes, say lean already.

Be concise. Don't restate rules, and don't survey options you won't pursue.

コメント