/threejs-kit:threejs-masteryfrom Three.js
Use whenever the user is working with Three.js: scenes, WebGPU/WebGL rendering, geometry, materials, lighting, textures, TSL or GLSL shaders, animation, loaders, raycasting, controls, or post-processing. Trigger on .glb/.gltf files, NodeMaterial, OrbitControls, EffectComposer, or any Three.js API — even when "Three.js" is never named. Treats WebGPURenderer + TSL as the primary path, WebGLRenderer + GLSL as the fallback.
Ships in Three.js. 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.
Comprehensive Three.js reference covering modern best practices. The body of this file is shared setup, cross-cutting laws, a topic routing table, and the mistakes that bite across every topic. Topical depth lives in references/ — one file per topic, each ending in its own Common Mistakes table.
Two rendering paths exist, and this skill treats them as primary/fallback:
WebGPURenderer + TSL. Recommended for new code. Async initialization, node-based shading, modern post-processing pipeline. Works by default in Chrome/Edge 113+, Safari 26+, and Firefox 141+.WebGLRenderer + GLSL. The compatibility path. Same scene graph, same API surface for materials/lights/loaders, classic ShaderMaterial + EffectComposer. Use when you need to support older browsers or you're porting existing code.The two share the vast majority of the API. Specific differences are called out in the relevant reference file.
Going below the framework? For raw WebGL2 / GLSL intricacies beneath Three.js — hand-rolling the GL pipeline, deep GLSL technique, or dropping down when you hit a framework limit — use the sibling webgl-mastery skill (the webgl-kit dependency). This skill stays at the scene-graph / app level; webgl-mastery covers the layer underneath.
Trigger this skill when the user:
THREE, three.js, or works with .glb/.gltf/.hdr/.exr files.Scene, Mesh, ShaderMaterial, MeshStandardMaterial, MeshStandardNodeMaterial, OrbitControls, GLTFLoader, EffectComposer, RenderPipeline, PostProcessing, Raycaster, AnimationMixer, BufferGeometry, InstancedMesh, etc.).The canonical scene boot uses WebGPURenderer with async initialization. The full HTML version is in assets/scene-template.html — copy-paste ready.
import * as THREE from "three/webgpu";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000
);
camera.position.set(0, 0, 5);
const renderer = new THREE.WebGPURenderer({ antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.toneMapping = THREE.ACESFilmicToneMapping;
document.body.appendChild(renderer.domElement);
await renderer.init(); // REQUIRED before the first render
const controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
scene.add(new THREE.AmbientLight(0xffffff, 0.4));
const sun = new THREE.DirectionalLight(0xffffff, 1.2);
sun.position.set(5, 5, 5);
scene.add(sun);
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
const timer = new THREE.Timer();
renderer.setAnimationLoop(() => {
timer.update();
const delta = timer.getDelta();
controls.update();
renderer.render(scene, camera);
});
When you need broader compatibility, swap WebGPURenderer for WebGLRenderer. Everything else stays the same — drop the await renderer.init() call:
import * as THREE from "three"; // not "three/webgpu"
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.outputColorSpace = THREE.SRGBColorSpace;
// ...no init() needed
You can also feature-detect at runtime: try WebGPURenderer, fall back to WebGLRenderer on failure or unsupported environments.
Three.js ships ~monthly and the API surface for TSL and WebGPURenderer is still evolving. Before pinning a version, check the current release:
npm view three version
Or read the release notes. When a code example here references a class or node that doesn't exist in your version, the cause is almost always that the symbol was renamed/added/removed in a more recent release — check the changelog before assuming the example is wrong.
assets/scene-template.html pins a specific Three.js version in its importmap — treat it as a fallback, not authoritative current state. Before handing the template (or any importmap snippet) to a user, verify against the latest release: npm view three version, the release feed, or context7's threejs docs. If the pin is behind by more than two minor releases, bump all three pinned URLs (three, three/tsl, three/addons/) before producing the answer.
Module entry points (three / three/webgpu / three/tsl / three/addons/), npm + Vite bundling, TypeScript, and React (react-three-fiber) live in references/project-setup.md.
These cross every topic. Internalize them once.
PBR rendering assumes linear math internally and sRGB on the way out. Stick to these rules:
renderer.outputColorSpace = THREE.SRGBColorSpace is the default. Don't override unless you know why.texture.colorSpace = THREE.SRGBColorSpace.GLTFLoader sets these correctly automatically. TextureLoader does not — set them yourself.See references/textures.md#color-space.
Drive everything time-dependent with timer.getDelta(), not wall-clock time:
const timer = new THREE.Timer(); // `Clock` is deprecated since r183
renderer.setAnimationLoop(() => {
timer.update(); // Refresh once per frame, before reading
const delta = timer.getDelta(); // Seconds since last frame
controls.update(); // Required when damping is on
mixer?.update(delta); // Required for AnimationMixer
renderer.render(scene, camera);
});
controls.update() is mandatory whenever OrbitControls.enableDamping = true or autoRotate = true. mixer.update(delta) is mandatory for every AnimationMixer, every frame.
GPU resources are not garbage-collected. Anything that owns GPU memory has .dispose():
geometry.dispose();
material.dispose();
texture.dispose();
renderTarget.dispose();
When discarding a loaded model, traverse and dispose:
function disposeModel(model) {
model.traverse((child) => {
if (child.isMesh) {
child.geometry?.dispose();
const mats = Array.isArray(child.material) ? child.material : [child.material];
mats.forEach((m) => {
Object.values(m).forEach((v) => v?.isTexture && v.dispose());
m.dispose();
});
}
});
scene.remove(model);
}
Three handlers must move in lockstep with the canvas size:
function onResize() {
const w = window.innerWidth, h = window.innerHeight;
camera.aspect = w / h;
camera.updateProjectionMatrix();
renderer.setSize(w, h);
composer?.setSize(w, h); // EffectComposer (legacy)
postProcessing?.setSize(w, h); // RenderPipeline (TSL)
}
window.addEventListener("resize", onResize);
All examples and references use three/addons/... — the modern alias. The older three/examples/jsm/... path still works but is being phased out. Standardize on three/addons/ everywhere in new code.
WebGPURenderer requires await renderer.init() before the first render(). Forgetting this is the #1 silent failure when porting a scene from WebGL.
| Topic | Reference | What it covers |
|---|---|---|
| Fundamentals | fundamentals.md | Cameras, Object3D, scene graph, math utilities, LoadingManager, LOD, merging |
| Geometry | geometry.md | Built-in shapes, BufferGeometry, attributes, instancing, edges/wireframe, morph targets |
| Materials | materials.md | PBR (MeshStandardMaterial), classic types, node materials (TSL), ShaderMaterial (GLSL) |
| Lighting | lighting.md | Light types, shadows tuning, IBL/PMREM/HDR environment lighting |
| Textures | textures.md | Loaders, color space, filtering, render targets, UVs, compressed textures |
| Loaders | loaders.md | GLTF deep dive, Draco/Meshopt/KTX2 compression, OBJ/FBX/STL/PLY, async patterns |
| Animation | animation.md | AnimationMixer, GLTF clips, skeletal/morph targets, blending, procedural patterns |
| Interaction | interaction.md | Raycaster, controls catalog (Orbit/Fly/PointerLock/Transform/Drag), selection, screen↔world |
| Shaders (TSL) | shaders.md | TSL essentials + recipes (primary), WGSL interop, shader debugging + performance |
| Shaders (GLSL, legacy) | shaders-glsl.md | Raw-GLSL ShaderMaterial/RawShaderMaterial, onBeforeCompile, ShaderChunk, GLSL function reference |
| Post-processing | postprocessing.md | TSL RenderPipeline pipeline + node passes (primary), EffectComposer (legacy) |
| Compute | compute.md | GPU compute (WebGPU only): storage buffers, instancedArray/attributeArray, compute() dispatch, particles/simulation |
| WebGPU runtime | webgpu-runtime.md | Device-loss handling and recovery, requesting device limits/features (WebGPU) |
| Migrations | migrations.md | Version-bound breaking changes; includes the unreleased r186 guidance published after r185 |
| Project setup | project-setup.md | Module entry points, npm/Vite bundling, TypeScript, React (r3f) |
When the user's question fits cleanly into one topic, load that reference and answer from it. When it spans two or three (typical for non-trivial scenes), load each in turn.
Quick routing cues:
.glb/.gltf/.hdr/.exr → loaders. Then check animation if it has clips, lighting if it's an HDR env, materials if textures look wrong.MeshStandardMaterial).ShaderMaterial/RawShaderMaterial, onBeforeCompile, third-party shader chunks → shaders-glsl (legacy path).instancedArray" → compute (WebGPU only).Object3D hierarchy, LOD, geometry merging → fundamentals.If the user asks something this skill doesn't cover (physics engines, XR/AR, audio), say so plainly — better to point at the right library than to half-answer. For react-three-fiber abstractions above Three core (<Canvas>, hooks, drei, the pmndrs ecosystem), route to the sibling react-three-fiber-mastery skill. For raw WebGL2 / GLSL beneath the framework (hand-written pipeline, deep GLSL technique, framework-limit drop-downs), route to the webgl-mastery skill.
These bite across every topic; topical mistakes live in each reference's own table.
| Mistake | Fix |
|---|---|
WebGPURenderer scene renders nothing | Forgot await renderer.init() before the first render. Always async-initialize. |
| Loaded GLB looks washed out / overbright | Set texture.colorSpace = THREE.SRGBColorSpace on color/albedo/emissive maps. Data textures stay linear. GLTFLoader does this automatically; TextureLoader does not. |
| Animations don't play | Missing mixer.update(delta) in the render loop. See animation.md. |
Damped OrbitControls feel skippy | Missing controls.update() in the render loop (required whenever damping or autoRotate is on). |
| Post-processing effects don't appear | Render loop still calls renderer.render() instead of composer.render() / postProcessing.render(). |
| Memory grows when swapping models/textures | Every retired geometry/material/texture/render target needs .dispose(). Walk the model on teardown. |
| Resize handler updates camera and renderer but effects stay blurry | Composer / postProcessing also need setSize(w, h). |
Mixing WebGLRenderer-only APIs with WebGPURenderer and expecting them to work | Some legacy addons (EffectComposer, certain shader chunks) target WebGL. For WebGPU, migrate to the TSL equivalents in postprocessing.md and shaders.md. |
| Raycaster picks nothing on a canvas that isn't full-screen | NDC coords must use getBoundingClientRect(), not window.innerWidth/Height. See interaction.md. |
| TSL node looks correct but the material doesn't update | Reassign to material.colorNode = … (don't mutate nodes in place) and set material.needsUpdate = true. |
Transparency/blending looks wrong under WebGPURenderer after upgrading to r185 | r185 changed premultiplied-alpha handling (#33369). Set an opaque background: scene.background = new THREE.Color(...) or renderer.setClearColor(color, 1). Use a transparent clear only when the canvas must blend with the HTML page. |
| Scene goes black only when devtools or browser automation probes the canvas | canvas.getContext(type) on a canvas whose renderer hasn't initialised yet claims the canvas's context type, so a pending renderer of the other type (webgpu probe vs WebGL2 renderer, or vice versa) fails when it later requests its own context. Probe context types only after the first frame has visibly rendered — on an initialised canvas, getContext with the same type returns the existing context and a different type returns null, both read-only. |
webgl-mastery skill — sibling skill for raw WebGL2 / GLSL beneath Three.js (ships with this plugin).react-three-fiber-mastery skill — sibling skill for the React layer above Three.js: <Canvas>, hooks, events, drei, and the pmndrs ecosystem.assets/scene-template.html (opens in a new tab)references/animation.md (opens in a new tab)references/compute.md (opens in a new tab)references/fundamentals.md (opens in a new tab)references/geometry.md (opens in a new tab)references/interaction.md (opens in a new tab)references/lighting.md (opens in a new tab)references/loaders.md (opens in a new tab)references/materials.md (opens in a new tab)references/migrations.md (opens in a new tab)references/postprocessing.md (opens in a new tab)references/project-setup.md (opens in a new tab)references/shaders-glsl.md (opens in a new tab)references/shaders.md (opens in a new tab)references/textures.md (opens in a new tab)references/webgpu-runtime.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
2 plugins in one repository ship this exact skill · first indexed Sep 1, 2026
Other plugins' skills for the same job
threejs-kit@cypherpoet-toolchest is listed by cypherpoet/cypherpoet-toolchest — review the source before installing
npx claudepluginhub cypherpoet/cypherpoet-toolchest --plugin threejs-kit