Logo vun Rust Review

Rust Review

CommunautéitBeléift
morganlinton
rust-review

Review existing Rust code for idiom, API design, error handling, safety, and maintainability, and produce a prioritized report where every finding cites the rule it breaks and gives a concrete fix. Use this whenever the user asks to review, audit, critique, grade, or "check" Rust code, a crate, a module, a .rs file, a diff, or a pull request, or asks what is wrong with their Rust or how to make it more idiomatic, even if they don't say "review". Pairs with the rust-best-practices skill, which covers writing new code.

Iwwersiicht

Editeurmorganlinton
RepositoryBeautifulRust
Skill-Nummrust-review
Stären
1.5K
Forks
78
Matgeliwwert Fichieren
34
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 34 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum morganlinton op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Rust Review an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/morganlinton/BeautifulRust/tree/main/skills/rust-review
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/morganlinton/BeautifulRust.git /tmp/BeautifulRust
mkdir -p .claude/skills
cp -r /tmp/BeautifulRust/skills/rust-review .claude/skills/rust-review
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Rust Review an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Rust Review automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Rust Review net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Rust review

Review Rust code against the same rules the rust-best-practices skill uses for writing it, and report what to change. The output is a review, not a rewrite: the reader decides what to fix. Only rewrite code when the user asks for that.

1. Decide the scope

  • What to read. Review exactly what the user pointed at: a file, a module, a crate, or a diff. For a diff, review the changed lines and anything they break, not the whole file.
  • Library or application. Check for a lib.rs, pub items used by other crates, or a published Cargo.toml. Library code is held to the API-design rules strictly. Application code gets the simplicity rules instead: concrete types, anyhow-style errors, and no speculative generality. Say which you assumed at the top of the report.
  • The edition and MSRV, from Cargo.toml, so you don't recommend features the project can't use.
  • Frameworks. If the crate depends on bevy or bevy_ecs, read the Bevy digest (bevy.md) in the rust-best-practices skill's references first. It lists the Bevy conventions to leave alone (by-value system parameters, the prelude, plain-data components) and the ECS bugs to look for.

2. Run the tools first, if you can

If a Rust toolchain is available, run these from the crate root and fold the results into the report. They catch the mechanical issues, which leaves you free for design.

bash
cargo fmt --check
cargo clippy --all-targets --all-features -- -W clippy::pedantic
cargo test

Don't paste raw clippy output. Group repeated warnings into one finding, and skip pedantic lints that don't matter for this code. If the tools aren't available, say so in the report and review by reading.

3. What to look for, in priority order

Work through these in order. The first two categories are where real bugs live.

Correctness and soundness

  • Undefined behavior: an unsafe block without a // SAFETY: comment, transmute to cast enums or extend lifetimes, unsafe impl Send/Sync used to silence the compiler, or a safe function that can cause UB through safe calls (unsound).
  • Panics on reachable paths: unwrap(), expect(), indexing, as casts that wrap, or integer overflow, wherever input from outside can reach them.
  • Trait contracts: a hand-written Ord with a derived PartialEq, or Hash that disagrees with Eq. These silently corrupt BTreeMap, HashMap, sort, and dedup.
  • Lock hazards: a MutexGuard held across .await or returned to a caller, user closures called under a lock, or a poisoned lock recovered with into_inner.
  • ECS bugs in Bevy code: two queries that can reach the same component mutably (a B0001 panic on the first frame), systems that read each other's results with no order between them, and deferred Commands read back before they apply.
  • Destructors that panic, block, or can fail.

Error handling

  • Errors that callers can't use: (), String, or Box<dyn Error> as a library's public error type, an error enum without Display and std::error::Error, or anyhow::Error in a library's public API.
  • Errors that lose information: map_err(|_| ...), no source(), or messages without the path, line, or value that failed.
  • Panics used for expected failures, or catch_unwind used as control flow.

