wasm-interop

Debug JavaScript-WebAssembly boundary issues in brepjs CAD kernel adapters.

77|7|Updated Feb 1, 2026
One-click install
npx skills add https://github.com/andymai/brepjs --skill wasm-interop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wasm-interop
Source: https://github.com/andymai/brepjs/tree/main/.claude/skills/wasm-interop
Command: npx skills add https://github.com/andymai/brepjs --skill wasm-interop

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates hours of frustrating debugging for common low-level issues that occur when working across the JavaScript and WebAssembly boundary in the brepjs CAD library, including broken enum comparisons, garbage mesh data, detached ArrayBuffers, and kernel initialization failures specific to Emscripten's WASM integration.

Core Features & Use Cases

  • Emscripten enum handling: Fixes silent failures where OCCT enum values are compared incorrectly or returned as unexpected object types instead of usable numbers.
  • WASM heap safety: Prevents stale heap views, detached buffers, and corrupted geometry data by enforcing correct typed array read and copy patterns for growing WASM linear memory.
  • Kernel initialization and build debugging: Resolves issues with missing WASM artifacts, incorrect kernel fallback behavior, broken dynamic imports for optional backends, and misconceptions about multi-threading support in shipped builds.
  • Use Case: If you are editing code in src/kernel/occt/meshOps.ts and seeing garbage mesh vertices after a later WASM operation, or debugging an "enum comparison is always false" error in src/kernel/occt/topologyOps.ts, this Skill provides the exact patterns and fixes to resolve the issue.

Quick Start

Use the wasm-interop skill to debug the "brepjs kernel not initialized" error you are encountering when trying to run brepjs operations in your TypeScript project.

Frequently Asked Questions about wasm-interop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my WebAssembly enum comparison always return false in Emscripten?

WebAssembly enum comparisons fail in Emscripten when OCCT enum values are returned as unexpected object types instead of usable numbers. This Skill fixes the silent comparison failures by applying correct Emscripten enum handling patterns for the brepjs CAD library kernels.

How do I fix detached ArrayBuffers and garbage mesh data when reading from WASM heap?

Fix detached ArrayBuffers and garbage mesh data by enforcing safe WASM heap memory access patterns. This Skill provides correct typed array read and copy logic to prevent stale heap views and corrupted geometry data when working with growing WASM linear memory.

How do I resolve the brepjs kernel not initialized error in my TypeScript project?

Resolve the brepjs kernel not initialized error by debugging the kernel initialization workflow and optional backend loading. This Skill diagnoses dynamic import build failures and missing WASM artifacts specific to single-threaded WASM kernel builds.

Does the brepjs CAD library support multi-threading in its WebAssembly builds?

The brepjs CAD library ships single-threaded WASM kernel builds and does not support multi-threading in its shipped artifacts. This Skill addresses misconceptions about multi-threading support and resolves incorrect kernel fallback behavior for optional backends.

How do I debug missing WASM artifact and dynamic import build failures in occt kernel adapters?

Debug missing WASM artifacts and dynamic import build failures in occt kernel adapters by correcting the optional backend loading and initialization workflows. This Skill targets code in src/kernel/occt, src/kernel/occtWasm, and src/kernel/brepkit to restore proper Emscripten integration.