AgentSkillsCN

design-system

在构建或维护设计系统时使用——一套协调一致的设计令牌、组件库、文档以及工具,确保各产品在视觉与行为上保持高度统一。 适用场景:设计系统架构、选择令牌格式 vs 组件框架、将 Figma 与代码对接、设计到开发的工作流、多平台一致性。 切勿用于:具体的令牌创作(使用 Design Tokens)、Figma 工作流(使用 Figma)、组件目录化(使用 Storybook)、令牌转换(使用 Style Dictionary)、跨框架组件(使用 Mitosis)。

SKILL.md
--- frontmatter
name: design-system
description: |
    Use when building or maintaining a design system — the coordinated set of design tokens, component libraries, documentation, and tooling that ensures visual and behavioral consistency across products.
    USE FOR: design system architecture, choosing token formats vs component frameworks, connecting Figma to code, design-to-development workflows, multi-platform consistency
    DO NOT USE FOR: specific token authoring (use design-tokens), Figma workflows (use figma), component cataloging (use storybook), token transformation (use style-dictionary), cross-framework components (use mitosis)
license: MIT
metadata:
  displayName: "Design System"
  author: "Tyler-R-Kendrick"
compatibility: claude, copilot, cursor

Design System

Overview

A design system is the single source of truth for an organization's UI — combining design tokens, component libraries, documentation, and tooling into a cohesive ecosystem. It ensures consistency, accelerates development, and bridges the gap between design and engineering.

Architecture Layers

code
┌─────────────────────────────────────────────────┐
│  Design (Figma)                                 │
│  Variables, components, styles, auto-layout     │
├─────────────────────────────────────────────────┤
│  Tokens (W3C DTCG / Style Dictionary)           │
│  Color, typography, spacing, elevation, motion  │
├─────────────────────────────────────────────────┤
│  Components (React, Vue, Angular, Web Comp.)    │
│  Buttons, inputs, modals, cards, layouts        │
├─────────────────────────────────────────────────┤
│  Documentation (Storybook)                      │
│  Stories, usage guidelines, interaction tests   │
└─────────────────────────────────────────────────┘

Design-to-Code Pipeline

code
Figma Variables ──► W3C DTCG JSON ──► Style Dictionary ──► CSS / SCSS / iOS / Android
                                                            │
Figma Components ──► Code Connect / Mitosis ──────────────► React / Vue / Angular / Svelte
                                                            │
                                                            ▼
                                                        Storybook
                                                  (catalog + interaction tests)

Token Architecture

Design tokens are the atomic values of a design system — colors, spacing, typography, elevation, motion. They flow through three tiers:

TierExamplePurpose
Globalblue-500: #3b82f6Raw palette values
Alias / Semanticcolor-primary: {blue-500}Intent-based references
Componentbutton-bg: {color-primary}Scoped to a specific component

Component Strategy

Single-Framework

Build components in one framework (e.g., React) and use Storybook for documentation and testing.

Multi-Framework

Use an intermediary format to target multiple frameworks from a single source:

  • Mitosis — JSX subset that compiles to React, Vue, Angular, Svelte, Solid, etc.
  • Web Components — Framework-agnostic custom elements usable everywhere
  • Stencil — Web Component compiler with lazy loading and SSR

Key Tools

ToolRole
FigmaVisual design, variables, prototyping, Dev Mode
W3C Design TokensVendor-neutral token format (DTCG spec)
Style DictionaryTransform tokens into platform-specific outputs
StorybookComponent catalog, docs, visual/interaction testing
MitosisWrite-once component compiler for multiple frameworks
Tokens StudioFigma plugin for managing tokens in DTCG format
ChromaticVisual regression testing for Storybook stories

File Structure

code
design-system/
  tokens/
    global/
      colors.tokens.json      # W3C DTCG format
      typography.tokens.json
      spacing.tokens.json
    semantic/
      theme-light.tokens.json
      theme-dark.tokens.json
  style-dictionary.config.mjs  # Token build pipeline
  src/
    components/
      Button/
        Button.tsx             # Component implementation
        Button.stories.tsx     # Storybook stories
        Button.test.tsx        # Unit / interaction tests
  .storybook/
    main.ts
    preview.ts

Best Practices

  • Define tokens in W3C DTCG format for vendor neutrality — avoid locking into a single tool's proprietary format.
  • Use three-tier token architecture (global → semantic → component) so themes only override the semantic layer.
  • Use Style Dictionary to transform tokens into every platform your products target (CSS, SCSS, iOS, Android, Compose).
  • Catalog every component in Storybook with args, docs, and play-function interaction tests.
  • Use Figma Variables synced to your token files — Tokens Studio or Code Connect bridges the gap.
  • For multi-framework orgs, evaluate Mitosis or Web Components before duplicating component code per framework.
  • Automate visual regression testing with Chromatic or Percy in CI.
  • Version your design system as a package — consumers should pin to semver releases.