actionbook avatar

M15 Anti Pattern

Catches you when you're fighting Rust instead of working with it. Reviews code for the classic mistakes: cloning everywhere to escape the borrow checker, unwrapping in production code, using String when you need &str, index loops instead of iterators. The pattern tables are solid references, especially the trace ups that connect surface symptoms like "too many clones" back to ownership design issues. Sits at Layer 2 in the skill system, so it bridges the gap between seeing suspicious code and understanding why it's wrong. The checklist is honest about what matters in code review. Most useful when you're reviewing PR feedback and want to understand whether you're patching symptoms or fixing the actual problem.

skills.sh installs
9.3K
GitHub stars
1.6K
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

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

More from actionbook/rust-skills

All 38
1kunchenguid avatargh-axikunchenguid/gh-axiOperate GitHub through the gh-axi CLI - issues, pull requests, workflow runs, workflows, releases, repositories, labels, gists, Projects (v2), Actions secrets a9.1Kskills.sh installs
2getsentry avatarcode-simplifiergetsentry/skillsSimplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when asked to "simplify code", "clean up code"9Kskills.sh installs
3earthtojake avatarcad-viewerearthtojake/text-to-cadStart or reuse CAD Viewer and return review links for explicit CAD, implicit CAD, robot-description, and G-code files. Use when visually reviewing `.step`, `.st9Kskills.sh installs
4emblemcompany avataremblem-portfolio-trackeremblemcompany/agent-skillsTrack crypto portfolio across 7 blockchains via EmblemAI. Aggregated balances with USD values, conditional trade P&L, and DeFi position tracking via Nansen. Use8.9Kskills.sh installs
5openai avatarsecurity-threat-modelopenai/skillsRepository-grounded threat modeling that enumerates trust boundaries, assets, attacker capabilities, abuse paths, and mitigations, and writes a concise Markdown8.9Kskills.sh installs
6planetscale avatarmysqlplanetscale/database-skillsPlan and review MySQL/InnoDB schema, indexing, query tuning, transactions, and operations. Use when creating or modifying MySQL tables, indexes, or queries; dia8.8Kskills.sh installs