#601

Global Rank · of 601 Skills

threejs AI Agent Skill

View Source: oakoss/agent-skills

Medium

Installation

npx skills add oakoss/agent-skills --skill threejs

37

Installs

Three.js

Overview

Guides building high-performance 3D web experiences with Three.js, WebGPU-first rendering, TSL (Three Shader Language), and React Three Fiber. Covers scene architecture, asset compression, draw call budgets, and React 19 / Next.js integration patterns.

When to use: Creating 3D scenes, WebGPU rendering setup, TSL shader authoring, asset optimization (Draco/KTX2), React Three Fiber composition, Next.js streaming for 3D content, loading GLTF models, setting up lighting and shadows, animation playback and blending.

When NOT to use: 2D canvas animations (use Canvas API), simple SVG graphics, server-side rendering without client hydration, projects targeting pre-2022 hardware exclusively.

Quick Reference

Pattern API / Approach Key Points
WebGPU renderer import * as THREE from 'three/webgpu' Must await renderer.init() before first render
R3F canvas <Canvas gl={...}> with Suspense Wrap in <Suspense> for streaming support
Frame updates useFrame((state, delta) => ...) Mutate refs directly; never use setState
TSL shaders import { ... } from 'three/tsl' Node-based; compiles to WGSL or GLSL
Instancing <instancedMesh> with matrix updates Single draw call for repeated geometry
Batched mesh BatchedMesh (r156+) Different geometries sharing one material
Draco compression gltf-pipeline -i in.gltf -o out.glb -d Up to 90% geometry size reduction
KTX2 textures Basis Universal via toktx Stays compressed in VRAM
LOD THREE.LOD with distance thresholds Swap detail levels by camera distance
On-demand render <Canvas frameloop="demand"> Only render when scene state changes
Cleanup .dispose() on unmount Geometries, materials, and textures
Compute shaders Fn(() => {...})().compute(count) GPU-side physics, particles, flocking
Lighting DirectionalLight, SpotLight, HemisphereLight Enable shadowMap on renderer + castShadow on light
GLTF loading GLTFLoader + DRACOLoader Draco for geometry compression; traverse for shadows
Animation AnimationMixer + clipAction() Update with clock.getDelta() every frame
Crossfade action.fadeOut() / action.fadeIn() Weight-based blending between walk/run/idle
Environment maps RGBELoader + PMREMGenerator Set scene.environment for PBR reflections
Raycasting Raycaster.setFromCamera(pointer, cam) Mouse/touch picking; use recursive: true for GLTF
Morph targets mesh.morphTargetInfluences[index] Facial animation, blend shapes from GLTF

Common Mistakes

Mistake Correct Pattern
Allocating new THREE.Vector3() or new THREE.Color() inside useFrame Pre-allocate outside the loop to avoid GC pressure every frame
Using requestAnimationFrame manually in React projects Use R3F's useFrame hook for frame-by-frame updates
Not awaiting renderer.init() for WebGPU Always await renderer.init() before the first render to avoid race conditions
Loading assets without <Suspense> boundaries Wrap <Canvas> in <Suspense> to prevent main thread blocking
Using high-poly models for background or distant elements Use LOD (Level of Detail) or Impostors to reduce draw calls
Using setState inside render loop for animations Mutate refs directly via useFrame for frame-by-frame updates
Speed tied to frame rate (rotation += 0.01) Multiply by delta for frame-rate-independent motion
Not using clock.getDelta() for mixer.update() Always pass delta time to mixer.update(delta) for correct animation speed
Forgetting to dispose loaded GLTF models Traverse and dispose geometries, materials, and textures on removal
Shadow map enabled on renderer but not on the light Set both renderer.shadowMap.enabled and light.castShadow = true
Large far/near ratio on camera Keep ratio small to avoid z-fighting; set near as large as possible

Delegation

  • Asset and scene graph exploration: Use Explore agent
  • Multi-file scene refactoring and optimization passes: Use Task agent
  • 3D architecture and rendering pipeline planning: Use Plan agent

References

Installs

Installs 37
Global Rank #601 of 601

Security Audit

ath Safe
socket Safe
Alerts: 0 Score: 90
snyk Medium
zeroleaks Safe
Score: 93
EU EU-Hosted Inference API

Power your AI Agents with the best open-source models.

Drop-in OpenAI-compatible API. No data leaves Europe.

Explore Inference API

GLM

GLM 5

$1.00 / $3.20

per M tokens

Kimi

Kimi K2.5

$0.60 / $2.80

per M tokens

MiniMax

MiniMax M2.5

$0.30 / $1.20

per M tokens

Qwen

Qwen3.5 122B

$0.40 / $3.00

per M tokens

How to use this skill

1

Install threejs by running npx skills add oakoss/agent-skills --skill threejs in your project directory. Run the install command above in your project directory. The skill file will be downloaded from GitHub and placed in your project.

2

No configuration needed. Your AI agent (Claude Code, Cursor, Windsurf, etc.) automatically detects installed skills and uses them as context when generating code.

3

The skill enhances your agent's understanding of threejs, helping it follow established patterns, avoid common mistakes, and produce production-ready output.

What you get

Skills are plain-text instruction files — not executable code. They encode expert knowledge about frameworks, languages, or tools that your AI agent reads to improve its output. This means zero runtime overhead, no dependency conflicts, and full transparency: you can read and review every instruction before installing.

Compatibility

This skill works with any AI coding agent that supports the skills.sh format, including Claude Code (Anthropic), Cursor, Windsurf, Cline, Aider, and other tools that read project-level context files. Skills are framework-agnostic at the transport level — the content inside determines which language or framework it applies to.

Data sourced from the skills.sh registry and GitHub. Install counts and security audits are updated regularly.

EU Made in Europe

Chat with 100+ AI Models in one App.

Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.

Customer Support