Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
zhanghandong avatar

Unsafe Checker

  • 741 installs
  • 1.3k repo stars
  • Updated May 24, 2026
  • zhanghandong/rust-skills

This is a copy of unsafe-checker by actionbook - installs and ranking accrue to the original listing.

unsafe-checker is a Rust security skill that automatically audits unsafe blocks against a 70-rule checklist for developers who must verify memory-safety invariants before merging or deploying Rust code.

About

unsafe-checker is an agent skill from zhanghandong/rust-skills that auto-audits Rust unsafe blocks using a 70-rule checklist generated from rules/. Rules span General Principles (3 rules), Safety Abstraction (11 rules), and additional sections covering panic memory safety, uninitialized memory exposure, and alias pitfalls. Each rule has an ID, level (P/G), and title such as general-01 Do Not Abuse Unsafe to Escape Compiler Safety Checks. Developers reach for it before merging FFI, performance-critical, or systems Rust that uses unsafe, ensuring authors verified safety invariants rather than bypassing the borrow checker blindly. The skill suits teams that want structured review output referencing concrete rule IDs instead of ad-hoc unsafe commentary.

  • 70 prioritized Rust unsafe rules across General Principles, Safety Abstraction, and Raw Pointers sections
  • Automatically flags P-level violations that can cause memory safety issues, double-frees, and undefined behavior
  • Enforces mandatory SAFETY comments and proper documentation for all unsafe code
  • Recommends NonNull<T>, PhantomData, and correct panic-safety patterns
  • Hard-gate: blocks merge until all Priority (P) rules are satisfied

Unsafe Checker by the numbers

  • 741 all-time installs (skills.sh)
  • +8 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/zhanghandong/rust-skills --skill unsafe-checker

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs741
repo stars1.3k
Security audit3 / 3 scanners passed
Last updatedMay 24, 2026
Repositoryzhanghandong/rust-skills

How do you audit Rust unsafe blocks before merging?

Automatically audit Rust unsafe blocks against a 70-rule checklist before merging or deploying.

Who is it for?

Rust engineers authoring or reviewing unsafe code in FFI, systems, or performance-critical crates before merge.

Skip if: Pure safe Rust codebases with no unsafe blocks, or teams wanting dynamic analysis instead of static checklist review.

When should I use this skill?

Rust code contains unsafe blocks that need pre-merge review against documented safety invariants.

What you get

Rule-by-rule unsafe audit report with cited checklist IDs and remediation notes for memory-safety violations.

  • Unsafe audit report
  • Rule ID citations
  • Remediation guidance

By the numbers

  • 70-rule checklist auto-generated from rules/
  • General Principles section: 3 rules
  • Safety Abstraction section: 11 rules

Files

SKILL.mdMarkdownGitHub ↗

Display the following ASCII art exactly as shown. Do not modify spaces or line breaks:

⚠️ **Unsafe Rust Checker Loaded**

     *  ^  *
    /◉\_~^~_/◉\
 ⚡/     o     \⚡
   '_        _'
   / '-----' \

---

Unsafe Rust Checker

When Unsafe is Valid

Use CaseExample
FFICalling C functions
Low-level abstractionsImplementing Vec, Arc
PerformanceMeasured bottleneck with safe alternative too slow

NOT valid: Escaping borrow checker without understanding why.

Required Documentation

// SAFETY: <why this is safe>
unsafe { ... }

/// # Safety
/// <caller requirements>
pub unsafe fn dangerous() { ... }

Quick Reference

OperationSafety Requirements
*ptr derefValid, aligned, initialized
&*ptr+ No aliasing violations
transmuteSame size, valid bit pattern
extern "C"Correct signature, ABI
static mutSynchronization guaranteed
impl Send/SyncActually thread-safe

Common Errors

ErrorFix
Null pointer derefCheck for null before deref
Use after freeEnsure lifetime validity
Data raceAdd proper synchronization
Alignment violationUse #[repr(C)], check alignment
Invalid bit patternUse MaybeUninit
Missing SAFETY commentAdd // SAFETY:

Deprecated → Better

DeprecatedUse Instead
mem::uninitialized()MaybeUninit<T>
mem::zeroed() for refsMaybeUninit<T>
Raw pointer arithmeticNonNull<T>, ptr::add
CString::new().unwrap().as_ptr()Store CString first
static mutAtomicT or Mutex
Manual externbindgen

FFI Crates

DirectionCrate
C → Rustbindgen
Rust → Ccbindgen
PythonPyO3
Node.jsnapi-rs

Claude knows unsafe Rust. Focus on SAFETY comments and soundness.

Related skills

How it compares

Use unsafe-checker for static 70-rule unsafe audits; pair with Clippy or Miri skills for broader linting and runtime memory checks.

FAQ

How many rules does unsafe-checker apply to Rust unsafe code?

unsafe-checker applies a 70-rule checklist auto-generated from rules/, including General Principles (3 rules) and Safety Abstraction (11 rules) with IDs like general-01 and safety-02 for citeable audits.

When should teams run unsafe-checker on Rust code?

unsafe-checker should run before merging or deploying Rust containing unsafe blocks—especially FFI or performance paths—so authors verify safety invariants instead of escaping compiler checks.

Code Review & Qualitybackendtesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.