agentleFS
gurinderugurinderu/craft/skills/rust-review/SKILL.md

rust-review

Skill1 starsChanged 41 days agoMITView on GitHub

Rust code-review rubric — the cargo quality gate, a severity-tiered checklist (safety, error handling, ownership, concurrency, performance, API quality), a public-API pass against the Rust API Guidelines (language-independent severity, classes and sweeps come from review-rules), the Approve/Warning/Block verdict (at most Warning when the gate could not be established; INCOMPLETE only when the review itself could not run), how to dispatch the craft review agents, and posting findings on a PR (defects only; doubtful ones go to the human first). Use when reviewing Rust code or a diff, deciding if it's mergeable, or reviewing a public API. Its review workflow needs Claude Code's Workflow tool (not in Codex or OpenCode) and its review agents are not in Codex; the rubric applies anywhere. Triggers: code review, is this mergeable, dispatch reviewer, public API, what proves done.

  • Commits and pushes

19 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use rust-port, python-review and 6 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • fedemeloSkill

    rust-port

    Port code from C, C++, Python, Go, JavaScript, or TypeScript into idiomatic Rust that keeps the original behavior: ownership instead of manual memory, Result instead of error codes and exceptions, enums instead of flag ints and magic strings, and tests that prove the port matches. Use this whenever the user asks to port, translate, convert, migrate, or rewrite code in Rust ("rewrite this in Rust", "what would this look like in Rust", "move this module to Rust"), even if they don't say "port". Pairs with the rust-best-practices skill, which covers the target code's style.

    Also in 7 projects that use this

  • kingsidharthSkill

    python-review

    Also in 4 projects that use this

  • TheKREATORSSkill

    go-review

    Comprehensive Go code review for idiomatic patterns, concurrency safety, error handling, and security. Invokes the go-reviewer agent.

    Also in 3 projects that use this

  • MicrosoftSkill

    rust-best-practices

    Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1) writing new Rust code or functions, (2) reviewing or refactoring existing Rust code, (3) deciding between borrowing vs cloning or ownership patterns, (4) implementing error handling with Result types, (5) optimizing Rust code for performance, (6) writing tests or documentation for Rust projects.

    Also in 6 projects that use this

  • GoogleSkill

    domain-modeling

    Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model.

    Also in 3 projects that use this

  • NVIDIASkill

    research

    Before designing a feature, research how comparable libraries solve the problem, check best practices, known pitfalls, and upstream changes. Use when starting a new feature, investigating an unfamiliar area, or the user asks to research something.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the workflow fails with at workflow.js:<line>:<column>, that place is in the bundled engine: node "<this skill's base …

    line 47
  2. Very specific:

    If gh is missing, unauthenticated, offline, or finds no PR → fall straight through to the local gate (never fail on detection).

    line 67
  3. Distinctive:

    no structural regression (a previously cohesive module didn't become more coupled or harder to scan).

    line 214
  4. Distinctive:

    no obvious simplification missed (the code-judo check above came up empty).

    line 215
  5. Distinctive:

    no unjustified file-size explosion.

    line 216
  6. Distinctive:

    no spaghetti-growth from special-case branching.

    line 217
  7. Distinctive:

    no hacky or magical abstraction obscuring the design.

    line 218
  8. Very specific:

    When the diff changes a public API (a library crate, a published pub surface), also run the condensed Rust API Guidelines checklist → …

    line 224
  9. Distinctive:

    Every finding (lens or seed) is checked before it can be Confirmed:

    line 399
  10. Distinctive:

    Mechanical first: if a tool can decide the finding (a clippy lint, semgrep rule, cargo-audit advisory), the verifier re-runs it scoped to …

    line 401

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rust Review

The rubric for reviewing Rust changes: run the mechanical gate first, then read the diff against the severity checklist, then issue a verdict. This is the knowledge; the craft:rust-reviewer agent applies it to an actual diff and reports back.

The review entry point is the craft:review workflow (the craft CLI's review, driven from Claude Code): it sends each changed Rust file to the Rust profile, scout-scales depth to the diff, fans out the lenses below, grounds findings in tool output, and verifies each one. This skill is the rubric its Rust lenses (on the review's task agent) and the craft:rust-reviewer agent, run by hand, apply.

The workflow recalls the project's active decisions, open questions and project rules for the diff's paths itself, on every launch; priorDecisions (the object argument, never a string, each record with its kind) only adds records the store may not hold yet and never replaces that recall (→ memory, "Before a review"): a finding the project already rejected comes back under Rejected before with who, when and why, one it deferred under Known and deferred, and one a project rule covers (a judge agreed its concern is exactly what the rule accepts; never a Critical) under Covered by project rules, instead of being raised as new. A finding the same judges say goes against an active decision or rule stays in the verdict, listed under Contradicts project memory with the record's id, and is a defect whatever other doubt sign it carries — unless its line is marked not confirmed: then it is a doubt to check (verify it before fixing), and with comment it is also listed under Doubtful, the record named first.

With comment the workflow posts only defects on the PR; a doubtful finding (not confirmed, raised by the compat, intent or api-boundary lens, a design question naming no harm, about rollback, rollout, old replicas, migration or a breaking change, or outside the changed lines) is listed under Doubtful — for the reviewer, not posted and waits for the human: show him that list, and act on his choice for each — ask the author, post as a defect, or do not post — as craft:addressing-findings says (its doubtful findings section).

When to Use

  • Reviewing a diff / PR of Rust code
  • Deciding whether changes are safe to commit or merge
  • A self-check before opening a PR

Pre-PR gate

Self-review runs before the PR opens, not after. Before gh pr create on a Rust change, run the craft:review workflow on the branch diff, then close the loop — triage the findings (triage-findings), fix them (addressing-findings), and re-review until the verdict is Approve (or Warning with each remaining item justified in the PR body). Only then open the PR. A one-shot review whose findings never loop back into fixes is not a gate; the PR isn't ready until the loop is green. If the workflow fails with at workflow.js:<line>:<column>, that place is in the bundled engine: node "<this skill's base directory>/../../integrations/shared/engine-source-map.mjs" review workflow.js:<line>:<column> gives it in the plugin's source. Once a workflow run has ended (completed, failed or stopped — not while you may still resume it), fold its real cost into the records it filed: sh "<this skill's base directory>/../../integrations/shared/craft-cli.sh" runs enrich-cost --run-id <wf_…>, with the run id the Workflow completion names. Best-effort: if it fails, say so in one line and go on.

Step 1 — Establish the gate (CI informs, never certifies)

The mechanical gate is non-negotiable: cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test, and (if installed) cargo audit / cargo deny check must be green before human-style review is worth doing. You establish each signal yourself, by running its command. CI informs, it never certifies: a green CI check is reported (CI green for <check>), but the signal it covers stays unknown until your own run computes it, and no verdict — Approve least of all — rests on it. A red CI check that runs the command still blocks.

A covering check does not have to be required. Most repositories have no branch protection — isRequired is then null on every check and gh api …/branches/<b>/protection returns 404 — so a rule that only reads required checks never sees a red one. Required-ness governs whether a red check blocks the merge upstream; it never turns a green one into a signal you did not compute.

Establish each signal:

  1. Detect the PR's CI for the current branch:
    gh pr checks --json name,state,bucket,link
    If gh is missing, unauthenticated, offline, or finds no PR → fall straight through to the local gate (never fail on detection).
  2. fmt / clippy / test / build — if a check whose name matches the command (substring: fmt, clippy, test, build/check; match generously — cargo nextest, just clippy, ci / test (stable) all count) is conclusive — required or not:
    • failed → the gate is red: verdict Block, cite the failed check name + link, stop;
    • green → report CI green for <check> · PR #N in the provenance; the signal stays unknown, so run that command locally as below — the green check never stands in for it;
    • pending / absent / name unrecognized → run that command locally (the safe default is an extra run, never a skipped check):
      cargo fmt --check
      cargo clippy --all-targets -- -D warnings
      cargo test                         # or: cargo nextest run + cargo test --doc
  3. audit / deny — always run locally if installed, regardless of CI (cheap, usually absent from CI):
    cargo audit                        # if cargo-audit present
    cargo deny check                   # if cargo-deny present
    Setting up / interpreting cargo audit + cargo deny → rust-security.
  4. The gate could not be established — the third outcome, and the one that is easy to lose. No red CI check covers it and the local command could not execute: cargo is not on PATH, the toolchain or a required component is missing, dependencies cannot be fetched (offline, private registry), or the command died before it judged anything. That is not a red gate and it is emphatically not a green one — nothing was computed. A green CI check does not change that: the gate is still NOT ESTABLISHED, with CI green for <check> reported beside it.

    Distinguish the three, and never collapse them:

    What happenedGate statusVerdict
    The command ran locally and passedPASSEDcontinue to Step 2
    The command failed (a local run, or a red CI check that runs it)FAILEDBlock, cite the failure
    The command could not run locally (a green CI check, if any, only informs)NOT ESTABLISHEDWarning at most — never Approve

    With the gate NOT ESTABLISHED, still read the diff and report findings — a human read is worth something — but the verdict cannot be Approve: an Approve asserts the mechanical gate is green by your own run, and here it was never computed. The verdict is Warning: say plainly that the gate was not established locally, name exactly which commands could not execute and why, report the CI you saw beside it (CI green for <check> informs only), and say the change is UNVERIFIED, not clean. If the read turns up a Confirmed Critical or High, that still wins: Block.

    A gate that is partly unknown caps the same way: if cargo test ran but clippy is unavailable (CI green for it or not), the clippy signal is unknown, so with nothing Confirmed CRITICAL/HIGH the verdict is Warning, the gap named in the provenance line. An unestablished gate is never INCOMPLETE: INCOMPLETE means the review itself could not run (no diff to read, the lenses failed).

If any fmt/clippy/test/build signal is red (a local run, or a red CI check that runs it), stop and report — don't review further. A green gate — green by your own runs — is the floor, not the ceiling: it means the change is reviewable, not that it's good.

Step 1.5 — Resolve dependency context

Review against the crate versions the project actually pins, not against crates-in-the-abstract. A call that is idiomatic on tokio 1.40 may be deprecated on the 1.20 this repo locks; a default may have flipped between minor versions. Before judging dependency usage:

  • Resolve the real versions — cargo metadata --locked --format-version 1 (or read Cargo.lock) — and match the external crates the changed files use to their locked versions.
  • For any nontrivial dependency the diff touches, check the usage against that version's API: a since-deprecated/removed/renamed item, a changed default, a known footgun of that exact version. Consult live docs (context7, docs.rs for the pinned version) rather than memory — this ecosystem moves fast. Version-specific misuse is DEP-001 (Medium).
  • Known-vulnerable versions are a separate axis, caught by cargo audit / RUSTSEC (DEP-002, High) in Step 1 — don't duplicate them here.

Best-effort: skip if there are no external-crate changes. Choosing/pinning versions and MSRV is the rust-ecosystem skill's domain; this step only uses the pinned set to ground the review.

Step 2 — Severity checklist

Review the diff against these tiers. This skill owns only the review process; cite the owning skill for each fix. Each item has a stable ID in the rules.md catalog — cite it in a finding (e.g. CON-003) so the finding is addressable and dedup-able; novel issues without a catalog ID are still welcome. The tiers are defaults: every finding names its harm, and the harm cap of the review-rules skill (severity.md) bounds its severity — read that skill alongside this one for severity, finding classes and the search sweeps (sibling sweep, early-exit diff, attribution check).

  • Safety / injection / secrets / untrusted-input limits → rust-security
  • unsafe / missing // SAFETY: → rust-unsafe
  • Result-vs-panic, typed-error-vs-anyhow → rust-errors
  • .clone() / &str-vs-String / lifetimes → rust-ownership
  • Blocking-in-async / lock-across-.await / deadlock / Send+Sync → rust-concurrency
  • Allocation / hot-path / N+1 → rust-performance
  • Generic code smells / naming / wildcard-match / missing-/// → rust-idioms
  • Structural simplification / file decomposition / spaghetti branching → refactoring
  • Missing tests → rust-testing

CRITICAL — block on sight

Safety

  • unwrap() / expect() / panic! / todo! / unreachable! on a reachable production path
  • unsafe block without a // SAFETY: comment justifying every invariant (SAFETY-comment discipline & UB checklist → rust-unsafe)
  • SQL/command built by string interpolation of untrusted input (injection)
  • User-controlled path used without canonicalize + prefix check (traversal)
  • Hardcoded secret / key / token / password in source
  • Deserializing untrusted input without size/depth limits
  • debug_assert! carrying a load-bearing invariant — an unsafe precondition, a bounds/length check, a trust-boundary validation. It compiles out in --release, so the shipped binary runs unguarded; a safety-critical check must be a real assert! (→ rust-unsafe; when debug_assert! is the right call → rust-performance)

Error handling

  • Recoverable failure handled with panic!/unwrap instead of Result
  • let _ = result; silently dropping a #[must_use] / error value

HIGH — block unless justified

Safety — build-profile divergence

  • Arithmetic on an untrusted-input path whose outcome differs between the dev/test and the shipping profile. overflow-checks is on in dev/test and off in release by default, so the same expression panics under review and wraps silently in production.

    Grade against the profile the project actually ships — read [profile.release] in the crate and workspace root before assuming, it may be re-enabled there. The profile-gated panic is the floor of the impact, not the ceiling: a panic that vanishes in release is not thereby harmless. Ask what the release build does instead — a silent wrap that truncates a length, misresolves an index, or corrupts state is worse than the panic precisely because nothing reports it. "Doesn't reproduce in release, moving on" is the reflex that misses it. Report both facets.

Ownership & lifetimes

  • .clone() added to silence the borrow checker without understanding why
  • Takes String where &str/impl AsRef<str> suffices; Vec<T> where &[T] suffices
  • Explicit lifetimes where elision applies

Concurrency

  • Blocking call (std::thread::sleep, std::fs, blocking I/O) inside an async fn
  • Unbounded channel without justification (prefer bounded back-pressure)
  • Lock held across an .await
  • Inconsistent lock acquisition order (deadlock risk)
  • Missing Send/Sync where the type crosses threads

MEDIUM — warn, may merge

Performance

  • N+1 queries / repeated calls against a database or the network that stall a request path or a controller until an operator steps in — the finding naming that load and who recovers (operator-recovery); one that names no such harm is LOW (rules.md, footnote ⁵)

API & quality

  • Library returning Box<dyn Error> / anyhow::Error instead of a typed error (API-design concern → rust-errors)
  • Function > ~50 lines or nesting > 4 levels
  • Wildcard _ => on a business enum (hides new variants — prefer exhaustive)

LOW — optional, never blocks (unless a harm is named)

Performance — LOW whatever the path: a performance cost names no harm above none; the finding says whether it sits on a hot path, and one finding per pattern lists every site (rules.md, footnote ⁴)

  • Allocation inside a hot loop; to_string()/to_owned()/format!/clone() inside a loop (a clone only for the borrow checker is OWN-001)
  • Vec::new() + push loop where the size is known (with_capacity)
  • N+1 queries / repeated work in a loop that names no harm above none
  • collect() into a Vec only to iterate it once, take its length or call contains
  • Returning Vec/String where impl Iterator or a borrow (&str) would do — not on a library's pub item that already exists on the base
  • A &[String]-style parameter where &[&str] or impl IntoIterator<Item = impl AsRef<str>> serves callers — not on a library's pub item that already exists on the base; &String/&Vec<T> is clippy ptr_arg
  • A lookup key built into a String only for a get

Test coverage (cross-check with the rust-testing skill)

  • New error path or branch with no test
  • Bug fix landed without a regression test reproducing it

A missing test takes the severity of the defect it would catch once that defect and its harm are named — a missing cross-tenant denial test on a new authz-guarded endpoint is HIGH. With no harm named, it stays here. A weak assertion — a test that exists and still passes under a named regression — is a different finding: it takes that regression's harm, capped at MEDIUM (review-rules severity.md).

Docs & lint hygiene (no harm named, so optional)

  • pub item without a /// doc
  • #[allow(...)] suppressing a lint without a justifying comment
  • Crate-root #![deny(warnings)] (or other blanket lint-level attributes) — brittle: a new compiler/clippy lint becomes a hard build break for the crate and its dependents → move the denial to CI (rust-idioms anti-patterns)

Maintainability & structural simplification (fix → refactoring, rust-idioms)

  • Missed code judo — a reframing that uses the existing architecture more effectively would make this change dramatically simpler or delete a whole category of complexity (a layer, a branch family). Don't flag hypothetical rewrites; flag a concrete, behavior-preserving restructuring the author could have taken.
  • File-size growth — the diff pushes a file across ~700 lines (Rust files are dense; this is the decomposition smell, the per-function ~50-line rule above is separate) → split by responsibility.
  • Spaghetti branching — a new ad-hoc conditional / one-off branch / scattered special-case spliced into an unrelated or shared flow, instead of behind a dedicated abstraction (→ refactoring "replace conditional with dispatch").
  • Needless optionality / casts — superfluous Option wrapping where the value always exists, as-casts where From/TryFrom belongs, Box<dyn Any> / downcasting where a typed model fits.

Maintainability bar — presumption of block (strict mode)

By default the maintainability items above are LOW (optional, never block). When the review is dispatched in strict mode (the craft:review workflow's strict flag, or an explicit "harsh maintainability review" request), they invert to a presumption of block: each is treated as a blocker unless the author has clearly justified it in the diff or brief. In strict mode, Approve additionally requires:

  • no structural regression (a previously cohesive module didn't become more coupled or harder to scan);
  • no obvious simplification missed (the code-judo check above came up empty);
  • no unjustified file-size explosion;
  • no spaghetti-growth from special-case branching;
  • no hacky or magical abstraction obscuring the design.

Strict mode raises the bar; it does not invent findings — every item still goes through the verification protocol and a refuted item is dropped.

Public-API diffs — the API-design pass

When the diff changes a public API (a library crate, a published pub surface), also run the condensed Rust API Guidelines checklist → api-design.md. It catches the library-author concerns the general checklist above doesn't — missing common-trait impls, Deref-as-inheritance, out-parameters, unsealed extensible traits, leaking unstable deps, absent CHANGELOG/metadata. Each item points at the craft skill that owns the fix. Skip it for application-internal code.

Review lenses

The workflow fans the rubric out into independent lenses, each reviewing ONE slice blind to the others (higher recall than one broad pass):

LensSliceOwning skill for the fix
correctnesslogic: wrong behaviour behind correct-looking code — off-by-one, inverted or incomplete conditions, a missed case, state updated in the wrong order, a documented invariant the change breaks (a general lens)rust-idioms
securityuntrusted input reaching a sink (SQL/command injection, path traversal, deserialization, SSRF), authn/authz, tenant or owner isolation, session/token handling, secrets, crypto use (a general lens)rust-security
moneyfloat arithmetic on amounts, lost cents in splits or rounding, payment idempotency, double-charge windows, currency mixups, ledger imbalance (a general lens)rust-fintech
complexitythe code-graph metrics of the functions the diff touches (cognitive and cyclomatic complexity, loop depth, a scan or allocation in a loop, unguarded recursion), each finding carrying the numbers it stands on; runs only when the binary's code-graph index is ready (a general lens)refactoring
safetypanics on reachable paths / unsafe and soundness / FFI / build-profile-divergent arithmetic and guardsrust-unsafe, rust-security
errorsResult-vs-panic, dropped errors, typed-vs-anyhowrust-errors
concurrencyblocking-in-async, lock-across-await, deadlock, Send/Syncrust-concurrency
performancehot-loop allocation, N+1; needless allocation at LOW (collect only to iterate, owned returns and &[String] params where an iterator or borrow fits, format!/clones in a loop, String lookup keys)rust-performance
invariantsdomain lifecycle/scope rules, derived/effective quantities, eligibility checks that diverge from an existing sibling gate (a new capacity/permission predicate dropping a fail-closed dimension), and the mirror walk on two-sided contracts (below)rust-architecture, rust-fintech
compatbackward compatibility of every contract another version reads, calls or deploys against — serde/JSONB/wire data (rename with no alias, alias that only covers new-reads-old, unbackfilled migration), CLI/config/env/Helm surface and defaults, CRD/API versions, IDL, rollout order, renamed exports, regression vs last release; reads the language-agnostic compatibility cataloguecompatibility, rust-ecosystem
maintainabilitystructural simplification (code judo), file-size growth, spaghetti branching, needless optionality/castsrefactoring, rust-idioms
teststest quality not just presence; missing regression/error-path testsrust-testing
intentdoes the change do what the brief/spec says?specs
designthe decisions the change makes — a new abstraction, source of truth, module or crate boundary, format, dependency direction, storage or engine — each critiqued for its alternatives, a second implementation, the accepted architecture and the next change; seeded with the crate graph's new edges and the dev-dependency cycles they close; runs by itself when the diff adds a module, crate, public type or format, else on optional=design, in the first round only (a general lens; not yet observed live)rust-architecture

The workflow runs additional context-dependent lenses the scout selects — reconciler (controller correctness; reads the language-agnostic distributed-races catalogue) and negative-space (breakage the diff enables in unchanged code); the Rust profile, content/profiles/rust.json, extends the general profile (content/profiles/general.json): its lenses are the general ones — the Rust brief replacing the general one where both name a lens (errors, concurrency, performance, maintainability, intent, negative-space) — then Rust's own. The two files are the authoritative lens set. On a security-sensitive or large plan, or one the scout gave no pick for, the security floor adds only the profile's securityFloor lenses — for Rust security, safety, correctness, errors, concurrency, compat and invariants — beside the always set; tests still joins on any change to production code, and complexity stays the scout's pick. money, performance and maintainability run on a signal the binary reads in the diff, hunks with their function around them — a money-like name; an allocation or I/O call in a loop; a new file or one gaining 150 lines or more — whoever picked them, and only the completeness critic of a full review may name one the signal held back (not yet observed live). safety and concurrency are not gated: reachable panics, build-profile arithmetic, a load-bearing debug_assert!, Send/Sync and the many forms of async and locking have no word list to see them.

The optional pass — off by default. Two lenses are not part of the standard fan-out, because on the measured run they returned no High findings at all while producing the bulk of the Low/Info volume: api-idioms (typed errors, giant fns, wildcard match, missing docs, #![deny(warnings)] — rust-idioms) and api-boundary (error→HTTP-status mapping, OpenAPI completeness — rust-web). Their findings are real and worth having, so they are not deleted; they are bought deliberately with optional=true (or a subset: optional=api-idioms). The general profile's design lens is optional too, and joins without a request when the diff adds a module, a crate, a public type or a format. performance was in this pass and now runs on its signal, an allocation or I/O call in a loop (not yet observed live), scoped to needless allocation at LOW. Neither strict nor the security-sensitive floor turns the pass on or off — the request is the only switch. A run that skipped it says so in its report and on its run record: that is an absence of a result, never a clean one. A run stopped by a red mechanical gate lists only the optional lenses you requested — the gate, not the optional pass, is why the rest did not run.

The ownership lens was retired: across three independent runs it produced no High finding at all, against hundreds of suspicions verification would not confirm. The OWN-* rules stay in the rubric below — a standalone whole-diff reviewer still applies them, and other lenses still raise them.

Each lens expands context (callers/impls/error paths via rust-navigation) and emits blast-radius for changed public symbols.

Confidence tiers — surface, don't censor

  • Confirmed — located and survived verification; drives the verdict.
  • Suspected — borderline or unverified; surfaced for the author, never changes the verdict.

Report everything you suspect. Borderline findings go to Suspected, not the bin.

Tool grounding (seed findings)

Beyond the gate, the workflow runs real tools scoped to the diff and feeds their output in as seed findings (each still verified): cargo clippy -W clippy::pedantic -W clippy::nursery; for published libraries cargo semver-checks check-release; and semgrep as a SAST seed — in-repo ./semgrep/ custom rules always when present, plus p/rust/p/secrets when the diff is security-sensitive (auth, crypto, input parsing, unsafe, FFI, deps). semgrep results are seeds, never gate failures: taint/secrets over-report, so the downstream verification refutes the false positives (see rust-security). Optional tools degrade gracefully when absent. Each seed carries, beside its catalog ruleId, the tool's own rule name as toolRule (the clippy lint, the semgrep rule id, the semver-checks check) — what tells two lints under one catalog rule apart — and, as its title, the tool's own message verbatim: a seed without toolRule goes to the match judge, and when the judge gives no verdict only a record with the very same title sets it aside; the report lists those titles verbatim.

Severity magnitude — measure it, don't inherit it (SAF-009)

"Same class as that other finding" is a claim about mechanism, not about severity. A shared root cause says nothing about shared magnitude, and the gap can be one or two orders of magnitude — entirely invisible unless someone does the arithmetic.

For any resource-exhaustion or algorithmic-complexity finding, compute before you label:

  • Attack throughput vs a real-data baseline. Measure the same code on representative real input, not only on the crafted PoC. "8× slower than normal traffic" and "50,000× slower" are different findings; a decoder still running at 10+ MB/s under attack is not a denial of service.
  • Attacker cost per unit of victim cost — bytes (or requests) the attacker must send per second of victim CPU. This is the metric that ranks two exhaustion bugs against each other; when citing a prior finding as precedent, compare this number against that one's, not the mechanism.
  • State the units. A severity backed by a measurement carries its numbers into the report.

Crashes have no throughput curve — a panic either fires or it doesn't. Rate those by convention (malformed input causing a panic, no memory corruption, in a parsing library → Medium) and say explicitly that it is a judgement call, so the label doesn't acquire false precision.

The check cuts both ways: run honestly, it demotes inflated findings and it promotes the ones that turn out far worse than their class suggests.

The mirror walk — enforcement asymmetry (INV-005)

For a protocol, state machine, codec, or any two-sided contract, bugs cluster where an invariant is enforced in one place and not at its mirror. The asymmetry itself is the finding — you do not need a crash, and a fuzzer has no oracle for it.

  1. Enumerate the invariants. The error enum is the index: every variant names a rule someone decided to enforce. The spec/RFC and doc comments name the rest.
  2. Grep every enforcement site for each invariant — the guard, the version check, the bounds or limit test, the capability predicate.
  3. Walk the four mirror axes. For each site, where is the mirror and is it guarded the same?
    • client ↔ server — the server rejects X; does the client?
    • send ↔ receive — the outgoing value is filtered; is the incoming one re-validated?
    • offered ↔ accepted — we constrain what we offer; do we constrain what we accept back?
    • one-param ↔ all-params — one negotiated parameter is validated; are its siblings (version, algorithm, limit, scope)? Missing siblings travel in packs.
  4. Release-diff each candidate — git diff <last-tag> -- <file>. A guard present in the release and gone at HEAD is a regression, not a long-standing gap; that changes its severity.

Report: the invariant · enforced-at file:line · missing-mirror-at file:line · which axis · what the gap lets through (panic, silent drop, downgrade, accepted-but-should-be-rejected).

Proving one — the control/attack differential

These findings have no crash to point at: the defect is that a value is silently discarded or a message that should be rejected is accepted. Build the oracle as an A/B where exactly one variable changes:

  • CONTROL — the benign arrangement; the value must arrive / the message must be rejected.
  • ATTACK — byte-for-byte the same construction with the one variable flipped; the loss or the wrong-accept must appear.

The oracle is the delta, not a panic. Assert both halves and exit non-zero unless CONTROL holds and ATTACK reproduces — then the reproducer doubles as the regression test, and a fix that breaks CONTROL cannot pass by making ATTACK stop firing.

Reach the state through the crate's own test helpers (its tests/common, an internal *-test crate, a #[cfg(feature = "test-util")] surface) rather than hand-rolling the wire format or mocking the protocol. A PoC over a mock measures the mock. Then state plainly what the harness demonstrated versus what is inferred — "acceptance demonstrated at the API; on-path reachability inferred, not exercised" is an honest and much stronger claim than blurring the two.

Premise grounding — cite it or drop the claim

Most findings rest on a premise that is not visible at the line they cite: "the dependency rejects this", "this is reachable from untrusted input", "no caller guards it", "the sibling path does X". That off-site premise is the claim a review most reliably invents — and a second, smarter reading does not catch it, because it reproduces the same assumption. Only opening the code does.

So every off-site premise is pinned to a file:line you actually opened — dependency sources included (~/.cargo/registry, the vendored tree) — and reported in the finding's whereChecked. A premise you did not open is not admissible: open it, or drop the claim and report only what the cited line itself shows.

This binds rejection exactly as much as confirmation. "A caller already validates this," waved through without opening the caller, is the same unfounded claim as the finding it dismisses — and it discards a real bug silently. Uncertain and unable to check? That is Suspected, not a rejection.

An off-site premise nobody could pin costs a finding its Confirmed tier — it drops to Suspected, never to refuted. Unsupported is not disproven, and burying it as "refuted" would keep a possibly real defect out of every later round.

Verification protocol

Every finding (lens or seed) is checked before it can be Confirmed:

  • Mechanical first: if a tool can decide the finding (a clippy lint, semgrep rule, cargo-audit advisory), the verifier re-runs it scoped to the cited file and the tool's output overrides judgement in both directions. Tool-reported seeds can never be refuted on reasoning alone — only by the tool demonstrably no longer reporting them.
  • Adversarial: skeptics try to REFUTE it (default to refuted when uncertain — except tool-reported seeds, per above). One skeptic by default; three-vote consensus for Critical/High.
  • Self-verification (anti-hallucination): re-read the cited file:line — does the code actually say what the finding claims? A wrong citation drops the finding. A path that is test/example-only (not production-reachable) does NOT drop it — it demotes the confirmed severity one notch.
  • Exclusion catalog: a rejection is a claim and carries the same burden as the finding. When one of the false-positive precedents in fp-rules.md — or in the language-independent fp-rules.md of the review-rules skill, which shares its ID space — fires, cite its ID (refuted per FP-006) — and run the trace that rule demands, not the shape it matches. That file also lists the KEEP-* non-reasons: dismissals that sound decisive and have repeatedly killed real defects.

Step 3 — Verdict

VerdictWhen
Approve ✅every gate signal green by your own runs (a green CI check never counts), no Confirmed CRITICAL/HIGH/MEDIUM
Warning ⚠️Confirmed MEDIUM at most over a gate green by your own runs, or a gate NOT ESTABLISHED or partly unknown (Step 1, item 4) with nothing Confirmed CRITICAL/HIGH — Suspected items listed but don't block
Block ⛔gate red (a local run, or a red CI check that runs the command), or any Confirmed CRITICAL/HIGH
INCOMPLETE 🚫the review itself could not run — no diff to read, or the lenses failed — so nothing was judged; never for a gate that could not be established

In strict mode, the maintainability bar applies: a Confirmed maintainability finding (code judo missed, file-size explosion, spaghetti branching, hacky abstraction) is a presumptive Block unless the author justified it — escalated from its default LOW. Outside strict mode those findings stay LOW (optional) unless a harm is named.

Report findings as severity · file:line · [rule-id] · what · why · fix. Cite the rules.md catalog ID when the finding maps to one (e.g. CON-003); novel findings need no ID. Be specific and cite the line; a finding without a location isn't actionable.

"Gate green / red" is read from Step 1 — green only from your own run; red from your own run or a red CI check that runs the command. Cite which in the ## Gate line of the output, and report a green CI check there as CI green for <check> beside a signal that stays unknown. When the gate could not be established, in whole or in part, the ## Gate line says so (NOT ESTABLISHED — cargo not on PATH, with the CI you saw) and the verdict is at most Warning, never Approve: silence from a gate that never ran is not a pass.

Requesting a review & acting on the verdict

Review early and often — small reviews catch issues while they're cheap; one giant review at the end catches them after they've compounded. Request after a feature or meaningful unit of work, before merging, when stuck, or after a complex bug fix.

Hand the reviewer a crafted brief, not your chat history:

  • the diff range — BASE..HEAD (git merge-base main HEAD and HEAD); the agent derives the exact range itself via git diff --merge-base main, so the SHAs are just for your reference;
  • what it should do — the requirement/spec it's meant to satisfy (→ specs);
  • what you built — a one-paragraph summary.

Where the harness ships craft's review agents (Claude Code, OpenCode), dispatch them with that brief; where it does not (Codex), apply this rubric yourself in the session:

  • rust-reviewer — runs the cargo gate + this rubric → Approve/Warning/Block.
  • rust-security-scanner — security-sensitive changes (deps, unsafe, input handling) → rust-security verdict.
  • rust-miri — when the change touches unsafe (→ rust-unsafe).

Acting on the verdict — working a set of findings to green (triage accept/reject/defer/needs-decision, order blocking → simple → complex, fix, verify, re-review, close the loop on GitHub) is its own discipline → addressing-findings; its triage, whatever the batch size, is the craft:triage-findings workflow launched by the main session.

Proving a claim — what proves what

The Rust commands that actually prove each claim:

ClaimProof (run it)Not proof
tests passcargo test / cargo nextest run → 0 failed"should pass", an earlier run
doctests passcargo test --docunit tests passing
lint cleancargo clippy --all-targets -- -D warnings → exit 0cargo check passing
formattedcargo fmt --check"I ran fmt earlier"
it buildscargo build --release → exit 0clippy passing
bug fixedre-run the case that reproduced it → passescode changed, "looks right"
a panic is release-unreachablere-run the repro under the shipping profile and state what release does instead (wrap? truncate? corrupt?)overflow-checks is off in release
a silent-loss / wrong-accept bug is reala control/attack pair differing in ONE variable: CONTROL correct and ATTACK reproducing (above)no panic, "the code clearly drops it"
a defect is reachable from untrusted inputdrive it through the real public entry point on crafted inputreproduced by constructing the state directly (builder/new/test fixture)
regression test workssaw it RED before the fix, GREEN afterit's green now
no vulnscargo audit / cargo deny check clean"deps look fine"
coverage target metcargo llvm-cov --fail-under-lines Ntests pass
an agent finishedread the actual diff / its outputthe agent said "success"
requirements metcheck each one against the spectests pass

A green CI check (required or not) for the same command is not proof of that command: report it (CI green for <check>) and still produce the fresh signal yourself (see Step 1 — Establish the gate). A red one is proof the command fails.

State the claim with the evidence, or state the real status with the evidence. An earlier run, a "should pass", or a subagent's self-report is not evidence.

Boundaries

  • How to write the missing tests → rust-testing skill (this rubric only flags that they're missing).
  • This skill judges; it does not rewrite. Propose the fix, let the author apply it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.