Agent skill
json-render-expert
Install this agent skill to your Project
npx add-skill https://github.com/YuniorGlez/gemini-elite-core/tree/main/skills/json-render-expert
SKILL.md
🚀 json-render-expert (v1.1.0)
Executive Summary
json-render (by Vercel Labs) is the 2026 standard for Guardrailed AI User Interfaces. Unlike raw LLM generations that often hallucinate or break, json-render forces AI models to work within a strictly defined Catalog of components validated by Zod. It specializes in JSONL Patch Streaming, allowing React components to render incrementally as bits of data arrive, ensuring sub-300ms perceived latency.
📋 Table of Contents
- Core Architecture
- The Catalog (The Guardrail)
- Next.js Integration
- Streaming Implementation (Native SDK)
- The "Do Not" List (Anti-Patterns)
- Standard Production Patterns
- Reference Library
🏗 Core Architecture
json-render operates on a three-pillar system:
- @json-render/core: The engine that handles state, data binding, and JSONL patch application.
- @json-render/react: The renderer that maps JSON schema to React 19 components.
- @json-render/codegen: Tool for exporting AI-generated state into pure React code.
The "State-to-UI" Loop
- AI Model generates JSONL Patches.
JSONRenderoruseUIStreamclient accumulates patches into a Virtual State.- Components render dynamically based on the Registry whitelist.
🛡 The Catalog (The Guardrail)
The Catalog defines what the AI can build.
Defining a Component
import { z } from 'zod';
export const catalog = {
components: {
MetricCard: {
schema: z.object({
title: z.string(),
value: z.number(),
}),
description: 'Display KPIs.',
}
}
};
⚡ Next.js Integration
Optimized for Next.js 16+ App Router.
Server (app/api/render/route.ts):
import { GoogleGenAI } from "@google/genai";
export async function POST(req: Request) {
const { prompt } = await req.json();
const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
const result = await client.models.generateContentStream({
model: "models/gemini-3-flash-preview",
contents: [{ role: "user", parts: [{ text: prompt }] }]
});
const stream = new ReadableStream({
async start(controller) {
for await (const chunk of result.stream) {
if (chunk.text) controller.enqueue(new TextEncoder().encode(chunk.text));
}
controller.close();
}
});
return new Response(stream);
}
🤖 Streaming Implementation (Native & Hook)
In 2026, we prefer the official useUIStream hook for robust parsing.
Client-side Implementation
'use client';
import { Renderer, JSONUIProvider, useUIStream } from '@json-render/react';
import { registry } from './registry';
export function AIInterface() {
const { tree, isStreaming, send } = useUIStream({ api: '/api/render' });
return (
<JSONUIProvider registry={registry}>
<Renderer
tree={tree}
registry={registry}
loading={isStreaming}
/>
</JSONUIProvider>
);
}
🚫 The "Do Not List" (Anti-Patterns)
| Anti-Pattern | Why it fails in 2026 | Modern Alternative |
|---|---|---|
| catalog prop in Provider | Not supported in v0.2.0 | Pass registry to JSONUIProvider instead. |
| Manual Stream Parsing | Error-prone for partial JSON | Use useUIStream hook. |
| Blocking Renders | Poor UX | Use JSONL Patch Streaming. |
| Mixing Logic | Security risk | Use Actions for logic. |
🛠 Standard Production Patterns
Pattern A: Multi-Turn UI Updates
Send the current tree back to the AI as context to request minimal patches.
Pattern B: Registry Override
Override how a catalog component is rendered locally without changing the catalog.
Pattern C: Native Visibility
Control UI based on external factors using the VisibilityProvider context.
📖 Reference Library
- API Reference
- Catalog Design
- Next.js Optimization
- Streaming Patterns
Updated: January 22, 2026 - 19:55
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
filesystem-context
Uso del sistema de archivos como extensión de la ventana de contexto, persistencia de planes, comunicación entre sub-agentes y carga dinámica de habilidades.
git-flow
Senior Workflow Architect. Master of Trunk-Based Development, Stacked Changes, and 2026 Branching Strategies.
track-master
Senior Progress Analyst & Conductor Strategist. Expert in Predictive Project Tracking and Agentic Milestone Management for 2026.
artifact-janitor
Senior Build Cleanup & System Optimization Specialist. Expert in reclaiming disk space and resolving build corruption in 2026 ecosystems.
openapi-pro
Senior API Architect & Integration Engineer for 2026. Specialized in Type-Safe API contracts using OpenAPI 3.1, Zod-First schema derivation, and automated TypeScript client generation. Expert in bridging the gap between Hono backends and Next.js 16 frontends using `openapi-fetch`, `orval`, and unified monorepo type-sharing.
seo-pro
Senior SEO Architect & Content Strategist. Expert in SGE Optimization, E-E-A-T Standards, and Semantic Entity SEO for 2026.
Didn't find tool you were looking for?