What problem does it solve?
React Three Fiber and Three.js projects often suffer from performance pitfalls and inconsistent practices. This skill provides standardized guidelines for writing and reviewing high-performance 3D components in a React context.
Core Features & Use Cases
- Performance best practices for render loops (avoid allocations inside useFrame, reuse objects, prefer InstancedMesh for large particle systems, and mutate uniforms directly instead of re-creating state).
- Type safety and stability (typed refs for common Three.js classes, proper casting for material uniforms, and avoiding @ts-nocheck).
- Ecosystem and tooling (prefer @react-three/drei helpers for loading, camera controls, and debugging).
- Shader and audio patterns (uniform-driven shaders, safe AudioContext usage with proper cleanup).
- Orchestration and integration (synchronize 3D visuals with UI stages using AnimationContext).
- Maintenance and safety (cleanup checklist, lint/build readiness).
- Common use cases include immersive 3D backgrounds, galaxy/hyperspace effects, particle fields, and interactive scenes within React apps.
Quick Start
Apply these performance and quality guidelines to every file under src/components/backgrounds/three/ to ensure efficient, maintainable 3D code.