# Three.js — card for AI agents

JavaScript 3D library for creating interactive 3D graphics in browsers.

Category: 3D and graphics · npm package `three` · latest version 0.187.0 (checked 2026-11-01)
Install: `npm install three`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## Three.js
- In plain HTML, load `three` through an import map pointing at the latest version. Do not use old CDN `<script>` tags such as `r128/three.min.js`.
- Map `three/addons/` as well. Import controls and loaders from it, for example `import { OrbitControls } from 'three/addons/controls/OrbitControls.js';`.
- Default to `WebGLRenderer`. Switch to `WebGPURenderer` only when you need TSL materials, compute shaders or node-based materials.
- For WebGPU, import from `three/webgpu` and `await renderer.init()` before rendering.
- With `WebGPURenderer`, write custom materials in TSL (`three/tsl`), not raw GLSL or `onBeforeCompile` hacks.
- Pair TSL with node materials such as `MeshStandardNodeMaterial` or `MeshPhysicalNodeMaterial`.
- Before upgrading across releases, check the Migration Guide. Recent releases remove code deprecated in earlier ones.

## Agent Skills for it
- three-best-practices from zebbern/claude-code-guide: `npx skills add zebbern/claude-code-guide --skill three-best-practices`

## Docs written for agents
- [llms.txt (index of the docs)](https://threejs.org/docs/llms.txt)

## What it is
- Three.js is a JavaScript 3D library, published on npm as `three` under the MIT license. The README states the project's aim as an "easy-to-use, lightweight, cross-browser, general-purpose 3D library." You build a scene from a camera, geometry, materials and meshes. A renderer then draws that scene into a canvas element on the page.
- The current builds include a WebGL renderer and a WebGPU renderer. SVG and CSS3D renderers are available as addons. The project's llms.txt calls `WebGLRenderer` the default and mature choice. It points to `WebGPURenderer` for TSL (Three.js Shading Language), compute shaders and node-based materials.
- Controls, loaders and exporters live in a separate addons tree that you import from `three/addons/`. The project links examples, docs, a manual, a migration guide, a forum and a Discord from the README.

## Caveats
- Old CDN snippets are out of date: Many copy-paste examples load a fixed old build through a plain `<script>` tag. The docs mark that pattern as wrong and ask for import maps pointing at the latest version.
- WebGPU setup differs from WebGL: The WebGPU renderer comes from a different entry point, `three/webgpu`. It also needs an awaited `init()` call before use. WebGL code does not carry over line for line.
- Deprecated APIs get removed: Releases are numbered (r187 is the latest listed). Each release links a migration guide section. The r187 notes remove code that was deprecated back in r177, so upgrades can break older code.
- Full clone is about 2 GB: The README warns that cloning the whole history is a large download. It suggests `git clone --depth=1` instead.

## Numbers (AgentGid data)
- Gid Score: 94.5 (#2 of all tools, 1 of 63 in its category)
- Used in 150 public projects set up for AI coding agents (2.4%)
- Downloads last week: 38,051,535 (as of 2026-11-24), +67.2% over 4 weeks
- GitHub stars: 119,257 (as of 2026-11-24)
- Last push: 2026-11-24

## Often used with
Tailwind CSS 80.0%, React Three Fiber 47.3%, Framer Motion 44.0%, React 76.0%, clsx 56.7%, Lucide React 56.0%

## Checked alternatives (same job)
- OGL: https://agentgid.com/tools/ogl/agent.md
- Pixi.js: https://agentgid.com/tools/pixi-js/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/three/
- Homepage: https://threejs.org/
- Repository: https://github.com/mrdoob/three.js
- Source: https://github.com/mrdoob/three.js#readme
- Source: https://github.com/mrdoob/three.js
- Source: https://github.com/mrdoob/three.js/releases
- Source: https://threejs.org/docs/llms.txt
- Source: https://threejs.org/docs/#examples/en/loaders/GLTFLoader

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
