design-system-patterns

Implement design tokens, theme switching, and component architecture patterns for design systems.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill design-system-patterns-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-system-patterns
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/design-system-patterns
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill design-system-patterns-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires class-variance-authority, @radix-ui/react-slot, and includes references (resource) components.

What problem does it solve? Building consistent, maintainable UI foundations across web and mobile applications requires solving recurring challenges: managing design tokens across platforms, implementing light/dark theme switching without flash-of-unstyled-content, and architecting reusable component APIs. This Skill provides production-tested patterns for each of these problems. ## Core Features & Use Cases - Design Token Architecture: Establish a three-layer token hierarchy (primitive, semantic, component) with naming conventions, JSON token definitions, and Style Dictionary pipelines that output CSS, SCSS, iOS Swift, and Android XML. - Theming Infrastructure: Implement React theme providers with system preference detection, localStorage persistence, multi-brand theming via data attributes, and accessibility support for reduced motion and high contrast modes. - Component Architecture Patterns: Build compound components, polymorphic components with the as prop, slot-based composition, headless UI hooks, and type-safe variant systems using class-variance-authority. - Use Case: When setting up a new component library, use this Skill to define semantic color tokens for light and dark themes, wire up a ThemeProvider with SSR-safe initialization, and create a Button component with CVA variants. ## Quick Start Ask the AI to create a design token hierarchy with light and dark semantic themes and a React ThemeProvider that persists the user's preference.

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 themes?

Define primitive tokens with raw color values, then create semantic tokens that reference primitives for each theme. Output them as CSS custom properties on :root for light and a .dark or [data-theme="dark"] selector for dark overrides.

How to implement dark mode toggle in React without flash of unstyled content?

Use a ThemeProvider that reads localStorage and prefers-color-scheme, then apply the theme via a data-theme attribute on the document root. Add an inline script in the HTML head that sets the attribute before first paint to prevent FOUC.

What is the difference between primitive, semantic, and component tokens?

Primitive tokens hold raw values like hex colors and rem sizes. Semantic tokens assign contextual meaning such as text-primary or surface-elevated by referencing primitives. Component tokens map semantics to specific usages like button-bg.

Can Style Dictionary generate tokens for iOS and Android?

Yes, Style Dictionary supports multiple platforms from a single JSON token source. Configure platforms for css, scss, ios-swift, and android to output variables.css, Swift classes, and colors.xml respectively.

When should I use compound components versus render props?

Use compound components when child elements need shared implicit state through context, such as Accordion items. Use render props or children-as-function when the consumer needs explicit control over rendering logic, such as a Disclosure exposing isOpen and toggle.

Why do my design tokens break when switching themes?

Theme breakage usually comes from hardcoded values instead of token references, missing dark theme semantic mappings, or circular token references. Validate that every semantic token has definitions in all themes and references resolve correctly.