Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
vercel-labs avatar

Codegen

  • 2.8k installs
  • 15.8k repo stars
  • Updated July 8, 2026
  • vercel-labs/json-render

codegen is an agent skill providing @json-render/codegen utilities to traverse UI specs and emit framework code files.

About

The codegen skill documents @json-render/codegen utilities for generating code from json-render UI trees when building custom exporters for Next.js, Remix, or other frameworks. It covers depth-first traverseSpec walks, collectUsedComponents, collectStatePaths, and collectActions helpers for spec introspection. Serialization APIs include serializePropValue, serializeProps, escapeString, and SerializeOptions for quotes and indent control. Types define GeneratedFile and CodeGenerator interfaces returning path and content file arrays. A sample generateNextJSProject function demonstrates collecting components, traversing the spec, and emitting package.json and page files. Installation uses npm install @json-render/codegen. Use when generating code from UI specs, building custom code exporters, traversing specs, or serializing props for json-render codegen pipelines in agent-driven UI generation workflows. The workflow follows the source SKILL.md contract with progressive reference loading, clear trigger phrases, and practical steps developers can apply directly in agent sessions.

  • traverseSpec depth-first walk with parent and depth context.
  • collectUsedComponents, collectStatePaths, and collectActions spec helpers.
  • serializePropValue and serializeProps for JSX-safe prop emission.
  • GeneratedFile and CodeGenerator types for multi-file exporters.
  • Sample Next.js project generator pattern with component collection.

Codegen by the numbers

  • 2,772 all-time installs (skills.sh)
  • +364 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #186 of 2,277 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

codegen capabilities & compatibility

Capabilities
depth first spec traversal · component state and action collection · jsx prop serialization · generatedfile multi file output · custom codegenerator patterns
Use cases
frontend · api development · refactoring
From the docs

What codegen says it does

Framework-agnostic utilities for generating code from json-render UI trees.
SKILL.md
Generate package.json, component files, main page...
SKILL.md
npx skills add https://github.com/vercel-labs/json-render --skill codegen

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.8k
repo stars15.8k
Security audit3 / 3 scanners passed
Last updatedJuly 8, 2026
Repositoryvercel-labs/json-render

How do I traverse a json-render spec and serialize props into generated framework code files?

Generate framework-agnostic code from json-render UI specs using traverseSpec, serializeProps, and custom CodeGenerator exporters.

Who is it for?

Developers building custom json-render exporters for Next.js, Remix, or other frameworks.

Skip if: Skip when you only need runtime rendering without code export from specs.

When should I use this skill?

Use when generating code from UI specs, building custom exporters, traversing specs, or serializing props for @json-render/codegen.

What you get

Reusable traversal, collection, and serialization utilities ready for a custom CodeGenerator exporter.

  • framework-specific component files
  • serialized prop mappings
  • action binding exports

Files

SKILL.mdMarkdownGitHub ↗

@json-render/codegen

Framework-agnostic utilities for generating code from json-render UI trees. Use these to build custom code exporters for Next.js, Remix, or other frameworks.

Installation

npm install @json-render/codegen

Tree Traversal

import {
  traverseSpec,
  collectUsedComponents,
  collectStatePaths,
  collectActions,
} from "@json-render/codegen";

// Walk the spec depth-first
traverseSpec(spec, (element, key, depth, parent) => {
  console.log(`${" ".repeat(depth * 2)}${key}: ${element.type}`);
});

// Get all component types used
const components = collectUsedComponents(spec);
// Set { "Card", "Metric", "Button" }

// Get all state paths referenced
const statePaths = collectStatePaths(spec);
// Set { "analytics/revenue", "user/name" }

// Get all action names
const actions = collectActions(spec);
// Set { "submit_form", "refresh_data" }

Serialization

import {
  serializePropValue,
  serializeProps,
  escapeString,
  type SerializeOptions,
} from "@json-render/codegen";

// Serialize a single value
serializePropValue("hello");
// { value: '"hello"', needsBraces: false }

serializePropValue({ $state: "/user/name" });
// { value: '{ $state: "/user/name" }', needsBraces: true }

// Serialize props for JSX
serializeProps({ title: "Dashboard", columns: 3, disabled: true });
// 'title="Dashboard" columns={3} disabled'

// Escape strings for code
escapeString('hello "world"');
// 'hello \"world\"'

SerializeOptions

interface SerializeOptions {
  quotes?: "single" | "double";
  indent?: number;
}

Types

import type { GeneratedFile, CodeGenerator } from "@json-render/codegen";

const myGenerator: CodeGenerator = {
  generate(spec) {
    return [
      { path: "package.json", content: "..." },
      { path: "app/page.tsx", content: "..." },
    ];
  },
};

Building a Custom Generator

import {
  collectUsedComponents,
  collectStatePaths,
  traverseSpec,
  serializeProps,
  type GeneratedFile,
} from "@json-render/codegen";
import type { Spec } from "@json-render/core";

export function generateNextJSProject(spec: Spec): GeneratedFile[] {
  const files: GeneratedFile[] = [];
  const components = collectUsedComponents(spec);
  // Generate package.json, component files, main page...
  return files;
}

Related skills

FAQ

Who is codegen for?

Developers and software engineers building custom json-render exporters for Next.js, Remix, or other frameworks.

When should I use codegen?

When generating code from UI specs, building custom exporters, traversing specs, or serializing props for @json-render/codegen.

Is codegen safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.