wasm

$npx mdskill add TheBeardedBearSAS/claude-craft/wasm

WASM pour performance critique, polyglot runtime, edge computing.

SKILL.md

.github/skills/wasmView on GitHub ↗
---
name: wasm
description: WebAssembly (WASM) integration, WASI, component model, Rust/Go to WASM compilation. Use when implementing WASM modules, browser/edge compute, or polyglot runtime.
triggers:
  files: ["**/*.wasm", "**/wasm/**", "**/*.wat"]
  keywords: ["webassembly", "wasm", "wasi", "component model", "wasm32", "wasm-bindgen", "emscripten", "wasmtime", "wasmer"]
auto_suggest: true
---

# WebAssembly (WASM) — Component Model, WASI

WASM pour performance critique, polyglot runtime, edge computing.

## Use Cases

**Browser** — Crypto, image (Figma, Google Earth)  
**Edge** — Cloudflare Workers, Fastly  
**Server** — Plugins sandboxés (Envoy)  
**Embedded** — IoT, automotive

## Compilation

**Rust** — `wasm-pack` (~50KB, perf)  
**Go** — `GOOS=js GOARCH=wasm` (~2MB)  
**C/C++** — Emscripten (legacy)  
**AssemblyScript** — TypeScript-like

## Rust to WASM

```rust
use wasm_bindgen::prelude::*;
#[wasm_bindgen] pub fn add(a: i32, b: i32) -> i32 { a + b }
```

```bash
wasm-pack build --target web
```

```javascript
import init, { add } from './pkg/wasm.js';
await init(); add(2, 3);
```

## WASI (System Interface)

```bash
rustc --target wasm32-wasi main.rs -o app.wasm
wasmtime app.wasm
```

## Component Model

```wit
interface math { add: func(a: s32, b: s32) -> s32 }
```

Compose Rust/Go/C++ modules typés.

## Edge (Cloudflare)

```javascript
import wasm from './processor.wasm';
export default {
  async fetch(req) {
    const inst = await WebAssembly.instantiate(wasm);
    return new Response(inst.exports.process(req.body));
  }
};
```

## Runtimes

**Wasmtime** — Fast, WASI  
**Wasmer** — Universal  
**WasmEdge** — Edge, K8s

---

Voir `@.claude/skills/edge-computing/SKILL.md`

More from TheBeardedBearSAS/claude-craft

SkillDescription
adapter-developmentErstellen Sie eine Paperclip-Extension — ein Plugin via @paperclipai/plugin-sdk oder einen Built-in-Adapter unter packages/adapters. Verwenden Sie dies beim Hinzufügen von AI-Runtimes oder Feature-Plugins.
aggregatesRègle 05 : Aggregates et Aggregate Roots. Use when implementing DDD patterns.
api-gatewayAPI Gateway patterns (Kong, Traefik, AWS API Gateway) — rate limiting, auth, routing, versioning. Use when implementing API gateway, reverse proxy, or API management.
architecture-clean-dddArchitecture Clean + DDD + Hexagonal - Atoll Tourisme. Use when designing architecture or reviewing code structure.
architecture-paperclipPaperclip-Two-Layer-Architektur (Control-Plane + Adapter). Verwenden Sie dies beim Entwerfen oder Reviewen von Paperclip-Modul-/Adapter-Grenzen.
asyncArchitecture async-first avec messaging et queues (Symfony Messenger, Laravel Queue, Ecotone). Use when working with async processing, queues, workers, background jobs.
atomic-tasksPattern GSD (Get Shit Done) - découper en tâches atomiques avec contextes subagent frais pour combattre le context rot. Use when planning complex work or working past 50% context usage.
coding-standards-tsPaperclip-TypeScript-Coding-Standards — Strict-Modus, Kebab-Files, kein any, strukturierte Logs. Verwenden Sie dies beim Schreiben oder Reviewen von Paperclip-TS-Code.
cqrsCQRS - Command Query Responsibility Segregation. Use when implementing DDD patterns, separating read/write models, event sourcing, or building scalable architectures with heterogeneous performance requirements.
ddd-patternsPatterns DDD - Atoll Tourisme. Use when implementing DDD patterns.