design-system-patterns

Build design token hierarchies, theme switching, and component variant systems for design systems.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/scoots31/engineering-playbook --skill design-system-patterns-scoots31
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-system-patterns
Source: https://github.com/scoots31/engineering-playbook/tree/main/references/design-system-patterns
Command: npx skills add https://github.com/scoots31/engineering-playbook --skill design-system-patterns-scoots31

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires class-variance-authority, style-dictionary.

What problem does it solve? Building a consistent UI across web and mobile products breaks down when colors, spacing, and component styles are hardcoded and scattered. This Skill provides the architecture patterns for design tokens, theming infrastructure, and component libraries so teams can maintain one scalable design system. ## Core Features & Use Cases - Design Token Architecture: Define primitive, semantic, and component token layers with CSS custom properties, including light and dark theme values. - Theme Switching Infrastructure: Implement a React ThemeProvider with system preference detection, localStorage persistence, and resolved theme state. - Component Variant Systems: Build type-safe component variants using class-variance-authority with variant and size props. - Multi-Platform Token Pipeline: Configure Style Dictionary to compile tokens into CSS, SCSS, iOS Swift, and Android XML outputs. - Use Case: A team needs dark mode across their React app. Use this Skill to set up a three-layer token hierarchy, wire up a ThemeProvider with prefers-color-scheme detection, and refactor components to consume semantic tokens instead of hardcoded hex values. ## Quick Start Set up a design token system with light and dark themes and a variant-based Button component for my React app.

Frequently Asked Questions about design-system-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create design tokens for light and dark mode?

Define primitive tokens as raw values like color scales, then create semantic tokens that reference primitives and swap per theme. Apply them via CSS custom properties on the root element, toggling a light or dark class to switch themes.

How to implement theme switching in React with system preference?

Create a ThemeProvider using React context that reads the stored theme from localStorage and falls back to the prefers-color-scheme media query. Listen for media query changes when set to system, and toggle a class on the document root.

What is the difference between primitive and semantic design tokens?

Primitive tokens hold raw values like blue-500 or gray-900 with no contextual meaning. Semantic tokens like text-primary or surface-default reference primitives and express purpose, which lets themes remap meaning without touching components.

Can I generate design tokens for iOS and Android from one source?

Yes, Style Dictionary compiles a single JSON token source into multiple platform outputs. Configure platforms for CSS variables, SCSS, iOS Swift classes, and Android XML resources, with filters to route token categories appropriately.

Why does my design system have inconsistent component styling?

Inconsistency usually comes from hardcoded values bypassing tokens, missing token hierarchy layers, or mixed naming conventions. Enforce component-level tokens that reference semantic tokens, and use a variant system like class-variance-authority for standardized styles.

When should I not use a three-layer token hierarchy?

Small single-theme projects with one brand may not need component-level tokens, and a two-layer primitive plus semantic structure is sufficient. The full hierarchy pays off when supporting multiple themes, brands, or platforms.