wasm-expert
하는 일
이 스킬은 Rust와 C 같은 언어로 WebAssembly 모듈을 만드는 방법을 안내하며, 서버 사용을 위한 WASI와 브라우저 연동을 포함합니다. 브라우저나 서버에서 이식 가능하고 빠른 코드를 원하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓Rust나 C 코드를 거의 네이티브 속도로 웹 페이지 안에서 실행하고 싶을 때.
- ✓WASI를 통해 서버에서 실행되는 이식 가능한 모듈이 필요할 때.
- ✓WebAssembly 파일이 너무 커서 브라우저 로딩을 위해 줄여야 할 때.
스킬 링크
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/wasm-expert/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 Rust 이미지 크기 조정 함수를 브라우저에서 실행되도록 WebAssembly로 컴파일해 주세요. 파일은 가능한 한 작게 유지해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 wasm-pack이나 WASI용 Cargo로 빌드하는 방법을 다루고, 모듈에 꼭 필요한 접근만 허용하며, 최적화 도구로 바이너리 크기를 줄이라고 설명합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
WASI란 무엇인가요?
WebAssembly 모듈이 파일, 네트워크, 시계를 통제된 방식으로 쓸 수 있게 하는 표준 시스템 인터페이스 집합입니다.
파일을 왜 작게 만들어야 하나요?
작은 파일이 브라우저에서 더 빨리 로드되며, 스킬은 디버그 정보를 제거하고 바이너리를 최적화하라고 권장합니다.
선형 메모리란 무엇인가요?
WebAssembly 모듈이 쓰는 평평한 메모리 블록으로, 커질 수는 있어도 줄어들 수는 없으므로 데이터 배치를 그에 맞게 계획해야 합니다.
상세 정보
작성자의 원본 설명
WebAssembly expert for WASI, component model, Rust/C compilation, and browser integration
repo: RightNow-AI/openfang
인기도
- GitHub 스타
- 18k
- 순위
- #10720
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 7. 2.
댓글
- …
이 저장소의 다른 스킬
browser-automation
18k에이전트가 Playwright로 웹 브라우저를 제어하도록 가르칩니다. CSS 선택자로 버튼, 양식, 링크를 찾습니다.
clip-hand-skill
18k에이전트가 영상 클립을 만들도록 돕습니다. 영상을 내려받고, 음성을 텍스트로 옮기고, 자막 파일을 만들고, ffmpeg로 클립을 자릅니다.
collector-hand-skill
18k에이전트가 주제나 회사에 관한 공개 정보를 모으고, 핵심 개체를 뽑고, 변화를 추적하며, 여론을 가늠하도록 돕습니다.
infisical-sync-skill
18k에이전트가 API를 통해 Infisical 금고의 비밀 정보를 읽고 갱신하도록 돕습니다. 로그인 단계와 명확한 오류 처리를 포함합니다.