
r3f-geometry
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.
- Installs
- 2K
- 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-geometry- 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-geometry 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 geometry
Inspect installed Three.js, Fiber, and Drei versions before copying constructor arguments or helper props. Examples target Fiber 9 / React 19 and Three.js r185.
Choose the representation
- Use native JSX geometry for ordinary shapes.
argsmatch the Three.js constructor; changing them reconstructs geometry, so animate transforms rather than constructor inputs. - Use
BufferGeometryfor custom topology and buffer-basedpointsfor large particle sets. Keep generated arrays stable and use deterministic generation when results must be reproducible. - Use Drei
Instancesfor convenient declarative instances with events. For large or frequently updated sets, read native instancing to avoid per-instance React overhead. - Instancing shares geometry/material and reduces draw calls. Merely sharing a geometry among separate meshes does not batch their draws.
- Drei
Mergedcreates instancing abstractions from meshes, not BufferGeometry objects; it does not concatenate arbitrary static geometry. For actual merging, inspectmergeGeometriesfromthree/addons/utils/BufferGeometryUtils.jsand ensure compatible attributes/indexing.
Declarative instances
Mount below Canvas with lighting. Each Instance belongs to its nearest Instances provider.
import { Instance, Instances } from '@react-three/drei'
export default function Example() {
return (
<Instances limit={3} range={3}>
<boxGeometry args={[0.7, 0.7, 0.7]} />
<meshStandardMaterial />
<Instance position={[-1.2, 0, 0]} color="coral" />
<Instance position={[0, 0, 0]} color="skyblue" />
<Instance position={[1.2, 0, 0]} color="gold" />
</Instances>
)
}
Custom buffers and updates
positionandnormalattributes usually have item size 3; UVs have item size 2. Construct JSX buffer attributes withargs={[typedArray, itemSize]}and the correctattach, not justarray/countprops with no constructor arguments.- Indices refer to vertices; winding determines the front face. Duplicate vertices at hard normals or UV seams. Indexed vertices share all attributes, not just positions.
- Lit geometry needs normals. Use
computeVertexNormals()when appropriate; do not recompute every frame if a shader or analytic normals can express the deformation more cheaply. - After CPU buffer writes, set
attribute.needsUpdate = true. Choose dynamic usage before the first GPU upload when buffers will change often. - Recompute bounding boxes/spheres after geometry changes that affect them. GPU vertex displacement does not update CPU bounds or raycasting automatically.
- UV selection is explicit on modern Three.js:
texture.channelselectsuv,uv1,uv2, oruv3. Do not unconditionally copyuvintouv2for AO. - Avoid rebuilding buffers for pointer movement. If topology is fixed, change attribute contents or uniforms instead.
Helpers and tradeoffs
- Drei
Linesupports useful line widths; native WebGL line width is limited by the platform. CheckworldUnitswhen choosing screen-space versus world-space thickness. - Use Drei
Textfor flat text andText3Dfor extruded geometry. Current TextGeometry usesdepth, not the historicalheight; verify the helper's installed types and font format. - Use
Edgesfor sharp-edge outlines, not as a replacement for screen-space selection effects. BoundsandCenterchange framing/transforms; decide whether they should update after asset loading, resizing, or interaction.- Segment count should follow silhouette, deformation, and viewing distance. A “high quality” fixed count is not universally better.
- Declaratively created geometry can be owned by R3F. Shared or cached geometry needs a shared lifetime; do not dispose it from one instance while others remain mounted.
Verify
Check bounds/culling after updates, raycast hit positions, resource cleanup, and draw calls. Test at the intended object count; three instances do not establish performance at ten thousand.
Sources
FAQ
What does the r3f-geometry skill do?
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.
How do I install r3f-geometry?
Run npx skills add https://github.com/enzed/r3f-skills --skill r3f-geometry 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-geometry/ (personal) or .claude/skills/r3f-geometry/ (project).
Which AI agents can use r3f-geometry?
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-geometry 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-geometry?
It is published by enzed in enzed/r3f-skills. It has 1,953 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-shaders
enzed/r3f-skills
Implement custom GLSL or TSL materials in React Three Fiber, including uniforms and vertex deformation. Use for shader code and shader debugging, rather than ordinary PBR settings or composer effects.
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.