Audit WebAssembly Component Model WIT world evolution offline with pinned wasm-tools AST/semver-check across imports, exports, signatures, types, resources, and binary components.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Wasm Component Wit Compatibility?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sickn33-wasm-component-wit-compatibility)
---
name: wasm-component-wit-compatibility
description: "Audit WebAssembly Component Model WIT world evolution offline with pinned wasm-tools AST/semver-check across imports, exports, signatures, types, resources, and binary components."
category: development
risk: safe
source: self
source_type: self
date_added: "2026-12-01"
author: Koushik-Katkam
tags: [webassembly, wasm, component-model, wit, wasm-tools, compatibility]
---
# WebAssembly Component WIT Compatibility
## Overview
Compare WebAssembly **Component Model WIT** world contracts offline using the real pinned **`wasm-tools`** parser (`wasm-tools component wit --json` and `wasm-tools component semver-check`) over both `.wit` packages and validated `.wasm` binary components, **without regular-expression scraping over WIT text** and **without executing WebAssembly code**. Verifies removed required exports, newly required host imports, parameter/result contract changes, package/interface semver versions, nominal type and resource identities, and compatibility direction.
Distinction from existing repository skills:
- `rust-migration`, `axum-development`, and `api-contract-testing`: zero WebAssembly Component Model, `.wit` interface parsing, world import/export compatibility, or `wasm-tools` usage exists anywhere in `upstream/main` (`0` hits across `3,092` skills).
## When to Use
- Auditing breaking vs. additive changes between `v1` and `v2` WebAssembly Component Model WIT worlds before publishing components or upgrading hosts.
- Inspecting compiled `.wasm` components safely offline to extract their resolved WIT JSON contract without running untrusted Wasm code.
- Verifying compatibility direction (`new component drops into existing v1 host`) across imports, exports, and resource handles.
- Do **not** use this skill to execute `.wasm` modules/components, benchmark runtime host bindings, or prove behavioral/ABI equivalence from identical interface names.
## Prerequisites
- Official **`wasm-tools` CLI** (`wasm-tools --version`, tested on **`1.263.0`**) on `PATH` or pointed to by `WASM_TOOLS_BIN`.
- Python `3.10+` with `pytest` (tested with Python `3.12.10` and `pytest==9.1.1`).
- **No Wasm runtime execution (`wasmtime`) or network access required.**
## How It Works
### 1. Define the compatibility direction explicitly
Audit direction defaults strictly to **`NEW_COMPONENT_ON_OLD_HOST`**:
- **Exports (what the old host expects the component to provide):** Removing an exported function, type, or interface or changing exported type definitions (`type id = u32` -> `type id = string`), parameter types, or result error payloads breaks existing hosts (`REMOVED_REQUIRED_EXPORT` / `CONTRACT_CHANGE`). Adding a new optional export is non-breaking for old hosts (`ADDED_EXPORT`).
- **Imports (what the component requires the old host to provide):** Adding a new required host import or mutating imported type/function definitions breaks old hosts (`NEW_REQUIRED_IMPORT` / `CONTRACT_CHANGE`).
- **Package-qualified identities, resources & canonical AST types:** Constructor signatures, resource methods, package-qualified interface keys, `variant`/`enum`/`flags` members, and nominal type definitions are canonicalized structurally without comparing unstable integer AST type IDs (`UNSUPPORTED` if an unmodeled type kind is encountered).
### 2. Parse genuine WIT ASTs and binary components with `wasm-tools`
Run the local verification suite in [WIT compatibility harness](references/wit-compatibility-harness.md):
1. Run `wasm-tools component wit <target> --json` (rejects invalid WIT/Wasm as `INVALID_INPUT` cleanly) to inspect resolved `packages`, `worlds`, `interfaces`, `types`, and `functions`.
2. Run `wasm-tools component semver-check --prev <new-world> --new <old-world> <wit>` **only when both worlds live in the same `.wit` file/package source** (never substituting an unrelated third `.wit` fixture) to confirm official Component Model semver compatibility alongside structured AST diff diagnostics.
3. Build and validate an actual `.wasm` binary component offline (`wasm-tools parse` + `component embed` + `component new` + `validate --features component-model`) and extract its embedded WIT contract via `component wit component.wasm --json` without instantiation or execution.
### 3. Distinguish conservative structural differences from proven incompatibility
Always state explicitly that structural AST differences flag **conservative compatibility breaks** (some changes, such as compatible minor package version bumps or nominal aliases, can require host/guest ABI review), whereas passing matching WIT identifiers, function signatures, and semver checks **never proves behavioral equivalence or canonical-ABI runtime safety** across different guest implementations or memory allocators.
## Examples
Run the self-contained verification suite in [WIT compatibility harness](references/wit-compatibility-harness.md):
```text
User request: "Check whether our plugin-v2 WIT world breaks hosts compiled against plugin-v1."
Inputs: WIT package(s) or binary .wasm components audited via wasm-tools 1.263.0.
Expected result: Backward-compatible export addition passes semver-check and reports NEW_COMPONENT_ON_OLD_HOST;
removed export, newly required host import, u32->u64 param change, and changed resource method return BREAKING findings;
syntax errors return INVALID_INPUT.
```
## Limitations
- Audits WIT syntactic/type resolution via `wasm-tools==1.263.0` (`component wit --json` and `component semver-check`); does **not** prove runtime behavioral parity, canonical-ABI `cabi_realloc` safety, or runtime execution correctness.
- Core non-component Wasm modules (missing component-model `wit` metadata) cannot yield WIT worlds and classify as `UNSUPPORTED`.
- `@unstable` gated WIT items require explicit `--features` / `--all-features` flags to be visible in AST resolution.
## Safety and Side Effects
- Strictly **offline and read-only** over synthetic `.wit` / `.wat` / `.wasm` files inside temporary directories with `15s` subprocess timeouts.
- Never runs `wasmtime` or executes untrusted WebAssembly guest code.
## Sources and related skills
- [Bytecode Alliance — Component Model WIT Specification](https://component-model.bytecodealliance.org/design/wit.html)
- [wasm-tools Repository](https://github.com/bytecodealliance/wasm-tools)
- Related skills: [rust-migration](https://github.com/sickn33/agentic-awesome-skills/blob/e4dcf3977b6d1e18a2539f630bd82c2433d283e2/skills/rust-migration/SKILL.md), [api-contract-testing](https://github.com/sickn33/agentic-awesome-skills/blob/e4dcf3977b6d1e18a2539f630bd82c2433d283e2/skills/api-contract-testing/SKILL.md).