> threejs
Assists with building interactive 3D experiences in the browser using Three.js. Use when creating 3D product configurators, data visualizations, games, or creative experiences with scenes, cameras, lighting, model loading, and performance optimization. Trigger words: threejs, three.js, 3d, webgl, react three fiber, r3f, glb, gltf.
curl "https://skillshub.wtf/TerminalSkills/skills/threejs?format=md"Three.js
Overview
Three.js is a JavaScript library for creating interactive 3D graphics in the browser using WebGL. It provides a scene graph, PBR materials, lighting systems, model loaders (glTF, FBX), and performance tools like instanced rendering. React Three Fiber offers a declarative React integration with automatic resource management and Suspense-based loading.
Instructions
- When setting up a scene, create a
Scene,PerspectiveCamera(orOrthographicCamera), andWebGLRenderer, addingOrbitControlsfor mouse/touch interaction and configuring anti-aliasing and tone mapping for production quality. - When creating objects, combine geometries (box, sphere, plane, or custom
BufferGeometry) with materials (MeshStandardMaterialfor PBR,MeshPhysicalMaterialfor advanced effects) and apply texture maps for diffuse, normal, roughness, and metalness. - When loading 3D models, use
GLTFLoaderfor glTF/GLB files (the preferred web format), enable Draco compression for models over 1MB, and use KTX2 textures for GPU-compressed formats. - When building lighting, combine ambient, directional, point, and spot lights with environment maps (HDR) for image-based lighting, and enable shadow maps on lights and meshes that need them.
- When optimizing performance, use
InstancedMeshfor rendering 100+ identical objects, merge static geometries, implement LOD for distance-based detail levels, and dispose resources manually when removing objects. - When using React, prefer React Three Fiber with
@react-three/dreihelpers (OrbitControls, Environment, useGLTF) and@react-three/postprocessingfor effects like bloom and SSAO.
Examples
Example 1: Build a 3D product configurator
User request: "Create a 3D product viewer where users can change colors and rotate the model"
Actions:
- Load the product model with
useGLTF()in React Three Fiber with Draco compression - Set up
OrbitControlsfor rotation and zoom, with camera animation on option change - Create material swapping logic that updates
MeshStandardMaterialcolor and roughness - Add environment lighting with an HDR map and contact shadows for realism
Output: An interactive 3D product configurator with color options, smooth rotation, and realistic lighting.
Example 2: Create an animated data globe
User request: "Visualize global data points on an interactive 3D globe"
Actions:
- Create a sphere geometry with an earth texture and atmosphere shader
- Plot data points using
InstancedMeshwith thousands of small spheres at geographic coordinates - Add arc connections between points using
TubeGeometrywith animated dash offsets - Implement auto-rotation with mouse-override orbit controls
Output: A 3D globe with data point markers, animated connection arcs, and interactive rotation.
Guidelines
- Use glTF/GLB format for all 3D models since it is the most efficient and widely supported web format.
- Enable Draco compression for models over 1MB to reduce file size significantly.
- Use
InstancedMeshwhen rendering more than 100 identical objects for massive performance gains. - Set
antialias: trueandtoneMapping: ACESFilmicToneMappingfor production visual quality. - Use React Three Fiber for React apps for declarative scene management and automatic disposal.
- Dispose resources manually when removing objects:
geometry.dispose(),material.dispose(),texture.dispose(). - Test on mobile devices and reduce shadow resolution, pixel ratio, and material complexity for low-end GPUs.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.