
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)
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
What codegen says it does
Framework-agnostic utilities for generating code from json-render UI trees.
Generate package.json, component files, main page...
npx skills add https://github.com/vercel-labs/json-render --skill codegenAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2.8k |
|---|---|
| repo stars | ★ 15.8k |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 8, 2026 |
| Repository | vercel-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
@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/codegenTree 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.