# m15-anti-pattern

Reviews Rust code for anti-patterns and points to idiomatic replacements. Use it during code review or when ownership and error handling become hard to reason about.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 8600 installs · ★ 1545
- Author: actionbook
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/actionbook/rust-skills/tree/HEAD/skills/m15-anti-pattern/SKILL.md
- Updated: 2026-08-23
- HTML: https://affpapa.org/en/nevibecode/skills/m15-anti-pattern

## What it does

m15-anti-pattern flags common Rust issues such as unnecessary `.clone()` calls, `.unwrap()` in production code, unnecessary `Rc`, convenience-driven `unsafe`, and `String` where `&str` fits. It also checks for index loops, ignored `#[must_use]` results, long functions, and overly public fields.

The skill connects a visible smell to its likely cause. Repeated cloning can signal an unclear ownership model, while lifetime struggles can call for a different data structure. It points to related skills including `m01-ownership`, `m06-error-handling`, and `m09-domain`. You cannot run it as a slash command because `user-invocable` is disabled.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m15-anti-pattern -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/m15-anti-pattern/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/m15-anti-pattern/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m15-anti-pattern -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/m15-anti-pattern/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m15-anti-pattern -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/m15-anti-pattern/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install actionbook/rust-skills m15-anti-pattern
```

2. **Manually: put the files in place**
- File: `.github/skills/m15-anti-pattern/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m15-anti-pattern -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/actionbook/rust-skills --path skills/m15-anti-pattern
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/m15-anti-pattern/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m15-anti-pattern -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/actionbook/rust-skills/tree/HEAD/skills/m15-anti-pattern/SKILL.md

## When to use it
- find unnecessary `.clone()` calls in Rust code
- replace `.unwrap()` with error handling
- trace borrow checker friction to a design issue
- turn index loops into iterator-based code
- review `unsafe` for a safe alternative

## Example prompts
- Review this Rust module for anti-patterns and explain each issue.
- Why does this code use so many `.clone()` calls? Check the ownership model.
- Is this `.unwrap()` appropriate for production code?

## Similar
- [rust-patterns](https://affpapa.org/en/nevibecode/skills/rust-patterns.md) — skill · 5100 installs
- [python-anti-patterns](https://affpapa.org/en/nevibecode/skills/python-anti-patterns.md) — skill · 13278 installs
- [test-anti-patterns](https://affpapa.org/en/nevibecode/skills/test-anti-patterns.md) — skill · 4400 installs
- [rust-systems-programming](https://affpapa.org/en/nevibecode/skills/rust-systems-programming.md) — skill · 485 installs
- [dotnet-design-pattern-review](https://affpapa.org/en/nevibecode/skills/dotnet-design-pattern-review.md) — skill · 11609 installs
- [rust-best-practices](https://affpapa.org/en/nevibecode/skills/rust-best-practices.md) — skill · 21100 installs

From the same set: [actionbook/rust-skills](https://affpapa.org/en/nevibecode/by/actionbook/rust-skills.md) — 35 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
