Skip to content
Frontend
Skill

/next

Next.js renderer for json-render that turns JSON specs into full Next.js applications with routes, layouts, SSR, and metadata. Use when working with @json-render/next, building Next.js apps from JSON specs, or creating AI-generated multi-page applications.

From plugin
json-render
19k31 skills

Claude Code

$ npx -y skills add vercel-labs/json-render --skill next --agent claude-code

SKILL.md

next.SKILL.md
name: next
description: Next.js renderer for json-render that turns JSON specs into full Next.js applications with routes, layouts, SSR, and metadata. Use when working with @json-render/next, building Next.js apps from JSON specs, or creating AI-generated multi-page applications.

@json-render/next

Next.js renderer that converts JSON specs into full Next.js applications with routes, pages, layouts, metadata, and SSR support.

Quick Start

npm install @json-render/core @json-render/react @json-render/next

1. Define Your Spec

// lib/spec.ts
import type { NextAppSpec } from "@json-render/next";

export const spec: NextAppSpec = {
  metadata: {
    title: { default: "My App", template: "%s | My App" },
    description: "A json-render Next.js application",
  },
  layouts: {
    main: {
      root: "shell",
      elements: {
        shell: { type: "Container", props: {}, children: ["nav", "slot"] },
        nav: { type: "NavBar", props: { links: [
          { href: "/", label: "Home" },
          { href: "/about", label: "About" },
        ]}, children: [] },
        slot: { type: "Slot", props: {}, children: [] },
      },
    },
  },
  routes: {
    "/": {
      layout: "main",
      metadata: { title: "Home" },
      page: {
        root: "hero",
        elements: {
          hero: { type: "Card", props: { title: "Welcome" }, children: [] },
        },
      },
    },
    "/about": {
      layout: "main",
      metadata: { title: "About" },
      page: {
        root: "content",
        elements: {
          content: { type: "Card", props: { title: "About Us" }, children: [] },
        },
      },
    },
  },
};

2. Create the App

// lib/app.ts
import { createNextApp } from "@json-render/next/server";
import { spec } from "./spec";

export const { Page, generateMetadata, generateStaticParams } = createNextApp({
  spec,
  loaders: {
    // Server-side data loaders (optional)
    loadPost: async ({ slug }) => {
      const post = await getPost(slug as string);
      return { post };
    },
  },
});

3. Wire Up Route Files

// app/[[...slug]]/page.tsx
export { Page as default, generateMetadata, generateStaticParams } from "@/lib/app";
// app/[[...slug]]/layout.tsx
import { NextAppProvider } from "@json-render/next";
import { registry, handlers } from "@/lib/registry";

export default function Layout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <NextAppProvider registry={registry} handlers={handlers}>
          {children}
        </NextAppProvider>
      </body>
    </html>
  );
}

Key Concepts

NextAppSpec

The top-level spec defines an entire Next.js application:

  • **metadata**: Root-level SEO metadata (title template, description, OpenGraph)
  • **layouts**: Reusable layout element trees (each must include a `Slot` component)
  • **routes**: Route definitions keyed by URL pattern
  • **state**: Global initial state shared across all routes

Route Patterns

Routes use Next.js URL conventions:

  • `"/"` -- home page
  • `"/about"` -- static route
  • `"/blog/[slug]"` -- dynamic segment
  • `"/docs/[...path]"` -- catch-all segment
  • `"/settings/[[...path]]"` -- optional catch-all segment

Layouts

Layouts wrap page content. Every layout MUST include a `Slot` component where page content will be rendered. Layouts are defined once in `spec.layouts` and referenced by routes via the `layout` field.

Built-in Components

  • **Slot**: Placeholder in layouts where page content is rendered
  • **Link**: Client-side navigation link (wraps `next/link`)

Built-in Actions

  • **setState**: Update state value. Params: `{ statePath, value }`
  • **pushState**: Append to array. Params: `{ statePath, value, clearStatePath? }`
  • **removeState**: Remove from array by index. Params: `{ statePath, index }`
  • **navigate**: Client-side navigation. Params: `{ href }`

Data Loaders

Server-side async functions that run in the Server Component before rendering. Results are merged into the page's initial state.

createNextApp({
  spec,
  loaders: {
    loadPost: async ({ slug }) => {
      const post = await db.post.findUnique({ where: { slug } });
      return { post };
    },
  },
});

SSR

Pages are server-rendered automatically. The `createNextApp` `Page` component is an async Server Component that:

1. Matches the route from the spec 2. Runs server-side data loaders 3. Generates metadata 4. Passes the resolved spec to the client renderer for hydration

Entry Points

  • `@json-render/next` -- Client components (NextAppProvider, PageRenderer, Link)
  • `@json-render/next/server` -- Server utilities (createNextApp, matchRoute, schema)

API Reference

Server Exports (`@json-render/next/server`)

  • `createNextApp(options)` -- Create Page, generateMetadata, generateStaticParams
  • `schema` -- Custom schema for Next.js apps (for AI catalog generation)
  • `matchRoute(spec, pathname)` -- Match a URL to a route spec
  • `resolveMetadata(spec, route)` -- Resolve metadata for a route
  • `slugToPath(slug)` -- Convert catch-all slug array to pathname
  • `collectStaticParams(spec)` -- Collect static params for all routes

Client Exports (`@json-render/next`)

  • `NextAppProvider` -- Context provider for registry and handlers
  • `PageRenderer` -- Renders a page spec with optional layout
  • `NextErrorBoundary` -- Error boundary component
  • `NextLoading` -- Loading state component
  • `NextNotFound` -- Not-found component
  • `Link` -- Built-in navigation component (wraps next/link)
Read more
@vercel-labs-2
Ships withjson-render

The Generative UI framework. Generate dynamic, personalized UIs from prompts without sacrificing reliability. Predefined components and actions for safe, predictable output.

Stars on GitHub

Momentum

stars in total
18.9k
Star history of vercel-labs/json-render on GitHub, a chart by star-history.com

Other skills on json-render.

codegen

codegen

Code generation utilities for json-render. Use when generating code from UI specs, building custom code exporters, traversing…

core

core

Core package for defining schemas, catalogs, and AI prompt generation for json-render. Use when working with @json-render/core,…

More skills from other plugins.

next-bundle-optimizer
Auto-invoked

next-bundle-optimizer

Audit and reduce Next.js browser initial-load work. Use for slow route startup, oversized client bundles, duplicate browser…

nextjs1d143k
@vercel@vercelInstall Skill
migrate-radix-to-base

migrate-radix-to-base

Migrates React projects and components from Radix UI to Base UI. Use when asked to migrate from radix, move to base-ui, convert…

ui10d127k
@shadcn-ui@shadcn-uiInstall Skill
chrome-release-cls

chrome-release-cls

Given a Chrome Releases blog post URL (chromereleases.googleblog.com), extract every CVE/bug and find the underlying Gerrit CL…

electron1d124k
@electron@electronInstall Skill
taste-skill
Auto-invoked

taste-skill

tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One…

@leonxlnx@leonxlnxInstall Skill

Questions about next.

Which coding agents can use next?
next installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.