Skip to content
Back to skills

Rust Antipatterns

ASecurity

Forbidden Rust patterns — unsafe without safety comment, unwrap in library code, unchecked integer arithmetic. Applies when editing Rust files.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 21, 2026
ai-agentsrust

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned October 21, 2026

npx -y skills add emgiezet/aisdlc --skill rust-antipatterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rust Antipatterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rust Antipatterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/emgiezet-rust-antipatterns/badge)](https://www.skillsdirectory.com/skills/emgiezet-rust-antipatterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rust-antipatterns
description: Forbidden Rust patterns — unsafe without safety comment, unwrap in library code, unchecked integer arithmetic. Applies when editing Rust files.
paths: ["**/*.rs"]
user-invocable: false
---

# Rust anti-patterns — do not write these

Checks run automatically after each edit. Findings reference the IDs below.

## Errors
- AP-RS-SEC-001 — Every `unsafe` block must have a `// SAFETY:` comment explaining the soundness invariant.
- AP-RS-SEC-003 — Validate raw pointers before dereferencing; prefer safe references; document the safety invariant.
- AP-RS-SEC-004 — Avoid `mem::transmute`; use `From`/`Into` or `bytemuck`; document layout guarantees in SAFETY comments.
- AP-RS-SEC-005 — Use `str::from_utf8(&bytes)?` instead of `from_utf8_unchecked`; propagate the validation error.

## Warnings
- AP-RS-SEC-002 — Return `Result`/`Option` from library functions; use `.unwrap()` only in tests or `main`.
- AP-RS-PERF-001 — Use `checked_add`/`checked_mul` for size/offset arithmetic; never rely on silent wrapping.
- AP-RS-MAINT-001 — Add `#[serde(deny_unknown_fields)]` to structs that deserialise external input.

Details for any ID: `reference/<ID>.md`

Files in this skill

  • SKILL.md1.2 KB
  • reference/AP-RS-MAINT-001.md737 B
  • reference/AP-RS-MAINT-002.md857 B
  • reference/AP-RS-PERF-001.md764 B
  • reference/AP-RS-SEC-001.md691 B
  • reference/AP-RS-SEC-002.md733 B
  • reference/AP-RS-SEC-003.md709 B
  • reference/AP-RS-SEC-004.md758 B
  • reference/AP-RS-SEC-005.md739 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.