Rust code review
Skill nledford/engineering-review-board/skills/rust-code-review
A collection of AI agent skills I have written
npx -y skills add nledford/engineering-review-board --skill rust-code-reviewAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Review Rust code with Rust-specific rigor. Use with code-review when changes touch Rust ownership, lifetimes, traits, error contracts, crate boundaries, feature flags, tests, Rustdoc, async, Tokio, Axum, Leptos, SQLx, SeaQuery, SeaORM, Diesel, SQLite, unsafe code, macros, FFI, public APIs, design patterns, anti-patterns, or performance-sensitive behavior. Use sql-engineering, postgresql-sql-engineering, or sqlite-sql-engineering too for database-native schema, SQL, migrations, privileges, or query plans.
SKILL.md
8.6 KB, ~1.8k tokens by cl100k_base, as published. Nobody here has run it
Rust Code Review
Use this skill as a specialist lens with
code-review, not as a replacement for it. Keep
findings tied to concrete behavior, contracts, safety, performance, or
maintainability risk.
Before reporting findings, apply
review-verification-protocol.
Use When
- Reviewing Rust source, tests, examples, benchmarks, macros, build scripts, or generated Rust contracts.
- Changes involve ownership, borrowing, lifetimes, trait bounds, public APIs, crate boundaries, feature flags, error handling, async runtime behavior, concurrency, HTTP/UI behavior, database access, SQL, unsafe code, FFI, macros, panic behavior, performance, or resource management.
- A Rust CI failure, Clippy finding, nextest failure, doctest failure, compile-time macro failure, SQLx prepare failure, Miri/Loom concern, or compile error needs review judgment.
Review Workflow
- Start with the general
code-reviewintent, affected surfaces, and validation status. - Identify the Rust-specific risk: type contract, ownership, API shape, error semantics, async/concurrency behavior, web boundary, persistence boundary, unsafe invariant, macro expansion, allocation, or performance.
- Read the full enclosing module or API, not just the diff hunk.
- Search for callers, trait impls, feature flags, generated mappings, tests, SQL migrations, docs, and CI recipes before claiming a contract is broken or unused. Use local code navigation for references, implementations, call relationships, and diagnostics when semantic evidence helps. Use direct reads/search for exact strings, docs, config, logs, fixtures, and generated or macro-expanded code, and repository commands for tests, builds, or other validation.
- Use the relevant implementation skill for deeper context:
rust-engineering,rust-testing-quality,rust-async-web, orrust-persistence-sql. Addrust-design-patternswhen judging a deliberate pattern choice, orrust-antipatternswhen reviewing a smell-focused concern. Addsql-engineering,postgresql-sql-engineering, orsqlite-sql-engineeringwhen database-native schema, SQL, migrations, privileges, RLS, PRAGMAs, locking, or query plans are part of the review. - Prefer fixes that make invalid states unrepresentable, preserve public contracts deliberately, and keep unsafe obligations small and documented.
- Verify with the relevant Rust lane or report missing evidence explicitly.
Rust Review Checklist
Correctness and API:
- Public names, visibility, trait bounds, lifetimes, feature flags, and error contracts match the intended caller contract.
- Ownership avoids unnecessary clones, hidden aliasing, stale references, and lifetime over-generalization.
- Domain invariants are represented in types, constructors, constraints, or state transitions rather than scattered checks.
Result,Option, panic, and cancellation behavior are documented or obvious from the API.
Async, web, and persistence:
- Async code does not block the runtime, leak tasks, ignore cancellation, hold
incompatible guards across
.await, or use unbounded queues without a reason. - Tokio runtime construction stays at process/test edges: no nested runtimes, no
hidden blocking work inside async APIs, and explicit
spawn_blockingor worker boundaries for unavoidable blocking/CPU-heavy operations. - Spawned tasks have ownership and supervision:
JoinHandle,JoinSet, or task tracker results are observed; detached tasks have a shutdown path, instrumentation, and a documented reason. - Cancellation is cooperative and tested where it is part of the contract: cancellation tokens, channel closure, signal handling, timeouts, and task joining line up with graceful shutdown behavior.
- Async boundaries follow the architecture: domain logic remains framework- and Tokio-independent where practical; application services orchestrate async ports; adapters own runtime, channel, retry, timeout, tracing, and driver details.
- Async trait choices are justified: native async traits, explicit future return
types, boxed futures, or
async-traitmatch the repository's MSRV, object-safety needs, allocation tolerance, dyn-dispatch needs, andSendrequirements. - Axum handlers, Leptos components/server functions, and persistence adapters are thin enough for domain logic to be tested outside the framework.
- SQLx queries, SeaQuery builders, migrations, transactions, constraints, and indexes preserve database invariants. Bind runtime query values; construct DDL identifiers, migrations, constraints, and indexes safely as static reviewed SQL or through a reviewed builder, then review their invariants.
- Query macros behind tests, target-specific code, or features have offline
metadata prepared and checked with the repository-supported Cargo target and
feature matrix forwarded after
--. Require matchingSQLX_OFFLINE=trueCargo checks for every supported configuration; userust-persistence-sqlfor the command shape and database setup. - SeaQuery is justified by genuine dynamic query composition and does not hide
simple static SQL that
sqlxmacros could check. - PostgreSQL-native and SQLite-native schema, index, privilege, RLS, PRAGMA, transaction, and plan concerns are reviewed with the database skills.
Safety, macros, and performance:
- Unsafe code has a small boundary, explicit safety comments, documented invariants, and risk-appropriate tests or tooling.
- Atomics and locks prove the needed synchronization without decorative
SeqCst, accidental deadlocks, or runtime blocking. - Macros have clear expansion, hygiene, diagnostics, feature gates, and compile-fail coverage for caller-facing errors.
- Performance changes are tied to a measured bottleneck or a clearly bounded complexity/allocation issue.
Testing and documentation:
- Tests cover the changed behavior at the lowest useful layer plus framework or database boundaries where those semantics matter.
- Doctests are run when public examples or Rustdoc contracts changed.
- Clippy suppressions are narrow and justified.
- Missing validation is called out as residual risk, not hidden.
Useful verification commands include:
cargo fmt --check
cargo check --workspace --all-targets
cargo test --workspace
cargo test --doc --workspace
cargo nextest run --workspace
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo sqlx prepare --check --workspace -- --workspace --all-targets --features <supported-feature-set>
SQLX_OFFLINE=true cargo check --workspace --all-targets --features <supported-feature-set>
Use repository recipes instead when they encode the correct toolchain, features,
services, or target matrix. When all targets and all features are compatible,
the corresponding metadata command can be
cargo sqlx prepare -- --all-targets --all-features; otherwise, forward the
supported target and feature arguments after -- and use the matching
workspace/check variant.
Reporting Rules
- Report Rust findings through the
code-reviewfinding format and severity scale. - Cite the concrete type, function, trait impl, module, migration, query, test, or command.
- Do not flag idiomatic alternatives as defects unless the current code creates a real behavior, contract, safety, performance, or maintainability risk.
- Do not require heavyweight Miri/Loom evidence for ordinary safe Rust. Reserve those gates for unsafe, atomics, hand-rolled synchronization, or concurrency primitives where normal tests cannot prove the invariant.
- Do not turn a review into a style rewrite. Prefer focused findings with a specific failure mode and a practical fix direction.
Gives 0 of the 12 instructions most code review skills give in ~1.8k tokens
Counted across 610 of the 674 authors here whose files we hold, read 2026-08-06
- push back with technical reasoning if wrongin 60 of 610, across 24 files
- ask for clarification on unclear itemsin 51 of 610, across 16 files
- fix critical issues immediatelyin 45 of 610, across 29 files
- implement one item at a timein 45 of 610, across 11 files
- group findings by severityin 44 of 610, across 43 files
- verify feedback against the codebasein 42 of 610, across 8 files
- dispatch a code reviewer subagentin 39 of 610, across 23 files
- fix important issues before proceedingin 37 of 610, across 22 files
- test each fix individuallyin 35 of 610, across 7 files
- reply in github comment threadsin 33 of 610, across 5 files
- check for security vulnerabilitiesin 31 of 610, across 27 files
- factualize corrections without over-explainingin 30 of 610, across 2 files
Said here and by no other author read
- read the full enclosing module not just the diff
- search callers and tests before claiming a contract is broken
- prefer fixes that make invalid states unrepresentable
- document or make obvious result option and panic behavior
- ensure async code does not block the runtime
- verify cancellation is cooperative and tested
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.