Design System Patterns
Master design system architecture to create consistent, maintainable, and scalable UI foundations.
For multiple isolated Design Systems inside one Next.js app (style classes, cookies, FOUC, iframe preview sync), also use
nextjs-multi-design-system.
When to Use This Skill
- Creating design tokens for colors, typography, spacing, and shadows
- Implementing light/dark theme switching with CSS custom properties
- Building multi-brand theming systems
- Architecting component libraries with consistent APIs
- Establishing design-to-code workflows with Figma tokens
- Creating semantic token hierarchies (primitive → semantic → component)
Core Capabilities
1. Design Tokens
- Primitive tokens (raw values)
- Semantic tokens (contextual meaning:
text-primary,surface-elevated) - Component tokens (specific usage:
button-bg,card-border) - Clear naming and organization
2. Theming Infrastructure
- CSS custom properties architecture
- Theme context / providers
- System preference detection (
prefers-color-scheme) - Persistent theme storage
- Reduced motion and high contrast modes
3. Component Architecture
- Compound component patterns
- Polymorphic components (
asprop) - Variant and size systems
- Slot-based composition / headless UI patterns
Best Practices
- Name Tokens by Purpose:
text-primary, notdark-gray - Maintain Token Hierarchy: Primitives → Semantic → Component
- Document Token Usage: Guidelines next to definitions
- Version Tokens: Treat breaking token changes like API changes
- Test Theme Combinations: Every theme × every component
- Avoid Hardcoded Values: Use tokens instead of raw hex in components
Common Issues
- Token sprawl without hierarchy
- Inconsistent naming conventions
- Missing dark-mode token mapping
- Hardcoded colors in components
- Circular token references
Source
Adapted from wshobson/agents — design-system-patterns.


