
r3f-loaders
Load and reuse 3D assets in React Three Fiber with useGLTF, useLoader, Suspense, and preloading. Use for model loading, decoder setup, caching, cloning, or loading/error UI.
- Installs
- 1.8K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/enzed/r3f-skills --skill r3f-loaders- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads r3f-loaders automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
React Three Fiber loaders
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.
Load and reuse a model
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>
)
}
Loading decisions
- Prefer
useGLTFfor glTF/GLB; useuseLoaderwith the matching Three.js loader for other formats. Fiber 9 also accepts an externally owned loader instance when configuration isolation is needed. - Loader hooks suspend. Put boundaries around assets that should reveal together; separate boundaries for independent loading. Preload likely-needed assets ahead of interaction, not the entire catalog.
- Preloading starts a request; it does not guarantee instantaneous display or GPU shader compilation. Asset decoding and first rendering can still cost time.
- Conditional loading means conditionally mounting a child component that calls the hook. Do not pass
nullas a pretend URL or call a hook conditionally. - Three.js addons use paths such as
three/addons/loaders/GLTFLoader.js. Check installed exports for renamed loaders; modern Three.js usesHDRLoaderwhere older examples usedRGBELoader. - Use gltfjsx with types when exposing named nodes/materials is useful, and inspect the generated result. For wrappers, use
ThreeElements['group'], not the removed global JSX type namespace.
Cache, clones, and lifetime
- Treat cached loader results as shared. Mounting one Object3D under two parents moves it between them; clone the graph for repeated placement.
- Drei Clone supports ordinary graph duplication and skeleton-aware cloning. For independent animation mixers, a stable
SkeletonUtils.cloneroot makes ownership explicit. - A graph clone normally shares geometry, textures, and materials. Clone the specific material/texture before per-instance edits; deep-cloning everything wastes memory.
- Prevent an individual consumer from disposing shared cached resources (
dispose={null}on the shared subtree). An application cache owner may release them only after all consumers are gone. - Primitives are not automatically disposed by R3F. Neither
useGLTF.clear(url)noruseLoader.clear(...)is a complete GPU cleanup operation. - Do not clear caches during render, and do not mutate a cached scene's transforms/materials as a local setup shortcut.
Decoders and failure paths
useGLTFintegrates 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.- Use the same loader/decoder settings for preload and actual load. Configure before requests start; later changes do not retroactively reparse an already cached result.
- Avoid creating a new decoder worker pool in every render or load callback. Give custom loader/decoder instances a deliberate owner and cleanup.
- Suspense handles pending work, not rejected requests. Use an error boundary with an explicit retry/remount strategy; cache eviction for retry belongs in a user action or controlled recovery path.
- Inside Canvas, use a Three.js fallback or Drei Html. Drei Loader is a DOM overlay and belongs outside Canvas.
useProgressreflects the loading manager's activity, not necessarily one asset's byte-accurate completion. Avoid treating an unavailable Content-Length as a trustworthy denominator.- Test network errors, CORS, decoder/transcoder hosting, and actual compressed assets. An uncompressed GLB smoke test does not validate every decoder path.
Sources
FAQ
What does the r3f-loaders skill do?
Load and reuse 3D assets in React Three Fiber with useGLTF, useLoader, Suspense, and preloading. Use for model loading, decoder setup, caching, cloning, or loading/error UI.
How do I install r3f-loaders?
Run npx skills add https://github.com/enzed/r3f-skills --skill r3f-loaders in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/r3f-loaders/ (personal) or .claude/skills/r3f-loaders/ (project).
Which AI agents can use r3f-loaders?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is r3f-loaders safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains r3f-loaders?
It is published by enzed in enzed/r3f-skills. It has 1,818 recorded installs.
More from enzed/r3f-skills
r3f-interaction
enzed/r3f-skills
Implement React Three Fiber pointer events, picking, dragging, keyboard input, and camera controls. Use for scene interaction and event propagation, rather than animation or physics simulation itself.
r3f-fundamentals
enzed/r3f-skills
Set 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-animation
enzed/r3f-skills
Animate 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-postprocessing
enzed/r3f-skills
Configure React Three Fiber postprocessing, bloom, selection effects, ambient occlusion, and depth of field. Use for composer pipelines and screen-space effects, rather than mesh material shaders.
r3f-materials
enzed/r3f-skills
Choose and configure React Three Fiber surface materials, PBR, transparency, and transmission. Use for mesh appearance and material cost; use shader guidance for custom GLSL or TSL code.
r3f-geometry
enzed/r3f-skills
Build React Three Fiber geometry, custom buffers, instanced meshes, points, and lines. Use for shape construction and geometry draw-call optimization, rather than material appearance.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.