/three-ws-core:build-an-agent-skillfrom three-ws-core
Guides building a three.ws agent skill bundle (manifest.json, SKILL.md, tools.json, handlers.js) to give a 3D agent new capabilities. Covers file layout, handler context API, sandbox limits, trust policy, and installation.
Ships in three-ws-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A three.ws skill is a directory served from any URL. The agent runtime fetches it, injects its instructions into the system prompt, exposes its tools to the LLM, and runs its handlers in a Web Worker sandbox. Because a skill is just files behind a URL, the same bundle installs into every agent without copying code.
Do not confuse this with the Claude skill you are reading: that one teaches an external model how to use three.ws. This one teaches a three.ws agent a new capability.
| File | Required | Purpose |
|---|---|---|
manifest.json | yes | Identity, version, what it provides, config defaults |
SKILL.md | yes | Instructions injected into the agent's system prompt |
tools.json | yes, if it exposes tools | JSON Schema tool definitions the LLM can call |
handlers.js | no | ES module implementing each tool |
A bundle with no handlers.js is valid and always trusted: it is a declarative skill
that only shapes behavior (an accent, a house style, a refusal policy).
Assets (clips/, morphs/, prompts/, assets/) sit beside those files and are
resolved against ctx.skillBaseURI.
Copy this shape. The repo's starter is examples/skills/wave/
and the runtime contract is docs/skills.md.
manifest.json
{
"spec": "skill/0.1",
"name": "weather-report",
"version": "0.1.0",
"description": "Look up the current temperature and wind for any named place and say it out loud.",
"license": "MIT",
"tags": ["weather", "voice"],
"requires": { "runtime": ">=0.1.0", "capabilities": [] },
"provides": { "tools": ["reportWeather"], "triggers": [] },
"config": { "units": "metric" }
}
tools.json
{
"tools": [
{
"name": "reportWeather",
"description": "Report the current temperature and wind speed for a named place, and speak the result.",
"input_schema": {
"type": "object",
"properties": {
"place": { "type": "string", "description": "City, town, or landmark name" }
},
"required": ["place"]
}
}
]
}
handlers.js
// Two chained ctx.fetch calls against Open-Meteo: free, no API key, CORS open.
export async function reportWeather(args, ctx) {
const place = String(args?.place || '').trim();
if (!place) return { ok: false, error: 'place is required' };
const geo = await ctx.fetch(
`https://geocoding-api.open-meteo.com/v1/search?count=1&name=${encodeURIComponent(place)}`,
);
if (!geo.ok) return { ok: false, error: `geocoding failed (${geo.status})` };
const hit = (await geo.json())?.results?.[0];
if (!hit) return { ok: false, error: `no place called "${place}"` };
const imperial = ctx.skillConfig?.units === 'imperial';
const query = new URLSearchParams({
latitude: String(hit.latitude),
longitude: String(hit.longitude),
current: 'temperature_2m,wind_speed_10m',
...(imperial ? { temperature_unit: 'fahrenheit', wind_speed_unit: 'mph' } : {}),
});
const res = await ctx.fetch(`https://api.open-meteo.com/v1/forecast?${query}`);
if (!res.ok) return { ok: false, error: `forecast failed (${res.status})` };
const { current, current_units: u } = await res.json();
const line =
`It is ${current.temperature_2m}${u.temperature_2m} in ${hit.name}, ` +
`wind ${current.wind_speed_10m} ${u.wind_speed_10m}.`;
await ctx.speak(line);
ctx.memory.note('weather-report', { place: hit.name, ...current });
return { ok: true, data: { place: hit.name, ...current }, sentiment: 0.2 };
}
SKILL.md (the agent-facing instructions, not this file)
# Weather report
When the user asks about the weather, temperature, or wind at a named place, call
`reportWeather` with that place name. Never guess the numbers: if the tool returns an
error, say you could not reach the weather service.
One exported function per tool name in provides.tools, matching tools.json. Return
{ ok: true, ... } on success and { ok: false, error: 'message' } on failure; the
runtime surfaces the error to the LLM and fires a skill-error event instead of
crashing the agent. A numeric sentiment between -1 and 1 drives the avatar's empathy
layer (positive blends a celebration, negative blends concern).
ctx is the only way a handler reaches the outside world:
| Group | Calls |
|---|---|
| Scene | ctx.viewer.play(clip, { blend }), stop, setExpression, lookAt, moveTo, playAnimationByHint(hint, { duration_ms }) |
| LLM | ctx.llm.complete(prompt, opts), ctx.llm.embed(text) |
| Memory | ctx.memory.read/write/note, ctx.memory.recall(query) (substring search, not embeddings) |
| Assets | ctx.loadClip(uri), ctx.loadGLB(uri), ctx.loadJSON(uri), ctx.skillBaseURI |
| Network | ctx.fetch(uri, opts) (normal CORS rules apply) |
| Other skills | ctx.call(toolName, args), which crosses skill boundaries into built-ins like speak |
| User | ctx.speak(text), ctx.listen(opts) |
ctx.skillBaseURI always ends in /, so resolve bundled assets with
new URL('./clips/wave.glb', ctx.skillBaseURI).href. Every individual ctx.* call
times out after 30 seconds.
Handlers run in a Web Worker with no DOM. They cannot touch document, window,
navigator, location, cookies or storage, cannot use import statements inside
handlers.js (the blob module has no base URL for relative imports), and cannot
make network calls outside ctx.fetch / ctx.loadJSON.
Everything a skill actually needs stays available through ctx.*. Write one
self-contained module, no bundler, no dependencies.
A skill that genuinely needs main-thread Three.js or per-frame work sets
"sandboxPolicy": "trusted-main-thread" in its manifest, and that opt-out is honored
only for skills that pass the agent's owned-only or whitelist trust check. Skills
loaded under any trust stay sandboxed no matter what the manifest says.
The registry enforces a per-agent trust policy: owned-only (default, manifest.author
must match the owner's wallet), whitelist (a list of publisher wallets), or any
(kiosks and demos). Under owned-only, a mismatched author makes install() throw
before any handler code is fetched. When the manifest carries integrity hashes, they
are verified before execution.
Set author to the owner's wallet address when the skill is meant to run on that
owner's agents.
Host the directory anywhere that serves the files over HTTPS (or pin it to IPFS or
Arweave: ipfs:// and ar:// URIs resolve through a gateway chain). Then reference it.
From the agent manifest, with a pinned version range:
{
"skills": [{ "uri": "https://your-site.com/skills/weather-report/", "version": "^0.1.0" }]
}
Or from the embed, comma separated (the attribute cannot pin versions):
<agent-3d
agent-id="<your agent id>"
skills="https://your-site.com/skills/weather-report/"
></agent-3d>
A skill can depend on other skills through dependencies (a map of skill URI to version
range). The registry installs them recursively first, detects circular dependencies, and
never re-fetches an already-installed URI.
npx -y serve . or any static server) and embed the agent
on a page with skills="http://localhost:3000/skills/weather-report/".const el = document.querySelector('agent-3d');
el.addEventListener('skill:tool-start', (e) => console.log('start', e.detail));
el.addEventListener('skill:tool-called', (e) => console.log('called', e.detail));
await window.VIEWER.agent_skills.perform('reportWeather', { place: 'Bondi Beach' });
perform-skill,
then skill-done (or skill-error with the message you returned).Verify the failure path too. A handler whose upstream is down must return
{ ok: false, error }, not throw an unhandled rejection.
sell-an-agent-skill publishes the skill to the marketplace and
prices it per call in $THREE, with the author's share routed to their own wallet.examples/skills/ in the repo for working bundles.What SKILL.md sets; muted values are Claude Code's defaults
The user wants an agent to be able to DO something new. To then charge for it, use sell-an-agent-skill. To create the agent itself first, use create-a-three-ws-agent. This is not about Claude skills: it is the three.ws in-app skill format that runs inside the agent runtime.
Three short reads, in order
npx claudepluginhub nirholas/three.ws --plugin three-ws-core49 skills in this plugin
/anatomyExplain how a machine works as an interactive isometric 3D cutaway. Use when the user asks how an engine, turbine, reactor, pump, clock, motor or any mechanism works and wants to see it, or types "/anatomy <machine>", for example "/anatomy explain how a big airliner turbofan engine like the A380's makes thrust, interactive". Produces a shareable three.ws link with real moving parts, shader effects (fire, exhaust, plasma, water, steam, sparks, arcs), flows, a section cut, an exploded view and a guided tour./authenticate-walletSign in to the wallet. Use when you or the user want to log in, sign in, connect, or set up the wallet, or when any wallet operation fails with authentication or "not signed in" errors. This skill is a prerequisite before sending, trading, or funding./connect-three-ws-mcpConnect any MCP client (Claude Code, Claude Desktop, the Agent SDK, or a custom one) to the three.ws MCP servers, so the model can generate 3D models and avatars, read and write agent data, and pay for services. Use when you or the user want to connect, add, install, configure, wire up, or debug three.ws MCP, an MCP server for 3D or avatars or agent wallets, a .mcp.json entry, or "give Claude access to three.ws". Also use to pick which of the hosted servers to add, and to test a connection that is not working./create-3d-avatarTurn a text prompt (or reference image) into a rigged, animation-ready 3D avatar (GLB). Use when you or the user want to create, generate, or make a 3D avatar, character, or humanoid figure that can be posed and animated, for example "make a 3D avatar of a knight", "generate a character I can animate", "create a rigged astronaut". Generates the mesh and adds a humanoid skeleton in one step. Returns a GLB URL plus a pose-studio link./create-a-three-ws-agentCreate a real three.ws AI agent (identity, 3D body, custodial Solana wallet, persona) from the command line and get its live public page. Use when you or the user want to create, build, deploy, launch, or set up an AI agent, a 3D agent, an on-chain agent, or "my own agent" on three.ws, attach a 3D body to an existing agent, edit an agent's persona or brain, or list the agents an account already owns. Returns the agent id, its Solana wallet address, and the public URL anyone can visit and chat with./embed-three-ws-avatarEmbed a live, animated three.ws 3D avatar in any website with the <agent-3d> web component. Use when you or the user want to embed, integrate, add, or show a 3D avatar, character, or agent on a site or app ("embed a 3D avatar on my site", "add an animated character to my landing page", "integrate three.ws", "put an avatar in my hero section"), wire avatar animations or moods from page code, let users design an avatar in the three.ws Avatar Studio from inside another app, or debug an existing agent-3d embed.Other plugins' skills for the same job