Rust Safety Rules
by mochalatte
Enforce memory safety, FFI soundness, and panic-free library patterns in Rust codebases.
Secure checkout via Stripe
Works with the AI tools you already use
See it in action
You say
Review this FFI wrapper. I added an unsafe Send impl to move the raw pointer between threads and a bytes method to get a slice. It occasionally crashes.
Your agent does
Safety scope
FFI wrapper for raw pointers.
Findings
- sensor.rs — Unsafe rule 1. Missing SAFETY comment.
- sensor.rs — Send rule 2. Unsafe impl Send has no written proof.
Patch
// [Patched code with NonNull and SAFETY comments]
Audit notes
- Run cargo +nightly miri test.
What you get
About this skill
The problem
The Rust compiler handles most safety checks, but it cannot verify the invariants inside unsafe blocks, the soundness of FFI wrappers, or hand-written Send and Sync implementations. These blind spots often lead to rare, hard-to-debug segfaults and undefined behavior in production.
What it does
- Enforces mandatory SAFETY comments for every unsafe block that explain the invariant being relied upon.
- Audits ownership patterns to identify when borrow checker struggles indicate a design flaw rather than a syntax error.
- Flags prohibited panics, unwraps, and expects in library code to prevent process crashes for callers.
- Verifies that unsafe functions include proper safety sections in doc comments for downstream callers.
- Reviews hand-written thread-safety claims (Send/Sync) and demands written proof of synchronization.
Frameworks & tools
Rust (2021 and 2024 editions), Cargo, thiserror, anyhow, and cargo-deny.
Why this beats prompting it yourself
Generic LLMs often suggest fixes that simply silence the compiler without addressing underlying soundness issues. This skill follows a strict "Trigger Matrix" to catch subtle signals like mutex guards crossing await points or missing raw pointer invariants that standard prompting misses.
Use cases
- Reviewing FFI wrappers to ensure C pointers are handled safely before dereferencing.
- Refactoring library code to replace panics with robust error handling using thiserror.
- Auditing thread-safety implementations in systems-level concurrency primitives.
- Cleaning up "reflexive cloning" and improper interior mutability patterns.
Known limitations
It cannot run cargo commands, Miri, or tests. It only reviews and edits code within the editor based on static analysis of the provided text.
How to install
Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean today
- 30-day refund guarantee
- One-time purchase, yours forever
- Secure checkout via Stripe
Frequently Asked Questions
Popular in Code Review

Senior Web App Architect for Coding Agents
Messy, insecure, unfixable — that's what AI builds without architecture. This file is the architecture: 10 years of senior judgement on rendering, caching, security and SEO, so your agent builds it right from day one.

Production Code Readiness Reviewer
A rigorous production-readiness auditor that identifies logic defects, security risks, and test gaps in code changes.

Ironclad — Senior Software Developer
Makes your coding agent work like a senior developer: exact money, configurable rules, real audit trails, honest testing. Any stack, any country.

agent skill security scanner
Audits agent skills and MCP manifests for prompt injection, data exfiltration, and over-permissioned access.