Index of every page on this site: llms.txt
All skills
nikunjkothiya avatar

/threejs-engineering

@c9e2b62
Run it yourself

Implement browser 3D experiences with Three.js or an existing React Three Fiber stack. Use for scene lifecycle, asset loading, canvas and DOM integration, picking, animation loops, rendering configuration, and GPU resource ownership. Pair with the relevant visual specialist for geometry, motion, materials, lighting, or composition decisions.

Use this Skill: https://skilld.dev/gh/nikunjkothiya/gpt-6-astra-skills/threejs-engineering

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesreact-three-fiber.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

React Three Fiber integration

Read only when the host uses React Three Fiber. Check the installed React, Fiber, Drei, and Three.js versions and their peer requirements. The published stable and /next/ documentation can differ in scheduling, event behavior, and renderer lifecycle; follow the branch matching the package lockfile.

Divide declarative and continuous state

Use React state for product intent and discrete UI state. Use scene refs and the Fiber frame callback for continuous transforms. Keep one owner for each property: a JSX position prop, drag handler, and independent animation library must not all write the same position. Subscribe to only the state needed by a component and reuse vectors in hot paths.

useFrame participates in Fiber's rendering loop. Do not create an additional renderer animation loop inside a child. React rerenders are inappropriate as a per-frame animation mechanism. A custom rendering callback that takes over rendering also owns the full render pipeline it replaces. Check the installed useFrame signature and priority semantics. Fiber hooks

Make demand rendering complete

For scenes that settle, use frameloop="demand". Mutating a Three.js object imperatively does not itself notify React. Call invalidate() when input or a loaded asset changes the scene and request further frames while a transition remains active. Fiber coalesces invalidations; they request a future frame rather than rendering synchronously. Controls and external animation libraries must participate in this scheduling. Drei controls may already provide the needed invalidation. Scaling performance

For an animation started from a long idle interval, establish its initial visible pose and time origin deliberately. Do not let a stale clock delta jump past the first meaningful movement. Ensure the exact endpoint is rendered before becoming idle. Reduced motion should reach the valid application state and still invalidate that final render.

Respect event semantics

Fiber raycasting can send a pointer event to more than one intersected object. Use stopPropagation() when the selected interaction should exclude objects behind it. Pointer capture is accessed through the event target, and its semantics differ from DOM capture; verify multi-pointer support in the installed major version. Fiber events

Handle release, cancel, lost capture, and unmount. If object dragging owns the gesture, coordinate camera controls accordingly. Shared DOM/canvas event sources need consistent coordinate computation; a nested overlay can change offsetX/offsetY. Prefer client coordinates relative to the canvas region when appropriate, as described in the input reference.

Respect cache and disposal ownership

Declaratively created scene resources generally follow Fiber's disposal lifecycle. A primitive carrying an external object needs an explicit owner; do not assume it disposes that object on unmount. A Three.js object can have only one parent, so render multiple instances through suitable clones or instancing. Shared cached geometries and materials still need a common lifetime policy. Use dispose={null} only when a separate owner actually manages those resources. Objects and disposal

Treat cached loader results as shared. Clone the material for a per-instance appearance change, preserving an owner that later disposes it. Do not dispose a cache entry while another live instance uses it. Effects that construct controls, listeners, or subscriptions must clean them up correctly through repeated mount/cleanup cycles.

Use Suspense/loading feedback and an error boundary at a useful product boundary. Keep the DOM's essential content available while assets load. Handle unsupported rendering and recovery without trapping the user in an empty canvas. Confirm custom renderer ownership against the installed Canvas API. Canvas configuration

Verify a prop change during animation, rapid selection, multiple instances of a cached asset, remount, a decoder failure, idle settling, and the host's development lifecycle. Observe actual rendering after an imperative update; a correct value in a ref does not establish that a new frame appeared.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts22d3 checks · Risk SAFE
  • Gen Agent Trust Hub22d

    The skill provides technical implementation guidance for Three.js and React Three Fiber, focusing on scene management, rendering, and input handling. It contains no malicious code or suspicious patterns.

  • Socket22d

    No alerts

  • Snyk22d

    Risk: LOW · No issues

Signed by skilld at c9e2b62. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 2 months ago

README badge

README badge for nikunjkothiya/gpt-6-astra-skills/threejs-engineering