agentsclimarketplace

Rust design review

Skill nikhil-salgaonkar/rust-design-review

Conduct a thorough Rust design review of code, functions, modules, or entire crates, covering idioms, design patterns, and anti-patterns. Use this skill whenever the user pastes or points at Rust code and asks for a review, design critique, pattern audit, or says things like "is this idiomatic?", "how would a Rust expert write this?", "review my Rust code", "what patterns am I missing?", "is this good Rust?", "do a design review", or "what am I doing wrong in Rust?". Also trigger for any request to refactor Rust code to be more idiomatic or better structured. Produces a structured review grounded in the rust-unofficial/patterns book (https://rust-unofficial.github.io/patterns/).From its SKILL.md

Install
npx -y skills add nikhil-salgaonkar/rust-design-review

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 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 file declares

Copied from the file, not written here

The file declares its own license as MPL-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.9 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it

Rust Design Review

A structured review skill grounded in the Rust Design Patterns book (rust-unofficial/patterns), covering idioms, design patterns, and anti-patterns.


Review Process

Work through these four phases in order. (Empty sections are omitted from the output — see Output Format — but do not skip a scan phase itself.)

Phase 1 — Understand context

Before reviewing, briefly note:

  • Scope: Is this a library crate, binary, module, or function snippet?
  • Audience: Public API (crate users) or internal code?
  • Rust edition if visible.

Library APIs get stricter scrutiny on ergonomics and trait implementations. Internal / binary code gets lighter scrutiny on those axes.

Phase 2 — Idiom scan

Work through the Idioms Checklist (see references/idioms.md). Flag every violation with a severity: 🔴 Must Fix, 🟡 Should Fix, 🔵 Consider.

Quick summary of what to scan for:

AreaCommon slip
Function arguments&String / &Vec<T> / &Box<T> instead of &str / &[T] / &T
String building+ operator chains instead of format!
ConstructorsMissing new associated fn; Default not derived when it could be
Ownership in enumsCloning to satisfy borrow checker instead of mem::take / mem::replace
Options / ResultsManual if let Some loops instead of iterator combinators
ClosuresCapturing whole env with move when only some vars are needed
Mutabilitymut persisting beyond the point where mutation is needed
Error returnConsuming an arg without returning it inside the error
Public API structsNot using #[non_exhaustive] when forward compatibility matters

Phase 3 — Pattern & anti-pattern audit

Work through the Patterns & Anti-patterns Checklist (see references/patterns.md).

Anti-patterns default to 🔴 Must Fix unless the surrounding context clearly justifies them (e.g. a deliberate clone in throwaway prototype code). Pattern opportunities are 🔵 Consider.

Key things to flag:

SmellLikely pattern to suggest
Long builder-like new(a, b, c, d, e...)Builder pattern
Mutex/resource accessed without guard typeRAII with guards
f32/u32/String used for domain values without newtypeNewtype pattern
Box<dyn Trait> list with manual dispatchCommand pattern or strategy via traits
Enum variants with complex logic duplicatedVisitor pattern
State machine logic scattered across methodsTypestate pattern
Clone called only to appease the borrow checkermem::take / restructure
Inheriting from base structs via DerefDeref polymorphism anti-pattern
#[deny(warnings)] in library codeReplace with #[warn] in CI
unsafe blocks spanning many linesContain unsafety in small modules

Phase 4 — Write the review

Use the Output Format below. Be specific: quote the offending code (short snippets), name the pattern from the book, and show the corrected version.

Refactor requests

If the user asked for a refactor ("make this idiomatic", "clean this up") rather than a written review, run Phases 1–3 exactly as above, then apply the fixes directly to the code instead of writing the report: fix all 🔴 and 🟡 findings, apply 🔵 suggestions only where they don't expand scope, and finish with a short summary of what changed, grouped by severity, naming each pattern applied.


Output Format

## Rust Design Review

### Summary
<2–3 sentence overall assessment. Note the biggest wins and the most critical issues.>

### 🔴 Must Fix
<numbered list — each item: what, why, fixed version>

### 🟡 Should Fix
<numbered list — each item: what, why, improved version>

### 🔵 Consider
<numbered list — each item: pattern name, where it applies, brief sketch>

### ✅ What's Done Well
<bullet list — call out idioms and patterns already used correctly>

Omit any section that has no entries. Do not pad with generic praise.


Reference Files

  • references/idioms.md — Full idioms checklist with examples (read when doing the idiom scan)
  • references/patterns.md — Full patterns & anti-patterns catalogue (read when doing the audit)

The summary tables in Phases 2 and 3 are a quick index only; the reference files are authoritative. Always read the relevant reference file before writing your first comment for that phase, including for short snippets — relying on memory risks inventing rules that aren't in the book.


Tone & Scope

  • Be specific, not generic. "Use &str instead of &String on line 12" beats "prefer slices".
  • Quote brief code fragments. Show corrected code for every 🔴 item.
  • Prioritise by impact. A single 🔴 anti-pattern matters more than five 🔵 style notes.
  • Acknowledge trade-offs. Some patterns add boilerplate; say so.
  • Stay grounded in the patterns book; do not invent new rules. The one exception is the "Supplementary: Functional Style" section of references/patterns.md, which is explicitly labelled as general Rust convention rather than book content — attribute those findings accordingly.

What ships with it: 5 files

38.5 KB alongside SKILL.md

references/

Keep looking

Skills are one crate of 326,750. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.