ui-visual-composition

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

UI Visual Composition

UI视觉构图

Purpose

用途

Help an AI agent create and critique polished visual UI through hierarchy, spacing, typography, color, depth, imagery, and finishing details. Treat visual design as functional communication: the interface should help users understand what matters, what belongs together, what can be acted on, and what has changed.
This skill covers visual design quality, layout composition, typography, color systems, depth, imagery, polish, accessibility, and frontend implementation choices that affect visual quality. It does not cover deep UX research, information architecture strategy, or frontend architecture except where those concerns determine visual composition.
帮助AI Agent通过层级结构、间距、排版、色彩、深度、图像及细节优化来创建和评审精致的视觉UI。将视觉设计视为功能性沟通:界面应帮助用户理解重要内容、关联内容、可操作项以及变化内容。
本技能涵盖视觉设计质量、布局构图、排版、色彩系统、深度、图像、细节打磨、无障碍设计,以及影响视觉质量的前端实现选择。但不涉及深度UX研究、信息架构策略或前端架构,除非这些因素会决定视觉构图。

When to use this skill

何时使用本技能

Use this skill when the user asks for UI critique, redesign, product-page improvement, frontend visual implementation, design-system guidance, style polish, layout refinement, typography, color palette, empty/error/loading state improvement, or visual QA of generated UI.
Also use it when producing frontend code for a visual interface, because component structure, semantic markup, tokens, state styling, responsive behavior, and accessibility details determine whether visual recommendations survive implementation.
当用户要求UI评审、重设计、产品页面优化、前端视觉实现、设计系统指导、风格打磨、布局优化、排版调整、调色板设计、空/错误/加载状态优化,或生成UI的视觉QA时,使用本技能。
在生成视觉界面的前端代码时也可使用,因为组件结构、语义标记、tokens、状态样式、响应式行为和无障碍细节会决定视觉建议能否在实现中保留。

When not to use this skill

何时不使用本技能

Do not use this skill as the primary framework when the user is asking mainly for user research planning, product strategy, market positioning, analytics instrumentation, backend/frontend architecture, performance engineering, copywriting without visual presentation, or detailed interaction flow design. Use it only for the visual-design portions of those tasks.
Do not use it to justify arbitrary decoration. If a visual suggestion does not improve hierarchy, comprehension, perceived quality, accessibility, or fit with product context, remove it.
当用户主要询问用户研究规划、产品策略、市场定位、分析工具部署、后端/前端架构、性能工程、无视觉呈现的文案撰写,或详细交互流程设计时,不要将本技能作为主要框架。仅在这些任务涉及视觉设计的部分使用它。
不要用它来为任意装饰提供理由。如果某个视觉建议无法提升层级结构、理解度、感知质量、无障碍性或适配产品场景,请移除该建议。

Core principles

核心原则

  1. Start with the feature, not the shell. Identify the concrete user task and content before designing navigation chrome, page framing, or decorative treatments.
  2. Hierarchy is the backbone. Make the most important content and actions easiest to notice. Use size, weight, contrast, spacing, placement, and order before relying on color or ornament.
  3. Use familiar patterns unless novelty has a purpose. Users bring mental models from other products. Preserve conventions for common controls, navigation, forms, and feedback unless the user’s brand or product goal justifies a deliberate departure.
  4. Group by meaning. Proximity, common regions, alignment, and connectedness should match conceptual relationships. Ambiguous spacing creates ambiguous meaning.
  5. Constrain choices with systems. Use type, spacing, color, radius, border, and elevation tokens instead of ad hoc one-off values.
  6. Typography is interface structure. Choose type that fits the content and context, then set readable line length, line height, alignment, emphasis, and hierarchy.
  7. Color must carry meaning safely. Use color to reinforce hierarchy, state, and brand, but never as the only signal. Maintain contrast and test against color-vision and low-vision needs.
  8. Depth should explain layers. Shadows, overlaps, borders, and background shifts should clarify elevation, grouping, focus, or interaction—not create visual noise.
  9. Aesthetics improve acceptance but do not excuse usability flaws. Polish can make users more tolerant and confident, but it can also mask problems. Verify clarity, accessibility, and task fit before celebrating beauty.
  10. Simplify without hiding necessary complexity. Reduce visible choices and chunk complex tasks, but do not abstract away information users need to decide or recover.
  11. Design for resilient real content. User-uploaded images, long labels, empty data, errors, loading, disabled states, and localization must not break the composition.
  12. Explain tradeoffs in user-centered terms. Recommendations should reference user goals, comprehension, accessibility, system consistency, and implementation feasibility.
