agentleFS
cosmonic-labscosmonic-labs/skills/webassembly-component-development/SKILL.md

webassembly-component-development

Skill21 starsChanged 31 days agoApache-2.0View on GitHub

Build, compose, run, test and debug WebAssembly components targeting WASI 0.3 (wasip3) with native async. Use this skill whenever the user is building or troubleshooting a component or `.wasm` file, targeting `wasm32-wasip3` (or falling back to wasip2/wasip1), choosing an async approach, composing components with wac or wasm-tools, resolving WIT dependencies (wkg, wit-bindgen, `wash wit update`), hitting "unknown import" or version-mismatch errors, picking a runtime (wasmtime, jco, wasmCloud), or working across languages (Rust, JS/TS, Go, Python, C/C++). Also use it when the user mentions WASI, the component model, wasip3, or component composition. For designing or reviewing the WIT interfaces themselves (naming, capability scoping, errors, versioning), use wit-interface-design.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Build: use wash build when the project has .wash/config.yaml.

    line 14
  2. Very specific:

    Async: use the component model's native async: async fn in exported handlers, wit_stream / wit_future for streams and futures, …

    line 15
  3. Very specific:

    Threading: not available yet. std::thread::spawn returns an error on wasip3, and cooperative threading is still in development.

    line 16
  4. Very specific:

    wasmCloud docs: use https://wasmcloud.com/docs/, never /docs/v1/.

    line 19

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

WebAssembly Component Development

Build components against WASI 0.3 (wasip3). It adds native async, stream<T> and future<T> to the component model, so most of the old workarounds (poll loops, tokio_unstable, third-party async runtimes) are no longer needed for new code. Fall back to wasip2 only when a runtime or dependency requires it.

Key Defaults

  • Target: wasm32-wasip3 (Tier 2 in Rust, stable since 1.100.0). Use the wasip3 crate for WASI bindings (wasip2 crate for the fallback). Gate code with #[cfg(all(target_os = "wasi", target_env = "p3"))].
  • Build: use wash build when the project has .wash/config.yaml. For plugins use wash build --skip-fetch (the wasmcloud:wash interface isn't published). Otherwise cargo build --target wasm32-wasip3 --release.
  • Async: use the component model's native async: async fn in exported handlers, wit_stream / wit_future for streams and futures, wit_bindgen::spawn_local for background tasks. Don't pull in tokio or wstd for new p3 code (see async.md).
  • Threading: not available yet. std::thread::spawn returns an error on wasip3, and cooperative threading is still in development. Design single-threaded and avoid rayon.
  • Strings: UTF-8. Avoid as_encoded_bytes().
  • Version matching: the runtime must implement the exact WASI 0.3.x versions your component imports. Check with wasm-tools component wit component.wasm.
  • wasmCloud docs: use https://wasmcloud.com/docs/, never /docs/v1/.

Reference Files

Load the relevant file when working on the matching topic:

TopicFile
Component Model, wasip3 vs wasip2, targets and worldscore-concepts.md
Composition patterns, building with wash / cargo, wac, .wash/config.yamlcomposition-and-building.md
Languages and toolchains (Rust, JS/TS, Go, Python, C/C++)language-interop.md
Native async on wasip3: handlers, streams, futures, spawning; the wasip2 fallback (tokio, wstd)async.md
Gotchas (threading, strings, networking), unknown-import errors, runtimes (wasmtime, jco, wasmCloud), version alignmentgotchas-and-runtime.md
Testing with mock components, debugging workflow, error patterns, performancetesting-debugging-performance.md
Development practices, CI/CD, architecture patternspatterns-and-best-practices.md
Designing or reviewing WIT interfaces (naming, capability grants, errors, versioning)the wit-interface-design skill

Related skills

  • wit-interface-design: how to design the WIT contract.
  • wash: the wash build / wash dev toolchain.
  • cosmonic-go: Go components with componentize-go on async wasip3.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.