Skip to content

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
View on GitHub

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 MyVec with 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 -y

Installs 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:

  1. Dereference raw pointers (*const T, *mut T)
  2. Call unsafe functions (including extern "C" functions)
  3. Access or modify mutable static variables
  4. Implement unsafe traits (Send, Sync)
  5. 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

Similar to Rust Unsafe

More Rust