API design (strict for libraries)

  • Parameters: &String, &Vec<T>, or &Box<T> instead of &str, &[T], or &T; a bool parameter in a public signature; ownership taken and then cloned, or a borrow cloned internally to get ownership; impl Into<T> in application code, or on a library function too rarely called to justify a copy per argument type.
  • Return types: a library function that collects into a Vec only to return it, when an iterator would do. Owned results are fine when callers need ownership or random access, or when building the collection is the function's job.
  • Visibility: public fields that should be private, Rc, RefCell, or Arc in public signatures, or third-party types leaking into the API.
  • Missing standard traits: Debug on public types, Display on errors, Default next to a zero-argument new(), and FromStr instead of an ad-hoc from_str method.
  • Naming: get_ prefixes on getters, as_/to_/into_ that don't match their cost and ownership, and Manager/Service/Util names.
  • Evolution: public enums or structs that should be #[non_exhaustive], or traits that should be sealed.

Idiom and clarity

  • Clones that exist only to satisfy the borrow checker.
  • Check-then-unwrap (if x.is_some() { x.unwrap() }), and match where a combinator is clearer, or the reverse.
  • String building with +, hand loops that are clearer as iterators, or iterator chains long enough to need a loop.
  • HashMap iteration order leaking into output or tests.
  • #![deny(warnings)] in source, #[allow] without a reason, and glob imports of external crates (a framework's documented prelude, such as bevy::prelude, is fine).

Documentation and tests

  • Public items without docs, and docs that restate the name.
  • Missing # Errors, # Panics, or # Safety sections where they apply.
  • Doc examples that use unwrap() instead of ?.
  • Logic with no tests, or tests that only restate constants.

The rust-best-practices skill and its references/ folder hold the full rules and their reasoning. If it is installed, read the relevant reference when a finding needs a rule you're unsure of. Otherwise, rely on the summary above.

4. Write the report

Use this structure:

markdown
# Rust review: <what was reviewed>

<One paragraph: what the code does, library or application, overall verdict, and the
single most important thing to fix. Say whether clippy and tests were run.>

## Must fix
### 1. <Short title> (`src/file.rs:42`)
**Rule:** <rule name and source, e.g. "Errors implement std::error::Error (C-GOOD-ERR,
Rust API Guidelines)">
**Problem:** <what is wrong and the concrete consequence, one or two sentences>
**Fix:**
```rust
<the smallest code change that fixes it>
```

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

## Consider
### 3. ...

## What's already good
- <2 to 4 specific things the code does well>

How to sort findings:

  • Must fix means a bug, a soundness hole, a reachable panic, or an API mistake that becomes a breaking change once published.
  • Should fix means it works but violates a rule with a real cost, such as worse error messages, harder testing, or a confusing API.
  • Consider means style, naming, and polish.

Rules for each finding:

  • Cite a location as file:line for every finding (write whole file for a finding that has no single location, such as missing tests), and cite the rule with its source: an API Guidelines code such as C-GETTER, an Effective Rust item number, a Microsoft guideline code such as M-PANIC-ON-BUG, a clippy lint name, or "Google Rust Style Guide". A reader should be able to look the rule up.
  • Show the fix as code, kept to the lines that change. Don't rewrite whole functions.
  • Group repeats. One finding for "eight unwrap() calls on parse results", listing the lines, rather than eight findings.
  • Respect intent. If something looks deliberate, such as a documented quirk or a comment explaining it, mention it under Consider with the trade-off. Don't mark it Must fix.
  • Keep it proportionate. For a short file, five to ten findings is plenty. Don't pad the list, and don't hide a real bug among style nits.
  • "What's already good" is required. It tells the author what to keep and makes the rest credible.

5. Offer the lints

If the project lacks a [lints] table, end the report by suggesting the BeautifulRust lints config (lints/lints.toml and lints/clippy.toml in the BeautifulRust repo, https://github.com/morganlinton/BeautifulRust). It makes clippy catch most of the mechanical findings above automatically. Name two or three findings from this review that it would have caught.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Rust Review?

Review existing Rust code for idiom, API design, error handling, safety, and maintainability, and produce a prioritized report where every finding cites the rule it breaks and gives a concrete fix. Use this whenever the user asks to review, audit, critique, grade, or "check" Rust code, a crate, a module, a .rs file, a diff, or a pull request, or asks what is wrong with their Rust or how to make it more idiomatic, even if they don't say "review". Pairs with the rust-best-practices skill, which covers writing new code.

Firwat Rust Review op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Rust Review besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Rust Review an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/morganlinton/BeautifulRust/tree/main/skills/rust-review an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Rust Review benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Rust Review benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Rust Review domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Rust Review gratis?

Jo. De Skill gëtt vum morganlinton ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