Claude Marketplaces
SkillsMCP serversMarketplacesDigestTools
Submit

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP servers by category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control
Claude Marketplaces

An independent directory of skills, plugins and MCP servers for Claude Code. Not affiliated with Anthropic.

Browse

  • Skills
  • MCP servers
  • Marketplaces
  • Weekly digest
  • Skill index
  • MCP index
  • Marketplace index

Site

  • About
  • Tools
  • Submit
  • Feedback
  • Privacy
  • llms.txt
  • Plugins reference

Maker

  • Snug
  • Agent Caffeine
  • knobs
  • Wax
  • Vectoys
  • mertduzgun.com
Crafted at
Skills/Code Review & Quality
zhanghandong avatar

M15 Anti Pattern

zhanghandong/rust-skills

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.

installs
5.6K
GitHub stars
1.3K
last updated
Jul 14, 2026
View on GitHubSave

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
  2. What would idiomatic code look like?

    • References instead of clones
    • Iterators instead of index loops
    • Pattern matching instead of flags
  3. Does this fight Rust?

    • Fighting borrow checker → restructure
    • Excessive unsafe → find safe pattern

Trace Up ↑

To design understanding:

"Why does my code have so many clones?"
    ↑ Ask: Is the ownership model correct?
    ↑ Check: m09-domain (data flow design)
    ↑ Check: m01-ownership (reference patterns)
Anti-PatternTrace ToQuestion
Clone everywherem01-ownershipWho should own this data?
Unwrap everywherem06-error-handlingWhat's the error strategy?
Rc everywherem09-domainIs ownership clear?
Fighting lifetimesm09-domainShould data structure change?

Trace Down ↓

To implementation (Layer 1):

"Replace clone with proper ownership"
    ↓ m01-ownership: Reference patterns
    ↓ m02-resource: Smart pointer if needed

"Replace unwrap with proper handling"
    ↓ m06-error-handling: ? operator
    ↓ m06-error-handling: expect with message

Top 5 Beginner Mistakes

RankMistakeFix
1Clone to escape borrow checkerUse references
2Unwrap in productionPropagate with ?
3String for everythingUse &str
4Index loopsUse iterators
5Fighting lifetimesRestructure to own data

Code Smell → Refactoring

SmellIndicatesRefactoring
Many .clone()Ownership unclearClarify data flow
Many .unwrap()Error handling missingAdd proper handling
Many pub fieldsEncapsulation brokenPrivate + accessors
Deep nestingComplex logicExtract methods
Long functionsMultiple responsibilitiesSplit
Giant enumsMissing abstractionTrait + types

Common Error Patterns

ErrorAnti-Pattern CauseFix
E0382 use after moveCloning vs ownershipProper references
Panic in productionUnwrap everywhere?, matching
Slow performanceString for all text&str, Cow
Borrow checker fightsWrong structureRestructure
Memory bloatRc/Arc everywhereSimple ownership

Deprecated → Better

DeprecatedBetter
Index-based loops.iter(), .enumerate()
collect::<Vec<_>>() then iterateChain iterators
Manual unsafe cellCell, RefCell
mem::transmute for castsas or TryFrom
Custom linked listVec, VecDeque
lazy_static!std::sync::OnceLock

Quick Review Checklist

  • No .clone() without justification
  • No .unwrap() in library code
  • No pub fields with invariants
  • No index loops when iterator works
  • No String where &str suffices
  • No ignored #[must_use] warnings
  • No unsafe without SAFETY comment
  • No giant functions (>50 lines)

Related Skills

WhenSee
Ownership patternsm01-ownership
Error handlingm06-error-handling
Mental modelsm14-mental-model
Performancem10-performance
SKILL.md on GitHub

Sponsors

SnugThe clipboard manager you and your agent can use, safelyAgent CaffeineClose your lid, come back to finished workWaxBlock anything with supervision, without erasing your iPhoneOpen StepsSponsoredFree and open-source skills that make AI coding agents easier to understand, verify, and control.

Details

Repository
github.com/zhanghandong/rust-skills
Categories
Code Review & Quality, Rust

More from zhanghandong/rust-skills

All 34
  • Coding Guidelines1.2K
  • M10 Performance895
  • M07 Concurrency844
  • M06 Error Handling827
  • Rust Refactor Helper821
  • M01 Ownership809
  • M04 Zero Cost789
  • M05 Type Driven786
  • M02 Resource783
  • M03 Mutability773
  • M12 Lifecycle764
  • M14 Mental Model751
  • M09 Domain750
  • M11 Ecosystem747
  • M13 Domain Error738
  • Rust Trait Explorer731
  • Rust Code Navigator728
  • Unsafe Checker726
  • Domain Cli709
  • Rust Symbol Analyzer702
  • Rust Call Graph699
  • Rust Router698
  • Rust Learner688
  • Rust Deps Visualizer684

Recommended

More Code Review & Quality
1github avatarsecurity-reviewgithub/awesome-copilotAI-powered codebase security scanner that reasons about code like a security researcher — tracing data flows, understanding component interactions, and catching5.6Kinstalls
2claude-office-skills avatarcontract-reviewclaude-office-skills/skillsAnalyze contracts for risks, check completeness, and provide actionable recommendations. Supports employment contracts, NDAs, service agreements, and more.5.4Kinstalls
3affaan-m avatarandroid-clean-architectureaffaan-m/eccClean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns.5.3Kinstalls
4wshobson avatarreview-agent-setupwshobson/agentsConfigure human-in-the-loop gating for AI agent review actions in Claude Code. Use when setting up a project where an agent may post PR reviews, comments, merge5.3Kinstalls
5aaron-he-zhu avatarcontent-quality-auditoraaron-he-zhu/seo-geo-claude-skillscontent quality auditor5.1Kinstalls
6jeffallan avatarmicroservices-architectjeffallan/claude-skillsDesigns distributed system architectures, decomposes monoliths into bounded-context services, recommends communication patterns, and produces service boundary d5Kinstalls