rust-unsafe

rust-unsafe is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 82 tokens per session (1,985 once invoked), scanned A, original, MIT.

A guide to writing and reviewing Rust code that uses unsafe operations such as raw pointers, unions, mutable statics, and external functions.

In plain words
What is it for?
Use it to decide when unsafe is needed, audit unsafe blocks, build safe abstractions, and reason about raw pointers, transmute, UnsafeCell, and unsafe traits.
Why use it?
It explains what unsafe permits and how to check that the surrounding code still upholds Rust’s memory-safety rules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

not rated 203repo +8 2mo ago A scan Socket: passSnyk: passSkillSpector: warn 82 tokens original MIT

Good fit Use it to decide when unsafe is needed, audit unsafe blocks, build safe abstractions, and reason about raw pointers, transmute, UnsafeCell, and unsafe traits.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/rust-unsafe
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill rust-unsafe
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rust-unsafe

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/rust-unsafe/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/rust-unsafe)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/rust-unsafe"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/rust-unsafe/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rust-unsafe

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/rust-unsafe"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/rust-unsafe.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,985 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 18 Mar 2026
  • Snyk pass 21 Feb 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high YARA Match · line 145
    YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
    Fix: Remove offensive tool references and exploit code. Legitimate agent skills should not contain penetration testing tools, exploit frameworks, or reconnaissance utilities.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00082 $0.01985
Opus 5 $0.00041 $0.00992
Sonnet 5 $0.00016 $0.00397
Haiku 4.5 $0.00008 $0.00198

Measured 9d ago against content hash 23252db7d1c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

rust-unsafe scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/rust/rust-unsafe/SKILL.md · 249 lines

How it starts

The opening of the file, as written. The whole thing — 249 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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;

// Null pointer
let null: *const u32 = std::ptr::null();
let null_mut: *mut u32 = std::ptr::null_mut();

// Dereference (unsafe)
let val = unsafe { *ptr };

// Null check
if !ptr.is_null() {
    let val = unsafe { *ptr };
}

// Offset (safe to compute, unsafe to dereference)
let arr = [1u32, 2, 3, 4, 5];
let p = arr.as_ptr();
let third = unsafe { *p.add(2) };   // arr[2]
let also_third = unsafe { *p.offset(2) };

// Slice from raw parts
let slice: &[u32] = unsafe {
    std::slice::from_raw_parts(p, arr.len())
};

Rules for sound raw pointer dereference:

  • Pointer must be non-null
  • Pointer must be aligned for T
  • Memory must be initialized for T
  • Must not violate aliasing rules (only one &mut to a location)
  • Memory must be valid for the lifetime of the reference

3. unsafe functions and traits

Read the full file on GitHub · 249 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 249 lines · 82 tokens per session scan A 23252db7d1c2

Subscribe to this mod's changes

rust-unsafe is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (203 stars, last pushed 2mo ago), licensed MIT. It adds 82 tokens to every session and 1,985 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

rust-patterns

Idiomatic Rust patterns, ownership, error handling, traits, concurrency, and best practices for building safe, performant applications.

affaan-m/ECC · 28 tokens

omh-rust

This is a Hermes-native rust workflow skill.

rlaope/oh-my-hermes · 69 tokens

rust-project

Modern Rust project architecture guide for 2025. Use when creating Rust projects (CLI, web services, libraries). Covers workspace structure, error handling, async patterns, and idiomatic Rust best practices.

majiayu000/spellbook · 43 tokens

gcs-rust-download-object-api

Fix "DownloadObjectRequest not found" error in google-cloud-storage Rust crate. Use when: (1) Trying to download objects from GCS using the Rust SDK, (2) Looking for a download request type in http::objects::download module, (3) Compile error about missing type. The downloadobject method uses GetObjectRequest from the…

divinevideo/divine-mobile · 91 tokens

solana-toolkit-guide

Guide to the Solana Wallet Toolkit — vanity address generation with multi-threaded search, official Solana Labs libraries, Rust and TypeScript implementations. Includes wallet generation, custom address prefixes, and OG names on the blockchain.

nirholas/three.ws · 50 tokens

windows-compat

Audit and harden this Rust repo (code-graph-mcp) for Windows correctness: path-spelling drift between producers, the 32,767-char command-line cap, index-key mismatches, and path predicates that assume one ecosystem's layout. Use whenever touching code that builds, compares, prints, or stores a filesystem path; that…

sdsrss/code-graph-mcp · 165 tokens