directives
Skill by vercel-labs
Provides pre-built custom directives for json-render, covering formatting, math, string manipulation and i18n. It is for developers who use @json-render/directives or define their own directives with defineDirective.
Install directives
Built from the published package, never by AI.
git clone --depth 1 https://github.com/vercel-labs/json-render /tmp/json-render && mkdir -p ~/.claude/skills && cp -r /tmp/json-render/skills/directives ~/.claude/skills/directivesRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/vercel-labs/json-render /tmp/json-render && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/json-render/skills/directives ~/.gemini/antigravity-cli/skills/directivesAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The directives skill documents a set of pre-built custom directives for json-render, shipped in the @json-render/directives package. They cover locale-aware formatting with $format, arithmetic with $math, and string work with $concat, $truncate, $join and $pluralize. $count returns lengths, and $t handles translation through an i18n factory. Directives are added to a catalog and renderer, and they can wrap each other inside a spec.
The skill also explains how to define custom directives with defineDirective from @json-render/core, including naming rules and the need to call resolvePropValue on sub-values. It shows how to wire the directives into React, Vue, Svelte and Solid renderers and into prompt generation. It suits developers building json-render specs who need these helpers or their own directives.
Written from the project's SKILL.md and checked against it.
What it can do
- $formatFormats values as date, currency, number or percent using Intl formatters.
- $mathRuns add, subtract, multiply, divide, mod, min, max, round, floor, ceil and abs.
- $concatResolves an array of values and joins them into a single string.
- $countReturns the length of an array or string.
- $truncateShortens text to a set length with a suffix, defaulting to 100 characters and '...'.
- $pluralizeChooses singular, plural or zero labels based on a count value.
- $joinJoins array elements with a separator, defaulting to ', '.
- $tTranslates keys with interpolation parameters, via the createI18nDirective factory.
- defineDirectiveDefines custom directives whose names start with $ and do not clash with built-in keys.
What you need
- @json-render/core package
- @json-render/directives package
- A json-render renderer for React, Vue, Svelte or Solid
Try asking
- Format my json-render cart total as USD currency using $format
- Use $pluralize in my json-render spec to show item counts
- Add a $truncate directive to limit a post body to 140 characters
Good to know
- Unary math operations such as round, floor, ceil and abs only use the a operand.
- Division by zero returns 0.
- $count returns 0 for values that are neither arrays nor strings.
- Custom directive names must start with $ and must not conflict with built-in keys.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/directives/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md6 KB
Alternatives to directives
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
directives: common questions
What value types does $format support?
The source says $format supports date, currency, number and percent, using Intl formatters.
How do I define my own json-render directive?
Use defineDirective from @json-render/core with a name starting with $. The resolver should call resolvePropValue on sub-values so directives can compose.
What happens when $math divides by zero?
According to the source, a division by zero returns 0.
How do I install directives?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is directives free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is directives safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to directives?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
