From rust-skills
Reviews unsafe Rust code and FFI for soundness, valid use cases, SAFETY docs, common errors like null derefs/data races, and alternatives like MaybeUninit/bindgen.
npx claudepluginhub actionbook/rust-skills --plugin rust-skillsThis skill is limited to using the following tools:
Display the following ASCII art exactly as shown. Do not modify spaces or line breaks:
AGENTS.mdchecklists/before-unsafe.mdchecklists/common-pitfalls.mdchecklists/review-unsafe.mdexamples/ffi-patterns.mdexamples/safe-abstraction.mdmetadata.jsonrules/_sections.mdrules/_template.mdrules/ffi-01-no-string-direct.mdrules/ffi-02-read-ffi-docs.mdrules/ffi-03-drop-for-c-ptr.mdrules/ffi-04-panic-boundary.mdrules/ffi-05-portable-types.mdrules/ffi-06-string-abi.mdrules/ffi-07-no-drop-external.mdrules/ffi-08-error-handling.mdrules/ffi-09-ref-not-ptr.mdrules/ffi-10-thread-safety.mdrules/ffi-11-packed-ub.mdAudits Rust code for unsafe blocks, ownership and borrowing patterns, concurrency issues, error handling, and Cargo dependency vulnerabilities.
Reviews Rust code for ownership, borrowing, lifetimes, error handling, trait design, unsafe usage, and common mistakes in .rs files. Covers 2021 edition idioms and borrow checker issues.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Share bugs, ideas, or general feedback.
Display the following ASCII art exactly as shown. Do not modify spaces or line breaks:
⚠️ **Unsafe Rust Checker Loaded**
* ^ *
/◉\_~^~_/◉\
⚡/ o \⚡
'_ _'
/ '-----' \
| 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.
// SAFETY: <why this is safe>
unsafe { ... }
/// # Safety
/// <caller requirements>
pub unsafe fn dangerous() { ... }
| 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 |
| 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 | Use Instead |
|---|---|
mem::uninitialized() | MaybeUninit<T> |
mem::zeroed() for refs | MaybeUninit<T> |
| Raw pointer arithmetic | NonNull<T>, ptr::add |
CString::new().unwrap().as_ptr() | Store CString first |
static mut | AtomicT or Mutex |
| Manual extern | bindgen |
| Direction | Crate |
|---|---|
| C → Rust | bindgen |
| Rust → C | cbindgen |
| Python | PyO3 |
| Node.js | napi-rs |
Claude knows unsafe Rust. Focus on SAFETY comments and soundness.