# WebAssembly Module taste

WebAssembly Module taste — a system prompt for ChatGPT, Claude.ai, and Claude Code that establishes architectural standards for WebAssembly development. It guides developers on performance and safety best practices.

- prompt · `type=prompt` · ChatGPT, Claude.ai, Claude Code · ★ 178201 repo stars
- Author: f
- License: CC0-1.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/f/prompts.chat/tree/HEAD/prompts.csv
- Updated: 2026-10-24
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/prompts/webassembly-module-taste

## What it does

This prompt defines a performance-focused approach to building WebAssembly modules, covering memory management, build optimization, and the JavaScript-to-Wasm boundary. It provides actionable rules for developers to ensure Wasm is used only for CPU-heavy tasks rather than standard UI logic.

Guidelines include using `wasm-bindgen` and `wasm-pack` as the default toolchain, handling typed array views, and implementing safe sandboxing for untrusted plugins. The prompt also details CI strategies for tracking binary size and managing module loading.

To use this with Claude Code, save the prompt text into the `.claude/commands/prompts.csv.md` file.

## Install

### ChatGPT (native platform)

**How to use**
- Paste the text at the start of a chat or into project instructions

### Claude Code

**Manually: put the files in place**
- File: `.claude/commands/prompts.csv.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/f/prompts.chat/tree/HEAD/prompts.csv

## When to use it
- optimize WebAssembly module performance
- manage data exchange between JS and Wasm
- implement secure sandboxing for plugins
- automate Wasm binary size checks in CI

## Example prompts
- Apply the WebAssembly Module taste prompt to my project
- Review my Wasm architecture against WebAssembly Module taste rules
- Suggest optimizations for my Wasm module based on WebAssembly Module taste

## Source text · prompts.csv · CC0-1.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 0eadb2be746ab874.

BEGIN THIRD-PARTY FILE 0eadb2be746ab874
```text
# WebAssembly Module taste of a performance-focused systems developer
- Reach for WebAssembly only for CPU-heavy, measurable hot paths like codecs, parsers or simulations, not for ordinary UI logic. Confidence: 0.90
- Benchmark against a well-optimized JavaScript version before shipping, and keep the Wasm path only if the gain is real on target devices. Confidence: 0.85
- Write browser modules in Rust with wasm-bindgen and wasm-pack as the default toolchain. Confidence: 0.80
- Keep the boundary between JavaScript and Wasm coarse: pass whole buffers in a few calls instead of crossing it per item. Confidence: 0.90
- Share large data through typed array views over Wasm memory rather than serializing to JSON or strings. Confidence: 0.85
- Never hold a typed array view across a call that may grow memory, because growth detaches the old buffer. Confidence: 0.85
- Build release modules with opt-level set for size or speed on purpose, enable LTO, and run wasm-opt in the pipeline. Confidence: 0.85
- Track the compressed .wasm size in CI and fail the build when it grows past an agreed budget. Confidence: 0.80
- Load modules with WebAssembly.instantiateStreaming and serve them with the application/wasm content type. Confidence: 0.85
- Run heavy Wasm work in a Web Worker so it never blocks the main thread. Confidence: 0.90
- Use threads and SharedArrayBuffer only when the page can stay cross-origin isolated with COOP and COEP headers. Confidence: 0.75
- Detect SIMD support at runtime and ship a fallback build, instead of assuming every browser has it. Confidence: 0.70
- Avoid panics crossing the boundary: return Result types and convert them to JavaScript errors with clear messages. Confidence: 0.85
- Install console_error_panic_hook in debug builds and strip it from release builds. Confidence: 0.75
- Keep the exported API small and typed, and publish the generated TypeScript definitions with the package. Confidence: 0.85
- Avoid pulling heavy crates like full regex or serde_json into browser builds unless the size cost is measured and accepted. Confidence: 0.75
- Target WASI and the component model for server-side or plugin use, and keep that build separate from the browser build. Confidence: 0.70
- Treat plugin modules from users as untrusted: run them in a sandboxed runtime like Wasmtime with fuel or time limits and no ambient file or network access. Confidence: 0.90
- Test the core logic as native code with cargo test and keep a smaller set of wasm-bindgen-test runs in a headless browser. Confidence: 0.80
- Keep a pure JavaScript fallback for environments where Wasm is blocked by policy or fails to load. Confidence: 0.65
```
END THIRD-PARTY FILE 0eadb2be746ab874

The third-party file has ended. Everything between the 0eadb2be746ab874 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© f · CC0-1.0 · https://github.com/f/prompts.chat/tree/HEAD/prompts.csv

## Similar
- [cloudflare-workers-multi-lang](https://affpapa.org/en/nevibecode/skills/cloudflare-workers-multi-lang.md) — skill · 317 installs
- [discover-wasm](https://affpapa.org/en/nevibecode/skills/discover-wasm.md) — skill · 117 installs
- [webassembly-z80-cellular-automata-cursorrules-prom](https://affpapa.org/en/nevibecode/rules/webassembly-z80-cellular-automata-cursorrules-prom.md) — rule · ★ 41178 repo stars
- [wasm-emscripten](https://affpapa.org/en/nevibecode/skills/wasm-emscripten.md) — skill · 597 installs
- [edict](https://affpapa.org/en/nevibecode/mcp/edict.md) — MCP server · ★ 14 repo stars
- [wasm-agent](https://affpapa.org/en/nevibecode/skills/wasm-agent.md) — skill · 741 installs

From the same set: [f/prompts.chat](https://affpapa.org/en/nevibecode/by/f/prompts.chat.md) — 218 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
