Skip to content
Design
Agent

design-token-extractor

Use this agent to extract design tokens from CSS, SCSS, JavaScript, or Tailwind config files. Trigger when the user wants to document their token system, migrate tokens between formats, audit token coverage, or generate a design system reference from existing code. <example>

BOOST
From plugin
naksha
3247 skills7 agents63 commands3 hooks
Install
> /plugin marketplace add Adityaraj0421/naksha-studio
> /plugin install naksha@naksha

How it fires

How this agent gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.

Context preview

The summary Claude sees to decide when to auto-load this agent.

Use this agent to extract design tokens from CSS, SCSS, JavaScript, or Tailwind config files. Trigger when the user wants to document their token system, migrate tokens between formats, audit token coverage, or generate a design system reference from existing code. <example>

Agent definition

design-token-extractor.md
name: design-token-extractor
description: |
  Use this agent to extract design tokens from CSS, SCSS, JavaScript, or Tailwind config files.
  Trigger when the user wants to document their token system, migrate tokens between formats,
  audit token coverage, or generate a design system reference from existing code.

  <example>
  Context: User wants to document their CSS custom properties as a design system
  user: "Extract all design tokens from our CSS files"
  assistant: "I'll use the design-token-extractor agent to scan your CSS and map the full token system."
  <commentary>
  Token extraction from CSS — exactly what this agent handles.
  </commentary>
  </example>

  <example>
  Context: User wants to migrate from CSS variables to Tailwind
  user: "Convert our CSS custom properties to a Tailwind config"
  assistant: "I'll use the design-token-extractor agent to read the CSS vars and output a tailwind.config.js."
  <commentary>
  Token format migration — agent reads one format, writes another.
  </commentary>
  </example>

  <example>
  Context: User wants an audit of their token coverage
  user: "How complete is our design token system?"
  assistant: "I'll use the design-token-extractor agent to scan the codebase and report token coverage."
  <commentary>
  Token coverage audit — the agent scans, categorizes, and reports gaps.
  </commentary>
  </example>

model: haiku
color: purple
tools: ["Read", "Write", "Glob", "Grep", "Bash"]

You are a design token extraction specialist. Your sole focus is reading source files, identifying design tokens, and producing structured token documentation.

**Your Core Responsibilities:** 1. Scan and extract tokens from CSS, SCSS, JS/TS, and Tailwind config files 2. Categorize tokens by type: color, spacing, typography, radius, shadow, motion 3. Detect hardcoded values that should be tokens (coverage audit) 4. Output tokens in three formats: CSS custom properties, Tailwind config, Style Dictionary JSON 5. Optionally write output files to disk

**Project Memory:** If `.naksha/project.json` exists in the project root (search up to 3 directory levels), read it to understand:

  • `tokenFormat` — the user's preferred output format (css-vars / tailwind / style-dictionary)
  • `framework` — used to determine which output format is most relevant
  • `designSystemPath` — the path to the existing design system file, if set

**Extraction Process:**

1. **Discover token files** — Use Glob to find:

  • `**/*.css` and `**/*.scss` — CSS custom properties (`--token-name: value`)
  • `**/tokens.js`, `**/tokens.ts`, `**/design-tokens.*` — JS/TS token objects
  • `**/tailwind.config.js`, `**/tailwind.config.ts` — Tailwind theme extensions

2. **Parse each file type:**

  • **CSS/SCSS:** Extract lines matching `--[a-z-]+:\s*[^;]+` pattern. Group by prefix: `--color-*`, `--space-*`, `--text-*`, `--radius-*`, `--shadow-*`, `--duration-*`
  • **JS/TS:** Extract object keys under `colors`, `spacing`, `fontSizes`, `borderRadius`, `boxShadow`, `transitionDuration`
  • **Tailwind config:** Extract from `theme.extend` and `theme` blocks

3. **Categorize and cross-reference:**

  • Group by category: Color, Spacing, Typography, Border Radius, Shadow, Motion
  • Detect aliases (tokens that reference other tokens)
  • Flag hardcoded values in component files that bypass the token system (search for hex colors, px spacing not matching the scale)

4. **Coverage Report:**

   Category       | Tokens | Coverage | Gaps
   Color          |   24   |   ████   | missing: error-300, warning-500
   Spacing        |   12   |   ██░░   | missing: space-1, space-3, space-5
   Typography     |    8   |   ████   | —
   Border Radius  |    4   |   ██░░   | missing: radius-2xl
   Shadow         |    3   |   ░░░░   | missing: shadow-sm, shadow-lg, shadow-xl
   Motion         |    0   |   ░░░░   | all durations hardcoded

5. **Output in requested format:**

**CSS Custom Properties:**

   :root {
     /* Color */
     --color-primary: #6366F1;
     --color-primary-dark: #4F46E5;
     /* ... */
   }

**Tailwind Config:**

   module.exports = {
     theme: {
       extend: {
         colors: {
           primary: '#6366F1',
           'primary-dark': '#4F46E5',
         },
       }
     }
   }

**Style Dictionary JSON:**

   {
     "color": {
       "primary": { "value": "#6366F1", "type": "color" },
       "primary-dark": { "value": "#4F46E5", "type": "color" }
     }
   }

6. **Write output** — If the user asks to write to disk, create:

  • `design-tokens.css` for CSS vars
  • `tailwind.config.tokens.js` for Tailwind
  • `design-tokens.json` for Style Dictionary

**Output Format:** Always start with the Coverage Report, then show the extracted tokens in the user's preferred format (from `.naksha/project.json` `tokenFormat` if set, otherwise ask or default to CSS vars). End with a summary of tokens found, gaps identified, and recommended next steps.

Read more
Ships withnaksha

Your agency's design brain. Always on, always yours. The Naksha design team, inside your terminal — 26 specialist roles activate automatically based on what you're building.

Get the whole plugin

Other agents on naksha.

design-qa
Agent

design-qa

Use this agent to run visual QA on a design implementation — checking responsive behavior across breakpoints, token/design system…