--- name: design-system-adoption description: Measure how much of a codebase actually uses its design system — token coverage versus hardcoded colors, spacing and font sizes, design-system components versus local re-implementations and forks — find the hotspots and the repeated patterns that should become components, and plan a ratcheted migration with lint rules and safe codemods. Use when asked whether the design system is used, why the UI is inconsistent, to inventory components, or to plan a design-system migration. --- # Design System Adoption A design system only helps where the code uses it. Teams know their design system exists; few know that a third of their colors are still hardcoded or that the product has six button implementations. This skill measures adoption the way you measure test coverage — reproducibly and per area — and turns the result into a migration plan that can't regress. ## Phase 1: Locate the system Find the tokens (CSS custom properties, Tailwind theme, theme object, DTCG files) and the component library: an internal package or folder, or an external one (MUI, Chakra, Mantine, Radix, shadcn/ui, Ant Design, Polaris…). Note which components it provides and how they're imported. If there are no tokens yet, run `design-system-extract` first. Scope the measurement to application source. Exclude the design system's own code, generated files, vendored code, tests, stories and fixtures. ## Phase 2: Measure token adoption For each category, count token usages against hardcoded values in the scoped files, using commands someone else can re-run. Example patterns to adapt to the stack (use ripgrep when available): | Category | Hardcoded | Token usage | |---|---|---| | Color | `#[0-9a-fA-F]{3,8}\b`, `rgba?\(`, `hsla?\(`, `oklch\(` in styles; Tailwind arbitrary values like `bg-[#…]` | `var(--color-…)`, theme references, Tailwind classes from the theme palette | | Spacing | `margin`, `padding`, `gap` with `px` values off the scale; Tailwind `p-[13px]` | scale classes, `var(--space-…)` | | Font size | `font-size:` literals, Tailwind `text-[15px]` | type-scale classes or tokens | | Radius, shadow, z-index | literals in those properties | tokens | Report **adoption = token usages ÷ (token usages + hardcoded values)** per category and per top-level area (feature folder, package or route). Count separately the literals that exactly equal a token value: they're the easy wins. Expect noise. SVG fills, third-party overrides and one-off illustrations are legitimate. Review a sample of matches for each pattern and state the estimated false-positive rate instead of presenting the number as exact. ## Phase 3: Measure component adoption For each design-system component, count: - **DS usages** — imports from the design system. - **Native re-implementations** — raw `