custom-allocators
Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning…
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
Claude Code
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime --agent claude-code
Codex
$ npx skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime -a codex -y
Cursor
$ npx skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime -a cursor -y
Gemini CLI
$ npx skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime -a gemini-cli -y
GitHub Copilot
$ npx skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime -a github-copilot -y
OpenCode
$ npx skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime -a opencode -y
Windsurf
$ npx skills add mohitmishra786/low-level-dev-skills --skill wasm-wasmtime -a windsurf -y
name: wasm-wasmtime description: WebAssembly runtime skill using wasmtime. Use when running WASM modules or components with the wasmtime CLI, choosing between WASI 0.1/0.2/0.3, using the component model, embedding wasmtime in Rust applications, limiting execution with fuel or timeouts, or debugging WASM with DWARF in wasmtime. Activates on queries about wasmtime, WASI, WASIp2, WASIp3, WASM component model, wasmtime embedding, WIT interfaces, fuel metering, or server-side WebAssembly.
Guide agents through wasmtime (examples checked against wasmtime 50): running modules and components from the CLI, WASI versions, the component model with WIT interfaces, embedding wasmtime in Rust, fuel and timeout limits, and debugging WASM with DWARF.
# Install curl https://wasmtime.dev/install.sh -sSf | bash # Run a WASM module or component (run is the default subcommand) wasmtime hello.wasm # Arguments after the file go to the guest wasmtime run prog.wasm arg1 arg2 # Pre-open directories (WASI filesystem sandbox) wasmtime run --dir /tmp::/ prog.wasm # map host /tmp to guest / # Pass environment variables wasmtime run --env HOME=/home/user prog.wasm # Invoke an exported function wasmtime run --invoke add math.wasm 3 4 # core module wasmtime run --invoke 'add(3, 4)' math-component.wasm # component: call syntax # Inspect a binary (wasm-tools, not wasmtime) wasm-tools print prog.wasm --skeleton # imports/exports as WAT wasm-tools component wit component.wasm # a component's WIT interface wasmtime explore prog.wasm # writes prog.explore.html (wasm ↔ machine code) # Compile ahead of time wasmtime compile prog.wasm -o prog.cwasm wasmtime run --allow-precompiled prog.cwasm # required for .cwasm input
Resource limits on the CLI:
wasmtime run -W fuel=10000000 prog.wasm # trap after N units of fuel wasmtime run -W timeout=2s prog.wasm # trap after wall-clock time wasmtime run -W max-memory-size=67108864 prog.wasm # cap linear memory (bytes)
`-W` sets wasm features and limits, `-S` WASI options, `-D` debug options, `-O` codegen options. Run `wasmtime -W help` (or `-S help`, `-D help`, `-O help`) for the full list.
| Version | Binary kind | Rust target | Notes | |---------|-------------|-------------|-------| | 0.1 (preview 1) | core module importing `wasi_snapshot_preview1` | `wasm32-wasip1` | Was `wasm32-wasi`; that target was removed from rustc | | 0.2 | component, `wasi:*@0.2.x` interfaces | `wasm32-wasip2` | Streams via `wasi:io` | | 0.3 | component, `wasi:*@0.3.x` interfaces | `wasm32-wasip3` | Native `async`, `stream<T>`, `future<T>`; on by default in wasmtime 46+ |
# wasmtime detects module vs component and links the matching WASI version wasmtime run hello-p1.wasm wasmtime run hello-p3.wasm # WASI options (components) wasmtime run -S http component.wasm # wasi:http outgoing requests wasmtime run -S inherit-network component.wasm # full host network for wasi:sockets wasmtime run -S p3=n component.wasm # disable WASIp3 interfaces # Serve a wasi:http proxy component wasmtime serve proxy.wasm # Key WASI interfaces (WIT) # wasi:filesystem, wasi:sockets, wasi:http, wasi:cli, wasi:random, wasi:clocks
WASI 0.3 was ratified in June 2026. It removes the `wasi:io` package; streams and futures are component-model types, and the canonical ABI lifts/lowers `async func` directly. Bindings generators (`wit-bindgen`, `wasmtime::component::bindgen!`) emit async functions for these.
# Cargo.toml — wasmtime and wasmtime-wasi versions must match [dependencies] wasmtime = "50" wasmtime-wasi = "50" anyhow = "1"
use wasmtime::*;
use wasmtime_wasi::p1::{self, WasiP1Ctx};
use wasmtime_wasi::{FsPerms, WasiCtxBuilder};
fn main() -> Result<()> {
let engine = Engine::default();
// Load and compile a module built for wasm32-wasip1
let module = Module::from_file(&engine, "prog.wasm")?;
// WASI imports are supplied through a Linker
let mut linker: Linker<WasiP1Ctx> = Linker::new(&engine);
p1::add_to_linker_sync(&mut linker, |ctx| ctx)?;
// WASI context: stdio, env, args, preopened directory
let wasi = WasiCtxBuilder::new()
.inherit_stdio()
.inherit_env()
.args(&["prog.wasm", "arg1"])
.preopened_dir("/tmp", "/", FsPerms::ReadWrite)?
.build_p1();
// The store holds all instance state
let mut store = Store::new(&engine, wasi);
let instance = linker.instantiate(&mut store, &module)?;
// Run the WASI command entry point
let start = instance.get_typed_func::<(), ()>(&mut store, "_start")?;
start.call(&mut store, ())?;
Ok(())
}A module without imports can use `Instance::new(&mut store, &module, &[])` directly. A module that imports WASI fails to instantiate that way.
Fuel metering limits the work a guest can do, stopping runaway or malicious code:
use wasmtime::*;
let mut config = Config::new();
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)?;
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.downcast_ref::<Trap>() == Some(&Trap: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.
Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning…
NUMA programming skill for multi-socket memory locality. Use when detecting NUMA topology, binding processes with numactl, using…
AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT…
DPDK skill for userspace packet I/O. Use when initializing EAL, configuring PMD drivers, using mbuf pools and rte_ring, setting…
io_uring skill for Linux async I/O. Use when building high-performance servers with liburing, multi-shot operations, provided…
Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.