design-system
Systematic UI engineering covering token architecture (DTCG), polymorphic accessible headless components, variant prop contracts, multi-brand theming, and regression testing gates.
- License 许可
- MIT
- 所属仓库
- poppyTM/oride
- 最近更新
- 2026-09-30
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- design-system
- description
- Systematic UI engineering covering token architecture (DTCG), polymorphic accessible headless components, variant prop contracts, multi-brand theming, and regression testing gates.
02 资源文件 9
- 参考文档checks/design-system-checklist.md2.3 KB
- 其他examples/Button.tsx3.8 KB
- 参考文档examples/design_token_spec.json1.1 KB
- 参考文档manifest.json1.7 KB
- 参考文档references/color-theory.md1.5 KB
- 参考文档references/design-system-guide.md4.4 KB
- 脚本scripts/extract_design_tokens.js1.5 KB
- 脚本scripts/verify.sh1.7 KB
- 参考文档templates/design-system-spec.md2.9 KB
03 SKILL.md 正文
Design System Engineering
1. Purpose
Define, engineer, and govern a multi-platform, token-driven Design System that provides reusable, accessible, cohesive, and themeable UI components across the entire product ecosystem, ensuring zero visual drift and strict contract compliance.
2. Use When
- Creating or refactoring shared component libraries and UI design tokens.
- Establishing multi-brand, dark mode, or responsive theme architectures.
- Defining component API contracts (props, slots, variants, events, accessibility states).
- Implementing headless accessible primitives (Radix UI, React Aria, AccessKit) with custom styling.
- Establishing visual regression testing suites and interactive living documentation (Storybook, Styleguidist).
3. Do Not Use When
- Building one-off, highly specialized, domain-specific landing pages with zero reuse potential.
- Prototyping disposable mockups where formal token pipelines and semver contracts introduce unnecessary overhead.
- Auditing low-level memory layout or binary runtime internals (use
memory-managementorclean-code).
4. Required Context
Before implementing or modifying design system primitives, obtain:
- Design Tokens Specification: DTCG-compliant JSON tokens covering colors, spacing, typography, radii, elevation, motion.
- Component Anatomy & States: Visual specs and interaction matrices for all 19 states (default, hover, focus-visible, active, disabled, loading, error, etc.).
- Accessibility Baseline: Required ARIA APG pattern, keyboard navigation schema, and contrast target (WCAG 2.2 AA / AAA).
- Target Platform & Framework: Target runtimes (React, Vue, Svelte, Web Components, Flutter, Native).
5. Procedure
Step 1: Token Integration & Theming Layer
- Map raw design decisions into the 3-tier DTCG hierarchy:
- Global (Tier 1): Immutable raw values (
color.blue.500: #2563eb). - Semantic (Tier 2): Intent-driven abstraction (
color.action.primary.bg: {color.blue.500}). - Component-Scoped (Tier 3): Isolated component styling (
button.primary.bg: {color.action.primary.bg}).
- Global (Tier 1): Immutable raw values (
- Expose tokens via CSS Custom Properties or platform-native variables under theme scopes (
:root,[data-theme="dark"],[data-theme="high-contrast"]). - Ensure runtime switching carries zero layout shift or JavaScript recalculation overhead.
Step 2: Component Contract & Polymorphic Architecture
- Define strict TypeScript interfaces for all component props using discriminated unions or variant maps (e.g., CVA / Tailwind Variants / StyleX).
- Implement polymorphic rendering via the
asChild/ Slot pattern to prevent tag soup and support arbitrary wrappers without breaking semantic markup:<Button asChild variant="primary"> <a href="/login">Log In</a> </Button> - Separate component state/behavior from styling using headless primitives or well-defined hook contracts.
Step 3: Accessibility & Keyboard Interaction Contract
- Enforce native semantic elements wherever possible (
<button>,<dialog>,<nav>). - If custom composite widgets are required (e.g., Combobox, Tabs, Menu), wire full ARIA APG state management, focus traps, and roving tabindexes.
- Guarantee visible focus rings (
:focus-visible) styled via semantic tokens (outline: 2px solid var(--focus-ring); outline-offset: 2px).
Step 4: Component Documentation & Living Catalog
- Create interactive Storybook stories (
*.stories.tsx) covering every variant, size, and interactive state. - Expose interactive Controls (args) allowing consumers to test edge cases (long strings, right-to-left languages, zoom).
- Document accessibility guarantees, keyboard shortcuts, and dos/don'ts.
Step 5: Visual Regression & Contract Automated Gates
- Run automated snapshot tests verifying rendered DOM structure.
- Execute pixel-level visual regression tests (Playwright, Chromatic, Storybook Test Runner) across both light and dark themes.
- Run automated accessibility scans (
axe-core,eslint-plugin-jsx-a11y) in CI.
6. Decision Rules
- Composition Over Configuration: Prefer compound components (
<Card.Header>,<Card.Body>,<Card.Footer>) over monolithic prop-heavy components (<Card title="" header="" subtitle="" footer="" ... />). - Zero Hardcoded Values: Never write raw hex codes (
#1e293b), pixel dimensions (16px), or font families directly in component stylesheets. Every value must resolve through design tokens. - No Breaking Changes Without Codemods: Renaming or removing a prop is a breaking change. Deprecate with runtime warnings and supply automated codemods before removal.
- Encapsulated Layout Boundaries: Components must never specify external margins (
margin-top,margin-left). Layout spacing is the responsibility of parent layout components (Stack,Grid,Cluster).
7. Evidence Required
- Contract Tests: TypeScript compilation with zero type errors under
strict: true. - Accessibility Audit: Automated Axe / Jest-Axe scan with 0 violations.
- Visual Regression Proof: Screenshot diffs confirming 0 unexpected pixel mutations across themes and breakpoints.
- Storybook Coverage: Stories present for 100% of defined component variants.
8. Output Contract
A production design system artifact must contain:
- Component implementation file (e.g.
Button.tsx,Button.vue). - Component style definition consuming semantic design tokens.
- Component unit and accessibility tests (
*.test.tsx). - Storybook documentation story (
*.stories.tsx). - Export entry in package index with clean tree-shaking metadata (
package.jsonwith"sideEffects": false).
9. Stop Conditions
- All component variants pass type checking, unit tests, and accessibility validations.
- Visual regression suite matches baseline with zero unwanted diffs.
- Component API documentation is generated and verified in Storybook.
10. Escalation Rules
- Escalate to Design Lead if a proposed component variant cannot satisfy WCAG 2.2 AA contrast with the current color palette.
- Escalate to Architecture Board if a new component introduces a conflicting dependency or breaking token tier change.
04 同仓库更多 Skills
zoom-reflow
暂无简介
wireframe-styleguide
暂无简介
visual-regression
Pixel-by-pixel snapshot testing, Playwright integration, dynamic content masking, deterministic font rendering, and cross-browser CI gates
ui-implementation
Component-driven UI implementation, multi-state matrix (default, hover, focus-visible, active, disabled, loading, empty, error), DTCG design tokens, responsive layout contracts, and accessibility tree mapping.
tui-editor-engine
Text buffer and editing semantics for a terminal code editor — index conversion, transaction-first editing, multi-cursor invariants, undo grouping, and large-file behaviour.
tree-sitter-context-indexing
暂无简介