See references/principle-cards.md for each principle as a reusable card.
  1. 从功能出发,而非外壳。 在设计导航栏、页面框架或装饰元素前,先明确具体的用户任务和内容。
  2. 层级结构是核心。 让最重要的内容和操作最容易被注意到。在依赖颜色或装饰之前,先使用尺寸、字重、对比度、间距、位置和顺序来构建层级。
  3. 除非有明确需求,否则使用熟悉的模式。 用户会从其他产品中带来心智模型。对于常见控件、导航、表单和反馈,保留常规设计,除非用户的品牌或产品目标需要刻意创新。
  4. 按含义分组。 proximity(邻近性)、共同区域、对齐和关联性应与概念关系匹配。模糊的间距会导致模糊的含义。
  5. 用系统约束选择。 使用字体、间距、颜色、圆角、边框和层级tokens,而非临时的一次性数值。
  6. 排版是界面结构。 选择适合内容和场景的字体,然后设置易读的行宽、行高、对齐方式、强调效果和层级结构。
  7. 颜色必须安全地传递含义。 使用颜色强化层级、状态和品牌,但绝不能仅依赖颜色作为唯一信号。保持对比度,并针对色觉障碍和低视力需求进行测试。
  8. 深度应解释层级关系。 阴影、重叠、边框和背景变化应明确提升层级、分组、焦点或交互——而非制造视觉噪音。
  9. 美观性提升接受度,但不能掩盖可用性缺陷。 细节打磨能让用户更宽容和自信,但也可能掩盖问题。在追求美观之前,先验证清晰度、无障碍性和任务适配性。
  10. 简化但不隐藏必要的复杂性。 减少可见选项,拆分复杂任务,但不要抽象掉用户决策或恢复所需的信息。
  11. 为真实内容的弹性设计。 用户上传的图片、长标签、空数据、错误、加载、禁用状态和本地化内容不能破坏构图。
  12. 以用户为中心解释权衡。 建议应参考用户目标、理解度、无障碍性、系统一致性和实现可行性。
查看references/principle-cards.md获取可复用的单条原则卡片。

Default recommendations

默认建议

Use these defaults unless the user gives context that makes another choice better.
AreaDefaultWhy it is usually bestOverride whenAsk before overriding
Product/task focusBegin with one core feature or screen goalPrevents designing app chrome before content and actions are knownUser is explicitly asking for global navigation, design-system shell, or IAAsk for the primary task and the screen’s success criterion
Visual directionProfessional, warm, restrained, and content-firstWorks for most productivity, SaaS, dashboard, admin, and commerce interfacesBrand is playful, luxury, editorial, youth-focused, highly technical, or campaign-likeAsk for brand personality and examples
Information densityComfortable spacing first; reduce only deliberatelySpacious layouts usually read as cleaner and clearerDashboard, pro tool, trading, ops, or data-monitoring context requires high densityAsk about density and scan speed needs
Layout strategyContent-width container with clear groups; avoid filling the screen by defaultReduces line length and visual drift on large screensImmersive canvas, map, media, spreadsheet, timeline, or data grid needs full widthAsk what content needs to stay visible together
GridUse a simple flexible grid plus tokenized spacing, not a rigid layout for its own sakeHelps alignment without forcing content into arbitrary columnsEditorial, marketing, or data-dense layouts need stronger grid logicAsk about content types and responsive breakpoints
TypographySystem UI or high-quality neutral sans for UI; pair with one expressive display face only when brand calls for itReduces loading risk and improves legibilityEditorial/brand work needs a distinct typographic voiceAsk for brand tone and font constraints
Type scaleSmall set of reusable steps for body, supporting text, labels, titles, and displayReduces inconsistent hierarchyExisting design system has a scaleAsk for the design-system token source
Line lengthKeep prose and long-form text in a readable measure; avoid edge-to-edge textImproves scanning and reading comfortData tables, code, or short cards need different measuresAsk only if the content type is unusual
ColorBuild semantic roles from a limited palette with neutral scale, accent scale, success/warning/error/info, and focus statesSupports consistency and accessibilityBrand palette is fixed or compliance/regulatory states are prescribedAsk for brand palette and accessibility target
ContrastTreat contrast as a functional requirement; verify text, icons, controls, and statesPrevents inaccessible or low-confidence UILarge decorative text or nonessential illustration is exemptAsk if the product requires a specific accessibility standard
DepthUse a small elevation scale and one consistent light modelCreates layers without visual chaosBrand is intentionally flat/brutalist or skeuomorphicAsk only if depth direction is a brand choice
ImageryUse high-quality, purpose-fit imagery; protect text overlays with scrims/gradients/containersImages vary and can destroy readabilityUser provides fixed photography or UGCAsk about image source and volatility
BordersUse spacing, background, shadow, or subtle dividers before adding many bordersBorders add noise quicklyData tables, legal forms, or dense settings screens need explicit separationAsk if density or tabular precision matters
Empty statesInclude helpful empty states with next actionEmpty states are part of the experience, not blank failureEmpty state is impossible or intentionally hiddenDo not ask; implement by default
MotionUse subtle, purposeful motion for feedback, continuity, and loading; respect reduced-motion preferencesAdds clarity without distractionProduct is entertainment-heavy or brand motion is a key differentiatorAsk about motion appetite and accessibility constraints
Frontend implementationUse semantic HTML, design tokens, responsive CSS, visible focus states, keyboard access, and state variantsPreserves visual quality and accessibility in real UIPrototype is static and disposableAsk if production constraints or framework/design-system rules exist
除非用户提供的上下文需要其他选择,否则使用以下默认方案。
领域默认方案通常最优的原因需覆盖默认的场景覆盖前需询问的内容
产品/任务聚焦从一个核心功能或屏幕目标开始避免在明确内容和操作前设计应用框架用户明确要求全局导航、设计系统框架或信息架构询问主要任务和屏幕的成功标准
视觉方向专业、温暖、克制且以内容为核心适用于大多数生产力工具、SaaS、仪表盘、管理后台和电商界面品牌风格为趣味、奢华、编辑类、年轻化、高度技术化或营销活动类询问品牌个性和示例
信息密度优先采用舒适间距;仅在必要时减少间距宽敞的布局通常更简洁清晰仪表盘、专业工具、交易系统、运维或数据监控场景需要高密度询问密度和扫描速度需求
布局策略采用内容宽度容器和清晰分组;默认避免填满整个屏幕减少大屏幕上的行宽和视觉偏移沉浸式画布、地图、媒体、电子表格、时间线或数据网格需要全屏询问哪些内容需要保持可见且关联
网格使用简单的弹性网格加标准化间距,而非为了网格而使用刚性布局在不强迫内容适配任意列的前提下帮助对齐编辑类、营销类或数据密集型布局需要更强的网格逻辑询问内容类型和响应式断点
排版系统UI字体或高品质中性无衬线字体用于界面;仅当品牌要求时搭配一种富有表现力的展示字体降低加载风险并提升可读性编辑/品牌工作需要独特的排版风格询问品牌调性和字体约束
字体层级为正文、辅助文本、标签、标题和展示文本设置少量可复用的层级减少不一致的层级结构现有设计系统已有字体层级询问设计系统的token来源
行宽将散文和长文本保持在易读的宽度范围内;避免文本从边缘到边缘提升扫描和阅读舒适度数据表格、代码或短卡片需要不同的宽度仅当内容类型特殊时询问
色彩从有限调色板构建语义角色,包括中性色阶、强调色阶、成功/警告/错误/提示色和焦点状态支持一致性和无障碍性品牌调色板固定或合规/监管状态有明确规定询问品牌调色板和无障碍目标
对比度将对比度视为功能性要求;验证文本、图标、控件和状态的对比度避免无障碍性差或可信度低的UI大型装饰文本或非必要插图可豁免询问产品是否需要特定的无障碍标准
深度使用小型层级刻度和一套一致的光照模型在不造成视觉混乱的前提下创建层级品牌风格为刻意扁平化/粗野主义或拟物化仅当深度方向是品牌选择时询问
图像使用高品质、适配场景的图像;通过遮罩/渐变/容器保护文本叠加层图像差异大,可能破坏可读性用户提供固定摄影作品或UGC(用户生成内容)询问图像来源和易变性
边框在添加大量边框前,优先使用间距、背景、阴影或细微分隔线边框会快速增加视觉噪音数据表格、法律表单或密集设置界面需要明确分隔询问密度或表格精度是否重要
空状态包含带有下一步操作的有用空状态空状态是体验的一部分,而非空白失败空状态不可能存在或故意隐藏无需询问;默认实现
动效使用微妙、有目的的动效提供反馈、保持连续性和加载提示;尊重减少动效的偏好在不分散注意力的前提下提升清晰度产品以娱乐为主或品牌动效是核心差异化因素询问动效需求和无障碍约束
前端实现使用语义化HTML、设计tokens、响应式CSS、可见焦点状态、键盘访问和状态变体在真实UI中保留视觉质量和无障碍性原型是静态且一次性的询问是否存在生产约束或框架/设计系统规则

