๐ŸŽฏ

unsafe-checker

๐ŸŽฏSkill

from actionbook/rust-skills

VibeIndex|
What it does

Identifies and reviews unsafe Rust code patterns, highlighting potential memory safety risks and FFI complexities.

๐Ÿ“ฆ

Part of

actionbook/rust-skills(35 items)

unsafe-checker

Installation

Quick InstallInstall with npx
npx skills add ZhangHanDong/rust-skills
CargoRun with Cargo (Rust)
cargo install cowork
git cloneClone repository
git clone https://github.com/ZhangHanDong/rust-skills.git
Add MarketplaceAdd marketplace to Claude Code
/plugin marketplace add ZhangHanDong/rust-skills
๐Ÿ“– Extracted from docs: actionbook/rust-skills
14Installs
-
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

๐Ÿช
actionbook-rust-skills๐ŸชMarketplace

Comprehensive Rust development assistant with meta-question routing, coding guidelines, version queries, and ecosystem support

๐ŸŽฏ
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, dependencies, and potential impacts using Language Server Protocol (LSP) operations.

๐ŸŽฏ
m09-domain๐ŸŽฏSkill

Guides domain modeling in Rust by helping identify entities, value objects, aggregates, and their ownership patterns with domain-driven design principles.

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

Enforces compile-time type safety by preventing invalid states through type-level design techniques like newtypes, type states, and phantom types.

๐ŸŽฏ
m13-domain-error๐ŸŽฏSkill

Designs comprehensive domain error handling strategies with categorization, recovery mechanisms, and contextual error management for different audiences.

๐ŸŽฏ
m02-resource๐ŸŽฏSkill

Guides developers in selecting the right smart pointer and resource management strategy based on ownership, thread safety, and design constraints.

๐ŸŽฏ
rust-learner๐ŸŽฏSkill

Retrieves and provides comprehensive Rust and crate information, including versions, features, documentation, and changelogs from authoritative sources.

๐ŸŽฏ
rust-trait-explorer๐ŸŽฏSkill

Explores Rust trait implementations, revealing which types implement specific traits and their implementation details using LSP.

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

Guides developers in choosing zero-cost abstractions by analyzing type system errors and runtime polymorphism needs in Rust.