Brand tokens export
@brandkit/brand-tokens-export
Turn the tokens in your brand.md into code: CSS variables, a Tailwind theme (v3 and v4), and a design-tokens.json for Figma token plugins. One source of truth, regenerated in a second whenever the brand changes.
- Activity
- New: be the first to try it
- Installs
- 0 installs
- Likes
- 0 likes
- Clones
- 0 clones
How this works
- It is a skill: written instructions Claude reads when your request matches what the skill is for. You do not call it by name; just ask for the task.
- While it works, it reads and changes files in the places it lists, nowhere else.
- It runs these commands on your computer: node scripts/export-tokens.mjs.
- Nothing runs until you choose to use it, and you can remove it any time.
SKILL.md
Brand tokens export
Turns the tokens block in brand.md into files a codebase and a design tool can use. The brand guide stays the single source of truth; the generated files are never edited by hand.
When to use
- Setting up a new site or app and wiring in the brand's colors, fonts, sizes, spacing, and radii.
- The brand guide changed and the code needs to catch up.
- "Make Tailwind use our brand colors", "give me CSS variables for the brand", "export tokens for Figma".
- Not for writing a brand guide from scratch. Use
brand-guide-builderfor that.
Inputs
- The brand guide. Look for
brand.md, thendocs/brand.md. If neither exists, stop and offer to create one withbrand-guide-builder(or by hand fromexamples/brand.md). A tokens block inside it: a fenced block marked
```yaml tokens(or plainyamlorjson). Groups it understands:color,font(a list, first choice first),text(font sizes),weight,space,radius,shadow.- Plural names (
colors,fonts,spacing) work too.name,logo, andvoiceare read by other brandkit kits and ignored here.
- Where to write. Default
brand-tokens/. Ask only if the project clearly keeps styles elsewhere (for examplesrc/styles/), and then copy frombrand-tokens/rather than writing there directly.
Steps
- Find the guide and read the tokens block. If there is no block, show the user the format from
examples/brand.mdand offer to add one from the colors and fonts already described in prose. Confirm the values before adding them. Run the export.
node scripts/export-tokens.mjs brand.md brand-tokensAdd
--prefix brand-if the project already has variables like--color-primarythat must not clash.- Read the script's warnings (for example a color that is not a valid CSS color) and fix them in
brand.md, then run again. Wire it in. Detect the stack and give the one step that applies:
- Tailwind v4 (
@import "tailwindcss"in CSS):@import "./brand-tokens/theme.css";right after it. Utilities likebg-primaryandfont-headingthen work. - Tailwind v3 (
tailwind.config.js):theme: { extend: require("./brand-tokens/tailwind.theme.cjs") }. - Plain CSS: import
brand-tokens/tokens.cssonce, then usevar(--color-primary). - Figma: import
brand-tokens/design-tokens.jsonwith a design tokens plugin that reads the W3C format. Show the exact line to add and ask before editing any config file yourself.
- Tailwind v4 (
- Report in the format below.
Output format
Exported 24 tokens from brand.md to brand-tokens/
| File | Use it for |
| --- | --- |
| tokens.css | Plain CSS: `var(--color-primary)` |
| theme.css | Tailwind v4 `@theme` |
| tailwind.theme.cjs | Tailwind v3 `theme.extend` |
| design-tokens.json | Figma and other token tools |
Next step for this project: <the one line to add, and where>
Warnings: <none, or what to fix in brand.md>Naming
Variables follow Tailwind v4 names so every output agrees: --color-*, --font-*, --text-*, --font-weight-*, --spacing-*, --radius-*, --shadow-*. Token names are lowercased with hyphens (Primary Dark becomes primary-dark).
Guardrails
- Never edit the generated files by hand. Change
brand.mdand run the export again; say so in the report. - Never invent token values. If the guide describes a color in words only ("our green"), ask for the hex value.
- Do not overwrite an existing
tailwind.config.*or global stylesheet. Suggest the line; edit only after the user says yes. - If the tokens block fails to parse, show the script's error line and fix the YAML (usually a tab, or a missing space after a colon).
README.md
Brand tokens export
Keep your brand colors, fonts, and spacing in one place, brand.md, and generate the code from it. One command writes CSS variables, a Tailwind theme, and a design-tokens.json for Figma.
Who it is for: anyone with a brand guide and a website or app that keeps drifting off it. Designers who want Figma and code to match. Developers who are tired of copying hex codes.
Example
You have this in brand.md:
```yaml tokens
color:
primary: "#1F7A5C"
accent: "#F2A541"
font:
heading: [Fraunces, Georgia, serif]
radius:
md: 10px
```Ask "export our brand tokens". Claude runs the script and writes brand-tokens/:
:root {
--color-primary: #1F7A5C;
--color-accent: #F2A541;
--font-heading: Fraunces, Georgia, serif;
--radius-md: 10px;
}plus theme.css (Tailwind v4), tailwind.theme.cjs (Tailwind v3), and design-tokens.json (W3C format). Then it tells you the one line to add for your setup. Try it on examples/brand.md.
What it can access
- Reads
brand.mdordocs/brand.md. - Writes only inside
brand-tokens/. - Runs one script,
scripts/export-tokens.mjs(Node, no dependencies). No network.
Setup
None. Needs Node 18 or newer. Pairs well with brand-guide-builder (writes the tokens block) and /brand (uses it).
Files
- README.md
- SKILL.md
- examples/brand.md
- kit.json
- scripts/export-tokens.mjs
- scripts/tokens-lib.mjs
Did it work?
0worked for them0did not work
Sign in to say whether it worked for you.
Nobody has said yet. Tried it? Tell the next person.