Required user questions

需向用户询问的问题

Do not ask users to confirm routine best practices such as readable text, sufficient contrast, or clear hierarchy. Apply those by default.
Ask a focused question only when the answer materially changes the visual solution. Use the
question
tool or equivalent when available. Good triggers:
  • The product goal, primary task, audience, or platform is unknown and cannot be inferred.
  • Brand personality or visual tone could plausibly change type, color, density, imagery, or ornament.
  • The user asks for a redesign but does not provide the current UI, screenshot, code, design-system constraints, or success criteria.
  • Accessibility target, compliance context, or audience needs are stricter than ordinary inclusive defaults.
  • The UI will handle volatile content such as user-uploaded images, localization, very long names, unknown data density, or generated content.
  • The user requests novelty that could conflict with familiar mental models or platform conventions.
  • The user asks for frontend implementation and the target framework, design system, or CSS constraints matter.
When asking, include a recommended default and options. Ask one question at a time unless the user explicitly requests a thorough discovery process. Use the question-tool-ready prompts in references/decision-prompts.md for the full decision set.
不要要求用户确认常规最佳实践,如易读文本、足够对比度或清晰层级结构。默认应用这些规则。
仅当答案会实质性改变视觉解决方案时,才提出针对性问题。如果有
question
工具或类似工具,请使用它。合适的触发场景:
  • 产品目标、主要任务、受众或平台未知且无法推断。
  • 品牌个性或视觉调性可能改变字体、颜色、密度、图像或装饰。
  • 用户要求重设计但未提供当前UI、截图、代码、设计系统约束或成功标准。
  • 无障碍目标、合规场景或受众需求比普通包容性默认要求更严格。
  • UI将处理易变内容,如用户上传的图像、本地化内容、超长名称、未知数据密度或生成内容。
  • 用户要求的创新可能与熟悉的心智模型或平台常规冲突。
  • 用户要求前端实现,且目标框架、设计系统或CSS约束很重要。
提问时,包含推荐的默认方案和选项。除非用户明确要求全面的探索流程,否则一次只提一个问题。使用references/decision-prompts.md中适合工具调用的提示语获取完整决策集。

Workflow: critique existing UI

工作流程:评审现有UI

