Rust Unsafe
Guide to writing, reviewing, and auditing unsafe Rust, covering raw pointers, transmute, and sound abstractions.
- CCM score
- 64 of 100
- skills.sh installs
- 670
- GitHub stars
- 303
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers the five capabilities unsafe grants: raw pointer dereference, unsafe calls, mutable statics, unsafe trait impls, and union field access
- Includes raw pointer and transmute examples, safe-wrapper patterns like a
MyVecwith Drop, an UnsafeCell cell, and an audit checklist - Enforces a
// Safety:comment and an as-small-as-possible rule for every unsafe block, plus a Miri test before shipping - Designed for Rust developers who must justify unsafe code, and it points to rust-sanitizers-miri and rust-ffi for related work
Install
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill rust-unsafe -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Rust unsafe
Purpose
Guide agents through writing, reviewing, and reasoning about unsafe Rust: what operations require unsafe, how to write safe abstractions, audit patterns, common pitfalls, and when to reach for unsafe.
Triggers
- "When do I need to use unsafe in Rust?"
- "How do I write a safe abstraction over unsafe code?"
- "How do I audit an unsafe block?"
- "What are the rules for raw pointers in Rust?"
- "What does transmute do and when is it safe?"
- "How do I implement UnsafeCell correctly?"
Workflow
1. The five unsafe superpowers
unsafe grants exactly five capabilities not available in safe Rust:
- Dereference raw pointers (
*const T,*mut T) - Call unsafe functions (including
extern "C"functions) - Access or modify mutable static variables
- Implement unsafe traits (
Send,Sync) - Access fields of unions
Everything else in Rust — including memory allocation, borrowing, closures — follows safe rules even inside unsafe blocks.
2. Raw pointers
// Creating raw pointers (safe — no dereference yet)
let x = 42u32;
let ptr: *const u32 = &x;
let mut_ptr: *mut u32 = &mut some_val as *mut u32;
Details
- Repository
- github.com/mohitmishra786/low-level-dev-skills
- Categories
- Rust, Security
- First seen
- Jun 3, 2026
Questions
What does the rust-unsafe skill help with?
The rust-unsafe skill guides agents through writing, reviewing, and reasoning about unsafe Rust. It covers which operations require unsafe, how to build safe abstractions over unsafe code, how to audit unsafe blocks, and how raw pointers, transmute, and UnsafeCell behave.
How do I install the rust-unsafe skill?
Run npx -y skills add mohitmishra786/low-level-dev-skills --skill rust-unsafe -y in a project. Once installed, the rust-unsafe skill lets the agent check unsafe blocks against a Safety comment and audit checklist.
Where does rust-unsafe rank in the Rust category?
The rust-unsafe skill ranks in the top 100 of the Rust category on Claude Marketplaces. It focuses on the five operations that unsafe Rust permits, such as dereferencing raw pointers and implementing unsafe traits, which sets it apart from general Rust guidance.
Does the rust-unsafe skill cover raw pointers and transmute?
Yes, the rust-unsafe skill covers raw pointer dereference rules, slice creation from raw parts, and transmute, including its size requirements and common pitfalls. It also explains when a safe alternative such as f32::from_bits is preferable.
More from mohitmishra786/low-level-dev-skills
All 54- Pgo663
- Interpreters660
- Cargo Workflows657
- Meson654
- Rust Debugging648
- Cpp Modules644
- Hardware Counters637
- Debug Optimized Builds626
- Cpp Templates622
- Rustc Basics620
- Rust Cross614
- Wasm Emscripten603
- Zig Debugging594
- Zig Build System593
- Wasm Wasmtime576
- Zig Cross576
- Zig Cinterop564
- Cmake1.9K
- Static Analysis1.4K
- Gdb1.2K
- Llvm1K
- Sanitizers997
- Core Dumps915
- Linux Perf880
Similar to Rust Unsafe
More Rustrust-sanitizers-mirimohitmishra786/low-level-dev-skills680 installsRuntime sanitizer and Miri workflows for validating memory safety and undefined behaviour in unsafe Rust.
rust-securitymohitmishra786/low-level-dev-skills706 installsRust security guidance for auditing dependencies, enforcing supply chain policy, and reviewing memory-safe FFI.
memory-safety-patternswshobson/agents12.5K installsCross-language memory-safety patterns covering RAII, ownership, smart pointers, and resource management for Rust, C++, and C.
rust-skillsleonardomso/rust-skills7.7K installsComprehensive Rust coding guidelines with 265 rules across 26 categories for writing and reviewing code.