/phoria2:phoria2from phoria2
Build 3D for the web with phoria2, a small WebGL 2 library for business apps. Creates 3D charts, labelled diagrams, floor plans, cutaway explainers, animated infographics, dashboards, glTF product viewers, and editors with drag/snap/undo.
Ships in phoria2. 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.
Read when SKILL.md points to them; scripts run unread.
phoria2 is small 3D for the web: charts from a data spec, labelled scenes, diagrams, explainers, dashboards, editors and product viewers. Picking, tooltips, hover highlights, HTML labels, shadows and image-based light are built in, and a view draws only when something changes. Apps are short - a few dozen lines - and every option is checked: a wrong or misspelt option throws an error that names the fix.
Don't write phoria2 from memory - read the reference before writing code. It is the whole API on one page:
node_modules/phoria2/llms-full.txt when phoria2 is installed - it matches that versionFor a chart, the spec chart() takes is a JSON Schema:
references/chart.schema.json. Check a spec you generate against it.
For a scene as plain data (create()), the description is
references/scene.schema.json.
With a bundler (Vite, etc.):
npm install phoria2
A single HTML file with no build: map the imports to the CDN, pinning a version (look it up with
npm view phoria2 dist-tags), and import as usual:
<script type="importmap">
{ "imports": {
"phoria2": "https://cdn.jsdelivr.net/npm/phoria2@VERSION/dist/phoria2.js",
"phoria2/charts": "https://cdn.jsdelivr.net/npm/phoria2@VERSION/dist/charts.js"
} }
</script>
<script type="module">
import { View } from 'phoria2'
// ...
</script>
A page that must open straight from a folder (double-clicked, file://) has to keep its code
inline like this: browsers won't load <script type="module" src="./main.js"> from file://, and
the page stays blank. A page that is served (a dev server, any static host) can use separate files.
Entry points: phoria2 (core), phoria2/charts, phoria2/gltf, phoria2/motion,
phoria2/particles, phoria2/edit - each dist/<name>.js on the CDN.
import { View, Mesh, box, DirectionalLight } from 'phoria2'
const view = new View({ canvas: '#c', orbit: true, background: '#1c1c20' })
const cube = view.scene.add(new Mesh({ geometry: box(2), material: { color: 'orange' } }))
view.scene.add(new DirectionalLight({ direction: [-1, -2, -1] }))
view.start((dt) => cube.rotateY(0.6 * dt))
window.view = view // lets the check below run view.explain() - fine to leave in while developing
Things that trip people up:
width: 100%; height: 100vh; display: block, or a sized
container). A canvas with no height draws nothing.fov is degrees).new THREE..., MeshStandardMaterial): materials are plain
objects like { color, roughness, metalness }.view.scene.add(chart({ mark: 'bar', data: rows, x: 'month', y: 'sales' }))
gives axes, legend, tooltips and animated update(). Prefer it to building bars by hand. A chart
needs no lights of its own. Set title and format once, on the channel - tooltips and the legend
use them. In depth (z) the first category is nearest the viewer, so put the tallest series last
with z.scale.domain, or it hides the others.format can also be a function, (v) => \£${v}k``.highlight, tooltip, onClick, onHover, onDrag on the View or
any node; view.on('click', (hit) => ...) where hit.datum is the data row.view.frame(node)
padding is the margin as a fraction (0.2 leaves a fifth around it).view.start(fn) only for your own per-frame work.You can't see the page, so look at it. The skill's check loads it in headless Chrome and reports
errors, failed requests, canvas sizes, view.explain() (what is drawn, culled and why), idle redraws,
tooltips at points you hover, and saves a screenshot:
node ${CLAUDE_SKILL_DIR}/scripts/check.mjs http://localhost:5173/ # a dev server's page
node ${CLAUDE_SKILL_DIR}/scripts/check.mjs index.html # a file, served from its folder
node ${CLAUDE_SKILL_DIR}/scripts/check.mjs index.html --hover 600,400 --hover 420,380
(scripts/check.mjs in this skill's folder. Needs Node 22+ and Chrome, Chromium or Edge; set
CHROME to its path if it isn't found. Options: --size 1200x800, --wait 2 seconds before
looking, --out shot.png.)
Then:
view.explain() too.--hover x,y in page pixels) and check the text.It exits 1 when the page threw, logged an error, failed a request or has no canvas.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub kevinroast/phoria2 --plugin phoria2Other plugins' skills for the same job