wasm-emscripten
Skill0 starsChanged 3 months agoMITView on GitHub
Compiles C/C++ code to WebAssembly using Emscripten, configures runtime flags, bridges JavaScript and WASM, manages virtual filesystems (FS/IDBFS), and handles direct HEAP memory views. Use when compiling, debugging, or interfacing C/C++ WebAssembly modules with browser APIs, WebGL, Web Audio, or Node.js.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- mohitmishra786/low-level-dev-skillstheir own version, first seen Apr 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- mohitmishra786/low-level-dev-skills★ 251same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- core/CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- avoid-ai-writingSkill
- c-cpp-systemsSkill
- doubt-driven-developmentSkill
- marketing-copywritingSkill
- mempalace-recallSkill
- mempalaceSkill
- mempalace-taskSkill
- retro-emulation-engineeringSkill
- seo-optimization-and-auditSkill
- skill-ai-mlSkill
- skill-backend-architectSkill
- skill-codebase-onboardingSkill
- skill-code-reviewSkill
- skill-context-engineeringSkill
- skill-creative-designSkill
- skill-data-analysisSkill
- skill-data-scienceSkill
- skill-design-engineeringSkill
- skill-devops-cloudSkill
- skill-emulator-wasmSkill
- skill-frontend-architectSkill
- skill-graph-analyticsSkill
- skill-graphics-webglSkill
- skill-low-level-programmingSkill
- skill-master-orchestratorSkill
- skill-mcp-builderSkill
- skill-monorepo-architectSkill
- skill-osint-engineeringSkill
- skill-plugin-architectureSkill
- skill-qa-engineerSkill
- skill-researchSkill
- skill-resume-tailorSkill
- skill-stealth-scrapingSkill
- skill-system-diagnosticsSkill
- skill-web-architectureSkill
- skill-web-performanceSkill
- spec-driven-developmentSkill
- spec-minerSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
When building high-performance C/C++ projects (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WebAssembly & Emscripten Engineering Skill
Specialist in WebAssembly compilation pipelines, Emscripten toolchains (emcc), runtime bindings, direct memory inspection, and browser I/O interfacing.
1. Emscripten Compilation & Optimization Flags
When building high-performance C/C++ projects (e.g. emulators, game engines, audio processors) to WebAssembly:
emcc source.c -O3 \
-s WASM=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_free', '_init_core', '_run_frame']" \
-s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap', 'FS', 'getValue', 'setValue', 'UTF8ToString']" \
-s USE_WEBGL2=1 \
-s FULL_ES3=1 \
-o emulator.jsEssential Debugging Flags
-s ASSERTIONS=1/-s ASSERTIONS=2: Enables runtime assertions and checks for stack overflows.-s SAFE_HEAP=1: Detects unaligned memory accesses, NULL pointer dereferences, and out-of-bounds reads/writes.-s STACK_OVERFLOW_CHECK=2: Injects guards to catch call-stack exhaustion.-g3 --source-map-base http://localhost:8000/: Generates DWARF/WASM sourcemaps for browser DevTools debugging.
2. JavaScript <-> WASM Interfacing
C-Level Exports (EMSCRIPTEN_KEEPALIVE)
#include <emscripten.h>
EMSCRIPTEN_KEEPALIVE
void run_frame(void) {
// Process one video/audio emulation step
}
EMSCRIPTEN_KEEPALIVE
uint8_t* get_framebuffer_ptr(void) {
return g_framebuffer;
}JS-Level Invocation (cwrap vs Direct Calls)
// Function wrapper with type safety
const runFrame = Module.cwrap('run_frame', null, []);
const getFramebufferPtr = Module.cwrap('get_framebuffer_ptr', 'number', []);
// Direct fast C-pointer call
const ptr = Module._get_framebuffer_ptr();3. Direct HEAP Memory Views & The Growth Invalidation Rule
Emscripten exposes WASM linear memory as typed array views:
Module.HEAPU8:Uint8Array(8-bit unsigned bytes)Module.HEAP16:Int16Array(16-bit signed PCM audio samples)Module.HEAP32:Int32Array(32-bit signed integers/pointers)Module.HEAPF32:Float32Array(32-bit IEEE-754 floats)
CRITICAL MEMORY INVALIDATION RULE
Whenever WebAssembly memory grows (ALLOW_MEMORY_GROWTH=1 or Module._malloc), the underlying ArrayBuffer is detached and reallocated.
Never cache HEAP typed arrays across asynchronous boundaries or frame loops:
// BAD: Storing reference across frames (will throw "Cannot perform construct on detached ArrayBuffer" on memory grow)
class AudioRenderer {
constructor() {
this.buffer = new Int16Array(Module.HEAP16.buffer, Module._getAudioPtr(), 4096);
}
}
// GOOD: Fresh view instantiation or validation helper
function getAudioView(ptr, size) {
return new Int16Array(Module.HEAP16.buffer, ptr, size);
}4. Virtual File System (FS & IDBFS)
Emscripten provides an in-memory POSIX filesystem (MEMFS) and an IndexedDB persistent layer (IDBFS):
// Writing ROM directly to Virtual FS
FS.writeFile('/rom.v64', romUint8Array);
// Reading output or save data
const saveStateBytes = FS.readFile('/savestate.gz');
// Mounting persistent storage in IndexedDB
FS.mkdir('/saves');
FS.mount(IDBFS, {}, '/saves');
FS.syncfs(true, function (err) {
// populated from IndexedDB to Virtual FS
});Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

