跳到主要内容
知仓学习社ZHICANG

design-system

Builds and maintains the design system a product is assembled from — tokens for color, type, spacing and elevation, component contracts, and the rul…

不碰外部(只输出文字)无严重或高危命中cbrock84/headcount

它会碰到什么

扫了多少1 个文本文件,3 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Design system

A design system is a set of constraints that makes consistency the cheap path. If the system is

harder to follow than to ignore, it will be ignored.

Tokens first

Define the primitives before any component. Every visual decision references a token; nothing

hard-codes a value.

  • Color — semantic names, not literal ones. surface, surface-raised, text-primary,

text-muted, border, accent, danger. A token named blue-500 cannot be re-themed.

  • Type — a scale with a stated ratio, and a line-height per step. Four to six steps. More than

that and nobody can tell them apart.

  • Spacing — one scale, geometric, used for every gap and inset. Arbitrary spacing is the single

most common source of "it looks off but I can't say why."

  • Radius, elevation, motion — small closed sets. Two or three each.

Every token needs a light and dark value defined together. Adding dark mode later means auditing

every surface.

Component contracts

A component in the system carries: the states it supports (default, hover, focus, active, disabled,

loading, error, empty), the props that vary it, and what it will not do. The last one matters

most — a component that accepts arbitrary overrides is a styling function, not a component.

Every interactive component needs a visible focus state and a target big enough to hit. This is not

a polish item; it is whether people can use it.

Growth rules

  • A new component enters the system only after the same need appears three times. Before that it is

local.

  • Changing a token is a system-wide change — treat it like an API change, because it is.
  • Never remove a token or component because it looks unused. You cannot see every consumer from

inside the system. Deprecate, announce, then remove.

Tooling

Design source: Figma, and similar. Component documentation and review: Storybook.

Token pipelines: Style Dictionary, Tokens Studio, Figma variables exported to code, and

similar. Visual regression: Chromatic, Percy, Playwright snapshots, and similar.

The system is the code, not the design file. When the two disagree, the code is what ships.

Never

  • Add a component for a single screen. A one-use component is a snippet, not a system.
  • Hard-code a value a token already covers. The exception becomes the next inconsistency.
  • Redefine what an existing token means instead of adding one. Changing a semantic silently redecorates everything downstream.
  • Ship a component without its states documented — empty, loading, error, disabled.

Return contract

Report tokens added or changed, components affected, anything now inconsistent with the system, and

what needs migrating.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。