Skip to content
Back to skills

Rustler Bindings

ASecurity

Rustler conventions for building Elixir NIFs from a Rust core: nif macros, tagged {:ok,_}/{:error,_} tuples, dirty schedulers, ResourceArc state, NifStruct derives, and mix compile. Load when generating or reviewing Rustler Elixir NIF bindings for a Rust library.

  • 146 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 5, 2026
ai-agentsrustapi

Works with

  • api

Security analysis

A100/100

Scanned October 5, 2026

npx -y skills add Goldziher/ai-rulez --skill rustler-bindings --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rustler Bindings?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rustler Bindings
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/goldziher-rustler-bindings/badge)](https://www.skillsdirectory.com/skills/goldziher-rustler-bindings)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rustler-bindings
description: "Rustler conventions for building Elixir NIFs from a Rust core: nif macros, tagged {:ok,_}/{:error,_} tuples, dirty schedulers, ResourceArc state, NifStruct derives, and mix compile. Load when generating or reviewing Rustler Elixir NIF bindings for a Rust library."
---

- Use `#[rustler::nif]` for Elixir NIF functions. Use `#[module = "Elixir.ModuleName"]` for module naming.
- Return tagged tuples: `{:ok, value}` / `{:error, reason}`. Use Rustler encoders/decoders for type mapping.
- Use `rustler::Error` for NIF error handling. Map Rust errors to descriptive Elixir error tuples.
- Keep NIF functions fast (<1ms) to avoid scheduler issues. Use `#[rustler::nif(schedule = "DirtyCpu")]` for long operations.
- Build with `mix compile` (Rustler compiler). Test from Elixir using ExUnit.
- Use `ResourceArc<T>` for sharing Rust state across NIF calls. Implement `Drop` for cleanup.
- Use `#[derive(NifStruct)]` and `#[derive(NifUnitEnum)]` for Elixir-compatible types.
- Keep Elixir NIF wrapper thin — business logic in Rust, Elixir provides functional API.
- Handle binary data with `Binary` and `OwnedBinary` types.
- Anti-patterns: no panics in NIFs (crashes the BEAM VM), no blocking the scheduler, no I/O in NIFs.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.