New advertisers: 50% off your first month with code FIRSTMONTHSee slots
actionbook avatar

M15 Anti Pattern

Rust code review checklist that flags anti-patterns and points to idiomatic replacements with tracing to design causes.

skills.sh installs
9.4K
GitHub stars
1.6K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers an anti-pattern table mapping .clone(), .unwrap(), Rc, unsafe, String, and similar habits to better alternatives
  • Includes a code smell to refactoring table, a top five beginner mistakes list, and a quick review checklist
  • Enforces trace-up questions that ask whether a symptom like excessive cloning points to an unclear ownership design
  • Designed for reviewing Rust code and cross-referencing related skills for ownership, error handling, and performance

Install

$ npx -y skills add actionbook/rust-skills --skill m15-anti-pattern -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Anti-Patterns

Layer 2: Design Choices

Core Question

Is this pattern hiding a design problem?

When reviewing code:

  • Is this solving the symptom or the cause?
  • Is there a more idiomatic approach?
  • Does this fight or flow with Rust?

Anti-Pattern → Better Pattern

Anti-PatternWhy BadBetter
.clone() everywhereHides ownership issuesProper references or ownership
.unwrap() in productionRuntime panics?, expect, or handling
Rc when single ownerUnnecessary overheadSimple ownership
unsafe for convenienceUB riskFind safe pattern
OOP via DerefMisleading APIComposition, traits
Giant match armsUnmaintainableExtract to methods
String everywhereAllocation waste&str, Cow<str>
Ignoring #[must_use]Lost errorsHandle or let _ =

Thinking Prompt

When seeing suspicious code:

  1. Is this symptom or cause?
    • Clone to avoid borrow? → Ownership design issue
    • Unwrap "because it won't fail"? → Unhandled case

Details

Repository
github.com/actionbook/rust-skills
Categories
Rust, Code Review & Quality
First seen
May 16, 2026

More from actionbook/rust-skills

All 38

Similar to M15 Anti Pattern

More Rust