threejs-development

A development guide for building Three.js 3D games with TypeScript. Three.js is a JavaScript library for displaying 3D scenes in a web browser.

In plain words
What is it for?
Implementing or modifying a Vite-based 3D game, including its render loop, keyboard input, physics, camera, lighting, and HUD.
Why use it?
It provides a consistent structure for scenes, game settings, movement physics, controls, cameras, lighting, and on-screen displays.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/robcost/gameforge/threejs-development
Any agent
npx skills add robcost/gameforge --skill threejs-development
Clone the repo
git clone --depth 1 https://github.com/robcost/gameforge

Made for: Claude Code, Codex.

Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,536 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00046 $0.01536
Opus 5 $0.00023 $0.00768
Sonnet 5 $0.00009 $0.00307
Haiku 4.5 $0.00005 $0.00154

Measured yesterday against content hash 0b1f68114f63, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

threejs-development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

apps/orchestrator/src/agents/skills/threejs-development/SKILL.md · 194 lines

How it starts

The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Three.js 3D Game Development Patterns

Project Structure

The Three.js game project uses Vite + TypeScript with this layout:

src/
  config.ts           - Game constants (VIEWPORT, CONTROLS, plus everything from GDD)
  main.ts             - DOM entry point, gets canvas element, calls startGame()
  scenes/
    BootScene.ts      - Creates WebGLRenderer, initializes MainScene, starts loop
    MainScene.ts      - Scene, Camera, Lights, animate loop, reset key - all gameplay here

Config-Driven Design

  • All game constants (dimensions, speeds, colors, physics values) go in src/config.ts
  • Scenes import from config - never hardcode values in scene files
  • Colors are hex numbers (e.g. 0x4fc3f7) for Three.js materials

Scene Architecture

  • MainScene is a class with a Three.js Scene, PerspectiveCamera, and WebGLRenderer
  • The animate loop uses requestAnimationFrame with delta time
  • Input is tracked via a keysPressed Set - use isKeyDown(code) to check
  • Camera and lighting are pre-configured in the template - modify as needed
// Typical MainScene structure
class MainScene {
  scene: THREE.Scene;
  camera: THREE.PerspectiveCamera;
  renderer: THREE.WebGLRenderer;
  keysPressed: Set<string>;

  animate(time: number) {
    const delta = (time - this.lastTime) / 1000;
    this.lastTime = time;
    this.update(delta);
    this.renderer.render(this.scene, this.camera);
    requestAnimationFrame((t) => this.animate(t));
  }
}

Creating Game Objects (Geometric Primitives)

  • Use THREE.BoxGeometry, THREE.SphereGeometry, THREE.CylinderGeometry for entities
  • Wrap in THREE.Mesh with THREE.MeshStandardMaterial for lit appearance
  • Add to scene: this.scene.add(mesh)
// Create a colored box
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshStandardMaterial({ color: 0x4fc3f7 });
const cube = new THREE.Mesh(geometry, material);
cube.position.set(0, 0.5, 0);
this.scene.add(cube);

// Create a sphere
const sphereGeo = new THREE.SphereGeometry(0.5, 16, 16);
const sphereMat = new THREE.MeshStandardMaterial({ color: 0xff5722 });
const sphere = new THREE.Mesh(sphereGeo, sphereMat);
this.scene.add(sphere);

Read the full file on GitHub · 194 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 194 lines · 46 tokens per session scan A 0b1f68114f63

Subscribe to this mod's changes

threejs-development is a skill published in the GitHub repository robcost/gameforge (2 stars, last pushed 6mo ago), licensed MIT. It adds 46 tokens to every session and 1,536 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

browserstack

../../../engineering-team/playwright-pro/skills/browserstack/SKILL.md.

alirezarezvani/claude-skills · 0 tokens

browser-automation

../../../engineering/skills/browser-automation/SKILL.md.

alirezarezvani/claude-skills · 0 tokens

feature-demo-recording

Record a demo video of a web feature from a real browser. Two modes -- a NARRATED film where measured voiceover drives the timeline (designed slides, subtitles, punch-in camera, rendered from an HTML timeline), and a SILENT evidence clip for a PR or a QA pass. Use when the user asks to record a video, demo, or screen…

kirodotdev/KiroCrew · 90 tokens

browser-recording

Record a browser flow as a video/GIF for evidence — animations, transitions, and multi-step interactions that a still screenshot cannot prove. Drives the project's own Playwright through a bundled runner, then converts to mp4 + GIF via ffmpeg. Use when the user asks to record a demo, capture a GIF or video of the UI…

kirodotdev/KiroCrew · 85 tokens

web-browse

Open a REAL external web page so the user can see it in Kiro Crew's Browser panel. PRIMARY path is the browser MCP tool (drives the built-in native panel); playwright-cli is the fallback for remote/plain-browser sessions and for attached logged-in browsers. Use when the user wants to VIEW / verify / "show me" an…

kirodotdev/KiroCrew · 93 tokens

web-verify

Look at your OWN front-end change before claiming it works -- navigate the loopback URL of a dev server or pod you started, screenshot the surface you changed, read the image to judge it, and embed it in chat. Three capture backends: playwright-cli (the session the dashboard Browser panel shows), the agent-browser CLI…

kirodotdev/KiroCrew · 154 tokens