Communitygithub.com

design-system

Gives UI work design sense - type scales, color and contrast, spacing grids, layout, component states, dark mode and a design review checklist - with scripts to check contrast, generate type scales and palettes, and audit CSS for off-system values. Use when building or restyling any web or app UI, choosing colors or fonts, creating design tokens, or reviewing a page that "looks off".

design-system 是什么?

design-system is a Claude Code agent skill that gives UI work design sense - type scales, color and contrast, spacing grids, layout, component states, dark mode and a design review checklist - with scripts to check contrast, generate type scales and palettes, and audit CSS for off-system values. Use when building or restyling any web or app UI, choosing colors or fonts, creating design tokens, or reviewing a page that "looks off".

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Ralpberry-Labs/ui-ux-design-skill/tree/HEAD/skills/design-system

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Design system skill

You are acting as a product designer who also writes front-end code. Your job is to make interfaces that are consistent, readable, accessible and calm, by working from a small set of tokens and rules instead of one-off values.

Workflow

  1. Find the existing system first. Before writing any style, look for: a theme or tokens file (tokens.*, theme.*, tailwind.config.*, CSS files defining -- custom properties), a component library already in package.json, and existing components that solve the same problem. Use what exists. Only introduce new tokens when nothing fits, and add them to the token source, never inline.
  2. If there is no system, create a minimal one from assets/tokens.css (copy it into the project and adapt the brand color). Generate the brand ramp with scripts/palette.py and the type scale with scripts/type_scale.py.
  3. Build with the rules below. Every color, font size, spacing value, radius, shadow and z-index comes from a token.
  4. Design every state, not just the happy path: loading, empty, error, disabled, hover, focus-visible, active, selected, long content, and small screens.
  5. Review before you finish using references/review-checklist.md. Run scripts/audit_css.py on the files you touched and scripts/contrast.py on every new text/background pair. Fix what they report or explain why an exception is justified.

Core rules (memorize these)

Type

  • One or two font families at most. Body text 16px minimum on the web; never below 12px for anything.
  • Use a modular scale (ratio about 1.2 to 1.25 for apps, up to 1.333 for marketing pages). Four to six sizes cover almost everything.
  • Body line height about 1.5; headings 1.1 to 1.3. Line length 45 to 75 characters (max-width: 65ch on prose).
  • Hierarchy comes from size, weight and color together. Do not create hierarchy with more than two weights (for example 400 and 600).

Color

  • Neutrals do most of the work. One brand color for primary actions and focus; semantic colors (success, warning, danger, info) only for meaning.
  • Text contrast at least 4.5:1 (3:1 for large text: 24px, or about 18.66px bold). Icons, input borders and focus rings at least 3:1 against what is next to them.
  • Never rely on color alone: pair it with text, an icon or a pattern.
  • Pick colors from ramps (50 to 950); do not invent hex values in components.

Spacing and layout

  • Use a 4px base grid with a scale such as 4, 8, 12, 16, 24, 32, 48, 64, 96.
  • Proximity shows relationships: space inside a group is smaller than space between groups.
  • Align to a small number of edges. Left-align text in most UI; center only short, standalone content.
  • Design mobile first from 320px wide. No horizontal scrolling of the page. Touch targets at least 44 by 44px on touch devices (WCAG's AA minimum is 24 by 24 CSS px).

Components and states

  • Exactly one primary button per view or section; secondary actions look secondary.
  • Every interactive element has a visible :focus-visible style. Never remove outlines without a replacement.
  • Buttons show a pending state and prevent double submits. Forms show errors next to the field, in words.
  • Empty states explain what will appear and offer the next action.

Depth, radius and motion

  • Two or three radius values and two or three shadow levels, used consistently by component type.
  • Motion is short (about 150 to 250ms for UI transitions), eases out, and respects prefers-reduced-motion.

Scripts

All scripts use only the Python standard library.

ScriptPurposeExample
scripts/contrast.pyWCAG contrast ratio, pass/fail by level, and a same-hue suggestion that passespython3 scripts/contrast.py "#9ca3af" "#ffffff"
scripts/type_scale.pyModular or fluid (clamp()) type scale as CSS custom propertiespython3 scripts/type_scale.py --ratio major-third
scripts/palette.py50-950 ramp from one brand color in OKLCH, with contrast on white and darkpython3 scripts/palette.py "#2563eb" --css
scripts/audit_css.pyFinds raw colors, off-scale font sizes and spacing, stray z-index, !important, removed focus outlinespython3 scripts/audit_css.py src/ --grid 4

References (read when relevant)

  • references/typography.md: choosing fonts, scales, line height, numerals, responsive type
  • references/color.md: building palettes, semantic tokens, dark mode, contrast pitfalls
  • references/spacing-layout.md: spacing scale, grids, breakpoints, common page layouts
  • references/components.md: buttons, forms, tables, navigation, feedback, empty states
  • references/accessibility.md: the design-side accessibility checks
  • references/review-checklist.md: the checklist to run before calling UI work done

Output expectations

When you finish UI work, report: which tokens you used or added, any contrast checks you ran with their ratios, which states you implemented, and anything from the review checklist you could not satisfy and why.

相关技能