agentleFS
michaelbobovmichaelbobov/ClaudeSkillTree/.claude/skills/react-three-fiber/SKILL.md

react-three-fiber

Skill0 starsChanged 7 days agoMITView on GitHub

Build 3D scenes in React with React Three Fiber (@react-three/fiber), the React renderer for three.js. Use when the user wants 3D in a React or Next.js app, a Canvas with meshes, lights and cameras, animation with useFrame, loading models or textures, pointer events on 3D objects, on-demand rendering and performance work, a v8 to v9 migration, or to fix a React Three Fiber problem such as setState in a render loop or a Next.js server-component error.

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use locomotive-scroll, threejs-webgl and 1 more.

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.
  • freshtechbroSkill

    locomotive-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

  • freshtechbroSkill

    threejs-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

  • +1 more from freshtechbro

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the file for the task above before writing code, and use the API shown there.

    line 42
  2. Very specific:

    Start from the smallest Canvas that works, check it renders, then add objects, lights and motion.

    line 43

“Common” is measured: kept by at least 6 in 10 of the 12 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

React Three Fiber

React Three Fiber (R3F) renders three.js with React: three.js objects are written as JSX, and hooks give access to the render loop and the scene. The project's own docs are bundled in reference/. Read the file that matches the task instead of all of them.

TaskRead
What it is, a first scenereference/introduction.md
Install for Vite, Next.js, React Native or a CDNreference/installation.md
Canvas props: frameloop, dpr, shadows, camera, glreference/canvas.md
useFrame, useThree, useLoader, useGraphreference/hooks.md
JSX objects, constructor args, attach, props, disposereference/objects.md
Pointer events, onClick, onPointerOver, event propagationreference/events.md
Animation with useFrame and springsreference/basic-animations.md
Loading glTF models and texturesreference/loading-models.md, reference/loading-textures.md
Why it is fast, how objects map to JSXreference/how-it-works.md
Common mistakesreference/pitfalls.md
Frame rate, instancing, on-demand rendering, level of detailreference/scaling-performance.md
TypeScript types and JSX typingreference/typescript.md
Upgrading from v8reference/v9-migration-guide.md
Testingreference/testing.md

The rules that prevent most problems

These come from the bundled docs; the details and examples are in reference/pitfalls.md and reference/scaling-performance.md.

  • Install three and @react-three/fiber. R3F must pair with the matching major version of React, like react-dom does: check the version note in reference/installation.md before choosing versions.
  • Do not call setState in useFrame or in fast events. Mutate refs and use the frame delta instead, so the animation does not depend on the frame rate.
  • Do not create objects in a loop. Allocate vectors, colours and materials once and reuse them.
  • Load assets with useLoader, which caches and suspends, rather than calling a loader in render.
  • Reuse geometries and materials, and use instancing for many copies of the same mesh.
  • Render on demand (frameloop="demand") when nothing animates all the time, and call invalidate() to draw a frame.
  • Mount with care. Toggling visible is cheaper than mounting and unmounting a heavy component.
  • In Next.js, add three to transpilePackages in next.config.js (see reference/installation.md). R3F components use hooks and browser APIs, so keep them in a client component ("use client").

Working method

  1. Read the file for the task above before writing code, and use the API shown there. R3F changes between major versions.
  2. Start from the smallest Canvas that works, check it renders, then add objects, lights and motion.
  3. For performance problems, measure first (the performance monitoring section in reference/scaling-performance.md), then apply the matching technique.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.