R3

r3f_component_gen

Standardized templates for creating optimized, high-performance 3D components in R3F.

Install

mkdir -p .claude/skills/r3f-component-gen && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18403" && unzip -o skill.zip -d .claude/skills/r3f-component-gen && rm skill.zip

Installs to .claude/skills/r3f-component-gen

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Templates and standards for creating high-performance 3D components using React Three Fiber.
92 charsno explicit “when” trigger
Advanced

Key capabilities

  • Generate particle systems with Points and PointMaterial
  • Create efficient instanced meshes for multiple objects
  • Render connection lines between points
  • Optimize performance by limiting pixel ratio
  • Ensure responsiveness by adjusting particle counts based on viewport
  • Apply Neon/Cyberpunk color palettes

How it works

The skill provides templates and standards for creating high-performance 3D components in React Three Fiber, enforcing a single-Canvas architecture. It uses `Points` and `PointMaterial` for particle systems and `instancedMesh` for multiple objects.

Inputs & outputs

You give it
Request for a 3D component (e.g., particle system, instanced mesh, connection lines)
You get back
High-performance 3D components using React Three Fiber

When to use r3f_component_gen

  • Creating 3D particle systems
  • Implementing R3F templates
  • Optimizing 3D component performance

About this skill

R3F Component Generator Skill

This skill provides the blueprint for "Neural Flux" 3D components.

IMPORTANT: This project uses a single-Canvas architecture. Only NeuralBackground.jsx has a <Canvas>. Do NOT create additional Canvas instances.

🎨 Scene Standards

  • Performance: Always limit pixel ratio.
    <Canvas
      dpr={[1, 1.5]}
      gl={{ antialias: true, alpha: true, powerPreference: 'high-performance' }}
      camera={{ position: [0, 0, 10], fov: 60 }}
    >
    
  • Responsiveness: Adjust particle counts based on viewport:
    const PARTICLE_COUNT_DESKTOP = 1500
    const PARTICLE_COUNT_MOBILE = 500
    // Use window.matchMedia('(max-width: 768px)') to switch
    

🧩 Templates

1. Particle System (Points + PointMaterial from drei)

Used in NeuralParticles — the primary particle visualization:

import { Points, PointMaterial } from '@react-three/drei'
import * as THREE from 'three'

function NeuralParticles({ particleCount }) {
  const ref = useRef()
  const [positions] = useMemo(() => {
    const pos = new Float32Array(particleCount * 3)
    for (let i = 0; i < particleCount; i++) {
      const theta = Math.random() * Math.PI * 2
      const phi = Math.acos((Math.random() * 2) - 1)
      const radius = 3 + Math.random() * 8
      pos[i * 3] = radius * Math.sin(phi) * Math.cos(theta)
      pos[i * 3 + 1] = radius * Math.sin(phi) * Math.sin(theta)
      pos[i * 3 + 2] = radius * Math.cos(phi)
    }
    return [pos]
  }, [particleCount])

  useFrame((state, delta) => {
    ref.current.rotation.y += delta * 0.05  // Use delta for frame-rate independence
  })

  return (
    <Points ref={ref} positions={positions} stride={3} frustumCulled={true}>
      <PointMaterial transparent size={0.015} sizeAttenuation depthWrite={false}
        blending={THREE.AdditiveBlending} opacity={0.8} />
    </Points>
  )
}

2. Instanced Mesh (for multiple objects)

Used in GlowingOrbs — efficient rendering of 5 colored wireframe orbs:

function GlowingOrbs() {
  const meshRef = useRef()
  const geometry = useMemo(() => new THREE.IcosahedronGeometry(1, 1), [])
  const dummy = useMemo(() => new THREE.Object3D(), [])

  useEffect(() => {
    orbs.forEach((orb, i) => {
      meshRef.current.setColorAt(i, new THREE.Color(orb.color))
    })
    meshRef.current.instanceColor.needsUpdate = true
  }, [orbs])

  useFrame((state, delta) => {
    orbs.forEach((orb, i) => {
      dummy.position.set(orb.x, orb.y + Math.sin(state.clock.elapsedTime + orb.phase) * 0.5, orb.z)
      dummy.updateMatrix()
      meshRef.current.setMatrixAt(i, dummy.matrix)
    })
    meshRef.current.instanceMatrix.needsUpdate = true
  })

  return (
    <instancedMesh ref={meshRef} args={[geometry, null, orbs.length]} frustumCulled={false}>
      <meshBasicMaterial transparent opacity={0.3} wireframe vertexColors />
    </instancedMesh>
  )
}

3. Line Segments (connection lines)

Used in ConnectionLines — decorative lines between points:

function ConnectionLines() {
  const geometry = useMemo(() => {
    const points = []
    for (let i = 0; i < 20; i++) {
      // Push start and end positions as flat arrays
      points.push(x1, y1, z1, x2, y2, z2)
    }
    const geo = new THREE.BufferGeometry()
    geo.setAttribute('position', new THREE.Float32BufferAttribute(points, 3))
    return geo
  }, [])

  return (
    <lineSegments geometry={geometry}>
      <lineBasicMaterial color="#6366f1" transparent opacity={0.15} />
    </lineSegments>
  )
}

⚠️ "Wow Factor" Checklist

  1. Motion: Is it moving? Static 3D is boring. Add useFrame rotation or floating.
  2. Interaction: Does it react to the mouse? Use mouseRef from MouseContext (NOT useState).
  3. Material: Use Neon/Cyberpunk palette from CSS vars (--neon-violet, --neon-cyan).
  4. Performance: Use delta parameter in useFrame for frame-rate independence.
  5. Cleanup: Memoize geometry/materials with useMemo — never create in render body.

When not to use it

  • When multiple Canvas instances are required in the project.
  • When static 3D scenes are acceptable.

Limitations

  • The project uses a single-Canvas architecture.
  • Static 3D is considered boring and motion is prioritized.
  • Geometry and materials should be memoized with `useMemo`.

How it compares

This skill provides specific templates and standards for high-performance 3D components with a single-Canvas architecture, unlike a generic R3F development approach.

Compared to similar skills

r3f_component_gen side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
r3f_component_gen (this skill)05moNo flagsAdvanced
rendering-animate-svg136moNo flagsBeginner
react-native-r3f04moNo flagsAdvanced
nextjs-developer3282moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

rendering-animate-svg

TheOrcDev

Wrap animated SVG elements in a div to enable hardware acceleration. Apply when animating SVG icons or elements, especially in 8-bit retro components with pixel art animations.

1348

react-native-r3f

TheMystic07

Expert guidance for React Three Fiber development with React, Vite, Tailwind CSS, and three.js

00

nextjs-developer

zenobi-us

Expert Next.js developer mastering Next.js 14+ with App Router and full-stack features. Specializes in server components, server actions, performance optimization, and production deployment with focus on building fast, SEO-friendly applications.

328531

frontend-developer

sickn33

Build React components, implement responsive layouts, and handle client-side state management. Masters React 19, Next.js 15, and modern frontend architecture. Optimizes performance and ensures accessibility. Use PROACTIVELY when creating UI components or fixing frontend issues.

2782

3d-web-experience

davila7

Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.

3570

tamagui

tamagui

Universal React UI framework for web and native. Use when building cross-platform apps with Tamagui, creating styled components with `styled()`, configuring design tokens/themes, using Tamagui UI components, or working with animations. Triggers: "tamagui", "styled()", "$token", "XStack/YStack", "useTheme", "@tamagui/*" imports, "createStyledContext", "variants".

2478

Search skills

Search the agent skills registry