three-js — Claude Code skill: what it does, how to install
Guides agent development for Three.js and React Three Fiber with TypeScript standards, render optimization, and resource disposal.
npx skills add Mindrally/skills --skill three-js -a claude-codeWhat three-js does
This skill enforces conventions for building 3D web applications with Three.js, React Three Fiber, Vite, and Next UI. It prompts the model to write functional TypeScript components, avoiding classes and semicolons while preferring interfaces over types and maps over enums.
For 3D scenes, the guidance focuses on GPU and memory management. The model will implement geometry merging, instancing, level of detail (LOD), and proper disposal of materials, textures, and geometries. Inside React Three Fiber components, animations rely on useFrame, context on useThree, and common helpers on @react-three/drei. Skipping explicit dispose calls inside cleanup routines inevitably causes WebGL memory leaks.
What it helps with
- set up React Three Fiber scenes using useFrame and drei helpers
- reduce draw calls using instanced meshes and merged geometries
- prevent WebGL memory leaks by disposing of textures and materials
- structure functional TypeScript components with early guard clauses
Example prompts for the agent
- Create an animated 3D mesh in React Three Fiber using useFrame and drei.
- Optimize this Three.js scene by replacing separate meshes with instanced rendering.
- Add proper resource disposal for geometries and textures when the component unmounts.
How to install three-js
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill three-js -a claude-code2Manually: put the files in place
~/.claude/skills/three-js/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/three-js/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill three-js -a codex2Manually: put the files in place
.agents/skills/three-js/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill three-js -a cursor2Manually: put the files in place
.cursor/skills/three-js/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills three-js2Manually: put the files in place
.github/skills/three-js/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill three-js -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path three-jsManually: put the files in place
.devin/skills/three-js/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill three-js -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about three-js
How to install three-js in Claude Code?
Run npx skills add Mindrally/skills --skill three-js -a claude-code. The skill file will be saved to ~/.claude/skills/three-js/SKILL.md.
What does the three-js skill do?
It directs coding agents to write clean Three.js and React Three Fiber code with strict TypeScript conventions. It emphasizes render loop profiling and memory cleanup.
Which libraries and coding conventions does it prefer?
It targets React with Vite, Tailwind CSS, and Next UI. It enforces pure function declarations without semicolons, interfaces instead of types, and early returns for error handling.
Source text
SKILL.md · Apache-2.0
--- name: three-js description: Expert guidance for Three.js and React Three Fiber development with modern React, TypeScript, and performance best practices metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # Three.js Development You are an expert in React, Vite, Tailwind CSS, Three.js, React Three Fiber, and Next UI. ## Key Principles - Write concise, technical responses with accurate React examples - Use functional, declarative programming; avoid classes - Prefer iteration and modularization over code duplication - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasRendered) - Use lowercase with dashes for directories (e.g., components/auth-wizard) - Favor named exports for components ## JavaScript/TypeScript Standards - Use "function" keyword for pure functions; omit semicolons - Use TypeScript for all code; prefer interfaces over types - Avoid enums; use maps instead - File structure: Exported component, subcomponents, helpers, static content, types ## Error Handling and Validation - Handle errors and edge cases at the beginning of functions - Use early returns for error conditions to avoid deeply nested if statements - Place the happy path last in the function for improved readability - Use guard clauses to handle preconditions and invalid states early - Implement proper error logging and user-friendly error messages ## React Best Practices ### Component Guidelines - Use functional components and interfaces - Use declarative JSX - Use function, not const, for components - Use Next UI and Tailwind CSS for components and styling - Implement responsive design with Tailwind CSS ### Performance Optimization - Wrap client components in Suspense with fallback - Use dynamic loading for non-critical components - Optimize images: WebP format, size data, lazy loading ## Three.js Specific Guidelines ### Scene Management - Properly dispose of geometries, materials, and textures when no longer needed - Use object pooling for frequently created/destroyed objects - Implement level of detail (LOD) for complex scenes ### Performance - Minimize draw calls through geometry merging and instancing - Use appropriate texture sizes and formats - Implement frustum culling for large scenes - Profile and optimize render loops ### React Three Fiber - Use the useFrame hook for animations - Leverage useThree for accessing the Three.js context - Use refs for direct Three.js object manipulation - Implement proper cleanup in useEffect hooks - Use drei library helpers for common 3D patterns
© Mindrally · Apache-2.0 · Mindrally/skills