Skip to content
vercel-labs avatar

Directives

Pre-built json-render directives for formatting, math, string handling, and i18n in specs.

CCM score
79 of 100
skills.sh installs
8.1K
GitHub stars
19.9K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers seven built-in directives: $format, $math, $concat, $count, $truncate, $pluralize, and $join, plus the $t i18n factory
  • Includes standardDirectives as a ready array and createI18nDirective for locale-keyed message catalogs with fallback
  • Guides custom directive authoring via defineDirective, requiring a $ prefix and avoiding built-in key names like $state or $cond
  • Designed for @json-render/core renderers in React, Vue, Svelte, and Solid, and for prompt generation with the same directive array

Install

$ npx -y skills add vercel-labs/json-render --skill directives -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

@json-render/directives

Pre-built custom directives for @json-render/core. Drop them into your catalog and renderer to add formatting, math, string manipulation, and i18n.

Quick Start

import { standardDirectives } from '@json-render/directives';

// Wire into prompt generation
const prompt = catalog.prompt({ directives: standardDirectives });

// Wire into the renderer (React example)
import { JSONUIProvider, Renderer } from '@json-render/react';

<JSONUIProvider registry={registry} directives={standardDirectives}>
  <Renderer spec={spec} registry={registry} />
</JSONUIProvider>

To add factory directives like createI18nDirective, spread the array:

import { standardDirectives, createI18nDirective } from '@json-render/directives';

const directives = [...standardDirectives, createI18nDirective(config)];

Defining Custom Directives

Use defineDirective from @json-render/core:

import { defineDirective, resolvePropValue } from '@json-render/core';
import { z } from 'zod';

Details

Repository
github.com/vercel-labs/json-render
Categories
Frontend & UI Code, AI Agents & LLM Apps
First seen
Jul 14, 2026

Questions

What does the json-render directives skill add to my project?

The directives skill provides pre-built custom directives for @json-render/directives, covering formatting, math, string manipulation, and i18n. It adds $format, $math, $concat, $count, $truncate, $pluralize, $join, and the $t translation directive to your specs.

How do I install the json-render directives skill?

Run npx -y skills add vercel-labs/json-render --skill directives -y in your project. After that, the agent can use the directives when you work with @json-render/directives or define custom directives with defineDirective.

What do I need before using the json-render directives?

You need the @json-render/core package, and the renderer you use, such as @json-render/react, Vue, Svelte, or Solid. The directives are passed to the provider or createRenderer output and to catalog.prompt. A factory directive like $t also needs a locale and a messages config.

Can I write my own directive with this skill?

Yes, the skill shows how to create one with defineDirective from @json-render/core. Directive names must start with $, must not clash with built-in keys like $state or $cond, and should call resolvePropValue on sub-values so directives can compose.

More from vercel-labs/json-render

All 30

Similar to Directives

More Frontend & UI Code