From kiva-design-system
Process skill for extracting a section of the Kiva design system from Figma into a portable agent skill file in @kiva/kv-skills/design-system/skills/kiva-design-system. Codifies the artifact-gathering, code-verification, structure, voice, and index-update steps proven out across typography, layout, spacing, and radius.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kiva-design-system:figma-design-system-to-skillWhen to use
Whenever starting a new skill that extracts a Figma design-system section (e.g., color, elevation, motion, iconography, components). Trigger phrases — "extract the X section of our design system into a skill", "create a new skill from these Figma panels", "let's build a skill for X".
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
A single self-contained Markdown skill file in `@kiva/kv-skills/design-system/skills/kiva-design-system/<name>.md`, plus a one-line entry in `@kiva/kv-skills/design-system/skills/kiva-design-system/SKILL.md`. The skill captures *design intent* from Figma (canonical), then ends with two code-facing sections: **Using with Tailwind** (how to express that intent with the Kiva Tailwind preset, hybri...
A single self-contained Markdown skill file in @kiva/kv-skills/design-system/skills/kiva-design-system/<name>.md, plus a one-line entry in @kiva/kv-skills/design-system/skills/kiva-design-system/SKILL.md. The skill captures design intent from Figma (canonical), then ends with two code-facing sections: Using with Tailwind (how to express that intent with the Kiva Tailwind preset, hybrid so it works with or without the preset) and Outstanding discrepancies (the real Figma-vs-code sync gaps consumers should verify before depending on a token name).
Existing exemplars in this repo:
typography.md — the original template, content-style skilllayout.md — multi-panel extraction with cross-skill linkagespacing.md — the most complex (semantic categories + raw ramp + responsive values)radius.md — small, tight scale with a per-component lookup tablecolor.md + color-themes.md — the umbrella + reference-companion splitRead at least one before starting a new extraction; mirror voice, headings, and table conventions.
A different kind of skill also lives here: tailwind documents the shipped mechanics of the Kiva Tailwind preset and is code-canonical (not Figma-canonical). You don't author skills like it with this process, but every design-intent skill's "Using with Tailwind" section links into it — treat it as the canonical reference for preset mechanics rather than re-explaining them.
Always ask for, or confirm you have, all three:
Screenshots are sufficient for conceptual panels — overviews, principles, do/don't grids, anatomy diagrams, small scales. Lift content directly from them.
For dense token tables, start with get_design_context from the first pass — don't try to read them from a screenshot. A panel qualifies as a "dense token table" if it has any of:
The color skill round of this process missed ~5 tokens per theme and invented incorrect shadow names by reading screenshots of tables that were too dense to be legible. The Figma MCP returns the underlying React export, which lets a parser pull every row reliably (see Extracting table data with a parser, below). For everything else — Overview, Guidelines, Accessibility framework text — screenshots remain faster.
@kiva/kv-skills/design-system/skills/kiva-design-system/<kebab-name>.md@kiva/kv-skills/design-system/skills/kiva-design-system/SKILL.md (add one line under ## Skills, format: - [name](docs/skills/name.md) — one-line hook)Every skill ends with two code-facing sections (see Standard skill structure below): Using with Tailwind — how to express the section's intent in code via the Kiva Tailwind preset, written hybrid so it's useful with or without the preset — and Outstanding discrepancies — the genuine Figma-vs-code sync gaps. Both are code-canonical (unlike the Figma-canonical body above them), so don't write them from memory or the Figma side alone — read the source.
Standard verification path (start narrow, widen only as needed):
@kiva/kv-tokens/tokens/core/*.json — canonical token source. Files: size.json (space, breakpoint, radius, border-width), color.json, typography.json, misc.json. Open the one relevant to your section.@kiva/kv-tokens/configs/tailwind.config.js — how tokens get exposed as Tailwind utilities. Find the relevant theme.* block. Note any hardcoded values not sourced from the JSON (those are sync gaps worth flagging).@kiva/kv-tokens/configs/kiva*.js — utility modules (kivaColors.js, kivaTypography.js) for sections with programmatic helpers.@kiva/kv-tokens/dist/js/tokens.js — built output. Useful as a fallback if the source JSON doesn't yet contain everything you expect (e.g., the spacing ramp is fully expanded here even when the source isn't).@kiva/kv-components/src/vue/ — only if the section has a thin component abstraction (e.g., KvGrid.vue for layout). Grep for likely names; don't open the whole tree.Use grep -rn for targeted lookups; use Read for whole files. Both are fast — there's no reason to defer to a subagent for code verification at this size.
Not every Figma-vs-code mismatch is a gap to close. Some are deliberate:
default vs base (radius): in code the token is default (Tailwind's DEFAULT key generates the unsuffixed utility class); in Figma it's base (renamed for consistency with the xs/sm/md/lg/xl scale, with default marked legacy). Same token, two surface-native names — document both, but don't assert which name "wins" long-term unless the team has said so. The only mechanically-fixed piece is the Tailwind DEFAULT key._ (e.g., 2_5), Tailwind utilities use . (tw-p-2.5), Figma variables use - (2-5). Not a gap — just three idioms for the same value.marigold-light. Both are correct in their own surface. Document both side-by-side so designers and engineers can each type the name native to their tool.When you find a divergence, ask the user or check context before framing it as "to be closed." Errantly calling an intentional difference a sync gap is a small but recurring failure mode — and so is the inverse: declaring a difference "permanent / intentional" when the Figma source actually marks the old value legacy (the radius default vs base case did exactly this on its first pass). State what each surface says today and let the team decide permanence.
When you find real sync gaps (Figma defines tokens or values that code doesn't ship), enumerate them as a bullet list inside the "Outstanding discrepancies" section. A list of names — text/action-disabled, background/action-secondary, border/secondary-disabled — is actionable; "several tokens are missing" is not. Group by theme or category if there are more than ~5 missing entries.
get_metadata for dense tablesFor any dense token/spec table, get_metadata is the most reliable extractor — more so than parsing the get_design_context React export. get_metadata returns each text node's name (the literal rendered string) plus its x/y coordinates and the containing cell's geometry. Reconstruct the table by sorting cells into columns by x and rows by y. This sidesteps two problems with the React export: (a) dense panels often exceed the output limit and get truncated or persisted to a file, and (b) the export is laid out column-major with ~100KB of image-asset constants, so a naive text scrape drops or scrambles cells. The metadata coordinates reconstruct even a two-sub-table ramp exactly.
The QA pass that verified the spacing ramp relied on this: the get_design_context text scrape stopped mid-table and missed the bottom rows, while get_metadata returned every (token, REM, value) cell with coordinates — which is how the 15-5 / 16 mislabel at the bottom of the Figma ramp was confirmed. As a bonus, text-node names give you clean copy for conceptual panels too (anatomy definitions, guideline paragraphs) without dumping the React export.
Fallback — parse the React export. When metadata isn't enough (you need styling, or text lives in nested instances), write a small parser (~25 lines of Python) over the get_design_context export: each cell has a data-name="<cell-type>" attribute (e.g. "semantic name", "hex code", "primitive token", "description") and a row-N class — group by row and emit a Markdown row per group. Note that text inside component instances (Do/Don't example cards, anatomy-label components) is often exposed by neither tool — capture that from a screenshot.
Mirror this order. Sections marked (optional) can be omitted if the source content doesn't support them.
---
name: <kebab-name>
description: <one sentence — specific enough that an agent can decide relevance>
when_to_use: <concrete triggers — when designing/implementing X, picking between Y and Z, etc.>
---
# Kiva <Section Title>
## Source of truth
<Figma is canonical. Code may lag. Verify before depending. Link to "Outstanding discrepancies" at bottom.>
## Why <section> matters / About
<2-4 sentences on the why. Lift from the Overview panel. Include "Common alternative names" line if Figma has one.>
## Design principles
<Numbered list, usually 2-4 items from the Overview panel. One sentence each.>
## <Main spec tables>
<The canonical content. Use tables for token data. Lead with semantic intent, raw values second.>
## Best practices / Usage rules
<Do / Don't pairs. Group related rules.>
## (optional) <Worked examples, lookup tables, gotchas>
<Anything that's component-level or implementation-level worth pulling out.>
## How to use in Figma
<Variable picker tips, library hover descriptions, before-handoff check (re-bind any raw values).>
## Using with Tailwind
<How to express this section's intent with the Kiva Tailwind preset; hybrid. Cross-link into tailwind.md for mechanics; link to in-body tables for values. Include a "### Without the preset" subsection. See "Writing the code-facing sections" below.>
## Outstanding discrepancies
<Only the critical, unresolved Figma-vs-code sync gaps. Concrete token names. Omit if there are none. Keep the "flag it — it's a data point" closer.>
## Figma source references
- <Panel name>: node `XXXXX:XXXX`
- ...
File: `TPmBUB4olYPMF6glEhBGDG` (Ecosystem 2026 — WIP)
These two sections are where an otherwise Figma-canonical skill becomes code-canonical. They sit where the old single "Current code state" section used to — right before "Figma source references" — and they defer to the tailwind skill, the canonical shipped-mechanics guide to the Kiva preset. Don't regenerate tailwind's content here; link into it.
## Using with TailwindTeach how to express this section's intent in code. It must be hybrid: encourage setting up and using the Kiva Tailwind preset, but still help a reader whose project doesn't have it. Use this four-part backbone:
@kiva/kv-tokens preset, link to tailwind → Consuming the preset for projects not yet wired up, and point to the "Without the preset" subsection for projects that won't adopt it.tw-rounded = 16px, no tw-text-lg, the 8px spacing scale). Link to the matching tailwind.md subsection for the mechanics rationale instead of re-explaining it, and point to any in-body mapping table already in the skill instead of reprinting it.tokens/core/*.json, the relevant configs/tailwind.config.js → theme.* block). Put the "verify against the current config before depending" caveat on these lines — it replaces the old hedged section header.### Without the preset. Two clearly-separated fallbacks:
@kiva/kv-tokens/css (dist/css/tokens.css); note that copied values are point-in-time and the static/hex route loses runtime theming.Cross-link discipline: never re-explain tailwind.md mechanics, and never copy a mapping table that already exists in the skill body — link to both. This keeps the section a thin bridge that won't drift as tokens change.
## Outstanding discrepanciesOnly the critical, unresolved Figma-vs-code divergences worth future work — the things a consumer would otherwise trip on. List concrete token names (see "List concrete missing tokens" above), and keep the closing line: "When you find a divergence … flag it — each is a data point for the design-system team." Omit this section entirely when a skill has no genuine gaps (a purely additive skill may not need it). Don't park stable, intentional facts here — code naming you type (marigold-light, the default/base split) belongs in "Using with Tailwind"; known Figma-label typos belong beside the value they describe or in a companion's source-caveats. Reserve "Outstanding discrepancies" for things that should change.
typography.md does it.[spacing](spacing.md), [layout](layout.md).>) for callouts the user needs to see (formulas, gotchas, caveats about Figma typos). Use them sparingly — every callout dilutes the next.Some sections have more reference data than conceptual content. For those, split into two files: an umbrella skill that captures the framework, and a reference companion that holds the bulk data.
Use the umbrella + companion pattern when any of these is true:
Naming: <topic>.md (umbrella) + <topic>-<axis>.md (companion). Examples: color.md + color-themes.md. The companion's frontmatter description should explicitly call out that it's a reference for the umbrella — e.g., "Reference companion to color …".
What lives where:
<topic>.md): source-of-truth caveat, why, principles, token grammar, accessibility framework, best practices / usage rules, Figma usage, Using with Tailwind, Outstanding discrepancies.<topic>-<axis>.md): the full structured tables, with whatever columns the Figma source has (name, hex, primitive, description, etc.). Light intro pointing back to the umbrella; per-X "source caveats" sections for Figma typos specific to that table.Add both files to SKILLS.md. The companion's index entry should explicitly mark it as a reference: e.g., "Reference companion to color: the full per-theme token tables …"
rem column wrapping in the spacing scale, "Atonomy" / "Principals" headings on the radius overview. Silently correct these in the skill; don't transcribe the typo.col: 8 (the drawn diagram and the Building Layouts example both confirm 4). Favor the value the canonical spec table and shipped code agree on, and add a brief caveat so a reader cross-referencing Figma isn't tripped by the stale label.get_design_context (and a parser) for dense token tables. See "When to start with screenshots vs. the Figma MCP" above.@kiva/kv-skills/design-system/skills/kiva-design-system/<name>.md. Use the Write tool for new files; use Edit if revising.@kiva/kv-skills/design-system/skills/kiva-design-system/SKILL.md under ## Skills.The user will frequently correct facts after the first draft — naming conventions, scale framing, intentional-vs-accidental gaps. Treat the first pass as an outline they'll refine. When a correction lands, audit related skills for the same mistake — the spacing/layout 4px-vs-8px correction propagated to both files because the same misleading framing was in both.
The self-verification step (step 8 above) should catch most of these before the user has to. Don't skip it to save tokens.
Hand the user this template they (or you) can drop into a fresh session to start the next extraction:
Time to extract the <SECTION> section of our design system into a new skill. Please load the `figma-design-system-to-skill` skill and walk through it.
Figma node links:
- <Panel 1>: <URL>
- <Panel 2>: <URL>
- <Panel 3>: <URL>
Screenshots attached: <count or list>
npx claudepluginhub kiva/kv-ui-elements --plugin kiva-design-systemProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.