kyy-logs/code-review-gate-skill

Auditable code review skill for Claude Code and Codex: four independent probes, evidence-backed findings, and a JSON-derived merge gate.

code-review-gate-skill — An Evidence-Backed AI Code Review Gate

What it is

code-review-gate-skill is an AI-powered code review tool that runs inside Claude Code or Codex. It reviews code changes and produces two things: a human-readable report and a machine-checkable "gate" decision (pass/block). The key idea is that every finding must be backed by concrete evidence — a file location, a contract, or a code path — not just "this looks risky."

It's called a skill because it plugs into AI coding agents as a specialized capability. The project is open source (MIT license) and currently at stable release v0.2.4.

The core philosophy: Static-first, probe-driven, gated

  • Static-first: It reads the diff, surrounding source code, tests, and project rules. It does not build the project, run tests, or require coverage reports. It works on a fresh clone or partial checkout.
  • Probe-driven: Instead of one big AI review, it dispatches four independent probes (separate AI contexts) that each answer a narrow question and file their own evidence.
  • Gated: The final pass/block decision is computed from structured JSON data, not from prose the AI wrote. This makes the gate auditable and verifiable.

The four probes

Probe Required? Question it answers
behavior-review Yes Does the changed behavior match its actual contract and implementation path?
test-coverage Yes Are the tests meaningful, and is incremental coverage measured when data exists?
repo-guard Yes Does the change violate repository or project rules?
impact-analysis No Who calls this, what contracts change, and what's the performance/architecture blast radius?

The probes are intentionally narrow — behavior-review is not a linter, repo-guard is not a general bug scanner. They run in fresh contexts (separation of duties, though all use the same underlying model).

The evidence contract

Every finding must record five fields:

  • location — path:line, or file-level with a reason
  • summary — what is wrong (not "consider improving")
  • evidence — contract, code path, test output, or rule ID
  • severity — high / medium / low (three levels only; older four-level records with critical are rejected)
  • status — open / reconciled / wontfix / false-positive

High-severity findings must cite the actual method signature and the contract they violate, or a concrete code path. A hunch is capped at medium until evidence is checked.

How the gate works

The pipeline has six steps:

  1. Scope — determine review mode (worktree changes vs. a commit range) and record base/head commit IDs
  2. Probes — dispatch the four agents in parallel, each writing its own JSON
  3. Sync — validate the probe JSON and derive counts
  4. Reconcile — high findings must be closed or marked false-positive
  5. Report — render the human report's fact sections from the JSON, then verify them
  6. Gate — three things block the merge: source freshness (code changed since review), required-probe failures, and open high findings

What it is NOT

  • Not a replacement for tests, CI, or human review
  • Not a guarantee that a clean report means the change is correct
  • Not a coverage tool (coverage is used when provided, not required)
  • Not a fixer — it never modifies the code under review

Installation and usage

Install inside your project (Node.js 22.20+ required):

# English
npx -y skills add kyy-logs/code-review-gate-skill --agent codex --skill code-review-gate --yes

# Chinese
npx -y skills add kyy-logs/code-review-gate-skill --agent codex --skill code-review-gate-zh --yes

Use --agent claude-code for Claude Code. One language per project.

Then ask in Claude Code:

Review these changes with code-review-gate.

Or for a fixed commit range:

Use code-review-gate on commits abc123..def456

Two review modes:

  • worktree — staged, unstaged, and untracked changes against current HEAD
  • commits — a fixed base..head range

Output

Results land in docs/work/active/{slug}/:

├── code-review.md          # human report
├── review-snapshot.json    # run metadata
└── probes/
    ├── behavior-review.json
    ├── test-coverage.json
    ├── repo-guard.json
    └── impact-analysis.json

Configuration

  • Project-specific rules can live in .code-review/rules/ or be pointed to with CODE_REVIEW_RULES_DIR. A project rule package replaces the built-in one (not merged).
  • Optional .code-review/config.json sets output directory, line-coverage target (default 85%), and branch-coverage target (default 80%). Line coverage blocks below target; branch coverage is advisory.
  • CODE_REVIEW_OUTPUT_DIR overrides the output root.

Requirements

  • Claude Code with Agent Skills support, or Codex with custom-agent support
  • Bash 3.2+, Git, awk, grep, sed
  • Python 3.9+ (to run review scripts; PyYAML used for parsing)
  • Node.js 22.20+ (for the install entry)

Validation status (honest caveats)

The project is transparent about what it has and hasn't validated:

  • 116 offline tests covering JSON validation, derived counts, report consistency, installation, and gate behavior — these are regression checks, not proof of defect-detection quality.
  • Historical regression runs: an 11-case Java regression (2026-10-29) and a 9-case expansion (2026-10-30) with detailed results, including confirmed misses and false-positive controls. The README explicitly warns these are snapshot-specific observations, not a general recall claim.
  • Not yet established: a controlled comparison against single-agent review measuring missed defects, false positives, time, and token usage. Concurrency-defect detection has not been validated.

Why it exists

The motivating problem: most AI reviews stop at "this looks risky." This skill forces every finding to point to a location, a contract or code path, and a severity — and makes the gate decision derivable from machine-readable JSON, so you can audit why a change was blocked or passed.

Repository layout (highlights)

  • skills/code-review-gate/ and skills/code-review-gate-zh/ — the actual skill definitions (English and Chinese)
  • shared/scripts/ — core scripts: collect-metrics, rule-grep, sync-results.py
  • scripts/ — installers and maintenance scripts
  • tests/ — offline test suite
  • .github/workflows/ — CI, news updates, star history

License

MIT License.

Related

  • Project
  • Project
  • Project
  • Project