Command Palette

Search for a command to run...

Back to skills
skill № 96443

wit

Guide for WebAssembly Interface Type (WIT) language. Use when defining component interfaces, writing WIT files, designing worlds and interfaces, or working…

FreeNo executable scripts
vinnie357by vinnie357★ 30 GitHub stars

Install wit in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

WIT (WebAssembly Interface Types)

WIT is the Interface Definition Language (IDL) for the WebAssembly Component Model. It defines typed contracts between components in a language-agnostic way, enabling interoperability across programming languages at the wasm boundary.

See also: wasmtime skill for runtime embedding and compilation details.

Anti-fabrication

This skill follows core:anti-fabrication. The claim area is the WIT type system and package syntax (packages, interfaces, worlds, records/variants/enums/flags, resources, use declarations, result<T,E>, borrow<T>), shared with wasmtime under the same Bytecode Alliance umbrella. Re-verified live 2026-08-04 (claude-skills-204) against component-model.bytecodealliance.org's design/wit.html: no drift found in the documented syntax. Re-verify against that page, or wasm-tools component wit, before asserting a type-system feature this skill doesn't cover — the Component Model is still evolving.

WIT File Structure

A WIT file contains one or more of: package declaration, interfaces, worlds, and use declarations.

package namespace:[email protected];

use wasi:io/[email protected].{input-stream, output-stream};

interface my-interface {
    // types and functions
}

world my-world {
    import my-interface;
    export my-interface;
}

Packages

Every WIT file belongs to a package. The package declaration names the namespace, package, and optional semver version.

package my-org:[email protected];
  • namespace: organization or project identifier (kebab-case)
  • package: library name (kebab-case)
  • @version: optional semver string

Package names use kebab-case identifiers. Dots are not allowed in identifiers; use hyphens.

Identifiers

WIT identifiers use kebab-case. Reserved words may be used as identifiers when prefixed with %:

interface example {
    // 'type' is reserved — prefix with %
    get-type: func() -> %type;
    type %type = string;
}

Interfaces

An interface groups related types and functions into a named, reusable unit.

interface geometry {
    record point {
        x: f64,
        y: f64,
    }

    distance: func(a: point, b: point) -> f64;
    translate: func(p: point, dx: f64, dy: f64) -> point;
}

Interfaces can be imported by worlds or by other interfaces using use.

Worlds

A world defines a complete component contract: what it imports (needs) and what it exports (provides). Worlds serve a dual role — they describe a component's requirements AND define the hosting environment that runs it. The only ways a component can interact with anything outside itself are by having its exports called or by calling its imports. A component cannot access resources it does not explicitly import, providing strong sandboxing boundaries.

world image-processor {
    // Imports: capabilities the component requires from the host
    import wasi:filesystem/[email protected];
    import log: func(msg: string);

    // Exports: capabilities the component provides to callers
    export process: func(input: list<u8>) -> result<list<u8>, string>;
    export geometry;
}

World Items

Item Syntax Purpose
Import interface import name: interface { ... } Inline imported interface
Import named import wasi:io/[email protected]; Import by package path
Import function import log: func(msg: string); Single function import
Import type import wasi:io/streams.{input-stream}; Import specific types
Export interface export my-interface; Export a named interface
Export function export run: func(); Export a single function
Include world include other-world; Inherit another world's items

World Includes

Worlds can include other worlds to inherit their imports and exports:

world base {
    import wasi:cli/[email protected];
}

world extended {
    include base;
    export my-app: func();
}

The with clause renames included items to avoid conflicts:

world combined {
    include world-a with { run as run-a };
    include world-b with { run as run-b };
}

Type System

Full reference: syntax-reference.md

Primitives

Type Description
bool Boolean
u8, u16, u32, u64 Unsigned integers
s8, s16, s32, s64 Signed integers
f32, f64 IEEE 754 floats
char Unicode scalar value
string UTF-8 string

Compound Types

interface types {
    // List: variable-length sequence
    type byte-array = list<u8>;

    // Option: nullable value
    type maybe-string = option<string>;

    // Result: success or error
    type parse-result = result<u32, string>;
    type io-result = result<_, string>;   // ok with no payload
    type check-result = result;           // both ok and err have no payload

    // Tuple: fixed-length heterog
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • references/patterns.md
  • references/syntax-reference.md

FAQ

What does the wit skill do?

Guide for WebAssembly Interface Type (WIT) language. Use when defining component interfaces, writing WIT files, designing worlds and interfaces, or working with the Component Model type system.

How do I install the wit skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the wit skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare wit with