# Threejs scene setup

> Threejs scene setup is an open-source agent skill for developer tools. Sets up and debugs a plain three.js r187 scene with camera, renderer and render loop. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/shinyobjectz/raea-skills/tree/main/skills/threejs/pack/threejs-scene-setup
- **Repository:** https://github.com/shinyobjectz/raea-skills
- **GitHub stars:** 38
- **License:** Apache-2.0
- **Skill name:** threejs-scene-setup
- **Collection:** https://github.com/shinyobjectz/raea-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

This skill walks an agent through building the base of a plain three.js project: resolving the library through an import map or bundler, creating the scene, perspective camera and WebGL renderer, and running one animation loop driven by a timer with a clamped delta. It also covers resize handling, adding OrbitControls during development, and a pixel-ratio budget for high-DPI screens. The guidance favours an unlit test mesh first, with game state kept in plain objects that meshes only display.

For verification it includes a headless browser smoke test built on Playwright. The script fails on page errors, checks that draw calls are issued and the canvas has a size, and tests recovery after a forced WebGL context loss. A troubleshooting section covers common failures such as unresolved module specifiers, black canvases, stretched views after resize, and deprecated Clock or examples/js usage.

The skill expects a project that uses three.js r187 or an existing version the user keeps, with npm and a browser available for the optional smoke test. WebGPURenderer is covered as an opt-in path for TSL node materials and compute shaders, with its own init step and limits on custom GLSL.

## When your agent uses it

> Sets up and debugs a plain three.js r187 game or 3D scene: import maps, Scene, PerspectiveCamera and WebGLRenderer, setAnimationLoop with Timer, resize, OrbitControls and WebGPURenderer. Use on "Failed to resolve module specifier three", a black canvas or nothing animating. Not for GLB loading (`threejs-gltf-loading`), materials (`threejs-materials-lighting`) or React Three Fiber.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/shinyobjectz/raea-skills/tree/HEAD/skills/threejs/pack/threejs-scene-setup)
- [License: Apache-2.0](https://github.com/shinyobjectz/raea-skills/tree/HEAD/skills/threejs/pack/threejs-scene-setup)

## Features

- **Import map setup:** Shows how to resolve the three module and its addons with an import map or a bundler.
- **Scene and renderer bootstrap:** Creates a scene, perspective camera and WebGL renderer with a capped pixel ratio.
- **Timer-driven render loop:** Runs frame updates through setAnimationLoop with a clamped, frame-rate independent delta.
- **Resize handling:** Updates camera aspect, projection matrix and renderer size when the window changes.
- **Headless smoke test:** A Playwright script that checks for page errors, draw calls and recovery after context loss.
- **Common error fixes:** Troubleshooting notes for module resolution errors, black canvases and deprecated APIs.

## Good for

- Set up a new three.js scene without a bundler
- Fix a black canvas or a page that renders nothing
- Make a three.js canvas resize correctly with the window
- Add orbit camera controls to a 3D preview
- Migrate an old three.js page from Clock to Timer and modules

## Install

### Claude Code

This skill ships in the `raea` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add shinyobjectz/raea-skills
/plugin install raea@raea
```

Or copy only this skill to `~/.claude/skills/threejs-scene-setup`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/shinyobjectz/raea-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/threejs-scene-setup &&
cp -R "$tmp/skills/threejs/pack/threejs-scene-setup" ~/.claude/skills/threejs-scene-setup &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/threejs-scene-setup` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/threejs-scene-setup` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/shinyobjectz/raea-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/threejs-scene-setup &&
cp -R "$tmp/skills/threejs/pack/threejs-scene-setup" ~/.agents/skills/threejs-scene-setup &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/threejs-scene-setup` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/threejs-scene-setup` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/shinyobjectz/raea-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/threejs-scene-setup &&
cp -R "$tmp/skills/threejs/pack/threejs-scene-setup" ~/.cursor/skills/threejs-scene-setup &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/threejs-scene-setup` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/shinyobjectz/raea-skills.git --path skills/threejs/pack/threejs-scene-setup
```

Or copy the folder to `~/.gemini/skills/threejs-scene-setup` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/threejs-scene-setup`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/shinyobjectz/raea-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/threejs-scene-setup &&
cp -R "$tmp/skills/threejs/pack/threejs-scene-setup" ~/.copilot/skills/threejs-scene-setup &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/threejs-scene-setup` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/shinyobjectz/raea-skills.git
```

Then copy `raea-skills/skills/threejs/pack/threejs-scene-setup` into your agent's skills folder as `threejs-scene-setup`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Which three.js version does Threejs scene setup target?

It targets three.js r187 and notes that the user's installed version should be read first, keeping an existing project's release unless an upgrade is requested.

### Does Threejs scene setup cover loading 3D models or materials?

No. Model loading, materials and lighting are handled by other skills, and React Three Fiber components are excluded because their Canvas owns the renderer and loop.

### Does the smoke test need extra software?

It needs npm, the playwright package and a Chromium install, plus a dev server exposing window.renderer. Without browser automation the skill asks the user to check the page manually.

### When should WebGPURenderer be used instead of WebGLRenderer?

The skill recommends staying on WebGLRenderer by default and switching only when the project needs TSL node materials or compute shaders.

### How do I install Threejs scene setup in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/threejs-scene-setup to use it in all your projects, or to .claude/skills/threejs-scene-setup in one project. Or install the raea plugin, which includes it: /plugin marketplace add shinyobjectz/raea-skills, then /plugin install raea@raea.

### Does Threejs scene setup run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Threejs scene setup?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Threejs scene setup?

The closest alternatives to Threejs scene setup are Threejs, Threejs gltf loading, Threejs materials lighting, Game engine and Vue.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Threejs](https://ai-powered.com/skills/threejs): Threejs is an open-source agent skill for design and media.
- [Threejs gltf loading](https://ai-powered.com/skills/threejs-gltf-loading): Threejs gltf loading is an open-source agent skill for developer tools.
- [Threejs materials lighting](https://ai-powered.com/skills/threejs-materials-lighting): Threejs materials lighting is an open-source agent skill for developer tools.
- [Game engine](https://ai-powered.com/skills/game-engine): Game engine is an open-source agent skill for design and media.
- [Vue](https://ai-powered.com/skills/vue): Vue is an open-source agent skill for developer tools.
- [Webapp testing](https://ai-powered.com/skills/webapp-testing-github): Webapp testing is an open-source agent skill for browser automation.
- [Playwright interactive](https://ai-powered.com/skills/playwright-interactive): Playwright interactive is a free agent skill for browser automation.
- [E2E testing](https://ai-powered.com/skills/e2e-testing): E2E testing is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/threejs-scene-setup
