算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
design-system【设计与创意】Build design system components and UI that are accessible, themeable, and visually polished. Use when building buttons, dialogs, forms, cards, or any reusable UI components. Covers component API design, design tokens, accessibility, theming, visual design rules, and interaction patterns. Triggers on: "build a component", "design system", "create a bu…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Build UI components that are accessible, themeable, composable, and visually polished. This skill covers architecture and patterns. See companion skills for React performance (vercel-react-best-practices), composition (vercel-composition-patterns), CSS techniques (modern-css), and UI code review (web-design-guidelines).
Separate behavior from appearance. Use headless primitives (Radix, Ark UI, Headless UI) for accessibility and interaction, then add your styling layer on top. This gives you accessible-by-default components you can theme however you want.
Complex UI should be composed of named parts, not configured with dozens of props:
// Good — composable, flexible, clear
<Dialog.Root>
<Dialog.Trigger asChild>
<Button>Edit Profile</Button>
</Dialog.Trigger>
<Dialog.Content>
<Dialog.Title>Edit Profile</Dialog.Title>
<Dialog.Description>Update your information below.</Dialog.Description>
{/* form content */}
<Dialog.Close asChild>
<Button variant="ghost">Cancel</Button>
</Dialog.Close>
</Dialog.Content>
</Dialog.Root>
// Bad — prop soup, inflexible, hard to customize
<Dialog
trigger="Edit Profile"
title="Edit Profile"
description="Update your information below."
showClose
cancelText="Cancel"
onConfirm={handleConfirm}
/>
// Good — variants as union type
type ButtonProps = {
variant: "primary" | "secondary" | "destructive" | "ghost" | "link"
size: "sm" | "md" | "lg"
children: React.ReactNode
loading?: boolean
disabled?: boolean
}
// Bad — boolean flags for everything
type ButtonProps = {
primary?: boolean
secondary?: boolean
danger?: boolean
small?: boolean
large?: boolean
}
Structure tokens in two layers. Primitive tokens define raw values. Semantic tokens assign meaning. Use semantic tokens directly in components — don't add a third "component token" layer unless you're building a white-label product with per-customer theming.
/* Layer 1: Primitive — raw values, no meaning */
--color-gray-50: oklch(0.985 0 0);
--color-gray-900: oklch(0.145 0 0);
--color-blue-500: oklch(0.55 0.2 250);
--radius-sm: 0.25rem;
--radius-md: 0.5rem;
/* Layer 2: Semantic — assigned meaning, used directly in components */
--color-background: var(--color-gray-50);
--color-foreground: var(--color-gray-900);
--color-primary: var(--color-blue-500);
--radius-default: var(--radius-md);
Why OKLCH over HSL: Perceptually uniform (same lightness looks the same across hues), supports P3 wide-gamut displays, produces better gradients without muddy midpoints.
Use a constrained scale for spacing (4px/8px grid), type (modular ratio with clamp()), shadows (5 levels), and border-radius (3-4 sizes). Never use arbitrary values — pick from the scale.
For the full token system implementation, see references/design-tokens.md.
Accessibility is not a feature — it's a baseline. Every interactive component must meet these requirements:
Every interactive component must be fully operable with keyboard alone. Follow WAI-ARIA Authoring Practices Guide (APG) patterns for keyboard navigation — don't invent your own.
Use semantic HTML first (<button>, <a>, <label>, <dialog>, <table>). Only add ARIA when HTML semantics aren't sufficient. When you do, follow the APG patterns exactly.
:focus-visible (not :focus) for keyboard-only focus ringstabindex > 0prefers-reduced-motion — disable decorative animations, keep functional onesFor component-specific accessibility patterns, see references/accessibility-patterns.md.
Good visual design follows consistent, systematic rules — not ad-hoc decisions.
Use the scale. Never use arbitrary pixel values. Components should use the same spacing scale as the rest of the app.
clamp(): font-size: clamp(1rem, 0.5rem + 2vw, 1.5rem)max-width: 65ch)font-variant-numeric: tabular-nums for number columnstext-wrap: balance on headings to prevent orphansCreate hierarchy through size, weight, and color — not font-size alone. Three levels of emphasis is usually enough: primary (bold/large), secondary (normal), tertiary (muted/small).
Fewer borders. Use spacing, contrasting backgrounds, and subtle shadows to separate elements instead. When you do use borders, keep them light and consistent.
Define 5 levels: none, sm, md, lg, xl. Use layered shadows (ambient + directional) for realism. In dark mode, use lighter surfaces for higher elevation instead of shadows.
3-4 sizes: sm (0.25rem), md (0.5rem), lg (0.75rem), full (9999px for pills). Keep consistent within a component — don't mix radii.
Don't render broken UI for empty data. Show: explanation of what this area is, how to populate it, and a CTA to get started.
aria-describedby)aria-live="polite" or role="alert" for screen readerstransform and opacity only — never width, height, or top/lefttransition: all — list properties explicitlySemantic tokens swap between themes. Don't invert colors — map them intentionally:
:root {
--color-bg: oklch(1 0 0);
--color-surface: oklch(0.97 0 0);
--color-text: oklch(0.145 0 0);
--color-text-muted: oklch(0.45 0 0);
--color-border: oklch(0.87 0 0);
}
.dark {
--color-bg: oklch(0.1 0 0);
--color-surface: oklch(0.15 0 0);
--color-text: oklch(0.93 0 0);
--color-text-muted: oklch(0.6 0 0);
--color-border: oklch(0.25 0 0);
}
#000) backgrounds — use dark gray (oklch lightness ~0.1)color-scheme: dark on <html> for native form controls and scrollbars<meta name="theme-color"> to match page background<div onClick> — use <button> for actions, <a> for navigationoutline: none without a :focus-visible replacementtabindex > 0 — evertransition: all — list properties explicitlywidth/height — use transform: scale()onPaste + preventDefault)user-scalable=no, maximum-scale=1)<label>width/height to prevent CLSvercel-react-best-practices — React/Next.js performance (58 rules by priority)vercel-composition-patterns — compound components, state management, React 19 APIsmodern-css — modern CSS techniques (64 old-vs-modern comparisons)web-design-guidelines — UI code review checklist (accessibility, forms, animation, performance)typescript — type patterns for component props (discriminated unions, branded types)For design token implementation, see references/design-tokens.md. For component recipes, see references/component-recipes.md. For accessibility patterns, see references/accessibility-patterns.md.