When reviewing an existing UI, inspect in this order:
  1. Task and context fit. Identify the primary user goal, audience, platform, and success criterion. If missing, infer cautiously and state the assumption.
  2. Mental model and convention fit. Check whether common controls, navigation, search, forms, and feedback behave like users expect.
  3. Information hierarchy. Identify the intended primary content/action. Verify that the visual hierarchy matches importance, not just document order or semantic severity.
  4. Grouping and layout. Check proximity, alignment, common regions, screen width, responsive behavior, and ambiguous spacing.
  5. Typography. Check font choice, type scale, line length, line height, emphasis, label treatment, alignment, and long-content behavior.
  6. Color and contrast. Check palette roles, contrast, semantic states, color-only meaning, hue/saturation balance, and dark/light mode implications.
  7. Depth and layer logic. Check shadows, borders, overlaps, surface colors, modals, popovers, cards, and focus hierarchy.
  8. Imagery and media. Check image quality, crop, intended size, overlay text contrast, loading failures, UGC, and alt text needs.
  9. States and resilience. Check empty, loading, error, disabled, focus, hover, selected, validation, destructive, and success states.
  10. Accessibility and inclusion. Check perceptibility, operability, simplicity, forgiveness, keyboard flow, focus, touch target comfort, motion sensitivity, and screen-reader semantics.
  11. Frontend feasibility. Check whether the visual recommendation can be implemented with tokens, semantic components, responsive CSS, and maintainable variants.
  12. Prioritize fixes. Group findings into high-impact fixes, polish improvements, and context-dependent tradeoffs. Recommend the smallest set of changes likely to produce the biggest improvement.
评审现有UI时,按以下顺序检查:
  1. 任务与场景适配性。 明确主要用户目标、受众、平台和成功标准。如果缺失,谨慎推断并说明假设。
  2. 心智模型与常规适配性。 检查常见控件、导航、搜索、表单和反馈是否符合用户预期。
  3. 信息层级。 确定预期的主要内容/操作。验证视觉层级是否与重要性匹配,而非仅与文档顺序或语义优先级匹配。
  4. 分组与布局。 检查邻近性、对齐、共同区域、屏幕宽度、响应式行为和模糊间距。
  5. 排版。 检查字体选择、字体层级、行宽、行高、强调效果、标签处理、对齐方式和长内容表现。
  6. 色彩与对比度。 检查调色板角色、对比度、语义状态、仅依赖颜色的含义、色相/饱和度平衡以及明暗模式的影响。
  7. 深度与层级逻辑。 检查阴影、边框、重叠、表面颜色、模态框、弹出框、卡片和焦点层级。
  8. 图像与媒体。 检查图像质量、裁剪、预期尺寸、叠加文本对比度、加载失败情况、UGC和替代文本需求。
  9. 状态与弹性。 检查空状态、加载状态、错误状态、禁用状态、焦点状态、悬停状态、选中状态、验证状态、破坏性操作状态和成功状态。
  10. 无障碍与包容性。 检查可感知性、可操作性、简洁性、容错性、键盘流程、焦点、触摸目标舒适度、动敏性和屏幕阅读器语义。
  11. 前端可行性。 检查视觉建议是否可以通过tokens、语义组件、响应式CSS和可维护的变体实现。
  12. 优先修复项。 将发现的问题分为高影响修复、细节优化和场景相关权衡。推荐能产生最大改进的最小变更集。

Workflow: create or improve UI

工作流程:创建或优化UI

When generating a new design or recommendation, proceed in this order:
  1. Clarify the core feature. Define the specific screen, task, audience, and completion goal. Start with content and functionality, not navigation chrome.
  2. List required elements. Identify primary content, primary action, supporting actions, constraints, and states.
  3. Choose the simplest useful structure. Sketch or describe the layout in low fidelity. Avoid color, shadows, icons, and detailed typography until the structure works.
  4. Create hierarchy in grayscale. Use order, grouping, size, weight, spacing, and contrast first. Add color only after hierarchy is clear without it.
  5. Establish systems. Choose type scale, spacing scale, grid/container rules, color roles, radius, borders, and elevation tokens.
  6. Compose the layout. Arrange groups so related elements are near each other and unrelated elements are clearly separated. Avoid ambiguous spacing.
  7. Apply typography. Set readable body text, strong titles, restrained labels, appropriate line height, consistent emphasis, and baseline/edge alignment.
  8. Apply color and states. Use color for brand, affordance, state, and focus. Verify contrast and add non-color cues.
  9. Add depth and imagery. Use shadows, overlap, background variation, and imagery only where they clarify surfaces, hierarchy, or brand.
  10. Design edge states. Include empty, loading, error, disabled, selected, focus, hover, long-content, and narrow-screen behavior.
  11. Check accessibility and frontend implementation. Ensure semantic structure, keyboard flow, focus visibility, responsive behavior, tokenization, and reduced-motion support.
  12. Explain decisions. Present recommendations as user-goal and system-quality improvements, not personal taste.
