zhanghandong avatar

M15 Anti Pattern

The m15-anti-pattern skill helps developers identify and refactor common code anti-patterns during code reviews, focusing on Rust-specific issues like excessive cloning, unwrap calls in production, and fighting the borrow checker. It's designed for Rust developers and code reviewers who need to distinguish between solving symptoms versus root causes, and who want guidance on more idiomatic approaches. The skill maps anti-patterns to their underlying design problems and traces them to related skills for deeper understanding of ownership, error handling, and domain design.

skills.sh installs
5.6K
GitHub stars
1.3K
last updated
Jul 14, 2026

Install

$ npx -y skills add zhanghandong/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/zhanghandong/rust-skills
Categories
Code Review & Quality, Rust

More from zhanghandong/rust-skills

All 34
1jeffallan avatarmicroservices-architectjeffallan/claude-skillsDesigns distributed system architectures, decomposes monoliths into bounded-context services, recommends communication patterns, and produces service boundary d5.2Kskills.sh installs
2trkbt10 avatarindexion-refactortrkbt10/indexion-skillsAfter writing code, detect and clean up duplication at three levels — copy-paste blocks, cross-package shared code, unnecessary wrappers, and concept-level SoT 5Kskills.sh installs
3affaan-m avatararchitecture-decision-recordsaffaan-m/everything-claude-codearchitecture decision records4.8Kskills.sh installs
4affaan-m avatarhexagonal-architectureaffaan-m/everything-claude-codehexagonal architecture4.2Kskills.sh installs
5alibaba avataropen-code-review-delegatealibaba/open-code-reviewDelegation mode for open-code-review (OCR). Instead of OCR calling an LLM endpoint, this skill instructs the host agent to perform the code review itself, using4.1Kskills.sh installs
6affaan-m avatargan-style-harnessaffaan-m/everything-claude-codegan style harness3.7Kskills.sh installs