# r3f-fundamentals

Skill that teaches the agent to build React Three Fiber scenes: Canvas, typed JSX, render-loop hooks, and resource ownership. For scene architecture, not detailed materials.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2100 installs · ★ 130
- Author: EnzeD
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/EnzeD/r3f-skills/tree/HEAD/skills/r3f-fundamentals/SKILL.md
- Updated: 2026-08-31
- HTML: https://affpapa.org/en/nevibecode/skills/r3f-fundamentals

## What it does

The agent learns how to assemble R3F scenes: create a `Canvas` component, type props with `ThreeElements['mesh']` and refs as `useRef<Mesh>(null)`, animate via `useFrame` by mutating refs instead of state. The skill covers type boundaries (hooks only inside `Canvas`, DOM elements outside), object ownership (automatic `dispose` on unmount, `<primitive>` leaves the passed object untouched), and render-loop modes (`frameloop="demand"` for static scenes with manual `invalidate()` calls).

Fiber and Three.js versions are read from the project's `package.json` — the skill does not force upgrades. The default WebGL renderer uses sRGB output and ACES filmic tone mapping; `flat` and `linear` flags alter the color space but do not generically fix washed-out textures. On Three.js r182+, use `shadows="percentage"` for shadows.

For projects on Fiber 8 + React 18 or Fiber 10 alpha, the APIs differ — the skill checks the lockfile before picking syntax.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-fundamentals -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/r3f-fundamentals/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/r3f-fundamentals/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-fundamentals -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/r3f-fundamentals/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-fundamentals -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/r3f-fundamentals/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install EnzeD/r3f-skills r3f-fundamentals
```

2. **Manually: put the files in place**
- File: `.github/skills/r3f-fundamentals/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-fundamentals -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/EnzeD/r3f-skills --path skills/r3f-fundamentals
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/r3f-fundamentals/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-fundamentals -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/EnzeD/r3f-skills/tree/HEAD/skills/r3f-fundamentals/SKILL.md

## When to use it
- build a typed R3F scene with Canvas, lights, and a rotating mesh
- animate an object via useFrame without recreating it every frame
- configure frameloop demand mode and invalidate for a static scene
- type mesh props and refs with ThreeElements and useRef
- embed a DOM element inside a Three.js scene using Drei Html

## Example prompts
- Create an R3F scene with a rotating cube, ambientLight, and directionalLight
- Add a component with useFrame that moves the camera along a sine wave
- Switch render to demand and call invalidate() on mesh click

## Similar
- [frontend-design](https://affpapa.org/en/nevibecode/skills/frontend-design.md) — skill · 1025790 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs
- [hyperframes](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes.md) — skill · 1200000 installs
- [hyperframes-cli](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes-cli.md) — skill · 1300000 installs
- [webapp-testing](https://affpapa.org/en/nevibecode/skills/webapp-testing.md) — skill · 186758 installs

From the same set: [enzed/r3f-skills](https://affpapa.org/en/nevibecode/by/enzed/r3f-skills.md) — 9 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