生成新设计或建议时,按以下步骤进行:
  1. 明确核心功能。 定义具体的屏幕、任务、受众和完成目标。从内容和功能开始,而非导航框架。
  2. 列出必要元素。 确定主要内容、主要操作、辅助操作、约束和状态。
  3. 选择最简单的实用结构。 以低保真度绘制或描述布局。在结构可行前,避免使用颜色、阴影、图标和详细排版。
  4. 在灰度模式下创建层级。 优先使用顺序、分组、尺寸、字重、间距和对比度。仅在层级清晰后添加颜色。
  5. 建立系统规则。 选择字体层级、间距层级、网格/容器规则、色彩角色、圆角、边框和层级tokens。
  6. 构图布局。 排列分组,使相关元素靠近,无关元素清晰分隔。避免模糊间距。
  7. 应用排版。 设置易读的正文、醒目的标题、克制的标签、合适的行高、一致的强调效果和基线/边缘对齐。
  8. 应用色彩与状态。 使用色彩实现品牌、可用性、状态和焦点效果。验证对比度并添加非色彩提示。
  9. 添加深度与图像。 仅在能明确表面、层级或品牌的情况下使用阴影、重叠、背景变化和图像。
  10. 设计边缘状态。 包含空状态、加载状态、错误状态、禁用状态、选中状态、焦点状态、悬停状态、长内容和窄屏幕表现。
  11. 检查无障碍与前端实现。 确保语义结构、键盘流程、焦点可见性、响应式行为、token化和减少动效支持。
  12. 解释决策。 将建议呈现为用户目标和系统质量的改进,而非个人喜好。

Decision framework

决策框架

Use this framework whenever a visual decision is ambiguous:
  1. Does the decision affect task success? Prefer clarity, familiarity, accessibility, and recovery over novelty.
  2. Does it express product personality? If yes and brand context is missing, ask. If no, use the restrained default.
  3. Does it reduce or increase cognitive load? Chunk, disclose progressively, and highlight recommended paths without hiding necessary complexity.
  4. Does it strengthen or confuse hierarchy? Every visual cue should support a priority or relationship.
  5. Does it work with real content? Test long labels, empty data, dense data, UGC, localization, dark mode, and responsive sizes.
  6. Can it be implemented consistently? Prefer tokenized, reusable patterns over custom one-offs.
  7. Is it accessible without special pleading? If it relies on color alone, tiny targets, hidden focus, motion, fragile contrast, or ambiguous labels, revise.
当视觉决策不明确时,使用以下框架:
  1. 该决策是否影响任务成功? 优先选择清晰度、熟悉度、无障碍性和可恢复性,而非创新性。
  2. 它是否表达产品个性? 如果是且品牌上下文缺失,询问用户。如果不是,使用克制的默认方案。
  3. 它是否减少或增加认知负荷? 拆分内容、逐步展示、突出推荐路径,但不隐藏必要的复杂性。
  4. 它是否强化或混淆层级结构? 每个视觉提示都应支持优先级或关系。
  5. 它是否适用于真实内容? 测试长标签、空数据、密集数据、UGC、本地化、暗色模式和响应式尺寸。
  6. 它是否能一致实现? 优先选择token化、可复用的模式,而非自定义一次性方案。
  7. 它是否无需特殊说明即可无障碍访问? 如果仅依赖颜色、微小目标、隐藏焦点、动效、脆弱对比度或模糊标签,请修改。

Practical rules

实用规则

Hierarchy

层级结构

  • Rank elements before styling them. Decide what is primary, secondary, tertiary, and ambient.
  • Do not make every important thing large, bold, colored, and boxed. Emphasize the primary and de-emphasize the rest.
  • Use multiple visual levers carefully: size, weight, contrast, spacing, placement, color, and depth. One or two strong cues are often enough.
  • A destructive action is not automatically the primary action. Style it according to its role in the current task; make it prominent only at the confirmation step if that is where the destructive decision occurs.
  • Labels are a last resort for obvious structured data. When the value can carry the meaning, de-emphasize or remove the label.
  • 在样式化前对元素排序。确定主要、次要、三级和次要元素。
  • 不要让每个重要元素都大、粗、有色且带框。突出主要元素,弱化其他元素。
  • 谨慎使用多种视觉手段:尺寸、字重、对比度、间距、位置、颜色和深度。通常一两个强提示就足够。
  • 破坏性操作并非自动成为主要操作。根据其在当前任务中的角色设置样式;仅在确认步骤中突出显示,如果该步骤是做出破坏性决策的环节。
  • 对于明显的结构化数据,标签是最后选择。当值本身能传递含义时,弱化或移除标签。

Layout and spacing

布局与间距

  • Start with generous whitespace, then remove it until the layout fits the task. Do not start cramped and add tiny margins until it barely stops looking bad.
  • Use a constrained spacing scale with meaningfully different steps. Avoid arbitrary pixel values that differ by only a few pixels.
  • Avoid ambiguous spacing. Related items should be closer to each other than to other groups.
  • Do not fill the whole screen by default. Limit text and content width when full width harms reading or grouping.
  • Use grids as flexible structure, not as decoration. Let content and relationships determine the grid.
  • Make dense layouts a deliberate choice for expert, monitoring, tabular, or high-frequency tasks.
  • 从充足的留白开始,然后逐步减少直到布局适配任务。不要从拥挤的布局开始,添加微小边距直到看起来勉强不错。
  • 使用具有明显差异步骤的受限间距刻度。避免仅相差几个像素的任意像素值。
  • 避免模糊间距。相关项之间的距离应小于与其他组的距离。
  • 默认不要填满整个屏幕。当全屏会影响阅读或分组时,限制文本和内容宽度。
  • 将网格用作弹性结构,而非装饰。让内容和关系决定网格。
  • 仅为专家、监控、表格或高频任务刻意选择密集布局。

Typography

