capnweb
Skill by cloudflare
Guides an assistant through capnweb RPC patterns for code that crosses the Durable Object and computerd boundary. It focuses on stub lifecycle and disposal, including the caller-disposes rule. Written for developers working in this repository.
Install capnweb
Built from the published package, never by AI.
git clone --depth 1 https://github.com/cloudflare/computer /tmp/computer && mkdir -p ~/.claude/skills && cp -r /tmp/computer/.agents/skills/capnweb ~/.claude/skills/capnwebRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/cloudflare/computer /tmp/computer && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/computer/.agents/skills/capnweb ~/.gemini/antigravity-cli/skills/capnwebAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill gives an assistant the capnweb RPC patterns used in this repository. capnweb is the RPC framing between the Durable Object and computerd, carried over a long-lived text JSON WebSocket. It focuses on stub lifecycle and disposal, and covers promise pipelining, .dup(), .map() and streaming results.
It explains the caller-disposes rule and the repo's disposal contract, including how drivers, direct streaming calls and client.close() handle stubs. It also covers listening for disconnects, testing for leaks with the soak script, and a set of do and don't rules for the shared wire contract. It is aimed at developers changing code in packages/rpc, packages/computer, the computerd client or the Durable Object server.
Written from the project's SKILL.md and checked against it.
What it can do
- Stub disposal patternsShows using declarations, try/finally and explicit dispose for capnweb stubs.
- Caller-disposes ruleExplains who owns stubs passed in parameters and returned in results.
- Repo disposal contractDescribes how drivers, direct streaming calls and client.close() manage stubs.
- Stub duplication with .dup()Shows how to keep a stub usable after a callee auto-disposes it.
- Promise pipeliningShows chaining RPC calls on an unawaited promise in one round trip.
- Magic .map()Explains running a sync callback on a remote promise result in one round trip.
- Disconnect handlingExplains onRpcBroken and how packages/computer uses it for the closed promise.
- Leak testingPoints to enableStubTracking, stubSnapshot and the computerd stub soak script.
What you need
- capnweb library
- WebSocket transport between the Durable Object and computerd
- TypeScript with using declarations or try/finally support
Try asking
- Check whether my new RPC call disposes its result envelope correctly
- Show me how to use .dup() to keep a stub alive after a call
- Review this sync driver change for stub disposal leaks
Good to know
- The wire is text JSON over WebSocket only, not HTTP batch
- The .map() callback must be synchronous and side-effect free
- Guidance is specific to this repository's packages and docs
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/capnweb/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md10 KB
Alternatives to capnweb
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
capnweb: common questions
Why does capnweb need manual stub disposal?
The source says stubs are not garbage-collected across the network, so undisposed stubs keep resources alive on the other side. Because the WebSocket stays up for the workspace lifetime, they remain alive until the connection drops.
Can I use capnweb over HTTP batch transport?
The source says no for this interface. HTTP batch transport cannot deliver a stream returned from a call, which is what every read on this interface is.
Where should new RPC methods be defined?
The source says to add them first on WorkspaceRPC in packages/rpc/src/interface.ts, before implementing them on either side.
How do I install capnweb?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is capnweb free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is capnweb safe to use?
It scores 85 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to capnweb?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
