react-three-fiber
Skill1 starsChanged 8 days agoMITView on GitHub
Audit how a codebase uses React Three Fiber (R3F) and tell them what's slow. R3F is a React renderer over three.js's own WebGL canvas, so the problem space is: the three.js bundle (big), a render loop that defaults to 60fps forever, draw calls and VRAM from textures and geometries, and mounting cost from large GLTF files. Report first; plan, approved, fix. For Next.js-specific details pair this skill with the nextjs one (same repo family) — the move here is always:…
10 other projects use a version of this.
Adopted by
Most recently taken up by
- vercel-labs/json-rendertheir own version, first seen Oct 29, 2026
- Eliart-tech/Claude-skillstheir own version, first seen Oct 25, 2026
- Samueladewole/claude-skillstheir own version, first seen Oct 13, 2026
- xenodeve/xeno-skillstheir own version, first seen Oct 12, 2026
- kschiavo-beep/claude-skillstheir own version, first seen Oct 11, 2026
- shreyam1008/shre-skillstheir own version, first seen Oct 9, 2026
Used with
Projects with it also use locomotive-scroll and threejs-webgl.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
freshtechbroSkilllocomotive-scroll
Comprehensive skill for Locomotive Scroll smooth scrolling library with parallax effects, viewport detection, and scroll-driven animations. Use this skill when implementing smooth scrolling experiences, creating parallax effects, building scroll-triggered animations, or developing immersive scrolling websites. Triggers on tasks involving Locomotive Scroll, smooth scrolling, parallax, scroll detection, scroll events, sticky elements, horizontal scrolling, or GSAP ScrollTrigger integration. Integrates with GSAP for advanced scroll-driven animations.
Also in 3 projects that use this
freshtechbroSkillthreejs-webgl
Comprehensive skill for Three.js 3D web development. Use this skill when building interactive 3D scenes, WebGL/WebGPU applications, product configurators, 3D visualizations, or immersive web experiences. Triggers on tasks involving Three.js, 3D rendering, scenes, cameras, meshes, materials, lights, animations, textures, or WebGL/WebGPU rendering.
Also in 3 projects that use this
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- vercel-labs/json-render★ 19ksame name
- CristianOlivera1/openvid★ 2.8ksame name
- freshtechbro/claudedesignskills★ 824same name
- xenodeve/xeno-skills★ 2same name
- SkotAlexsander/skills★ 1same name
- Eliart-tech/Claude-skills★ 0same name
- kschiavo-beep/claude-skills★ 0same name
- lklyne/skills★ 0same name
- Samueladewole/claude-skills★ 0same name
- shreyam1008/shre-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architecture-optimizerSkill
- csharp-optimizerSkill
- cpp-optimizerSkill
- c-optimizerSkill
- go-optimizerSkill
- node-service-optimizerSkill
- ruby-optimizerSkill
- rust-optimizerSkill
- docker-optimizerSkill
- kubernetes-optimizerSkill
- terraform-optimizerSkill
- animate-cssSkill
- animejsSkill
- auto-animateSkill
- gsapSkill
- lenisSkill
- magicuiSkill
- motionSkill
- react-moveSkill
- react-springSkill
- theatrejsSkill
- threejsSkill
- optimizer-routerSkill
- bootstrap-optimizerSkill
- pandacss-optimizerSkill
- sass-scss-optimizerSkill
- stylex-optimizerSkill
- tailwindcss-optimizerSkill
- twind-optimizerSkill
- unocss-optimizerSkill
- vanilla-extract-optimizerSkill
- angular-optimizerSkill
- astro-optimizerSkill
- ui-components-optimizerSkill
- nextjsSkill
- node-optimizerSkill
- nuxt-optimizerSkill
- react-optimizerSkill
- remix-optimizerSkill
- solid-optimizerSkill
- svelte-optimizerSkill
- tanstack-start-optimizerSkill
- vue-optimizerSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Run python <skill-dir>/scripts/audit.py <project-root> [--json] — finds where <Canvas mounts (statically imported into route/hero files vs …
- Distinctive: line 55
Verify motions still land (interactions, camera moves, animation events).
- Very specific: line 63
Per-frame code is sacred: No allocations, no closures, no state-change patterns in useFrame.
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
name: r3f-optimizer
description: Audit and optimize React Three Fiber (@react-three/fiber + three + drei) usage — three.js bundle loading and lazy mounting of <Canvas>, frameloop control (always vs demand, invalidate), useFrame hygiene (no allocations per frame, shared vectors), instancing/draw-call reduction, texture and GLTF asset budget (KTX2/Draco compression, VRAM, memory pressure on mobile), dispose/cleanup and context-limit handling, shadows settings, and WebGL a11y (reduced motion, labels, fallbacks). Takes the same report-first, plan-approved workflow. Use when the user mentions react-three-fiber, R3F, @react-three/drei, WebGL performance, "slow/janky 3D scene", high device temperature on mobile 3D, texture/VRAM spikes, or three.js in React/Next.js pages -- even if they don't say "optimize".
React Three Fiber Optimizer
Audit how a codebase uses React Three Fiber (R3F) and tell them what's slow. R3F is a React renderer over three.js's own WebGL canvas, so the problem space is: the three.js bundle (big), a render loop that defaults to 60fps forever, draw calls and VRAM from textures and geometries, and mounting cost from large GLTF files. Report first; plan, approved, fix. For Next.js-specific details pair this skill with the nextjs one (same repo family) — the move here is always: measure, then fix.
Workflow
1. Scope (quick)
- Find the project root (
package.jsonwith@react-three/fiber; recordthree,@react-three/drei, any loaders). - Run
python <skill-dir>/scripts/audit.py <project-root> [--json]— finds where<Canvasmounts (statically imported into route/hero files vs lazily), frameloop usage, useFrame hygiene, per-frame allocations, mesh density, Environment/texture loading, missing Suspense/dispose, reduced-motion coverage, and multi-canvas context budget leads.
2. Audit
Confirm the script's leads by reading scene code. Load areas as fit:
| Area | Reference |
| three/drei bundle loading, mount-gating the Canvas, Suspense | references/bundle-loading.md |
| frameloop, useFrame hygiene, draw calls, instancing | references/render-loop.md |
| Textures/GLTF/VRAM: formats, sizes, color spaces, dispose discipline | references/assets-vram.md |
| A11y, reduced motion, fallbacks, multiple-canvas constraints | references/a11y-fallbacks.md |
Measure the interesting things — don't guess them:
- Scene graph size (r3f inspector, devtools): number of nodes, materials, textures.
- Real fps / jank: Chrome tracing or r3f's
statsmode during interaction; record before/after. - Mobile: DevTools throttling or a device check — mobile GPU is usually the binding constraint.
- Memory:
performance.memory,renderer.info(three) —info.memory.textures/geometriesis a direct count you can log.
Mark findings Confirmed (seen in code/measurements) or Suspected (needs a run to verify, e.g. a texture size deduces to look from an unproven path).
3. Report
Fill in assets/report-template.md, save as R3F_REPORT.md in the project root. Group by: bundle/load, render loop/GPU, assets/VRAM, a11y/fallbacks.
4. Plan — stop for approval
- Quick wins — dynamic import the page's
<Canvas>; capdprand antialias; addframeloop="demand"(+invalidate()) where the scene is mostly static; drop unneeded drei helpers; remove per-frame allocations. - Structural — instancing/merging for many-mesh scenes; texture pipeline (smaller sizes, KTX2/Basis, Draco/meshopt GLTFs); dispose cleanup; mount-on-view gating; shadow configuration (cap shadow map size, casters limited).
- Optional / design calls — fewer live canvases; an a11y fallback (static image or poster) and
prefers-reduced-motionhandling (pause frameloop); mobile-first asset budget. Per step: files, expected effect (bundle bytes, fps, memory), verification, rollback. Let the user drop/reorder.
5. Fix
Only approved items. R3F geometry/material/texture changes are behavior-visible — verify one change per group (build/typecheck, run the page, watch animations and useFrame ordering). For asset re-encodes, note the trade-off: compressed formats (KTX2/Basis) shift decode cost to upload-time and keep GPU sampling cheap; uncompressed PNG/JPG textures cost VRAM and bandwidth every load.
6. Verify and wrap up
- Re-measure: bundle (route analysis or
next buildoutput), frame cost (traces with the same settings), memory before/after; report deltas or the honest "couldn't measure" statement. - Verify motions still land (interactions, camera moves, animation events); reduced-motion and fallback behavior still hold.
- Deferred items + next suggested step.
Principles
- Default is expensive. R3F's default canvas render is 60fps continuous with a full renderer; a scene that's not interactive doesn't need that —
frameloop="demand"andinvalidate()are the first lever. - Bundle starts where
threestarts. three.js is large; load it as late as is honest, and don't put an un-gated<Canvas>at the top of a route file (the audit flags statically-imported canvases in route/hero files). - Draw calls and VRAM, not just "shaders". Many meshes and big uncompressed textures are the games' usual hits; the fixes in render-loop.md and assets-vram.md are mechanical, not exotic.
- Per-frame code is sacred. No allocations, no closures, no state-change patterns in
useFrame; reuseVector3/matrices; exit early when not visible. - Screen space beats texture size. Texture size and format decide the memory spend more than any React code; work to bytes: KTX2/Basis, Draco/meshopt, mipmaps, the right sizes per target.
- A 3D scene has a 2D floor. A canvas is invisible to keyboard/screen readers; ship a meaningful fallback (poster image, labels, alt text), and pause/reduce motion on request.
- Contexts are not free. Many
<Canvas>s on one page can hit browser WebGL context limits — prefer one canvas + composition, or terminate truly unused ones. - Never chase shader tricks before basics. Low-hanging: cap DPR,
powerPreference, demand loop, texture sizes; exotic GPU pipeline rewrites are last.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