排版

  • Choose type for content, audience, platform, and brand—not because a font looks fashionable in isolation.
  • Use a small type scale. Avoid tiny differences that look accidental.
  • Keep body text readable. Use shorter line lengths for prose and cards, larger line heights for small text, and tighter line heights for large headings.
  • Align text for readability. Prefer left alignment for most Latin-script body text. Use centered text sparingly for short, low-density content.
  • Align text and controls by baseline when typography is the dominant visual element.
  • Use real italic, small caps, numerals, and weights when available. Avoid fake slanting, horizontal stretching, and excessive tracking.
  • Use no more than a few consistent cues per hierarchy level. Avoid combining bold, italics, underline, all caps, color, and size all at once.
  • 根据内容、受众、平台和品牌选择字体——而非因为字体单独看起来时尚。
  • 使用小型字体层级。避免看起来像意外的微小差异。
  • 保持正文易读。散文和卡片使用较短行宽,小文本使用较大行高,大标题使用较窄行高。
  • 为可读性对齐文本。大多数拉丁脚本正文优先左对齐。仅在短文本、低密度内容中谨慎使用居中对齐。
  • 当排版是主导视觉元素时,按基线对齐文本和控件。
  • 尽可能使用真实的斜体、小型大写字母、数字和字重。避免伪倾斜、水平拉伸和过度字距调整。
  • 每个层级使用不超过几个一致的提示。避免同时使用粗体、斜体、下划线、全大写、颜色和尺寸。

Color

色彩

  • Define neutral, brand/accent, semantic, focus, and surface color roles before applying colors broadly.
  • Prefer HSL/OKLCH-like thinking when adjusting hue, saturation, and lightness; do not pick isolated hex values one at a time.
  • Use more shade steps than the final UI seems to require so hover, active, border, background, and text states can be consistent.
  • Do not use gray text on saturated colored backgrounds if it reduces perceived contrast. Choose a color that belongs to that background.
  • Keep saturation alive in light colors; avoid washed-out palettes that lose personality and state distinction.
  • Use non-color cues for errors, success, warnings, selected states, links, and required fields.
  • 在广泛应用颜色前,定义中性色、品牌/强调色、语义色、焦点色和表面色的角色。
  • 调整色相、饱和度和明度时,优先采用HSL/OKLCH式思维;不要逐个选择孤立的十六进制值。
  • 设置比最终UI所需更多的色调步骤,以便悬停、激活、边框、背景和文本状态保持一致。
  • 如果灰色文本在饱和彩色背景上会降低感知对比度,不要使用。选择属于该背景的颜色。
  • 在浅色中保持饱和度;避免失去个性和状态区分度的褪色调色板。
  • 为错误、成功、警告、选中状态、链接和必填字段添加非色彩提示。

Depth, surfaces, and borders

深度、表面与边框

  • Use one consistent light model. Raised surfaces need highlights and shadows that make sense together.
  • Use a small elevation scale. Low elevation for controls/cards, medium for popovers/dropdowns, high for modals and blocking surfaces.
  • Prefer subtle background shifts, spacing, shadows, or accent edges before adding heavy borders everywhere.
  • Overlap elements only when it clarifies layering, creates a purposeful focal point, or adds controlled energy. Do not overlap important text or controls in ways that reduce clarity.
  • Flat design still needs depth cues: hierarchy, grouping, contrast, and surface changes.
  • 使用一套一致的光照模型。凸起表面需要协调的高光和阴影。
  • 使用小型层级刻度。控件/卡片使用低层级,弹出框/下拉菜单使用中层级,模态框和阻塞表面使用高层级。
  • 在到处添加粗边框前,优先使用微妙的背景变化、间距、阴影或强调边缘。
  • 仅在明确层级、创建有目的的焦点或增加可控活力时重叠元素。不要以降低清晰度的方式重叠重要文本或控件。
  • 扁平化设计仍需要深度提示:层级、分组、对比度和表面变化。

Images and media

图像与媒体

  • Use images with adequate resolution, strong crop, consistent style, and clear purpose.
  • Never place text directly on unpredictable images without a contrast protection strategy: overlay, gradient, solid panel, blur, or controlled crop.
  • Respect intended image size. Do not enlarge small assets beyond their quality or shrink detailed images until their content is illegible.
  • Treat user-uploaded images as hostile to layout and contrast. Provide cropping, fallback surfaces, safe text placement, and moderation/placeholder states.
  • 使用分辨率足够、裁剪得当、风格一致且目的明确的图像。
  • 绝不在不可预测的图像上直接放置文本,而不采取对比度保护策略:叠加层、渐变、纯色面板、模糊或受控裁剪。
  • 尊重图像的预期尺寸。不要将小资源放大超出其质量范围,也不要将细节图像缩小到内容无法辨认的程度。
  • 将用户上传的图像视为对布局和对比度有威胁的内容。提供裁剪、备用表面、安全文本位置和审核/占位符状态。

Finishing details

