Design System
Purpose
Keep user interfaces consistent by managing shared decisions — tokens (color, spacing,
typography), component contracts, and accessibility rules — as versioned code instead of
tribal knowledge. The skill defines the token architecture, the component API rules, and
the audit checklist that keeps third-party UI work on-system.
When to Use / When NOT to Use
Use when:
- Creating or refactoring shared UI components, tokens, or themes.
- Onboarding a new surface to the design system, or auditing an existing one.
- Reviewing a UI PR for accessibility and consistency violations.
Do NOT use when:
- The work is one-off application code with no shared component involvement.
- The question is backend API shape — use
api-design.
- A designer's visual decision is disputed and not encoded in tokens; escalate to the
design owner instead of relitigating taste in code review.
Prerequisites & Assumptions
- A component library or frontend codebase exists (React, Vue, Web Components, or
server-rendered HTML).
- WCAG 2.2 AA is the accessibility floor.
- Tokens are exported as code (CSS variables, TypeScript objects, or theme packages)
and consumed by reference — never re-declared in feature code.
Step-by-Step Workflow
- Token audit — inventory colors, spacing, radii, shadows, type sizes, and motion
in the current UI; map each raw value to a semantic token.
- Define the token layers — primitives (
color.blue.500) → semantic
(color.action.primary) → component-local aliases (button.bg). Features may use
only the semantic layer.
- Contract components — for every shared component, document props/variants, what
it owns (spacing inside), and what it never does (fetching data, business logic).
- Accessibility pass — keyboard paths, focus order, visible focus, contrast,
names/roles for interactive elements.
- Version and publish — SemVer for the component package; breaking component API
changes require a deprecation release first (see
ci-cd for release flow).
- Audit regularly — run the checklist below on each new surface; reject one-off
hex values and magic pixel numbers in review.
Enterprise Rules & Standards (MUST / SHOULD / MUST NOT)
- MUST reference semantic tokens for color, spacing, typography, and motion; raw
hex, px, or ms literals in feature code are violations.
- MUST meet WCAG 2.2 AA: 4.5:1 body-text contrast, full keyboard operability,
visible focus indicators, and accessible names for all interactive elements.
- MUST version the component library with SemVer and deprecate before removing.
- MUST keep components presentation-only: no data fetching, no business rules, no
direct service calls inside shared components.
- SHOULD support dark mode and reduced-motion via token themes, not component forks.
- SHOULD snapshot-test rendered variants of each component.
- MUST NOT copy another component's markup to "variant" it — extend the original or
compose smaller primitives.
Examples
Good — semantic token usage:
.card {
background: var(--color-surface-raised);
padding: var(--space-4);
border-radius: var(--radius-md);
transition: background var(--motion-fast) var(--ease-standard);
}
Bad — magic values:
.card {
background: #fafafa; /* one-off hex, breaks dark mode */
padding: 13px; /* not on the spacing scale */
transition: all 333ms; /* non-token duration, animates everything */
}
Why it fails: values drift per feature, dark mode breaks silently, and no reviewer can
trace which design decision a literal implements.
Checklist
Common Pitfalls
- Token sprawl — a token per screen; tokens encode decisions, not one-offs.
- Wrapper sprawl — "just a small wrapper" around a component that reimplements it;
extend or compose instead.
- A11y retrofit — accessibility checked only before release; check per component.
- Theme forks — dark mode maintained by duplicating components; themes belong in
token values, not markup.
References
1---2name: design-system-23description: 'Establishes and enforces UI consistency rules — design tokens, component API contracts, accessibility, and versioned component libraries. Trigger with "create design tokens", "is this component consistent", or "audit our UI for a11y".'4metadata:5 source: https://skillmd.com/skills/pnguyen215/design-system-26---78# Design System910## Purpose1112Keep user interfaces consistent by managing shared decisions — tokens (color, spacing,13typography), component contracts, and accessibility rules — as versioned code instead of14tribal knowledge. The skill defines the token architecture, the component API rules, and15the audit checklist that keeps third-party UI work on-system.1617## When to Use / When NOT to Use1819Use when:2021- Creating or refactoring shared UI components, tokens, or themes.22- Onboarding a new surface to the design system, or auditing an existing one.23- Reviewing a UI PR for accessibility and consistency violations.2425Do NOT use when:2627- The work is one-off application code with no shared component involvement.28- The question is backend API shape — use `api-design`.29- A designer's visual decision is disputed and not encoded in tokens; escalate to the30 design owner instead of relitigating taste in code review.3132## Prerequisites & Assumptions3334- A component library or frontend codebase exists (React, Vue, Web Components, or35 server-rendered HTML).36- WCAG 2.2 AA is the accessibility floor.37- Tokens are exported as code (CSS variables, TypeScript objects, or theme packages)38 and consumed by reference — never re-declared in feature code.3940## Step-by-Step Workflow41421. **Token audit** — inventory colors, spacing, radii, shadows, type sizes, and motion43 in the current UI; map each raw value to a semantic token.442. **Define the token layers** — primitives (`color.blue.500`) → semantic45 (`color.action.primary`) → component-local aliases (`button.bg`). Features may use46 only the semantic layer.473. **Contract components** — for every shared component, document props/variants, what48 it owns (spacing inside), and what it never does (fetching data, business logic).494. **Accessibility pass** — keyboard paths, focus order, visible focus, contrast,50 names/roles for interactive elements.515. **Version and publish** — SemVer for the component package; breaking component API52 changes require a deprecation release first (see `ci-cd` for release flow).536. **Audit regularly** — run the checklist below on each new surface; reject one-off54 hex values and magic pixel numbers in review.5556## Enterprise Rules & Standards (MUST / SHOULD / MUST NOT)5758- **MUST** reference semantic tokens for color, spacing, typography, and motion; raw59 hex, px, or ms literals in feature code are violations.60- **MUST** meet WCAG 2.2 AA: 4.5:1 body-text contrast, full keyboard operability,61 visible focus indicators, and accessible names for all interactive elements.62- **MUST** version the component library with SemVer and deprecate before removing.63- **MUST** keep components presentation-only: no data fetching, no business rules, no64 direct service calls inside shared components.65- **SHOULD** support dark mode and reduced-motion via token themes, not component forks.66- **SHOULD** snapshot-test rendered variants of each component.67- **MUST NOT** copy another component's markup to "variant" it — extend the original or68 compose smaller primitives.6970## Examples7172Good — semantic token usage:7374```css75.card {76 background: var(--color-surface-raised);77 padding: var(--space-4);78 border-radius: var(--radius-md);79 transition: background var(--motion-fast) var(--ease-standard);80}81```8283Bad — magic values:8485```css86.card {87 background: #fafafa; /* one-off hex, breaks dark mode */88 padding: 13px; /* not on the spacing scale */89 transition: all 333ms; /* non-token duration, animates everything */90}91```9293Why it fails: values drift per feature, dark mode breaks silently, and no reviewer can94trace which design decision a literal implements.9596## Checklist9798- [ ] No raw hex/px/ms literals in feature styles; tokens only from the semantic layer.99- [ ] Every shared component has a documented prop/variant contract.100- [ ] Keyboard-only operation verified for interactive flows.101- [ ] Contrast checked against WCAG 2.2 AA ratios.102- [ ] Component package version bumped correctly (major = breaking API).103- [ ] Deprecated components warn at runtime and in docs, with a migration path.104105## Common Pitfalls106107- **Token sprawl** — a token per screen; tokens encode decisions, not one-offs.108- **Wrapper sprawl** — "just a small wrapper" around a component that reimplements it;109 extend or compose instead.110- **A11y retrofit** — accessibility checked only before release; check per component.111- **Theme forks** — dark mode maintained by duplicating components; themes belong in112 token values, not markup.113114## References115116- WCAG 2.2: https://www.w3.org/TR/WCAG22/117- Design tokens community spec: https://design-tokens.github.io/community-group/format/118- WAI-ARIA Authoring Practices: https://www.w3.org/WAI/ARIA/apg/