/design-system-ops:token-auditfrom design-system-ops
Audits design token architecture across tiers (primitives, semantics, components) for naming, alias chains, raw values, orphans, and DTCG readiness. Produces a structured report with severity-rated findings and remediation list.
Ships in design-system-ops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A skill for auditing design token architecture across whichever tiers are in use — typically primitives and semantics, with component tokens where the system uses them. Produces a structured report with severity-rated findings and a prioritised remediation list.
Confirm that every path in this skill's frontmatter references: exists relative to this SKILL.md. If any is missing, stop: the install is incomplete, usually because a flattening installer (for example npx skills install) dropped the repo-root knowledge-notes/ directory. Tell the user to reinstall by a method in 1-INSTALL.md and run verify-install.sh from the install root. Proceed without the references only if the user explicitly says to, and then say in the output that it was produced without the pack's reference material.
This skill draws on the tiered token architecture model: primitives encode raw values, semantic tokens encode intent, and — where present — component tokens map intent to specific UI contexts. Not every system uses component tokens, and the absence of a component tier is not a finding. Most token debt accumulates when tiers blur — when component contexts reference primitives directly, when semantic names describe appearance rather than purpose, or when the primitive layer is treated as the only layer.
The audit is not about enforcing a particular naming convention. It's about identifying where the token structure is working against the teams using it.
If .ds-ops-config.yml exists, follow the configuration-and-recurring knowledge note (../../knowledge-notes/configuration-and-recurring.md) for loading, integration fallbacks and recurring runs. This skill reads:
severity.* — overrides for finding severity ratings (e.g. hardcoded_color: critical instead of the default high)system.theming — if true, elevate hardcoded colour findings to the severity specified in configsystem.styling — pre-selects the format-specific guidance to applyintegrations.style_dictionary — parse tokens via Style Dictionary 4 or 5 (see below)integrations.figma — Figma variables as an additional token sourcerecurring.* — the previous report, for trend comparison (see recurring workflow below)Style Dictionary 4 or 5, or Terrazzo (integrations.style_dictionary.enabled: true, or a config in the repo):
integrations.style_dictionary.config_pathnpx style-dictionary build --config [path] into a scratch output directory (or npx terrazzo build) to let the tool resolve every alias before you reason about the tree; its errors are findings with the tool named as the sourceFigma variables (integrations.figma.enabled: true):
integrations.figma.file_key--color-primary is #0066CC but the code says #0064CC — that is a finding)GitHub (integrations.github.enabled: true):
Before asking the user for files, search the codebase for token-like patterns. This step lowers activation energy for teams where tokens exist but are not centralised — the user does not have to know where all their tokens live.
What to search for:
.css files for :root blocks or -- prefixed properties. Include scoped variants (.dark, [data-theme="..."], .theme-*)..scss and .sass files for $-prefixed names. Follow @import and @use chains to find partial files (_colors.scss, _variables.scss, _tokens.scss).tokens.json, tokens.yaml, *.tokens.json, design-tokens/**, src/tokens/**, tokens/**. Also look for DTCG-formatted files containing $type or $value keys.style-dictionary.config.json, config.json in a style-dictionary/ directory, or .style-dictionary.json..ts and .js files for exports matching common patterns: export const tokens, export const theme, export default { color, as const typed objects with token-like key hierarchies.tailwind.config.js, tailwind.config.ts, or tailwind.config.mjs and extract the theme and extend blocks.tokens.json in a .tokens or tokens directory, or files exported from Tokens Studio.How to search:
Use file system access (glob patterns, file reads) to scan the project. If GitHub integration is configured and there's no local clone, use gh api search/code only to locate candidate files, then read them. If Figma integration is configured, pull Figma variables as an additional token source.
Prioritise by specificity: a dedicated tokens/ directory is more reliable than scattered CSS files. A Style Dictionary config is more reliable than raw JSON. But collect everything — fragmented token sources are themselves a finding.
Discovery output:
Produce a brief inventory before continuing:
Token sources found:
- src/tokens/colors.json (94 tokens, JSON, likely primitives)
- src/tokens/semantic.json (67 tokens, JSON, likely semantic tier)
- src/styles/variables.scss (43 variables, SCSS)
- tailwind.config.ts (theme block with 28 custom values)
Total: ~232 token-like declarations across 4 sources
If discovery finds nothing, proceed to Step 1 and ask the user for manual input. If discovery finds scattered sources across multiple formats, flag this as a finding: "Tokens exist in [N] different formats across [M] files. This fragmentation is structural debt — consider centralising to a single source of truth."
Present the discovered sources to the user and ask: "I found these token sources. Should I audit all of them, or focus on specific files?" This gives the user control without requiring them to have assembled the inventory manually.
Before running the full audit, do one pass to identify token usage. This is the only orphan pass — Step 3c reuses its results.
var(--token-name). For SCSS variables, search for $variable-name outside their declaration files. For JSON/DTCG tokens, search for alias references ({token.path}). For TypeScript objects, search for import and access patterns (tokens.color.primary, theme.spacing.md).In a design system repo, most tokens are consumed by product repos that weren't scanned. An orphan here means "no in-repo consumer", not "unused". Report orphans as unconfirmed for external consumers unless the user has given you access to the consuming repos or usage data.
Produce a checkpoint summary (figures illustrative):
Orphan detection:
- 232 tokens declared
- 189 tokens referenced in-repo (at least once)
- 43 orphan candidates (no reference from another token or an in-repo component)
Top candidates: --color-legacy-teal, --spacing-xl-deprecated, $font-heading-alt (3 more)
Positive control: --color-action-primary found in 14 files by the same patterns
Not checked: consuming product repos
This tells the user the scale of the question before the full audit begins. Confirmed orphans are maintenance burden without value — they clutter autocomplete, confuse new team members, and inflate the token count. Include orphan candidates as findings in the main audit (category: Coverage, severity: Low unless count exceeds 20% of total, then Medium), and say which consumers were checked.
If the orphan count is high (>30% of total tokens), flag this prominently: "Over a third of declared tokens are unreferenced. Before auditing token quality, consider whether a cleanup pass would simplify the architecture."
If Step 0 discovered token sources, use them as the primary input — skip the manual question unless the user wants to override. If Step 0 found nothing (or was skipped because no codebase access was available), ask for the token source. Acceptable inputs:
:root { --color-primary: #5e4890; } or theme variants scoped to .dark { }, [data-theme="dark"], or similar selectors)$color-primary: #5e4890;)export const tokens = { color: { ... } })tailwind.config.js or tailwind.config.ts) with a theme or extend block defining custom tokensFormat-specific guidance:
For CSS custom properties: treat each -- prefixed property as a token. Infer tier from naming patterns — properties like --color-blue-500 are likely primitives, --color-action-primary are semantic, --button-background-default are component-tier. Where properties are scoped to selectors (:root, .dark, [data-theme="dark"]), treat each scope as a theme variant. References between CSS custom properties using var(--other-token) indicate tier relationships — map these the same way as JSON token references.
For SCSS variables: treat each $ prefixed variable as a token. SCSS variables that reference other variables (e.g. $color-primary: $blue-500) indicate tier relationships. If variables are split across partials (_colors.scss, _spacing.scss), the file organisation may signal tier structure.
For TypeScript/JavaScript objects: treat the exported object's key hierarchy as the token structure. Nested objects map to tiers the same way JSON tokens do. For Emotion or styled-components themes, the theme object is the token source. Common patterns include: flat exports (export const backgroundColor = { scene: '#FFF', primary: '#206EF6' }), as const typed objects (const tokens = { ... } as const), aggregated barrel exports (export const tokens = { breakpoint, fontSize, spacing }), and theme-to-CSS-variable mapping functions (mapThemeToVars()). Helper functions like theme.spacing(4) or theme.colors.primary that resolve to token values are valid token references.
For Tailwind configurations: the theme block defines primitives, extend adds semantic overrides. Tailwind utility classes that reference custom tokens (e.g. bg-primary, text-color-content-default) are token references, not hardcoded values. Arbitrary values in square brackets (e.g. h-[12px], bg-[#ff0000]) are the actual hardcoded violations.
If the person pastes raw token names without values, proceed with a naming and structure audit only. Note in the output that value analysis was not possible.
Identify which tiers are present:
Primitive tier — raw values, no semantic meaning. Examples: color.blue.500, spacing.4, font-size.base
Semantic tier — intent-driven references. Examples: color.action.primary, spacing.component.gap, text.body.size
Component tier — scoped to a specific component context. Examples: button.background.default, card.padding.inner
Flag a missing primitive or semantic tier. A system with only primitives has no semantic contract. A system with only semantic tokens has no single source of truth for raw values. Both are structural problems worth naming. A missing component tier is not a finding — see the token-architecture note.
For each check, produce a PASS, WARN, or FAIL rating with specific examples. Every finding carries evidence: the token path and the file and line where it is defined (tokens/component.tokens.json:9, src/styles/tokens.css:17).
Severity rubric (the severity.* config keys override these defaults):
color.semantic.blue)Descriptive vs prescriptive naming Semantic tokens should describe purpose, not appearance.
color.semantic.blue — describes colour, not intentcolor.action.primary — describes roleTier leakage Component tokens should reference semantic tokens, not primitives.
button.background.default: {color.blue.500} — skips the semantic tierbutton.background.default: {color.action.primary} — correct reference chainAmbiguity flags Token names that could mean multiple things or require context to interpret (the token-architecture note has the full rule and its exceptions):
normal, alt, variant, misc, other, and default or base when they are the entire role (color.default)default/base as a state or level segment beside a role (color.action.default, color.surface.base), and t-shirt or numeric scale steps (spacing.sm, radius.lg)Convention consistency (this skill owns token naming; naming-audit covers components and patterns)
Within each tier, identify the dominant casing, separator and segment order, and flag the tokens that break from it: color.blue-500 beside color.blue.500, hover/active beside hover/pressed, button.background-hover beside button.background.hover. Report the dominant convention in the findings so the team can confirm it's the intended one.
Platform suffix abuse Token names that encode platform specifics in the name rather than in the transformation layer:
color.primary.ios, spacing.mobile.gap — these belong in transforms, not namesHardcoded values at semantic or component tier Any semantic or component token with a raw value rather than a reference is structural debt.
Duplicate raw values without token aliases Identical raw values appearing at the primitive tier under different names without explanation.
Out-of-tier references Any token referencing a token from a higher-specificity tier.
Missing interaction states Review whether semantic tokens exist for all standard states: default, hover, active, disabled, focus, error, success, warning.
Missing dark mode / theme aliases If the system intends to support theming, check whether semantic tokens exist as theme-aware aliases or whether raw values are used directly.
Inconsistent component tier (only if the system uses component tokens) If the system has adopted component tokens and they exist for some components but not others in the same category, flag the inconsistency. If the system does not use component tokens at all, this is not a finding — a two-tier architecture (primitives and semantics) is a valid and common choice.
Skip this section entirely if the token source is not DTCG format and the team has not mentioned DTCG migration. Most teams don't need this. Include it when the token source uses DTCG format, when the team asks about DTCG compliance, or when migration planning is the purpose of the audit.
If the token source uses DTCG format, or if the team is considering DTCG migration:
Structural validation is schema-validator's job. Type resolution, $type values outside the 13 types, 2025.10 value shapes, composite sub-value integrity, broken and circular aliases, and resolver document validity all belong there. If a schema-validator report exists, cite its finding IDs in this section; if not, run it (it's quick and mechanical) rather than re-checking by hand. This section reports what those results mean for the architecture, and adds the two checks below that need the tier map.
Alias tier in composites. A composite token whose sub-values mix references and raw values (typography.body with fontFamily: {font.family.body} but fontSize: "16px") is the composite form of a raw value at the semantic tier: it can't theme. schema-validator reports the shape; this audit rates it. Severity: 🟡 Medium, 🟠 High if the composite is used by a themed component.
Resolver contexts and theming. If .resolver.json files exist, read each modifier's contexts and its resolutionOrder (the note describes the structure; the spec's term is context, not mode). A context that doesn't redefine a token inherits the earlier value, which is the design, not a gap. What this audit reports: theme-dependent semantic tokens (colour, shadow, border colour) that no non-default context redefines, so the theme silently keeps the default value; and token files that no set includes. Severity: 🟠 High for an inherited colour token in a shipped theme (contrast risk), ⚪ Low for a token file outside every set. theme-audit goes deeper on this when the team has more than one theme; cite it rather than duplicating.
Migration signal (informational). For teams not yet on DTCG 2025.10, give one paragraph: how many tokens would need $type (after type resolution), how many composites need restructuring into object values, whether string values need converting to object shapes, and whether resolver files would be needed for theming. Name the lowest-risk first step (usually annotating primitives with $type, which changes no resolved values). Then offer the full phased migration plan with effort ranges if they want it — don't produce it unasked.
Skip this section if there is no codebase access or if the audit is focused on token naming/structure only. Include it when the user has a codebase connected and wants to understand blast radius before making changes.
The dependency graph has one producer: codebase-index, which writes token-to-component edges to .ai/index/. If that directory exists, read the token edges from it, mark the orphan candidates from Step 0b on them, and list the high-fan-out tokens (bound by many components in this repo; say how many, and remember consumers outside the repo aren't counted). If it doesn't exist, say the blast-radius view wasn't built and suggest running codebase-index first; don't build a second graph here. Token-versus-Figma consistency is figma-variable-audit Step 6's job.
Open with a headline sentence that tells the reader the overall state and where to focus. Example: "Your token architecture has three structural issues — two in the semantic tier and one cross-tier collision. Here's the full breakdown."
Structure the report as follows:
Summary One paragraph. What is the overall state of the token architecture? What is the most urgent problem? Write this like a peer review, not a compliance filing.
Tier structure
Findings
List each finding with:
Remediation priority Group findings into three tiers:
Effort estimates For each remediation tier, provide calibrated effort estimates with explicit assumptions and caveats:
| Finding | Estimated effort | Assumptions | Confidence |
|---|---|---|---|
| [Finding ID] | [range, e.g. 4–8 hours] | [what this estimate assumes] | [High/Medium/Low] |
Always give a range ("4–8 hours", not "6 hours"), state what it assumes, and rate confidence High / Medium / Low with what would need scoping for Low. For "Fix first" items, note that the estimate covers the token-side change only and consumer migration is extra. Over 200 tokens or more than 3 consuming apps, suggest a timeboxed spike before committing to sprint planning.
The goal is estimates a project manager can defend in sprint planning, not optimistic targets that erode trust when overrun.
Scope
End with the closing note below.
Follows the recurring-run procedure in the configuration-and-recurring note. Specific to this skill:
Comparing code tokens with Figma variables, and creating or renaming variables in Figma, is figma-variable-audit's job (its Step 6 does the cross-reference, its Step 10 the writes). If a Figma file is configured or the user mentions Figma, say the code-side audit is done and offer to run figma-variable-audit against the same token source, so the two reports line up by name. Don't compare or write to Figma from here.
End the report with:
A note on context: This audit sees your token files — it does not see the decisions behind them. Some findings may flag patterns your team chose deliberately. If any finding describes an intentional decision, let me know — I'll exclude it from future runs and learn your system's conventions. The goal is to surface problems you haven't seen yet, not to second-guess choices you've already made.
color.semantic.blue to color.action.primary" not "improve naming"What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
design-tokens, token-architecture, dtcg, style-dictionary, terrazzo
36 skills in this plugin
/accessibility-per-componentAudit one design system component's accessibility against WCAG 2.2 AA: keyboard, screen reader, contrast, focus, ARIA, target size. Trigger: a11y audit, is this accessible, WCAG check, screen reader support, keyboard navigation check. Not for page- or product-wide audits./adoption-reportAdoption report: coverage (what the system provides), reach (teams with access) and adoption (teams shipping with it), design vs engineering, trend and at-risk teams. Triggers: adoption report, usage metrics, which teams use the system. Not docs coverage — use docs-coverage./agent-instructionsWrite the AGENTS.md that tells coding agents how to use this design system: where things live, sourced rules, how to check work, what not to do; Claude, Cursor or Copilot pointers on request. Triggers: AGENTS.md for our system, make it AI-navigable, agent instructions. Inventory: codebase-index.Generated from the plugin's indexed repository (murphytrueman/design-system-ops) — no native marketplace selected
npx claudepluginhub p/murphytrueman-design-system-opsOther plugins' skills for the same job