细节打磨

  • Improve default components intentionally: focus rings, empty states, hover/active/disabled states, selected states, validation, loading skeletons, and microcopy.
  • Use accent borders, subtle backgrounds, and small decorative elements to add polish after hierarchy and accessibility are solved.
  • Empty states should explain what is missing, why it matters, and what action to take next.
  • Look for small high-leverage refinements: tighter heading line-height, better icon alignment, clearer selected state, more consistent radii, improved surface contrast, and less border noise.
  • 有意优化默认组件:焦点环、空状态、悬停/激活/禁用状态、选中状态、验证、加载骨架和微文案。
  • 在解决层级和无障碍问题后,使用强调边框、微妙背景和小型装饰元素添加细节。
  • 空状态应说明缺失内容、重要性以及下一步操作。
  • 寻找小而高效的改进:更紧凑的标题行高、更好的图标对齐、更清晰的选中状态、更一致的圆角、改进的表面对比度和更少的边框噪音。

Accessibility and inclusion requirements

无障碍与包容性要求

Treat accessibility as a core visual-composition requirement, not a compliance pass at the end.
  • Ensure perceptibility: text, icons, controls, and states must be perceivable through contrast, size, labeling, alt text, and redundant cues.
  • Ensure operability: controls must have comfortable target areas, keyboard access, logical focus order, and visible focus states.
  • Ensure simplicity: reduce unnecessary complexity, use clear labels, reveal only relevant information when possible, and make modes visible.
  • Ensure forgiveness: prevent errors where possible, explain errors near the relevant field, preserve user input, support undo/recovery when feasible, and make destructive actions deliberate.
  • Do not rely on color alone. Pair color with text, icons, shape, position, or pattern.
  • Respect reduced-motion preferences. Avoid attention-grabbing motion for critical meaning unless there is a non-motion alternative.
  • Use platform-appropriate touch target minimums and increase target size/spacing when accuracy matters or use is mobile, shaky, or time-critical.
  • Use inclusive imagery. Avoid visual choices that imply only one body type, ability, culture, device, or environment unless the product context requires that specificity.
  • Default to WCAG AA-equivalent contrast and focus visibility for production UI. Ask only when the user’s product requires a stricter or different standard.
将无障碍性视为视觉构图的核心要求,而非最后的合规步骤。
  • 确保可感知性:文本、图标、控件和状态必须通过对比度、尺寸、标签、替代文本和冗余提示被感知。
  • 确保可操作性:控件必须有舒适的目标区域、键盘访问、合理的焦点顺序和可见的焦点状态。
  • 确保简洁性:减少不必要的复杂性,使用清晰的标签,尽可能仅显示相关信息,并让模式可见。
  • 确保容错性:尽可能防止错误,在相关字段附近解释错误,保留用户输入,尽可能支持撤销/恢复,并让破坏性操作更慎重。
  • 不要仅依赖颜色。将颜色与文本、图标、形状、位置或图案搭配使用。
  • 尊重减少动效的偏好。除非有非动效替代方案,否则不要将引人注目的动效用于关键含义。
  • 使用平台适用的最小触摸目标尺寸,当精度重要或在移动、抖动或时间紧迫的场景中使用时,增加目标尺寸/间距。
  • 使用包容性图像。除非产品场景需要特定性,否则避免暗示只有一种体型、能力、文化、设备或环境的视觉选择。
  • 生产UI默认采用WCAG AA等效的对比度和焦点可见性。仅当用户产品需要更严格或不同的标准时询问。

Frontend implementation guidance

前端实现指导

When the output includes frontend code or implementation advice, make the visual design implementable:
  • Preserve semantic structure. Visual hierarchy may differ from document hierarchy, but headings, landmarks, lists, tables, buttons, links, and form controls must remain semantically correct.
  • Use design tokens for spacing, font sizes, line heights, colors, radius, shadow/elevation, z-index, and motion duration/easing.
  • Use responsive layout primitives: grid/flex, container queries or breakpoints where appropriate, max-widths for readable text, and fluid media.
  • Provide component variants for primary/secondary/tertiary/destructive actions, selected states, hover, active, disabled, focus, loading, error, and success.
  • Use real buttons for actions and real links for navigation. Do not style non-interactive elements as controls without semantics and keyboard behavior.
  • Keep focus states visible and consistent with the color system. Do not remove outlines unless replacing them with an equally visible focus indicator.
  • Use semantic tables for tabular data. Do not use tables for layout. For data-dense tables, prioritize alignment, scannability, sticky context, truncation rules, and responsive overflow behavior.
  • Use CSS variables or theme tokens for light/dark modes. Do not invert colors mechanically; tune surfaces, borders, shadows, and semantic colors per mode.
  • Optimize images with explicit dimensions, responsive sources, alt text, lazy loading where appropriate, and fallbacks for broken or missing media.
  • Use reduced-motion media queries and avoid blocking user feedback behind long animations.
  • Prefer a maintainable, slightly less novel solution over a custom visual treatment that requires fragile CSS or one-off state logic.
当输出包含前端代码或实现建议时,确保视觉设计可实现:
  • 保留语义结构。视觉层级可能与文档层级不同,但标题、地标、列表、表格、按钮、链接和表单控件必须保持语义正确。
  • 使用设计tokens处理间距、字体大小、行高、颜色、圆角、阴影/层级、z-index和动效时长/缓动。
  • 使用响应式布局原语:grid/flex、适当的容器查询或断点、易读文本的最大宽度和流体媒体。
  • 提供主要/次要/三级/破坏性操作、选中状态、悬停、激活、禁用、焦点、加载、错误和成功状态的组件变体。
  • 使用真实按钮处理操作,真实链接处理导航。不要将非交互元素样式化为控件,除非添加语义和键盘行为。
  • 保持焦点状态可见,并与颜色系统一致。除非用同样可见的焦点指示器替换,否则不要移除轮廓。
  • 使用语义表格处理表格数据。不要用表格做布局。对于数据密集型表格,优先考虑对齐、可扫描性、粘性上下文、截断规则和响应式溢出行为。
  • 使用CSS变量或主题tokens处理明暗模式。不要机械地反转颜色;针对每种模式调整表面、边框、阴影和语义颜色。
  • 通过明确尺寸、响应式源、替代文本、适当的懒加载以及损坏或缺失媒体的备用方案优化图像。
  • 使用减少动效的媒体查询,避免在长动画后阻止用户反馈。
  • 优先选择可维护、略微缺乏创新性的解决方案,而非需要脆弱CSS或一次性状态逻辑的自定义视觉处理。

