U
unsafe-checker
by @zhanghandongv
4.2(21)
CRITICAL: unsafe RustコードレビューおよびFFIに使用します。トリガーは、unsafe、raw pointer、FFI、extern、transmute、*mut、*const、union、#[repr(C)]、libc、std::ffi、MaybeUninit、NonNull、SAFETY comment、soundness、undefined behavior、UB、safe wrapper、memory layout、bindgen、cbindgen、CString、CStr、安全な抽象化。
インストール方法
npx skills add zhanghandong/rust-skills --skill unsafe-checkercompare_arrows
Before / After 効果比較
1 组使用前
RustプロジェクトでunsafeコードブロックやFFIを扱う際、メモリ安全性の脆弱性を導入しやすいです。手動でのレビューは時間がかかり、重要な問題を見落としやすく、潜在的なリスクが存在します。
使用後
Rustのunsafeコードを自動的に検出しレビューし、潜在的なメモリ安全性の問題とFFIのリスクを特定します。コードの安全性を大幅に向上させ、システムの安定性と信頼性を確保し、重大な脆弱性を回避します。
SKILL.md
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 Case | Example |
|---|---|
| FFI | Calling C functions |
| Low-level abstractions | Implementing Vec, Arc |
| Performance | Measured 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
| Operation | Safety Requirements |
|---|---|
*ptr deref | Valid, aligned, initialized |
&*ptr | + No aliasing violations |
transmute | Same size, valid bit pattern |
extern "C" | Correct signature, ABI |
static mut | Synchronization guaranteed |
impl Send/Sync | Actually thread-safe |
Common Errors
| Error | Fix |
|---|---|
| Null pointer deref | Check for null before deref |
| Use after free | Ensure lifetime validity |
| Data race | Add proper synchronization |
| Alignment violation | Use #[repr(C)], check alignment |
| Invalid bit pattern | Use MaybeUninit |
| Missing SAFETY comment | Add // SAFETY: |
Deprecated → Better
| Deprecated | Use Instead |
|---|---|
mem::uninitialized() | MaybeUninit<T> |
mem::zeroed() for refs | MaybeUninit<T> |
| Raw pointer arithmetic | NonNull<T>, ptr::add |
CString::new().unwrap().as_ptr() | Store CString first |
static mut | AtomicT or Mutex |
| Manual extern | bindgen |
FFI Crates
| Direction | Crate |
|---|---|
| C → Rust | bindgen |
| Rust → C | cbindgen |
| Python | PyO3 |
| Node.js | napi-rs |
Claude knows unsafe Rust. Focus on SAFETY comments and soundness.
ユーザーレビュー (0)
レビューを書く
効果
使いやすさ
ドキュメント
互換性
レビューなし
統計データ
インストール数650
評価4.2 / 5.0
バージョン
更新日2026年5月23日
比較事例1 件
ユーザー評価
4.2(21)
5
14%
4
48%
3
33%
2
5%
1
0%
この Skill を評価
0.0
対応プラットフォーム
🔧Claude Code
🔧OpenClaw
🔧OpenCode
🔧Codex
🔧Gemini CLI
🔧GitHub Copilot
🔧Amp
🔧Kimi CLI
タイムライン
作成2026年3月16日
最終更新2026年5月23日