m15-anti-pattern

Detect Rust anti-patterns in ownership, unsafe practices, and error handling.

1|1|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/svssdeva/agentic-skills --skill m15-anti-pattern-svssdeva
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m15-anti-pattern
Source: https://github.com/svssdeva/agentic-skills/tree/main/rust/m15-anti-pattern
Command: npx skills add https://github.com/svssdeva/agentic-skills --skill m15-anti-pattern-svssdeva

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you recognize non-idiomatic Rust patterns that hide design issues, prevent proper error handling, or create performance and maintainability problems.

Core Features & Use Cases

  • Anti-pattern identification: Flags common Rust code smells like clone-everywhere, unwrap-in-production, unnecessary Rc, unsafe-by-convenience, and giant match arms.
  • Better-pattern mapping: Guides refactoring toward ownership-correct designs, safe error strategies, and idiomatic Rust types and iteration patterns.
  • Trace up/down reasoning: Connects symptoms to root causes (e.g., ownership and domain/data flow) and then to concrete implementation changes (e.g., ? operator, iterator usage, extracted methods).

Quick Start

Ask your AI to review the following Rust code for anti-patterns and propose idiomatic, safer refactors with an ownership and error-handling explanation.

Frequently Asked Questions about m15-anti-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify Rust anti-patterns related to ownership and error handling during code review?

Rust anti-pattern detection flags flawed ownership designs and fragile error handling by mapping code smells like unwrap-in-production and clone-everywhere to root causes. It then specifies concrete idiomatic refactors such as proper references and safer error strategies.

What are common Rust code smells that indicate non-idiomatic ownership design?

Common Rust code smells include clone-everywhere, unnecessary Rc usage, unsafe-by-convenience, and giant match arms. These anti-patterns indicate flawed ownership design and fragile error handling that require refactoring toward idiomatic Rust types.

How do I refactor Rust code to fix deep nesting and long functions for better maintainability?

Refactoring deep nesting and long functions involves extracting abstractions and adopting iterator-based iteration. This improves maintainability by replacing complex control flow with idiomatic Rust patterns and proper error propagation using the ? operator.

Can I use this approach to review Rust code with unsafe blocks and performance hotspots?

Yes, this approach reviews Rust code with unsafe blocks by identifying unsafe-by-convenience anti-patterns and mapping them to safer alternatives. It also addresses performance hotspots by recommending ownership-correct designs and idiomatic iteration patterns.

What is the best way to replace unwrap calls in production Rust code?

The best way to replace unwrap calls in production Rust code is to adopt safer error handling strategies like the ? operator for proper error propagation. This refactoring resolves fragile error handling anti-patterns by ensuring errors are managed idiomatically.