# unsafe-checker

Reviews unsafe Rust blocks and FFI boundaries, tracking required SAFETY comments and catching common causes of undefined behavior.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3200 installs · ★ 1545
- Author: actionbook
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/actionbook/rust-skills/tree/HEAD/skills/unsafe-checker/SKILL.md
- Updated: 2026-08-23
- HTML: https://affpapa.org/en/nevibecode/skills/unsafe-checker

## What it does

The skill inspects `.rs` files across your codebase using `Read`, `Grep`, and `Glob`. It monitors `unsafe` blocks, raw pointers, `union` declarations, `#[repr(C)]` attributes, and FFI bindings to audit low-level memory operations.

It enforces documentation standards by demanding `// SAFETY:` explanations above dangerous blocks and `/// # Safety` sections on public unsafe functions. Bypassing the borrow checker simply to silence compiler errors is explicitly treated as invalid. The checks target pointer alignment, initialization status, aliasing violations, and correct `Send` or `Sync` concurrency contracts.

Outdated idioms get flagged with modern replacements. It catches `mem::uninitialized()` in favor of `MaybeUninit`, recommends `NonNull` over raw pointer math, and warns against dangling pointers when calling `.as_ptr()` on temporary `CString` instances.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill unsafe-checker -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/unsafe-checker/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/unsafe-checker/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill unsafe-checker -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/unsafe-checker/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill unsafe-checker -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/unsafe-checker/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install actionbook/rust-skills unsafe-checker
```

2. **Manually: put the files in place**
- File: `.github/skills/unsafe-checker/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill unsafe-checker -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/actionbook/rust-skills --path skills/unsafe-checker
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/unsafe-checker/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill unsafe-checker -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/actionbook/rust-skills/tree/HEAD/skills/unsafe-checker/SKILL.md

## When to use it
- catch potential undefined behavior across `unsafe` code blocks
- verify FFI signatures and external C function bindings
- enforce mandatory `// SAFETY:` and `/// # Safety` documentation
- replace deprecated constructs like `mem::uninitialized()` with `MaybeUninit`

## Example prompts
- Review the unsafe blocks in `src/ffi.rs` for alignment violations and required SAFETY comments.
- Scan the crate for deprecated `mem::zeroed` calls and update them to `MaybeUninit`.
- Audit C interface bindings in `src/bindings.rs` for memory layout and ABI issues.

## Similar
- [improve-codebase-architecture](https://affpapa.org/en/nevibecode/skills/improve-codebase-architecture.md) — skill · 1163035 installs
- [tdd](https://affpapa.org/en/nevibecode/skills/tdd.md) — skill · 1141062 installs
- [triage](https://affpapa.org/en/nevibecode/skills/triage.md) — skill · 990453 installs
- [codebase-design](https://affpapa.org/en/nevibecode/skills/codebase-design.md) — skill · 850344 installs
- [code-review](https://affpapa.org/en/nevibecode/skills/code-review.md) — skill · 789521 installs
- [implement](https://affpapa.org/en/nevibecode/skills/implement.md) — skill · 774700 installs

From the same set: [actionbook/rust-skills](https://affpapa.org/en/nevibecode/by/actionbook/rust-skills.md) — 33 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
