AI agents & LLMs
ws-asyncapi is designed to be legible to language models. The whole framework is contract-first: one Channel declaration is the source of truth for events, commands, RPC, streams, presence, history, and auth — and that same value drives the client's types and a machine-readable AsyncAPI 3.0 document. A model that reads your channel knows your entire wire protocol, and the TypeScript compiler gives it immediate, precise feedback when it writes against that contract.
This page covers the three things this project ships for AI-assisted workflows:
- An installable agent Skill that teaches a coding agent the framework.
llms.txt— these docs, packaged for model context.- Copy / download as Markdown on every page.
Why ws-asyncapi is AI-friendly
- The contract is the spec. A
Channelis a single, compact declaration. Hand it (or its emitted AsyncAPI document) to a model and it has the complete protocol — no scattered string event names to guess at. - End-to-end types are a feedback loop.
createClient<typeof channel>()infers the entire client surface with no codegen. When an agent callsclient.requestwith the wrong shape,tscrejects it — the model self-corrects instead of shipping a runtime bug. - AsyncAPI is machine-readable.
getAsyncApiDocument([channel])emits standard AsyncAPI 3.0 JSON, which agents and other tools can consume directly. See Channels & the contract.
The agent Skill
The docs repo ships an Agent Skill named ws-asyncapi that teaches a coding agent (Claude Code, and any tool that supports the open Skills format) how to build apps with the framework — not how to use the docs site. It activates automatically when the agent sees ws-asyncapi/@ws-asyncapi/* imports or APIs like new Channel(, createClient(, createNodeWsServer(, and routes the agent to focused references before it writes code:
| Reference | Covers |
|---|---|
channels | The full builder — events, commands, rpc, serverRpc, streams, path params, validators, derive/resolve context, lifecycle, broadcast |
client | createClient, request/safeRequest, typed errors, streams, reconnection/heartbeat/recovery, idempotency |
adapters-scaling | Node & Elysia adapters, the backplane interface, Redis scaling, msgpack codec, the external emitter |
presence-cursors | Typed presence, volatile updates, per-room history, live cursors |
auth | .onAuth + client.authenticate token refresh, auth in derive/resolve |
react-solid | @ws-asyncapi/react hooks and @ws-asyncapi/solid primitives over TanStack Query (@ws-asyncapi/query-core) |
codegen | The AsyncAPI 3.0 document and the CLI-generated client (@ws-asyncapi/cli) |
testing | In-memory test harness (@ws-asyncapi/testing) |
Install it
With the Skills CLI (installs into ~/.claude/skills):
npx skills add ws-asyncapi/documentation@ws-asyncapi -gOr install manually — copy the skill folder into your skills directory (~/.claude/skills/ for personal use, or .claude/skills/ committed to your repo):
git clone https://github.com/ws-asyncapi/documentation
cp -r documentation/skills/ws-asyncapi ~/.claude/skills/ws-asyncapiThe skill lives at skills/ws-asyncapi/ in the docs repo. Once installed, restart your agent and it will pick the skill up on the next ws-asyncapi task.
llms.txt
These docs are published in the llms.txt format, so you can drop the whole reference into any model's context window:
- https://ws-asyncapi.github.io/documentation/llms.txt — a structured index of every page with links and summaries (small; good for navigation).
- https://ws-asyncapi.github.io/documentation/llms-full.txt — the full docs concatenated into one Markdown file (large; good for "answer only from these docs" prompts).
Paste a URL into a chat, attach the file as context, or fetch it in a tool:
curl https://ws-asyncapi.github.io/documentation/llms-full.txt -o ws-asyncapi-docs.mdCopy & download as Markdown
Every page on this site has Copy and Download as Markdown buttons at the top. Use them to grab a single page as clean Markdown — ideal for pasting the exact guide you need (e.g. RPC & acknowledgements) into a model rather than the whole corpus.
Wiring up your tools
- Claude Code — install the Skill (above); it activates automatically. You can also point it at a page's Markdown or the
llms.txtURL for one-off questions. - Cursor — add the docs as a custom doc source (
@Docs→ addhttps://ws-asyncapi.github.io/documentation/), then reference@ws-asyncapiin prompts. For deep context, attachllms-full.txt. - GitHub Copilot / others — attach
llms-full.txt(or a per-page Markdown copy) as context, or keep the Skill folder in your repo under.claude/skills/so it travels with the project.
A good agent workflow
Let the contract drive the agent:
- Write the
Channelfirst (or have the agent draft it). It's small, it's the spec, and it's the one thing reviewers should scrutinize. - Let types do the enforcement. Ask the agent to build the server handlers and the
createClient<typeof channel>()client against that channel and runtsc— mismatches surface immediately, no runtime guessing. - Hand over the AsyncAPI document (
getAsyncApiDocument([channel])) when the client lives in a separate repo or stack — it's the language-agnostic contract, and the CLI regenerates a typed client from it.