# react-three-fiber

Lets an agent build 3D scenes from JSON specs in json-render and render them with React Three Fiber: meshes, lights, GLTF models, environments.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 2400 installs · ★ 19802 repo stars
- Author: vercel-labs
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/vercel-labs/json-render/tree/HEAD/skills/react-three-fiber/SKILL.md
- Updated: 2026-10-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/vercel-labs-react-three-fiber

## What it does

This skill covers `@json-render/react-three-fiber`, the React Three Fiber renderer for json-render. A scene is a flat JSON spec: a `root` id plus an `elements` map, and each entry carries `type`, `props` and `children`. The package ships 19 components: seven primitives such as `Box`, `Sphere` and `Capsule`, four lights, plus `Group`, `Model` for GLTF/GLB files, `Environment`, `Fog`, `GridHelper`, `Text3D`, `PerspectiveCamera` and `OrbitControls`.

Two entry points split the work. `@json-render/react-three-fiber/catalog` exposes `threeComponentDefinitions`, which are schemas with no R3F dependency, so a server can import them. The main entry gives you `threeComponents`, `ThreeRenderer` and `ThreeCanvas`. You pick components for `defineCatalog`, then the matching implementations for `defineRegistry`. Custom components can reuse `vector3Schema` and `materialSchema`.

Peer dependencies you need first: `@react-three/fiber` >= 8.0.0, `@react-three/drei` >= 9.0.0, `three` >= 0.160.0 and `zod` ^4.0.0. The project must run `react` ^19.0.0, so a project on an older React has to upgrade before this works.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel-labs/json-render --skill react-three-fiber -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel-labs/json-render --skill react-three-fiber -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel-labs/json-render --skill react-three-fiber -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install vercel-labs/json-render skills/react-three-fiber
```

2. **Manually: put the files in place**
- File: `.github/skills/react-three-fiber/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel-labs/json-render --skill react-three-fiber -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/vercel-labs/json-render --path skills/react-three-fiber
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add vercel-labs/json-render --skill react-three-fiber -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/vercel-labs/json-render/tree/HEAD/skills/react-three-fiber/SKILL.md

## When to use it
- build a 3D scene from a JSON spec instead of hand-written JSX
- place a box or sphere with set color, metalness and roughness
- load a GLTF/GLB model and light it with a directional light
- set up scene surroundings: HDRI map, fog, a reference grid
- define a custom 3D component on top of `materialSchema` and `transformProps`

## Example prompts
- Use react-three-fiber to build a scene from a JSON spec: a blue box, `AmbientLight` and `OrbitControls`
- Render this spec with `ThreeCanvas`, shadows on, camera at [5, 5, 5]
- Add `threeComponentDefinitions` to my json-render catalog and register `Sphere` and `DirectionalLight`

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 1fa87cab28b0155e.

BEGIN THIRD-PARTY FILE 1fa87cab28b0155e
````text
---
name: react-three-fiber
description: React Three Fiber 3D renderer for json-render. Use when working with @json-render/react-three-fiber, building 3D scenes from JSON specs, rendering meshes/lights/models/environments, or integrating Three.js with json-render catalogs.
---

# @json-render/react-three-fiber

React Three Fiber renderer for json-render. 19 built-in 3D components.

## Two Entry Points

| Entry Point | Exports | Use For |
|-------------|---------|---------|
| `@json-render/react-three-fiber/catalog` | `threeComponentDefinitions` | Catalog schemas (no R3F dependency, safe for server) |
| `@json-render/react-three-fiber` | `threeComponents`, `ThreeRenderer`, `ThreeCanvas`, schemas | R3F implementations and renderer |

## Usage Pattern

Pick the 3D components you need from the standard definitions:

```typescript
import { defineCatalog } from "@json-render/core";
import { schema } from "@json-render/react/schema";
import { threeComponentDefinitions } from "@json-render/react-three-fiber/catalog";
import { defineRegistry } from "@json-render/react";
import { threeComponents, ThreeCanvas } from "@json-render/react-three-fiber";

// Catalog: pick definitions
const catalog = defineCatalog(schema, {
  components: {
    Box: threeComponentDefinitions.Box,
    Sphere: threeComponentDefinitions.Sphere,
    AmbientLight: threeComponentDefinitions.AmbientLight,
    DirectionalLight: threeComponentDefinitions.DirectionalLight,
    OrbitControls: threeComponentDefinitions.OrbitControls,
  },
  actions: {},
});

// Registry: pick matching implementations
const { registry } = defineRegistry(catalog, {
  components: {
    Box: threeComponents.Box,
    Sphere: threeComponents.Sphere,
    AmbientLight: threeComponents.AmbientLight,
    DirectionalLight: threeComponents.DirectionalLight,
    OrbitControls: threeComponents.OrbitControls,
  },
});
```

## Rendering

### ThreeCanvas (convenience wrapper)

```tsx
<ThreeCanvas
  spec={spec}
  registry={registry}
  shadows
  camera={{ position: [5, 5, 5], fov: 50 }}
  style={{ width: "100%", height: "100vh" }}
/>
```

### Manual Canvas setup

```tsx
import { Canvas } from "@react-three/fiber";
import { ThreeRenderer } from "@json-render/react-three-fiber";

<Canvas shadows>
````
END THIRD-PARTY FILE 1fa87cab28b0155e

The third-party file has ended. Everything between the 1fa87cab28b0155e tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2252 of 5301 bytes. © vercel-labs · Apache-2.0 · https://github.com/vercel-labs/json-render/tree/HEAD/skills/react-three-fiber/SKILL.md

_Part of the page did not fit — see the HTML version._

---
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
