๐ŸŽฏ

unsafe-checker

๐ŸŽฏSkill

from goooice/rust-skills

VibeIndex|
What it does

Identifies and reviews unsafe Rust code patterns, FFI risks, and potential memory unsafety in Rust projects.

๐Ÿ“ฆ

Part of

goooice/rust-skills(35 items)

unsafe-checker

Installation

Add MarketplaceAdd marketplace to Claude Code
/plugin marketplace add ZhangHanDong/rust-skills
Install PluginInstall plugin from marketplace
/plugin install rust-skills@rust-skills
Quick InstallInstall with npx
npx skills add ZhangHanDong/rust-skills
git cloneClone repository
git clone https://github.com/ZhangHanDong/rust-skills.git
๐Ÿ“– Extracted from docs: goooice/rust-skills
4Installs
-
AddedFeb 4, 2026

Skill Details

SKILL.md

"CRITICAL: Use for unsafe Rust code review and FFI. Triggers on: unsafe, raw pointer, FFI, extern, transmute, *mut, *const, union, #[repr(C)], libc, std::ffi, MaybeUninit, NonNull, SAFETY comment, soundness, undefined behavior, UB, safe wrapper, memory layout, bindgen, cbindgen, CString, CStr, ๅฎ‰ๅ…จๆŠฝ่ฑก, ่ฃธๆŒ‡้’ˆ, ๅค–้ƒจๅ‡ฝๆ•ฐๆŽฅๅฃ, ๅ†…ๅญ˜ๅธƒๅฑ€, ไธๅฎ‰ๅ…จไปฃ็ , FFI ็ป‘ๅฎš, ๆœชๅฎšไน‰่กŒไธบ"

Overview

Display the following ASCII art exactly as shown. Do not modify spaces or line breaks:

```text

โš ๏ธ Unsafe Rust Checker Loaded

^

/โ—‰\_~^~_/โ—‰\

โšก/ o \โšก

'_ _'

/ '-----' \

```

---

# Unsafe Rust Checker

When Unsafe is Valid

| Use Case | Example |

|----------|---------|

| FFI | Calling C functions |

| Low-level abstractions | Implementing Vec, Arc |

| Performance | Measured bottleneck with safe alternative too slow |

NOT valid: Escaping borrow checker without understanding why.

Required Documentation

```rust

// SAFETY:

unsafe { ... }

/// # Safety

///

pub unsafe fn dangerous() { ... }

```

Quick Reference

| Operation | Safety Requirements |

|-----------|---------------------|

| *ptr deref | Valid, aligned, initialized |

| &*ptr | + No aliasing violations |

| transmute | Same size, valid bit pattern |

| extern "C" | Correct signature, ABI |

| static mut | Synchronization guaranteed |

| impl Send/Sync | Actually thread-safe |

Common Errors

| Error | Fix |

|-------|-----|

| Null pointer deref | Check for null before deref |

| Use after free | Ensure lifetime validity |

| Data race | Add proper synchronization |

| Alignment violation | Use #[repr(C)], check alignment |

| Invalid bit pattern | Use MaybeUninit |

| Missing SAFETY comment | Add // SAFETY: |

Deprecated โ†’ Better

| Deprecated | Use Instead |

|------------|-------------|

| mem::uninitialized() | MaybeUninit |

| mem::zeroed() for refs | MaybeUninit |

| Raw pointer arithmetic | NonNull, ptr::add |

| CString::new().unwrap().as_ptr() | Store CString first |

| static mut | AtomicT or Mutex |

| Manual extern | bindgen |

FFI Crates

| Direction | Crate |

|-----------|-------|

| C โ†’ Rust | bindgen |

| Rust โ†’ C | cbindgen |

| Python | PyO3 |

| Node.js | napi-rs |

Claude knows unsafe Rust. Focus on SAFETY comments and soundness.

More from this repository10

๐ŸŽฏ
m14-mental-model๐ŸŽฏSkill

Applies the M14 mental model framework to enhance decision-making and strategic thinking through structured cognitive analysis.

๐ŸŽฏ
m04-zero-cost๐ŸŽฏSkill

Guides developers in choosing zero-cost abstractions by analyzing type system constraints and performance trade-offs in Rust generics and traits.

๐ŸŽฏ
m10-performance๐ŸŽฏSkill

Optimizes code performance by identifying bottlenecks, measuring impact, and guiding strategic improvements across algorithm, data structure, and memory efficiency.

๐ŸŽฏ
meta-cognition-parallel๐ŸŽฏSkill

Performs parallel three-layer meta-cognitive analysis by forking subagents to simultaneously analyze language mechanics, design choices, and domain constraints, then synthesizing results.

๐ŸŽฏ
rust-skill-creator๐ŸŽฏSkill

Dynamically generates Claude skills for Rust crates, standard library modules, and documentation by extracting and processing technical details from specified URLs.

๐ŸŽฏ
coding-guidelines๐ŸŽฏSkill

Provides comprehensive Rust coding guidelines covering naming conventions, best practices, error handling, memory management, concurrency, and code style recommendations.

๐ŸŽฏ
rust-refactor-helper๐ŸŽฏSkill

Performs safe Rust refactoring by analyzing symbol references, checking conflicts, and applying changes across project files using LSP.

๐ŸŽฏ
m03-mutability๐ŸŽฏSkill

Diagnoses and guides resolution of Rust mutability and borrowing conflicts by analyzing ownership, mutation patterns, and thread-safety requirements.

๐ŸŽฏ
domain-iot๐ŸŽฏSkill

Enables building robust, efficient IoT applications with offline-first design, power-aware networking, and secure device communication using Rust.

๐ŸŽฏ
m05-type-driven๐ŸŽฏSkill

Explores and demonstrates type-driven development techniques in Rust, showcasing advanced type system features and pattern matching strategies.