/wasm-wasmtime
WebAssembly runtime skill using wasmtime. Use when running WASM modules with wasmtime CLI, working with WASI preview2, using the component model, embedding wasmtime in Rust applications, limiting execution with fuel metering, or debugging WASM with DWARF in wasmtime. Activates
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/wasm-wasmtime
Context preview
The summary Claude sees to decide when to auto-load this skill.
WebAssembly runtime skill using wasmtime. Use when running WASM modules with wasmtime CLI, working with WASI preview2, using the component model, embedding wasmtime in Rust applications, limiting execution with fuel metering, or debugging WASM with DWARF in wasmtime. Activates
SKILL.md
wasm-wasmtime.SKILL.mdname: wasm-wasmtime
description: WebAssembly runtime skill using wasmtime. Use when running WASM modules with wasmtime CLI, working with WASI preview2, using the component model, embedding wasmtime in Rust applications, limiting execution with fuel metering, or debugging WASM with DWARF in wasmtime. Activates on queries about wasmtime, WASI, WASM component model, wasmtime embedding, WIT interfaces, fuel metering, or server-side WebAssembly.
wasmtime — Server-Side WASM Runtime
Purpose
Guide agents through wasmtime: running WASM modules from the CLI, WASI APIs, the component model with WIT interfaces, embedding wasmtime in Rust applications, fuel metering for sandboxed execution, and debugging WASM with DWARF debug info.
Triggers
- "How do I run a WASM file with wasmtime?"
- "How does WASI work with wasmtime?"
- "How do I embed wasmtime in my Rust application?"
- "What is the WebAssembly component model?"
- "How do I limit WASM execution with fuel?"
- "How do I debug a WASM module in wasmtime?"
Workflow
1. wasmtime CLI
# Install
curl https://wasmtime.dev/install.sh -sSf | bash
# Run a WASM module
wasmtime hello.wasm
# Run with WASI arguments
wasmtime prog.wasm -- arg1 arg2
# Pre-open directories (WASI filesystem sandbox)
wasmtime --dir /tmp::/ prog.wasm # map host /tmp to WASI root
# Pass environment variables
wasmtime --env HOME=/home/user prog.wasm
# Invoke specific exported function
wasmtime run --invoke add math.wasm 3 4
# Inspect exports
wasmtime explore math.wasm # interactive explorer
wasmtime inspect math.wasm # show all exports/imports
# Compile to native ahead-of-time
wasmtime compile prog.wasm -o prog.cwasm
wasmtime run prog.cwasm
2. WASI preview2 APIs
WASI preview2 provides a capability-based POSIX-like API set:
# wasmtime supports WASI p2 natively
wasmtime --wasi-modules experimental-wasi-http prog.wasm
# Key WASI interfaces (WIT)
# wasi:filesystem — file and directory access
# wasi:sockets — TCP/UDP networking (preview2)
# wasi:http — HTTP client/server (experimental)
# wasi:cli — stdin/stdout/stderr, environment
# wasi:random — secure random numbers
# wasi:clocks — system and monotonic clocks
3. Embedding wasmtime in Rust
# Cargo.toml
[dependencies]
wasmtime = "24"
wasmtime-wasi = "24"
anyhow = "1"
use wasmtime::*;
use wasmtime_wasi::WasiCtxBuilder;
fn main() -> anyhow::Result<()> {
// Create engine with default config
let engine = Engine::default();
// Load and compile WASM module
let module = Module::from_file(&engine, "prog.wasm")?;
// Set up WASI context
let wasi = WasiCtxBuilder::new()
.inherit_stdio()
.inherit_env()
.preopened_dir("/tmp", "/")?
.build();
// Create a store (holds WASM state)
let mut store = Store::new(&engine, wasi);
// Instantiate the module
let instance = Instance::new(&mut store, &module, &[])?;
// Call an exported function
let add = instance.get_typed_func::<(i32, i32), i32>(&mut store, "add")?;
let result = add.call(&mut store, (3, 4))?;
println!("Result: {result}");
Ok(())
}4. Fuel metering — CPU limiting
Fuel metering limits the number of WASM instructions executed, preventing runaway or malicious code:
use wasmtime::*;
let mut config = Config::default();
config.consume_fuel(true); // enable fuel consumption
let engine = Engine::new(&config)?;
let module = Module::from_file(&engine, "untrusted.wasm")?;
let mut store = Store::new(&engine, ());
store.set_fuel(1_000_000)?; // allow 1M instructions
let instance = Instance::new(&mut store, &module, &[])?;
let run = instance.get_typed_func::<(), ()>(&mut store, "run")?;
match run.call(&mut store, ()) {
Ok(_) => println!("Completed, fuel remaining: {}", store.get_fuel()?),
Err(e) if e.to_string().contains("all fuel consumed") => {
println!("Timed out (fuel exhausted)");
}
Err(e) => eprintln!("Error: {e}"),
}5. Component model and WIT
The component model adds typed interface definitions (WIT) on top of core WASM:
// math.wit — interface definition
package example:math@1.0.0;
interface calculator {
add: func(a: s32, b: s32) -> s32;
sqrt: func(x: f64) -> f64;
}
world math-world {
export calculator;
}# Install component toolchain
cargo install wasm-tools cargo-component
# Create a Rust component
cargo component new --lib math-component
# Implement the WIT interface in src/lib.rs
# Build component
cargo component build --release
# Run with wasmtime component
wasmtime run math-component.wasm
// Embed a component in Rust
use wasmtime::component::*;
wasmtime::component::bindgen!({
world: "math-world",
path: "math.wit",
});
let component = Component::from_file(&engine, "math.wasm")?;
let (calculator, _) = MathWorld::instantiate(&mut store, &component, &linker)?;
let result = calculator.call_add(&mut store, 3, 4)?;6. WASM debugging with DWARF
# Build WASM with debug info (Rust)
cargo build --target wasm32-wasi # debug profile includes DWARF by default
# Run with source-level debugging
WASMTIME_BACKTRACE_DETAILS=1 wasmtime prog.wasm
# Full DWARF stack traces
wasmtime --debug-info prog.wasm 2>&1
# GDB with WASM (wasmtime dev build)
wasmtime debug prog.wasm # experimental
# wasm-tools for inspection
wasm-tools print prog.wasm | head -50 # disassemble to WAT
wasm-tools validate prog.wasm # validate WASM binary
7. WASM GC (garbage-collected objects)
WASM GC proposal adds struct and array types with managed allocation:
;; GC-enabled module (toolchain dependent)
(struct $point (field (mut f32) x) (field (mut f32) y))
# wasm-tools with GC support
wasm-tools validate --features gc module.wasm
wasmtime run --wasm gc module.wasm
In Rust/component builds, check wasmtime feature flags for `gc` support. Use `struct.new`, `
Read more
name: wasm-wasmtime description: WebAssembly runtime skill using wasmtime. Use when running WASM modules with wasmtime CLI, working with WASI preview2, using the component model, embedding wasmtime in Rust applications, limiting execution with fuel metering, or debugging WASM with DWARF in wasmtime. Activates on queries about wasmtime, WASI, WASM component model, wasmtime embedding, WIT interfaces, fuel metering, or server-side WebAssembly.
wasmtime — Server-Side WASM Runtime
Purpose
Guide agents through wasmtime: running WASM modules from the CLI, WASI APIs, the component model with WIT interfaces, embedding wasmtime in Rust applications, fuel metering for sandboxed execution, and debugging WASM with DWARF debug info.
Triggers
- "How do I run a WASM file with wasmtime?"
- "How does WASI work with wasmtime?"
- "How do I embed wasmtime in my Rust application?"
- "What is the WebAssembly component model?"
- "How do I limit WASM execution with fuel?"
- "How do I debug a WASM module in wasmtime?"
Workflow
1. wasmtime CLI
# Install curl https://wasmtime.dev/install.sh -sSf | bash # Run a WASM module wasmtime hello.wasm # Run with WASI arguments wasmtime prog.wasm -- arg1 arg2 # Pre-open directories (WASI filesystem sandbox) wasmtime --dir /tmp::/ prog.wasm # map host /tmp to WASI root # Pass environment variables wasmtime --env HOME=/home/user prog.wasm # Invoke specific exported function wasmtime run --invoke add math.wasm 3 4 # Inspect exports wasmtime explore math.wasm # interactive explorer wasmtime inspect math.wasm # show all exports/imports # Compile to native ahead-of-time wasmtime compile prog.wasm -o prog.cwasm wasmtime run prog.cwasm
2. WASI preview2 APIs
WASI preview2 provides a capability-based POSIX-like API set:
# wasmtime supports WASI p2 natively wasmtime --wasi-modules experimental-wasi-http prog.wasm # Key WASI interfaces (WIT) # wasi:filesystem — file and directory access # wasi:sockets — TCP/UDP networking (preview2) # wasi:http — HTTP client/server (experimental) # wasi:cli — stdin/stdout/stderr, environment # wasi:random — secure random numbers # wasi:clocks — system and monotonic clocks
3. Embedding wasmtime in Rust
# Cargo.toml [dependencies] wasmtime = "24" wasmtime-wasi = "24" anyhow = "1"
use wasmtime::*;
use wasmtime_wasi::WasiCtxBuilder;
fn main() -> anyhow::Result<()> {
// Create engine with default config
let engine = Engine::default();
// Load and compile WASM module
let module = Module::from_file(&engine, "prog.wasm")?;
// Set up WASI context
let wasi = WasiCtxBuilder::new()
.inherit_stdio()
.inherit_env()
.preopened_dir("/tmp", "/")?
.build();
// Create a store (holds WASM state)
let mut store = Store::new(&engine, wasi);
// Instantiate the module
let instance = Instance::new(&mut store, &module, &[])?;
// Call an exported function
let add = instance.get_typed_func::<(i32, i32), i32>(&mut store, "add")?;
let result = add.call(&mut store, (3, 4))?;
println!("Result: {result}");
Ok(())
}4. Fuel metering — CPU limiting
Fuel metering limits the number of WASM instructions executed, preventing runaway or malicious code:
use wasmtime::*;
let mut config = Config::default();
config.consume_fuel(true); // enable fuel consumption
let engine = Engine::new(&config)?;
let module = Module::from_file(&engine, "untrusted.wasm")?;
let mut store = Store::new(&engine, ());
store.set_fuel(1_000_000)?; // allow 1M instructions
let instance = Instance::new(&mut store, &module, &[])?;
let run = instance.get_typed_func::<(), ()>(&mut store, "run")?;
match run.call(&mut store, ()) {
Ok(_) => println!("Completed, fuel remaining: {}", store.get_fuel()?),
Err(e) if e.to_string().contains("all fuel consumed") => {
println!("Timed out (fuel exhausted)");
}
Err(e) => eprintln!("Error: {e}"),
}5. Component model and WIT
The component model adds typed interface definitions (WIT) on top of core WASM:
// math.wit — interface definition
package example:math@1.0.0;
interface calculator {
add: func(a: s32, b: s32) -> s32;
sqrt: func(x: f64) -> f64;
}
world math-world {
export calculator;
}# Install component toolchain cargo install wasm-tools cargo-component # Create a Rust component cargo component new --lib math-component # Implement the WIT interface in src/lib.rs # Build component cargo component build --release # Run with wasmtime component wasmtime run math-component.wasm
// Embed a component in Rust
use wasmtime::component::*;
wasmtime::component::bindgen!({
world: "math-world",
path: "math.wit",
});
let component = Component::from_file(&engine, "math.wasm")?;
let (calculator, _) = MathWorld::instantiate(&mut store, &component, &linker)?;
let result = calculator.call_add(&mut store, 3, 4)?;6. WASM debugging with DWARF
# Build WASM with debug info (Rust) cargo build --target wasm32-wasi # debug profile includes DWARF by default # Run with source-level debugging WASMTIME_BACKTRACE_DETAILS=1 wasmtime prog.wasm # Full DWARF stack traces wasmtime --debug-info prog.wasm 2>&1 # GDB with WASM (wasmtime dev build) wasmtime debug prog.wasm # experimental # wasm-tools for inspection wasm-tools print prog.wasm | head -50 # disassemble to WAT wasm-tools validate prog.wasm # validate WASM binary
7. WASM GC (garbage-collected objects)
WASM GC proposal adds struct and array types with managed allocation:
;; GC-enabled module (toolchain dependent) (struct $point (field (mut f32) x) (field (mut f32) y))
# wasm-tools with GC support wasm-tools validate --features gc module.wasm wasmtime run --wasm gc module.wasm
In Rust/component builds, check wasmtime feature flags for `gc` support. Use `struct.new`, `
A curated suite of AI agent skills for systems and low-level programming — C/C++, Rust, Zig, GPU, bare-metal firmware, Linux kernel/driver development, computer architecture, compiler internals, HPC, and more.
Repo: mohitmishra786/low-level-dev-skills
Other skills on low-level-dev-skills.
- /custom-allocators
Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning jemalloc/mimalloc, writing Rust GlobalAlloc, or benchmarking allocator performance. Activates on queries about jemalloc, mimalloc, tcmalloc, arena allocator,
Open skill - /numa-programming
NUMA programming skill for multi-socket memory locality. Use when detecting NUMA topology, binding processes with numactl, using libnuma API, building NUMA-aware data structures, or measuring remote access penalties. Activates on queries about numactl, libnuma, NUMA topology,
Open skill - /af-xdp
AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AF_XDP, xsk_umem, XDP_REDIRECT, libbpf xsk, or zero-copy XDP.
Open skill - /dpdk
DPDK skill for userspace packet I/O. Use when initializing EAL, configuring PMD drivers, using mbuf pools and rte_ring, setting up huge pages, RSS, or testpmd validation. Activates on queries about DPDK, EAL, rte_eth_rx_burst, hugepages, PMD, or testpmd.
Open skill - /io-uring
io_uring skill for Linux async I/O. Use when building high-performance servers with liburing, multi-shot operations, provided buffers, fixed files, zero-copy send, or tokio-uring. Activates on queries about io_uring, SQE/CQE, liburing, IORING_OP_PROVIDE_BUFFERS, or io_uring vs
Open skill - /adc-dac-baremetal
Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.
Open skill

