
Threejs Skills
Install this when you want your agent to scaffold interactive WebGL scenes, Three.js setups, and 3D UI effects without guessing import maps and render loops.
Overview
Three.js Skills is an agent skill for the Build phase that systematically creates WebGL scenes and interactive 3D experiences using Three.js best practices.
Install
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill threejs-skillsWhat is this skill?
- ES module import maps for Three.js r183+ plus npm/vite/webpack production imports
- Scene initialization pattern: renderer, camera, scene, lights, and animation loop
- OrbitControls and addons import path from three/addons/
- Guidance for interactive 3D, particles, animations, and data visualizations in 3D space
- Triggered by explicit 3D, WebGL, or Three.js user requests
- Documents Three.js 0.183.0 CDN import map pattern
- Covers ES modules and three/addons/ OrbitControls path
Adoption & trust: 558 installs on skills.sh; 40.1k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want a 3D or WebGL feature in the browser, but agent-generated Three.js code often breaks import maps, scene setup, or the render loop.
Who is it for?
Indie builders shipping browser-based 3D demos, visualizers, or interactive marketing scenes with Three.js r183+.
Skip if: Native mobile 3D (Unity/Unreal), server-side rendering-only sites with no canvas, or 2D-only UI tasks with no WebGL requirement.
When should I use this skill?
Use when the user requests 3D graphics, WebGL experiences, 3D visualizations, animations, interactive 3D elements, or mentions Three.js.
What do I get? / Deliverables
You get a consistent Three.js bootstrap—imports, scene graph, controls, and animation pattern—ready to extend for your specific mesh, shader, or interaction.
- Three.js scene bootstrap code (import map or bundler)
- Renderer, camera, lighting, and controls wiring
- Animation loop stub for interactive 3D
Recommended Skills
Journey fit
Three.js work is product surface and client rendering—canonical placement is Build while you compose the experience users see in the browser. Frontend is the shelf for scene graphs, cameras, lights, controls, and canvas/WebGL integration patterns.
How it compares
Use for procedural Three.js scene construction, not as a hosted 3D asset pipeline or game engine replacement.
Common Questions / FAQ
Who is threejs-skills for?
Solo developers and small teams using AI agents to add Three.js/WebGL to web apps without re-learning setup for every prompt.
When should I use threejs-skills?
During Build frontend work when users request 3D models, rotating objects, explorable scenes, particles, or data shown in 3D space.
Is threejs-skills safe to install?
Treat CDN and dependency choices as your supply-chain decision; review the Security Audits panel on this Prism page before install.
SKILL.md
READMESKILL.md - Threejs Skills
# Three.js Skills Systematically create high-quality 3D scenes and interactive experiences using Three.js best practices. ## When to Use - Requests 3D visualizations or graphics ("create a 3D model", "show in 3D") - Wants interactive 3D experiences ("rotating cube", "explorable scene") - Needs WebGL or canvas-based rendering - Asks for animations, particles, or visual effects - Mentions Three.js, WebGL, or 3D rendering - Wants to visualize data in 3D space ## Core Setup Pattern ### 1. Essential Three.js Imports Use ES module import maps for modern Three.js (r183+): ```html <script type="importmap"> { "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.183.0/build/three.module.js", "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.183.0/examples/jsm/" } } </script> <script type="module"> import * as THREE from "three"; import { OrbitControls } from "three/addons/controls/OrbitControls.js"; </script> ``` For production with npm/vite/webpack: ```javascript import * as THREE from "three"; import { OrbitControls } from "three/addons/controls/OrbitControls.js"; ``` ### 2. Scene Initialization Every Three.js artifact needs these core components: ```javascript // Scene - contains all 3D objects const scene = new THREE.Scene(); // Camera - defines viewing perspective const camera = new THREE.PerspectiveCamera( 75, // Field of view window.innerWidth / window.innerHeight, // Aspect ratio 0.1, // Near clipping plane 1000, // Far clipping plane ); camera.position.z = 5; // Renderer - draws the scene const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); ``` ### 3. Animation Loop Use `renderer.setAnimationLoop()` (preferred) or `requestAnimationFrame`: ```javascript // Preferred: setAnimationLoop (handles WebXR compatibility) renderer.setAnimationLoop(() => { mesh.rotation.x += 0.01; mesh.rotation.y += 0.01; renderer.render(scene, camera); }); // Alternative: manual requestAnimationFrame function animate() { requestAnimationFrame(animate); mesh.rotation.x += 0.01; mesh.rotation.y += 0.01; renderer.render(scene, camera); } animate(); ``` ## Systematic Development Process ### 1. Define the Scene Start by identifying: - **What objects** need to be rendered - **Camera position** and field of view - **Lighting setup** required - **Interaction model** (static, rotating, user-controlled) ### 2. Build Geometry Choose appropriate geometry types: **Basic Shapes:** - `BoxGeometry` - cubes, rectangular prisms - `SphereGeometry` - spheres, planets - `CylinderGeometry` - cylinders, tubes - `PlaneGeometry` - flat surfaces, ground planes - `TorusGeometry` - donuts, rings **CapsuleGeometry** is available (stable since r142): ```javascript new THREE.CapsuleGeometry(0.5, 1, 4, 8); // radius, length, capSegments, radialSegments ``` ### 3. Apply Materials Choose materials based on visual needs: **Common Materials:** - `MeshBasicMaterial` - unlit, flat colors (no lighting needed) - `MeshStandardMaterial` - physically-based, realistic (needs lighting) - `MeshPhongMaterial` - shiny surfaces with specular highlights - `MeshLambertMaterial` - matte surfaces, diffuse reflection ```javascript const material = new THREE.MeshStandardMaterial({ color: 0x00ff00, metalness: 0.5, roughness: 0.5, }); ``` ### 4. Add Lighting **If using lit materials** (Standard, Phong, Lambert), add lights: ```javascript // Ambient light - general illumination const ambientLight = new THREE.AmbientLight(0xffffff, 0.5); scene.add(ambientLight); // Directional light - like su