/odin-native:rust-unsafefrom ODIN Native
Reviews and audits unsafe Rust code, covering raw pointers, transmute, UnsafeCell, FFI, and safe abstractions. Provides structured guidance on invariants, safety contracts, and Miri testing.
Ships in ODIN Native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Field | Bound contract |
|---|---|
| Trigger | Unsafe Rust code is being written, reviewed, or audited, or a user asks what requires unsafe, how to write safe wrappers, or how to use raw pointers, transmute, UnsafeCell, or extern functions. |
| Authority | Read-only. Chat output only. No remote mutation. |
| Side effect | Emits a structured guidance report and pointers to references/unsafe-patterns.md. |
| Done | A report is emitted that identifies the unsafe operations, invariants, audit checks, and recommended safe alternatives. |
UnsafeCell, FFI, Send/Sync, or safe abstraction.The unsafe keyword enables five capabilities. Match the code against the table before auditing each one.
| Capability | Example |
|---|---|
| Dereference raw pointers | *const T, *mut T |
| Call unsafe functions | extern "C" functions and unsafe fn |
| Access or modify mutable statics | static mut X |
| Implement unsafe traits | unsafe impl Send for MyType |
| Access union fields | union field access |
unsafe capability in the code is named.unsafe fn has a /// # Safety contract, each unsafe trait impl upholds the trait invariants, and each unsafe impl Send/Sync is justified by thread safety. Done when: all unsafe items have documented contracts.UnsafeCell. Confirm the source and target types have the same size, the value is valid for the target type, and UnsafeCell uses are protected against concurrent mutation. Done when: transmute and interior-mutability uses are justified.references/unsafe-patterns.md and mark each item. Done when: the checklist is complete for every unsafe block.cargo +nightly miri test for the unsafe code and MIRIFLAGS="-Zmiri-strict-provenance" for pointer-heavy code. Done when: a test plan is documented.| Failure class | Behavior |
|---|---|
Missing // Safety: comment | Add one that lists every precondition the caller or caller-side code must uphold. |
| Raw pointer violates aliasing | Restructure to avoid simultaneous & and &mut, or use UnsafeCell with a documented ownership scheme. |
| Transmute creates an invalid value | Use safe conversions such as TryFrom, f32::from_bits, or u32::from_ne_bytes. |
Manual Send/Sync impl is unsound | Remove the impl or prove thread safety with a Miri or concurrency test. |
unsafe block is too large | Split it so that each unsafe operation has its own safety comment. |
unsafe block.references/unsafe-patterns.md for raw pointer, NonNull, transmute, and stacked borrows patterns.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odin-native138 skills in this plugin
/abi-and-calling-conventionsUse when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi./adc-dac-baremetalUse when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal./af-xdpUse when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.Other plugins' skills for the same job