Quality checklist

质量检查清单

Before finalizing a critique, recommendation, or UI implementation, verify:
  • The primary user task and primary action are obvious.
  • The interface works in grayscale before color is added.
  • Related elements are grouped by proximity, alignment, and common regions.
  • Spacing, type, color, radius, and elevation use a limited system.
  • Text is readable, lines are not too long, and hierarchy cues are consistent.
  • Color contrast is sufficient, and color is not the only meaning carrier.
  • Shadows, surfaces, and borders express real grouping or elevation.
  • Images do not break text contrast, layout, or meaning.
  • Empty, loading, error, focus, disabled, selected, and hover states are covered.
  • Touch targets, keyboard flow, focus visibility, and screen-reader semantics are considered.
  • The design handles long content, dense data, UGC, localization, and narrow screens.
  • Recommendations are prioritized and explained in terms of user value.
Use the full checklists in references/checklists.md.
在完成评审、建议或UI实现前,验证:
  • 主要用户任务和主要操作明确。
  • 在添加颜色前,界面在灰度模式下可用。
  • 相关元素通过邻近性、对齐和共同区域分组。
  • 间距、字体、颜色、圆角和层级使用有限的系统。
  • 文本易读,行宽不过长,层级提示一致。
  • 色彩对比度足够,且颜色不是唯一的含义载体。
  • 阴影、表面和边框表达真实的分组或层级。
  • 图像不会破坏文本对比度、布局或含义。
  • 覆盖空状态、加载状态、错误状态、焦点状态、禁用状态、选中状态和悬停状态。
  • 考虑了触摸目标、键盘流程、焦点可见性和屏幕阅读器语义。
  • 设计能处理长内容、密集数据、UGC、本地化和窄屏幕。
  • 建议按优先级排序,并从用户价值角度解释。
使用references/checklists.md中的完整检查清单。

Common mistakes to avoid

需避免的常见错误

  • Designing the navigation shell before designing the feature.
  • Adding color, shadows, gradients, and icons before hierarchy is clear.
  • Using arbitrary pixel values instead of a spacing/type/color system.
  • Making every important element visually loud.
  • Using color alone for links, errors, status, or selection.
  • Using too many borders instead of spacing, grouping, or background contrast.
  • Treating a pretty UI as automatically usable.
  • Over-simplifying until users cannot see the information needed to decide.
  • Violating familiar mental models without a strong user or brand reason.
  • Ignoring edge states because the static happy path looks polished.
  • Generating frontend code that looks right but is inaccessible or semantically wrong.
See references/anti-patterns.md for the full anti-pattern list.
  • 在设计功能前设计导航框架。
  • 在层级清晰前添加颜色、阴影、渐变和图标。
  • 使用任意像素值而非间距/字体/颜色系统。
  • 让每个重要元素在视觉上都很醒目。
  • 仅使用颜色表示链接、错误、状态或选择。
  • 使用过多边框而非间距、分组或背景对比度。
  • 认为漂亮的UI自动可用。
  • 过度简化直到用户无法看到决策所需的信息。
  • 无充分用户或品牌理由违反熟悉的心智模型。
  • 因为静态理想路径看起来精致而忽略边缘状态。
  • 生成看起来正确但无障碍性差或语义错误的前端代码。
查看references/anti-patterns.md获取完整的反模式列表。

How to explain recommendations to the user

如何向用户解释建议

Explain visual recommendations as functional tradeoffs, not taste.
Use this pattern:
  1. Observation: Describe what the current design is doing.
  2. Effect: Explain the likely user impact.
  3. Recommendation: State the specific change.
  4. Reason: Tie it to hierarchy, grouping, readability, accessibility, convention, or implementation.
  5. Tradeoff: Mention when an alternative would be better.
Example style:
The primary action competes with the filter chips because they share the same visual weight. Make the primary action the only filled button, reduce filters to secondary chips, and increase the spacing between the toolbar and content. This preserves scanability while keeping filters discoverable.
将视觉建议解释为功能性权衡,而非个人喜好。
使用以下模式:
  1. 观察: 描述当前设计的做法。
  2. 影响: 解释可能对用户产生的影响。
  3. 建议: 说明具体的变更。
  4. 原因: 将其与层级结构、分组、可读性、无障碍性、常规或实现联系起来。
  5. 权衡: 提及何时替代方案会更好。
示例风格:
主要操作与筛选芯片视觉权重相同,导致两者相互竞争。将主要操作设为唯一的填充按钮,将筛选器改为次要芯片,并增加工具栏与内容之间的间距。这样既能保持可扫描性,又能让筛选器易于发现。