- name
SKILL.md
Le fichier du skill reste dans le dépôt de l'éditeur.
Collez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add AThevon/genjutsu --skill threejs-r3f -a cursor -yCollez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add AThevon/genjutsu --skill threejs-r3f -a claude-code -yCollez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add AThevon/genjutsu --skill threejs-r3f -a codex -yCollez la commande copiée dans un terminal. Elle installe ce SKILL.md dans cet agent.
npx skills add AThevon/genjutsu --skill threejs-r3f -a grok -yEnvoyez le message copié dans un chat Grok Bot. Le Bot récupère ce SKILL.md sur GitHub et l'ajoute aux skills que partagent tous vos Bots.
Install this skill: https://github.com/AThevon/genjutsu/tree/HEAD/skills/_jutsu/threejs-r3fDe l'éditeur
Version-sensitive. Every API name, SDK gate and browser-support claim below was verified on 2026-09-08 against primary sources. What against, and when, is in
_jutsu/VERSIONS.md. If that date is old, re-verify before acting on a version number.
3D on the web. Three.js is the engine, R3F is the React renderer. Concise rules here. Deep-dive in
references/.Versions:
threer187 (0.187.x) ·@react-three/fiber9.x ·@react-three/drei10.x ·@react-three/postprocessing3.x. R3F 9 is React 19 only - its declared peer range isreact/react-dom>=19 <19.4(drei 10 asks^19). React 18 projects must stay on R3F 8 + drei 9. Check the installed React major before scaffolding. Renderers:WebGLRendereris still R3F's default.WebGPURenderer+ TSL is shipped (not flagged) and self-falls-back to WebGL 2, but three's docs call it "the new alternative ofWebGLRenderer", not the default. Opt in with an asyncglcallback:import * as THREE from 'three/webgpu' <Canvas gl={async (props) => { const r = new THREE.WebGPURenderer(props as any); await r.init(); return r }} />
import { Canvas } from '@react-three/fiber'
import { Environment, OrbitControls } from '@react-three/drei'
import { Suspense } from 'react'
<Canvas camera={{ position: [0, 2, 5], fov: 45 }} dpr={[1, 2]} gl={{ antialias: true }}>
<Suspense fallback={null}>
<Environment preset="studio" />
<OrbitControls makeDefault />
<Scene />
</Suspense>
</Canvas>
Rules:
<Suspense> -- loaders (GLTF, textures, HDRI) need itdpr={[1, 2]} to clamp pixel ratio (Retina without melting GPUs)useFrame((state, delta) => {
// Use delta for framerate-independent animation
meshRef.current.rotation.y += delta * 0.5
// Access clock for time-based effects
material.uniforms.uTime.value = state.clock.elapsedTime
})
state.clock is a THREE.Clock, which three deprecated in r183 in favour of Timer. R3F 9.8 still creates it, so the console shows that deprecation warning in every R3F app; state.clock.elapsedTime keeps working, and the warning is not yours to fix.
import { EffectComposer, Bloom, ChromaticAberration } from '@react-three/postprocessing'
import { BlendFunction } from 'postprocessing'
<EffectComposer>
<Bloom
luminanceThreshold={1}
luminanceSmoothing={0.4}
intensity={0.6}
/>
<ChromaticAberration
blendFunction={BlendFunction.NORMAL}
offset={[0.002, 0.002]}
/>
</EffectComposer>
Rules:
luminanceThreshold={1} = nothing glows unless explicitly emissiveTarget metrics: < 100 draw calls, < 1M triangles, 60fps on mid-range GPU.
Use stats-gl or r3f-perf to monitor.
Causes full React re-render 60x/second. Mutate refs directly.
// BAD
useFrame(() => {
setRotation(prev => prev + 0.01) // React re-render every frame
})
// GOOD
useFrame((_, delta) => {
meshRef.current.rotation.y += delta * 0.5 // Direct mutation, zero re-renders
})
new Vector3() per frame = GC spikes = stutter.
// BAD
useFrame((state) => {
const target = new THREE.Vector3(0, Math.sin(state.clock.elapsedTime), 0)
meshRef.current.position.copy(target)
})
// GOOD
const _target = useMemo(() => new THREE.Vector3(), [])
useFrame((state) => {
_target.set(0, Math.sin(state.clock.elapsedTime), 0)
meshRef.current.position.copy(_target)
})
Three.js textures, geometries, and materials live on the GPU. Unmounting a React component does NOT free them.
// BAD -- texture stays in VRAM after unmount
const texture = useLoader(TextureLoader, '/big-texture.jpg')
// GOOD -- R3F auto-disposes when using JSX primitives
// For manual resources, dispose in cleanup:
useEffect(() => {
return () => {
texture.dispose()
geometry.dispose()
material.dispose()
}
}, [])
State changes in the parent force the entire Canvas to remount = flash, lost state, reloaded assets.
// BAD
function App() {
const [uiState, setUiState] = useState(false) // re-renders remount Canvas
return (
<>
<button onClick={() => setUiState(!uiState)}>Toggle</button>
<Canvas><Scene config={uiState} /></Canvas>
</>
)
}
// GOOD -- isolate Canvas in its own component
function App() {
return (
<>
<UI />
<SceneCanvas />
</>
)
}
Loaders (useGLTF, useTexture, useLoader) throw promises. Without Suspense, you get crashes.
// BAD
<Canvas>
<Model /> {/* useGLTF inside -- will throw */}
</Canvas>
// GOOD
<Canvas>
<Suspense fallback={<Loader />}>
<Model />
</Suspense>
</Canvas>
Three.js and React Three Fiber sub-skill - 3D scenes, shaders, postprocessing.
---name: threejs-r3fdescription: Three.js and React Three Fiber sub-skill - 3D scenes, shaders, postprocessing.---# skills/_jutsu/threejs-r3f/SKILL.mdFAQ
Téléchargez skills/_jutsu/threejs-r3f/SKILL.md auprès de l'éditeur, ou copiez le chemin et ouvrez le dépôt. PlugMCP répertorie le skill et n'héberge pas le fichier.
L'éditeur le maintient sur https://github.com/AThevon/genjutsu.
Claude, Cursor, Codex et Grok Build peuvent lire un SKILL.md que vous ajoutez depuis le dépôt de l'éditeur. Grok Bot l'installe lorsque vous envoyez dans un chat le lien du dossier GitHub du skill.