Skip to main content
skill CX Codex

react-three-fiber · vercel-labs — Claude Code skill: what it does, how to install

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

Apache-2.0 2,400 installs ★ 19,802 updated 2026-10-24

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add vercel-labs/json-render --skill react-three-fiber -a claude-code
Open on GitHub

What react-three-fiber 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.

What it helps with

  • 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 for the agent

  • 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

How to install react-three-fiber

1Skills CLI (Vercel)

npx skills add vercel-labs/json-render --skill react-three-fiber -a claude-code

2Manually: put the files in place

~/.claude/skills/react-three-fiber/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/react-three-fiber/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about react-three-fiber

How do I install react-three-fiber in Claude Code?

Run npx skills add vercel-labs/json-render --skill react-three-fiber -a claude-code. The skill ends up at ~/.claude/skills/react-three-fiber/SKILL.md.

What does react-three-fiber do?

It teaches the agent to build 3D scenes for json-render from JSON specs: which of the 19 components to pick, how to wire the catalog and registry, and how to display the result with ThreeCanvas or ThreeRenderer.

What does react-three-fiber need to run?

Peer dependencies: @react-three/fiber >= 8.0.0, @react-three/drei >= 9.0.0, three >= 0.160.0, react ^19.0.0 and zod ^4.0.0.

Source text

SKILL.md · Apache-2.0
---
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>
  <ThreeRenderer spec={spec} registry={registry}>
    {/* Additional R3F elements */}
  </ThreeRenderer>
</Canvas>
```

## Available Components (19)

### Primitives (7)
- `Box` -- width, height, depth, material
- `Sphere` -- radius, widthSegments, heightSegments, material
- `Cylinder` -- radiusTop, radiusBottom, height, material
- `Cone` -- radius, height, material
- `Torus` -- radius, tube, material
- `Plane` -- width, height, material
- `Capsule` -- radius, length, material

All primitives share: `position`, `rotation`, `scale`, `castShadow`, `receiveShadow`, `material`.

### Lights (4)
- `AmbientLight` -- color, intensity
- `DirectionalLight` -- position, color, intensity, castShadow
- `PointLight` -- position, color, intensity, distance, decay
- `SpotLight` -- position, color, intensity, angle, penumbra

### Other (8)
- `Group` -- container with position/rotation/scale, supports children
- `Model` -- GLTF/GLB loader via url prop
- `Environment` -- HDRI environment map (preset, background, blur, intensity)
- `Fog` -- linear fog (color, near, far)
- `GridHelper` -- reference grid (size, divisions, color)
- `Text3D` -- SDF text (text, fontSize, color, anchorX, anchorY)
- `PerspectiveCamera` -- camera (position, fov, near, far, makeDefault)
- `OrbitControls` -- orbit controls (enableDamping, enableZoom, autoRotate)

## Shared Schemas

Reusable Zod schemas for custom 3D catalog definitions:

```typescript
import { vector3Schema, materialSchema, transformProps, shadowProps } from "@json-render/react-three-fiber";
import { z } from "zod";

// Custom 3D component
const myComponentDef = {
  props: z.object({
    ...transformProps,
    ...shadowProps,
    material: materialSchema.nullable(),
    myCustomProp: z.string(),
  }),
  description: "My custom 3D component",
};
```

## Material Schema

```typescript
materialSchema = z.object({
  color: z.string().nullable(),         // default "#ffffff"
  metalness: z.number().nullable(),     // default 0
  roughness: z.number().nullable(),     // default 1
  emissive: z.string().nullable(),      // default "#000000"
  emissiveIntensity: z.number().nullable(), // default 1
  opacity: z.number().nullable(),       // default 1
  transparent: z.boolean().nullable(),  // default false
  wireframe: z.boolean().nullable(),    // default false
});
```

## Spec Format

3D specs use the standard json-render flat element format:

```json
{
  "root": "scene",
  "elements": {
    "scene": {
      "type": "Group",
      "props": { "position": [0, 0, 0] },
      "children": ["light", "box"]
    },
    "light": {
      "type": "AmbientLight",
      "props": { "intensity": 0.5 },
      "children": []
    },
    "box": {
      "type": "Box",
      "props": {
        "position": [0, 0.5, 0],
        "material": { "color": "#4488ff", "metalness": 0.3, "roughness": 0.7 }
      },
      "children": []
    }
  }
}
```

## Dependencies

Peer dependencies required:
- `@react-three/fiber` >= 8.0.0
- `@react-three/drei` >= 9.0.0
- `three` >= 0.160.0
- `react` ^19.0.0
- `zod` ^4.0.0

© vercel-labs · Apache-2.0 · vercel-labs/json-render

Similar skills

All skills for Frontend and UI →

react-three-fiber by other authors comes first.

From the same set30

The whole set →
directives Pre-built directives for json-render: formatting, math, string handling, i18n. Wire them into your catalog and renderer with one import. CX Codex +1 8,100installs mcp This skill helps build MCP servers that render interactive json-render UIs in Claude, ChatGPT, Cursor, and VS Code. CX Codex +1 5,900installs react-native This skill turns JSON specs into native React Native mobile UIs. Use it when screens need state bindings, conditional visibility, and actions. CX Codex +1 3,300installs react-pdf Renders PDF documents from JSON specs using @react-pdf/renderer. Use it when you need to build invoices, reports, or forms programmatically from structured data. CX Codex +1 2,400installs remotion-best-practices remotion-best-practices is a Claude Code skill that loads rules for creating videos with Remotion, the React-based library, covering animation, sequencing, audio, 3D and transitions. CX Codex +1 1,600installs zustand This skill integrates Zustand into json-render to sync application state. Use it when your project already relies on Zustand and you need to connect it with components rendered by json-render. CX Codex +1 1,900installs remotion Turns JSON timeline specs into ready-made video compositions via Remotion. Use it when you need to generate videos programmatically or assemble video clip catalogs from data. CX Codex +1 1,800installs image Turns JSON specs into SVG and PNG images via Satori. Useful for generating OG images, social cards, and rendering AI-generated image specs. CX Codex +1 1,600installs

More in the catalog

Project sponsors

Companies that keep this analytics open