Skip to content
Back to skills

Wasm Bindings

ASecurity

wasm-bindgen conventions for compiling a Rust core to WebAssembly for JavaScript: wasm-pack packaging, JsValue mapping, async futures, bundle-size tuning, web-sys/js-sys, and TypeScript defs. Load when generating or reviewing WebAssembly/JS bindings for a Rust library.

  • 146 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 5, 2026
ai-agentsjavascripttypescriptrustjavanodeapi

Works with

  • api

Security analysis

A100/100

Scanned October 5, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Wasm Bindings?

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

Security grade badge for Wasm Bindings
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/goldziher-wasm-bindings/badge)](https://www.skillsdirectory.com/skills/goldziher-wasm-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: wasm-bindings
description: "wasm-bindgen conventions for compiling a Rust core to WebAssembly for JavaScript: wasm-pack packaging, JsValue mapping, async futures, bundle-size tuning, web-sys/js-sys, and TypeScript defs. Load when generating or reviewing WebAssembly/JS bindings for a Rust library."
---

- Use `wasm-bindgen` for JavaScript interop. Use `wasm-pack` for building and packaging.
- Map Rust types to JS with `#[wasm_bindgen]`. Use `JsValue` for dynamic types, typed wrappers for known types.
- Handle errors with `Result<T, JsValue>`. Convert Rust errors to descriptive JS error messages.
- Support both browser (ES modules) and Node.js (CommonJS/ESM) targets.
- Async: use `wasm-bindgen-futures` for Promise-returning functions. Never block the main thread.
- Bundle size: use `opt-level = "z"`, `lto = true`, `codegen-units = 1` in release profile.
- Use `web-sys` and `js-sys` for Web API access. Feature-gate platform-specific APIs.
- Test with `wasm-pack test --headless --firefox` and a JS test runner (e.g., Vitest or Jest) for JS integration tests.
- Generate TypeScript definitions automatically. Keep `.d.ts` files in sync with Rust exports.
- Anti-patterns: no `std::thread` (single-threaded), no synchronous I/O, no panics (becomes JS exception).

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.