unsafe-checker

Analyze unsafe Rust code for FFI and memory safety risks.

1|Updated Nov 27, 2025
One-click install
npx skills add https://github.com/flexisuite-org/FlexiSuite_Kernel --skill unsafe-checker-flexisuite-org
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unsafe-checker
Source: https://github.com/flexisuite-org/FlexiSuite_Kernel/tree/main/.agents/skills/unsafe-checker
Command: npx skills add https://github.com/flexisuite-org/FlexiSuite_Kernel --skill unsafe-checker-flexisuite-org

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers identify and mitigate risks associated with writing unsafe Rust code, ensuring memory safety and preventing undefined behavior.

Core Features & Use Cases

  • Unsafe Code Review: Analyzes unsafe blocks and functions for common pitfalls.
  • FFI Safety: Provides guidance on safe interaction with C libraries.
  • Use Case: A developer is about to implement a low-level data structure using unsafe. They can use this Skill to review their code, ensuring all SAFETY comments are present, invariants are documented, and potential issues like pointer aliasing or panic safety are addressed.

Quick Start

Use the unsafe-checker skill to analyze the provided Rust code snippet for potential safety issues.

Frequently Asked Questions about unsafe-checker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review unsafe Rust code for memory safety and soundness?

Reviewing unsafe Rust code involves analyzing unsafe blocks for raw pointer risks, undefined behavior, and FFI soundness issues. It verifies invariants, checks panic safety, and ensures proper memory layout to prevent critical vulnerabilities.

What is the best way to ensure FFI safety when interacting with C libraries in Rust?

Ensuring FFI safety requires analyzing interactions with C libraries for soundness issues and undefined behavior. You must verify raw pointer usage, document invariants with `SAFETY` comments, and check panic safety to maintain safe boundaries between Rust and C code.

How do I write `SAFETY` comments for unsafe Rust blocks?

Writing `SAFETY` comments involves documenting the specific invariants and preconditions that uphold memory safety in unsafe Rust. You must detail why raw pointer operations, FFI interactions, and memory layouts are sound and free from undefined behavior.

Does this tool check for panic safety in low-level Rust data structures?

Yes, checking for panic safety in low-level Rust data structures is a core function. It analyzes critical unsafe code sections to identify panic safety issues, ensuring unexpected panics do not violate memory safety invariants or cause undefined behavior.

What are common pitfalls when using raw pointers in unsafe Rust?

Common pitfalls when using raw pointers in unsafe Rust include pointer aliasing, invalid memory layouts, and triggering undefined behavior. Analyzing unsafe code helps identify these risks, ensuring soundness and verifying that all safety invariants are properly documented.

When do I need to analyze unsafe Rust code for soundness issues?

You need to analyze unsafe Rust code for soundness issues when implementing low-level data structures or interacting with C libraries via FFI. This analysis identifies undefined behavior risks, verifies `SAFETY` comments, and ensures raw pointer operations maintain memory safety.