Loads, caches, and reuses 3D assets in React Three Fiber with useGLTF, useLoader, Suspense, Clone, and preloading strategies.
Ships in enzed-r3f-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Inspect installed Fiber, Drei, Three.js, and React versions first. Examples use Fiber 9 / React 19. Verify actual asset paths, node names, formats, and compression; do not invent a model's structure.
Mount below Canvas. Supply /models/robot.glb in the application. These clones have separate object transforms but intentionally share cached geometry/materials.
import { Suspense } from 'react'
import { Clone, useGLTF } from '@react-three/drei'
function Models() {
const { scene } = useGLTF('/models/robot.glb')
return (
<group dispose={null}>
<Clone object={scene} position={[-1.2, 0, 0]} />
<Clone object={scene} position={[1.2, 0, 0]} />
</group>
)
}
export default function Example() {
return (
<Suspense fallback={null}>
<Models />
</Suspense>
)
}
useGLTF for glTF/GLB; use useLoader with the matching Three.js loader for other formats. Fiber 9 also accepts an externally owned loader instance when configuration isolation is needed.null as a pretend URL or call a hook conditionally.three/addons/loaders/GLTFLoader.js. Check installed exports for renamed loaders; modern Three.js uses HDRLoader where older examples used RGBELoader.ThreeElements['group'], not the removed global JSX type namespace.SkeletonUtils.clone root makes ownership explicit.dispose={null} on the shared subtree). An application cache owner may release them only after all consumers are gone.useGLTF.clear(url) nor useLoader.clear(...) is a complete GPU cleanup operation.useGLTF integrates Draco/Meshopt support, but decoder URLs and loader configuration must match the asset and hosting policy. For KTX2 textures, configure a KTX2Loader with renderer capability detection before loading.useProgress reflects the loading manager's activity, not necessarily one asset's byte-accurate completion. Avoid treating an unavailable Content-Length as a trustworthy denominator.What SKILL.md sets; muted values are Claude Code's defaults
/enzed-r3f-skills:r3f-loadersfrom enzed-r3f-skills
enzed-r3f-skills@cascade-code-languages-misc-1 is listed by joshuarweaver/cascade-code-languages-misc-1 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin enzed-r3f-skills11 skills in this plugin
/r3f-animationAnimate React Three Fiber objects with useFrame, damping, and GLTF clips. Use for procedural motion, animation transitions, or demand-loop animation; use physics guidance for collision-driven movement./r3f-fundamentalsSet up React Three Fiber scenes, Canvas, typed JSX, hooks, and resource ownership. Use for scene architecture and render-loop setup, rather than detailed materials or effects./r3f-geometryBuild React Three Fiber geometry, custom buffers, instanced meshes, points, and lines. Use for shape construction and geometry draw-call optimization, rather than material appearance.Other plugins' skills for the same job