mcpField
D
design-system-creation

design-system-creation

github.com/secondsky设计与 UI240492 次安装5 周前更新
代码仓库

关于 design-system-creation

用于构建设计系统的技能,以令牌、组件和模式支持团队间一致的 UI 开发。还涵盖文档与治理实践,包括无障碍和深色模式指引。

主要功能

  1. 01视觉基础设计令牌
  2. 02组件与模式分层
  3. 03组件文档结构
  4. 04评审与贡献治理
  5. 05无障碍及深色模式指引

适用场景

  1. 01为团队建立共享 UI 基础
  2. 02记录可复用组件变体
  3. 03制定组件评审与发布流程

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/secondsky/claude-skills --skill design-system-creation

安装后在 Claude Code 中输入/design-system-creation确认已加载。

详细介绍

设计系统创建

构建全面的设计系统,确保团队间的 UI 开发保持一致。

设计系统层级

  1. 基础:颜色、排版、间距、层级
  2. 组件:按钮、输入框、卡片、导航
  3. 模式:表单、布局、空状态

基础 - 设计令牌

:root {
  /* Colors */
  --color-primary-50: #eff6ff;
  --color-primary-500: #3b82f6;
  --color-primary-900: #1e3a8a;

  /* Semantic colors */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-4: 1rem;
  --space-8: 2rem;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

组件文档

## Button

### Anatomy
- Container (padding, background)
- Label (text)
- Icon (optional)

### Variants
- Primary: Main actions
- Secondary: Alternative actions
- Ghost: Subtle actions

### States
- Default, Hover, Active, Disabled, Loading

### Accessibility
- Role: button
- Keyboard: Enter/Space to activate
- Focus: Visible focus ring

组件示例(React)

interface ButtonProps {
  variant?: 'primary' | 'secondary' | 'ghost';
  size?: 'sm' | 'md' | 'lg';
  loading?: boolean;
  disabled?: boolean;
  children: React.ReactNode;
}

function Button({ variant = 'primary', size = 'md', loading, disabled, children }: ButtonProps) {
  return (
    <button
      className={`btn btn-${variant} btn-${size}`}
      disabled={disabled || loading}
      aria-busy={loading}
    >
      {loading ? <Spinner /> : children}
    </button>
  );
}

治理

  • 评审委员会:批准新组件
  • 贡献流程:RFC → 评审 → 实现
  • 版本管理:发布时采用语义化版本
  • 弃用:提前 3 个月通知并提供迁移指南

最佳实践

  • 从基础令牌入手
  • 详尽记录每个组件
  • 确保符合 WCAG 2.1 AA 标准
  • 从一开始就支持深色模式
  • 提供包含适用和不适用示例的使用指南

评论

支持 Markdown