wasm-expert
What it does
This skill guides building WebAssembly modules from languages such as Rust and C, including WASI for server use and browser integration. It is for developers who want portable, fast code in browsers or on servers.
When to use it
- ✓When you want to run Rust or C code inside a web page at near-native speed.
- ✓When you need a portable module that runs on a server through WASI.
- ✓When a WebAssembly file is too large and must be made smaller for browser loading.
Skill link
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/wasm-expert/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Compile my Rust image-resizing function to WebAssembly so it runs in the browser, and keep the file as small as possible.”
5 new skills a week. 1 minute to read.
How it works
The skill covers building with wasm-pack or Cargo for WASI, granting only the access a module needs and reducing binary size with optimization tools.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
WebAssembly Expert
A systems programmer and runtime specialist with deep expertise in WebAssembly compilation, WASI system interfaces, the component model, and browser integration. This skill provides guidance for compiling Rust, C, and other languages to WebAssembly, building portable server-side modules with WASI, designing composable components with WIT interfaces, and integrating Wasm modules into web applications with optimal performance.
Key Principles
- WebAssembly provides a portable, sandboxed execution environment; leverage its security model by granting only the capabilities a module needs through explicit imports
- Target wasm32-wasi for server-side and CLI applications that need file system, network, or clock access through the standardized WASI interface
- Use the Component Model and WIT (WebAssembly Interface Types) for language-agnostic module composition; components communicate through typed interfaces, not raw memory
- Optimize Wasm binary size aggressively for browser delivery; every kilobyte matters for initial load time, so strip debug info, use wasm-opt, and enable LTO
- Understand linear memory: Wasm modules operate on a flat byte array that grows but never shrinks; design data structures and allocation patterns accordingly
Techniques
- Compile Rust to Wasm with wasm-pack for browser targets (wasm-pack build --target web) or cargo build --target wasm32-wasi for server-side WASI modules
- Use wasm-bindgen to expose Rust functions to JavaScript and import JS APIs into Rust; annotate public functions with #[wasm_bindgen] and use JsValue for dynamic interop
- Define component interfaces in WIT files specifying exports (functions the component provides) and imports (functions the component requires from the host)
- Compose multiple Wasm components using wasm-tools compose, linking one component's imports to another's exports without source-level dependencies
- Optimize binaries with wasm-opt -Oz for size or -O3 for speed; use wasm-tools strip to remove custom sections and debug information for production builds
- Instantiate modules in the browser with WebAssembly.instantiateStreaming(fetch("module.wasm"), importObject) for the fastest possible startup
- Enable SIMD (Single Instruction, Multiple Data) for compute-intensive workloads by compiling with target features enabled and using explicit SIMD intrinsics or auto-vectorization
Common Patterns
- Plugin Architecture: Host application loads untrusted Wasm plugins with restricted WASI capabilities; plugins export a known interface (defined in WIT) and cannot access resources beyond what the host provides
- Polyglot Composition: Compile components from different languages (Rust, Go, Python) to Wasm components with WIT interfaces, then compose them into a single application using wasm-tools
- Streaming Compilation: Use WebAssembly.compileStreaming to compile the module while it downloads; pair with instantiate for near-zero wait time after the network transfer completes
- Memory-Mapped I/O: For large data processing in Wasm, share a linear memory region between the host and the module, passing pointers and lengths instead of copying data across the boundary
Pitfalls to Avoid
- Do not assume all WASI APIs are available in every runtime; WASI Preview 2 is still being adopted, and different runtimes (Wasmtime, Wasmer, WasmEdge) support different subsets
- Do not allocate memory freely without a strategy; Wasm linear memory grows in 64KB page increments and never releases pages back to the OS, so fragmentation accumulates over time
- Do not pass complex data structures across the Wasm boundary by serializing to JSON; use shared linear memory with well-defined layouts or the component model's typed interface for efficiency
- Do not skip testing on the target runtime; behavior differences exist between browser engines (V8, SpiderMonkey, JavaScriptCore) and server-side runtimes, especially for threading and SIMD
FAQ
What is WASI?
It is a standard set of system interfaces that lets WebAssembly modules use files, network or clocks in a controlled way.
Why make the file smaller?
Smaller files load faster in the browser, and the skill recommends stripping debug info and optimizing the binary.
What is linear memory?
It is the flat block of memory a WebAssembly module uses, which can grow but not shrink, so data layouts should plan for that.
Details
Original description by the author
WebAssembly expert for WASI, component model, Rust/C compilation, and browser integration
repo: RightNow-AI/openfang
Popularity
- GitHub stars
- 18k
- Ranking position
- #10720
- License
- Apache-2.0
- Updated
- 7/2/2026
Comments
- …
More skills from this repository
browser-automation
18kTeaches your agent to control a web browser with Playwright, using CSS selectors to find buttons, forms and links.
clip-hand-skill
18kHelps your agent make video clips: download a video, transcribe its speech, create subtitle files and cut clips with ffmpeg.
collector-hand-skill
18kHelps your agent gather public information on a topic or company, pull out key entities, track changes and gauge sentiment.
infisical-sync-skill
18kHelps your agent read and update secrets in an Infisical vault through its API, with login steps and clear error handling.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.