ui-skills
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUI Skills
UI 技能
When invoked, apply these opinionated constraints for building better interfaces.
调用后,将应用这些约定式约束来构建更优质的界面。
How to use
使用方法
-
/ui-skills
Apply these constraints to any UI work in this conversation. -
/ui-skills <file>
Review the file against all constraints below and output:- violations (quote the exact line/snippet)
- why it matters (1 short sentence)
- a concrete fix (code-level suggestion)
-
/ui-skills
将这些约束应用于本次对话中的所有UI相关工作。 -
/ui-skills <file>
基于以下所有约束评审指定文件,并输出:- 违规内容(引用准确的代码行/片段)
- 重要性说明(1句简短描述)
- 具体修复方案(代码级建议)
Stack
技术栈要求
- MUST use Tailwind CSS defaults unless custom values already exist or are explicitly requested
- MUST use (formerly
motion/react) when JavaScript animation is requiredframer-motion - SHOULD use for entrance and micro-animations in Tailwind CSS
tw-animate-css - MUST use utility (
cn+clsx) for class logictailwind-merge
- 除非已存在自定义值或有明确需求,否则必须使用Tailwind CSS默认配置
- 需要JavaScript动画时必须使用(原名为
motion/react)framer-motion - Tailwind CSS中的入场动画和微动画推荐使用实现
tw-animate-css - 类名逻辑必须使用工具(
cn+clsx)处理tailwind-merge
Components
组件规范
- MUST use accessible component primitives for anything with keyboard or focus behavior (,
Base UI,React Aria)Radix - MUST use the project’s existing component primitives first
- NEVER mix primitive systems within the same interaction surface
- SHOULD prefer for new primitives if compatible with the stack
Base UI - MUST add an to icon-only buttons
aria-label - NEVER rebuild keyboard or focus behavior by hand unless explicitly requested
- 所有涉及键盘或焦点行为的组件必须使用可访问的组件原语(、
Base UI、React Aria)Radix - 必须优先使用项目已有的组件原语
- 禁止在同一个交互区域内混用不同的原语系统
- 若与技术栈兼容,新的原语推荐优先使用
Base UI - 仅展示图标的按钮必须添加属性
aria-label - 除非有明确需求,否则禁止手动实现键盘或焦点行为
Interaction
交互规范
- MUST use an for destructive or irreversible actions
AlertDialog - SHOULD use structural skeletons for loading states
- NEVER use , use
h-screenh-dvh - MUST respect for fixed elements
safe-area-inset - MUST show errors next to where the action happens
- NEVER block paste in or
inputelementstextarea
- 破坏性或不可逆操作必须使用
AlertDialog - 加载状态推荐使用结构化骨架屏
- 禁止使用,请使用
h-screenh-dvh - 固定定位元素必须适配
safe-area-inset - 错误提示必须展示在触发操作的位置附近
- 禁止在或
input元素中禁用粘贴功能textarea
Animation
动画规范
- NEVER add animation unless it is explicitly requested
- MUST animate only compositor props (,
transform)opacity - NEVER animate layout properties (,
width,height,top,left,margin)padding - SHOULD avoid animating paint properties (,
background) except for small, local UI (text, icons)color - SHOULD use on entrance
ease-out - NEVER exceed for interaction feedback
200ms - MUST pause looping animations when off-screen
- SHOULD respect
prefers-reduced-motion - NEVER introduce custom easing curves unless explicitly requested
- SHOULD avoid animating large images or full-screen surfaces
- 除非有明确需求,否则禁止添加动画
- 仅可对合成属性(、
transform)添加动画opacity - 禁止对布局属性(、
width、height、top、left、margin)添加动画padding - 除小型局部UI(文本、图标)外,推荐避免对绘制属性(、
background)添加动画color - 入场动画推荐使用缓动函数
ease-out - 交互反馈动画时长不得超过
200ms - 元素离开可视区域时必须暂停循环动画
- 推荐适配(减少动画偏好)设置
prefers-reduced-motion - 除非有明确需求,否则禁止使用自定义缓动曲线
- 推荐避免对大尺寸图片或全屏区域添加动画
Typography
排版规范
- MUST use for headings and
text-balancefor body/paragraphstext-pretty - MUST use for data
tabular-nums - SHOULD use or
truncatefor dense UIline-clamp - NEVER modify (
letter-spacing) unless explicitly requestedtracking-*
- 标题必须使用,正文/段落必须使用
text-balancetext-pretty - 数据内容必须使用
tabular-nums - 高密度UI场景推荐使用或
truncate处理文本溢出line-clamp - 除非有明确需求,否则禁止修改(
letter-spacing类)tracking-*
Layout
布局规范
- MUST use a fixed scale (no arbitrary
z-index)z-* - SHOULD use for square elements instead of
size-*+w-*h-*
- 必须使用固定的层级体系(禁止使用任意
z-index值)z-* - 正方形元素推荐使用而非同时设置
size-*+w-*h-*
Performance
性能规范
- NEVER animate large or
blur()surfacesbackdrop-filter - NEVER apply outside an active animation
will-change - NEVER use for anything that can be expressed as render logic
useEffect
- 禁止对大尺寸或
blur()区域添加动画backdrop-filter - 非活跃动画期间禁止使用属性
will-change - 所有可通过渲染逻辑实现的功能禁止使用实现
useEffect
Design
设计规范
- NEVER use gradients unless explicitly requested
- NEVER use purple or multicolor gradients
- NEVER use glow effects as primary affordances
- SHOULD use Tailwind CSS default shadow scale unless explicitly requested
- MUST give empty states one clear next action
- SHOULD limit accent color usage to one per view
- SHOULD use existing theme or Tailwind CSS color tokens before introducing new ones
- 除非有明确需求,否则禁止使用渐变效果
- 禁止使用紫色或多色渐变
- 禁止将发光效果作为主要的交互提示
- 除非有明确需求,否则推荐使用Tailwind CSS默认阴影层级
- 空状态必须提供一个清晰的下一步操作引导
- 单视图内强调色的使用建议不超过1种
- 引入新颜色前优先使用现有主题或Tailwind CSS颜色token