agentleFS
po4ykapo4yka/rust-skills/skills/rust-review/SKILL.md

rust-review

Skill5 starsChanged 11 days agoBSD-3-ClauseView on GitHub

Use when reviewing Rust code that someone else wrote (a diff, a pull request, a file, or a crate) and writing a prioritized review report, with each finding at its location, the rule it breaks, and the smallest fix as code. Not for writing or fixing the code, or for a review of one area that one skill owns, such as unsafe or async code; load that skill.

13 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use python-review, rust-best-practices and 1 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.
  • kingsidharthSkill

    python-review

    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 4 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the code is trusted, or after approval, run these from the workspace root:

    line 38
  2. Very specific:

    Do not run cargo fmt without --check: it rewrites the code under review.

    line 46
  3. Distinctive:

    If a tool cannot run (no toolchain, no network for a dependency, no approval), say so in the report and review by reading.

    line 49
  4. Distinctive:

    Keep it in proportion: five to ten findings for one file.

    line 116
  5. Distinctive:

    When code looks deliberate (a comment explains it, or a test pins it), name the trade-off under Consider instead of calling it a defect.

    line 118
  6. Distinctive:

    Consider instead of calling it a defect.

    line 119

“Common” is measured: kept by at least 6 in 10 of the 12 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

A review reports what to change and why; the author decides what to fix. Do not edit the code under review unless the request asks for a fix. This skill holds the method and the report. The rules live in the skills that own them: the table in Where to look names the owner of each area, and the check to run when that skill is not installed.

Scope

  1. Read what the request names. For a diff, read the changed lines and the code they can break: callers of a changed signature, invariants of a changed type, and tests of a changed behavior. git diff --stat <base>...HEAD lists the files; git diff <base>...HEAD shows the lines. Do not review unchanged code that the diff cannot affect.
  2. Decide library or application. A crate that other crates use (a lib.rs, publish not set to false, or a path dependency of another crate) gets the API rules in full. An application gets the simpler rules: concrete types, one error type with context, no speculative generics. Say which one you assumed in the report.
  3. Read the edition and the MSRV (edition, rust-version in Cargo.toml). Do not propose an API or a syntax that is newer than the MSRV.
  4. Respect the framework. A framework convention wins over generic advice: system parameters by value in Bevy, a framework prelude glob, an attribute macro that generates pub items. At most, report it under Consider.

Run the tools first

cargo clippy and cargo test run code from the reviewed tree: build scripts, procedural macros, and the tests themselves. Before you run them on code from someone you do not trust, such as a pull request from outside the team, read build.rs, the proc-macro crates, and the changed tests, and get the user's approval. Run them in a sandbox with no secrets and no network. Without that approval, review by reading, and say so in the report.

When the code is trusted, or after approval, run these from the workspace root:

cargo fmt --all -- --check
cargo clippy --locked --workspace --all-targets -- -D warnings
cargo test --locked --workspace
  • Do not run cargo fmt without --check: it rewrites the code under review.
  • Report each command and its result. Group clippy output by lint, with the lines; do not paste it raw. A lint that the project allows on purpose, with a reason, is not a finding.
  • If a tool cannot run (no toolchain, no network for a dependency, no approval), say so in the report and review by reading.

Where to look

Work through the areas in this order. The first four are where real defects live.

AreaLook forOwner of the ruleCheck without the owner
Soundnessunsafe with no // SAFETY: comment, transmute, unsafe impl Send or Sync, a safe function that can cause undefined behaviorrust-unsafeclippy::undocumented_unsafe_blocks; cargo +nightly miri test on the tests that reach the code
Threads and tasksA value that is not Send across a thread or an .await, a lock guard held across .await, a select! branch that is not cancel-saferust-send-sync, rust-async-internalsclippy::await_holding_lock; a compile-time fn assert_send<T: Send>() {} call
Atomics and globalsOrdering::Relaxed that publishes data, static mutmemory-modelMIRIFLAGS="-Zmiri-many-seeds=0..16" cargo +nightly miri test
Reachable panicsunwrap, expect, indexing, or an as cast on input from outside; a panic that can cross extern "C"rust-panic-safetyclippy::unwrap_used, clippy::indexing_slicing, clippy::cast_possible_truncation
Drop and borrow pointsA guard alive through a match, a temporary that drops early or laterust-borrow-semanticsclippy::significant_drop_in_scrutinee; a try_lock().is_ok() assertion in a test
ErrorsString, (), or Box<dyn Error> as a library's error type, anyhow::Error in a public signature, map_err(|_| ...) that drops the causerust-code-stylea thiserror enum with #[from] for each cause
API shape&String or &Vec<T> parameters, a bool parameter, Rc<RefCell<_>> in a pub signature, get_ getters, conversions named against their cost, missing standard traitsrust-discipline and its API conventions referenceclippy::ptr_arg, clippy::fn_params_excessive_bools, clippy::wrong_self_convention, missing_debug_implementations
Published compatibilityA new variant on an exhaustive pub enum, a new field on a public struct, a removed itemrust-crate-releasecargo semver-checks --baseline-rev <base>
Wire formatsA changed Serialize or Deserialize on stored or sent datarust-serdea test that decodes a recorded old payload with serde_json::from_str
Lints and suppressions#[allow] with no reason, #![deny(warnings)] in sourcerust-lintsclippy::allow_attributes_without_reason
TestsA bug fix with no regression test, a test that restates a constantrust-tddthe test count in cargo test output before and after the change
PortsA rewrite that must keep another implementation's outputrust-portthe recorded comparison in its PORTING.md
Speed and sizeA performance claimrust-performancea profile or cargo bench numbers; without them, the claim is not a finding

For a full API pass on a library, read the review checklist reference of the rust-discipline skill when it is installed; otherwise run clippy::pedantic once and use the API shape row above.

Severity

SectionWhat belongs there
Must fixUndefined behavior or unsoundness, a data race, a panic or a hang that outside input can reach, data loss, a security hole, a breaking change to a published API
Should fixCode that works but breaks a rule at a real cost: an error that loses its cause, an API that is hard to use correctly, a bug fix without a test
ConsiderStyle, naming, and polish; a deliberate choice that has a cost worth naming

A Must fix needs evidence: a failing test, a tool line, or the input that triggers it. Without evidence, put it under Should fix and mark it "not verified".

The report

# Review: <what was reviewed>

<One paragraph: what the code does, library or application, the verdict, and the one thing to
fix first. List the commands that ran and their results, or say that none could run.>

## Must fix

### 1. <Short title> (`src/file.rs:42`)
Rule: <owner skill, and the rule code where one exists: C-GETTER, clippy::ptr_arg, E0502>
Problem: <what goes wrong, and for which input or caller>
Fix:
<the smallest change, as a code block of the lines that change>

## Should fix
### 2. ...

## Consider
### 3. ...

## Already good
- <two to four specific things the code does well>
  • Give every finding a location (file:line, or "whole crate" for a missing test suite) and a rule that a reader can look up.
  • Show the fix as code, kept to the lines that change. Do not rewrite whole functions.
  • Group repeats: one finding for "four unwrap() calls on parsed input", with all the lines.
  • Keep it in proportion: five to ten findings for one file. Do not bury a Must fix under style notes, and do not pad the list.
  • When code looks deliberate (a comment explains it, or a test pins it), name the trade-off under Consider instead of calling it a defect.
  • "Already good" is required. It tells the author what to keep, and it shows that the reviewer read the code.

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.