Communitygithub.com

LIKELION-CAPSULE/Landing_Page

为项目中的表面、图标和动效打磨细节,提供精确的圆角、光学对齐、阴影、图标状态和动画参数。

Landing_Page 是什么?

此技能专注于 UI 的视觉打磨,为表面、图标和动效提供精确的具体数值。它适用于底层交互已经确定的情况,并且打磨建议永远不会优先于破坏性的交互问题。该技能覆盖了多种主流平台和工具,如 CSS、Tailwind CSS 和 Motion(Framer Motion)的实践。核心原则包括:使用精确值而非区间(例如 `cubic-bezier(0.2, 0, 0, 1)` 不可近似)、根据内边距计算嵌套表面的外半径、通过人眼进行光学对齐、用阴影表示层级而用边框表示结构、以及为交互状态使用 CSS 过渡而非关键帧(关键帧无法在用户中途撤销时反转)。此外,它还规定了按钮按压缩放为 0.96、高频交互不添加动画、所有动效必须尊重 `prefers-reduced-motion` 偏好、以及入场和退场动画的具体时长与缓动函数。该技能还指导用户如何为不同字重匹配图标描边、使用单一 SVG 并通过 CSS 颜色更改状态、以及处理 RTL 布局中的图标镜像。最后,它提供了一个详细的检测与修复对照表,以及一个包含严重级别分级和验证要求的报告格式。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/LIKELION-CAPSULE/Landing_Page/tree/HEAD/.agents/skills/better-ui

在你喜欢的 AI 中提问

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

文档

UI 打磨

此技能包含表面、图标和动效的视觉打磨细节,以及每个细节的具体数值。它适用于底层交互已确定的情况,且打磨建议永远不会优先于破坏性的交互问题。

精确值,可选的打磨

以下数值是精确的,不是近似范围。cubic-bezier(0.2, 0, 0, 1) 不是 cubic-bezier(0.4, 0, 0.2, 1),0.96 也不是 0.95。光学微调和同心内边距临界点是例外,它们是起点,需要人眼判断。

保持项目自身的组件库、设计令牌和密度,并匹配其动效语言,除非此处有规则提供了数值。一个有意为之且一致的项目约定(例如一个无阴影的样式)是一种偏好,而不是一个发现。项目内部同一细节采用两种不同方式则是一个发现。

文本换行、字体渲染、表格数字和文本间距属于 better-typography。点击区域、键盘支持、ARIA 和减少动效要求属于 better-accessibility。分组、章节间距、断点和空间 RTL 属于 better-layout,但方向性图标镜像除外。颜色令牌和对比度测量属于 better-colors。

外半径等于内半径加内边距

在嵌套表面共享可见的均匀内嵌的情况下,外半径等于内半径加上内边距以及任何边框宽度。当内边距超过 24px 或内边距故意不对称时,将各层视为独立表面,并保留各自的半径令牌。配方请参见 surfaces.md。

在几何对齐看起来不对时进行光学对齐

当几何居中对齐看起来不对时,通过人眼微调。在按钮的图标侧减少 2px 内边距,将播放三角形向其顶点移动,并在 SVG 本身中修复不对称的字形。配方请参见 surfaces.md。

阴影用于层级,边框用于结构

当边框仅用于创建深度时,将其替换为分层的透明 box-shadow 值。在分隔线、分割线、表格单元格和选中状态上保留边框。在表单输入上也保留边框,其边界在 better-accessibility 下需要 3:1 的非文本对比度。焦点环也属于 better-accessibility。

强制颜色模式会移除所有 box-shadow。在阴影环下保留 border: 1px solid transparent,以便该模式仍能绘制边缘。配方请参见 surfaces.md。

以纯黑或纯白勾勒图像轮廓

为内容图像添加 1px 向内偏移 1px 的轮廓。在浅色模式下使用 oklch(0 0 0 / 0.1),深色模式下使用 oklch(1 0 0 / 0.1)。切勿使用接近黑色的色调、带有色调的中性色或强调色,因为色调会表现为图像边缘上的彩色边缘。跳过透明艺术作品,如标志和插图。配方请参见 surfaces.md。

对交互状态使用过渡,而非关键帧

使用 CSS 过渡或动效库的弹簧驱动交互状态变化,这可以在用户中途逆转操作时重新定位目标。关键帧运行固定时间轴且无法逆转,因此将其保留给只运行一次的序列。请参阅 animations.md。

按压缩放至 0.96

被按压的按钮在 150ms 内以 ease-out 缩放至 0.96,禁用的按钮从不缩放。为按钮提供一个退出机制,以便在动效会分散注意力的场景下通过组件的现有变体 API 或 static prop 关闭此效果。有关 CSS、Tailwind 和 Motion 的配方,请参见 animations.md。

高频交互无动画

按键、行悬停和标签切换应获得即时反馈,或一个关于 opacity 或 background-color 且持续时间不超过 150ms 的过渡。将表现性动效保留给不频繁的时刻,例如视图的首次加载、成功状态或空状态。

每个有动画的状态变化也应保留一个静态提示,形式为颜色、图标或标签。动效永远不是唯一的反馈通道。

将动效限制于减少动效偏好之后

better-accessibility 拥有此要求,此处的任何配方都不能缺少它。仅在 prefers-reduced-motion: no-preference 下运行位移、缩放和模糊。在减少动效模式下,用透明度交叉淡入淡出替代它们,而不是立即移除元素。CSS、Tailwind 和 Motion 的配方请参见 animations.md。

不频繁的入场错开 100ms

在序列通过分阶段入场传达层级关系时,将内容拆分为语义块,如标题、描述和操作。将它们错开 100ms,每个块在 300ms 内以 ease-out 伴随透明度、4px 模糊和 12px 的 translateY 进入。切勿错开常规交互。请参阅 enter-exit.md。

退出比入场更短更小

使用透明度、4px 模糊和固定的 -12px translateY 在 150ms 内以 ease-out 退出,切勿使用整个容器高度。仅在目的地具有意义的情况下完全滑出,例如抽屉关闭。在动效不增加信息的情况下立即移除元素。请参阅 enter-exit.md。

首次渲染跳过状态动画

在包裹状态切换的 AnimatePresence 上设置 initial={false},以便默认状态在挂载时不进行动画。切勿在故意的入场(如错开的主视觉)周围设置它。请参见 animations.md。

使用精确值对上下文图标进行交叉淡入淡出

当图标在不频繁的状态变化中切换时,例如从播放到暂停或从复制到已复制,进行交叉淡入淡出。缩放从 0.25 到 1,透明度从 0 到 1,模糊从 4px 到 0px。使用动效库时,使用 { type: "spring", duration: 0.3, bounce: 0 },弹性始终为 0。没有动效库时,将两个图标都保留在 DOM 中,并在 300ms 内以 cubic-bezier(0.2, 0, 0, 1) 进行交叉淡入淡出。

标签的图标切换和鼠标悬停时行显示的操作属于 高频交互无动画。两个配方都位于 icon-transitions.md。

在主题切换时抑制过渡

为主题切换禁用所有过渡,强制样式刷新,并在下一帧后恢复过渡。否则,所有颜色过渡会同时触发,导致切换过程出现色污。请参见 配方。

只过渡变化的内容

指定确切的属性,例如 transition-property: scale, opacity,绝不用 all。请参阅 performance.md。

在 will-change 中命名动画属性

仅在看到首帧卡顿后才添加 will-change,并命名你要动画化的属性:scale 对应 scale,transform 对应 transform。将其限制在变换属性、opacity 和 filter,绝不用 all。请参阅 performance.md。

仅对支持悬停的指针应用悬停效果

将仅悬停的样式放在 @media (hover: hover) 后面。在触摸设备上,:hover 会在点击后锁定,看起来像卡住的选中状态。Tailwind 4 的 hover: 变体已经在该查询下编译,而 Tailwind 3 的则没有。如果控件绘制自己的按下状态,设置 -webkit-tap-highlight-color: transparent 以防止默认的灰色闪烁造成双重效果。

在叠加层内包含滚动

为可滚动的对话框、抽屉、菜单和侧面板设置 overscroll-behavior: contain,以便滚动到它们的末尾时不会触发页面滚动。

匹配图标描边与文本字重

图标的渲染描边跟随其旁文本的字重,从 400 字重的 1.5px 到 700 字重的 2.5px。每个表面使用一个图标库。表格、尺寸和网格规则请参见 icons.md。

一个 SVG,按状态重新着色

图标使用 currentColor,并通过 CSS 颜色和透明度获取悬停、选中和禁用状态,而不是使用单独的素材。轮廓是默认变体,填充表示活动状态。在 dir="rtl" 下,仅镜像其含义遵循阅读方向的图标。请参见 icons.md。

完成之前

检测修复
具有相同 rounded-* 或 border-radius 的带内边距的父元素和子元素将内边距加到外半径上
box-shadow: 0 0 0 1px 环旁没有 borderborder: 1px solid transparent
img 上使用了 outline-slate-*、outline-zinc-* 或十六进制轮廓颜色outline-black/10 和 dark:outline-white/10
transition-all 或 transition: all命名变化的属性
在 :hover、.open 或其他切换类上设置了 animation:对相同属性使用过渡
active:scale-95、scale-90 或低于 0.96 的 whileTap0.96
:active 缩放没有 :disabled 排除enabled:active: 或 :not(:disabled):active
bounce: 设置为非 0 的值bounce: 0
基础规则中的 opacity: 0 仅由 animation 揭示将隐藏状态放在 from 关键帧中,并设置 animation-fill-mode: both
translate、scale、filter 或 motion.* 动画没有 prefers-reduced-motion、motion-safe: 或 MotionConfig 保护将其限制,并在减少动效下使用透明度交叉淡入淡出
颜色过渡加主题切换,没有 disableTransitionOnChange 或覆盖使用主题切换抑制配方
will-change: all,或在从不进行动画的元素上的 will-change命名动画属性或删除它
图标 SVG 中的 fill="#..." 或 stroke="#..."currentColor
纯 CSS 的 :hover 或 Tailwind 3 的 hover: 不在 @media (hover: hover) 内将其包裹在查询中
对话框、抽屉或菜单上的 overflow: auto 或 overflow-y-auto 没有 overscroll-behavioroverscroll-behavior: contain

报告

严重级别。 HIGH 破坏交互,例如无法逆转的关键帧切换或在触摸设备上卡住的悬停状态。better-interface 的两个升级触发器属于此处,并且一出现就是 HIGH。一个是忽略 prefers-reduced-motion 的动效,另一个是仅由动效承载的状态变化。MEDIUM 是表面、图标或动效中可见的不一致。LOW 是孤立的打磨问题。

验证。 没有浏览器时,从代码中读取组件定义的每个状态,如悬停、按下、选中、加载和空,以及其持续时间和缓动。有浏览器时,遍历每个状态,并在浏览器的动画面板中以 10% 的速度重放动效。报告你无法运行的每个检查为 Not verified。

格式。 将发现按违反的原则分组,按严重级别排序,每个根本原因一行,列出其出现的每个位置:

严重级别位置之前之后原因

位置 为 path/to/file:line。原因 指明原则和用户影响。

当任何 HIGH 问题仍然存在时,以 Block 结尾,否则以 Approve 结尾,将表格中的其余内容留作待办工作。绝不对你未检查的覆盖范围 Approve。没有可报告的内容时,说明 "No actionable UI-polish findings" 并报告验证情况。

Individual skills in this repo

This repo contains 14 individual skills — each has its own dedicated page.

LIKELION-CAPSULE/Landing_Page

Reviews and fixes keyboard and focus behavior, ARIA, accessible names, forms, screen-reader announcements, motion and zoom in your project against WCAG 2.2.

LIKELION-CAPSULE/Landing_Page

Helps you build and check a color system for your project. It generates palettes, names semantic tokens, converts between formats and measures contrast.

LIKELION-CAPSULE/Landing_Page

Combines all of the `better-*` skills into a single review across accessibility, layout, writing, typography, color and UI polish.

LIKELION-CAPSULE/Landing_Page

Helps with grouping, alignment, reading order, responsive structure and room for translated text, so a layout holds up when it is resized, translated or mirrored.

LIKELION-CAPSULE/Landing_Page

Sets and reviews how text renders in your product, from the type scale and spacing to font features, wrapping, truncation and punctuation.

LIKELION-CAPSULE/Landing_Page

Writes and reviews your interface copy, from labels and errors to empty states and confirmations, so it matches your product's voice and tells people what to do next.

LIKELION-CAPSULE/Landing_Page

Renders a component you choose under every scenario that can reach it on a temporary page and stress tests it.

LIKELION-CAPSULE/Landing_Page

Try to break a piece of UI by feeding it worst-case data — long names, unbreakable emails, one-letter names, missing fields, huge counts, zero items, long labels, non-Latin text, emoji, extreme numbers — then render it behind a "Demo data / Worst case" toggle and report everything that broke, with the fix for each. Use when the user asks to stress-test, break, or find edge cases in a component or screen, or to "try the worst case". For visual design critique use emil-design-eng; for motion use review-animations.

LIKELION-CAPSULE/Landing_Page

Builds UI from a Figma file or a design image so it matches the design, using your project's existing tokens and components.

LIKELION-CAPSULE/Landing_Page

Explains how a website, a visual effect or an animation was built, from a live URL or a screenshot.

LIKELION-CAPSULE/Landing_Page

Reviews a branch, pull request or uncommitted change for the interface problems it introduced or regressed, across accessibility, layout, writing, typography, color and UI.

LIKELION-CAPSULE/Landing_Page

Make a web app feel native on a phone — the small CSS and meta-tag fixes that separate "a website in a browser" from something that feels installed. Covers sticky hover states, tap highlight flashes, the 100vh bug, inputs that zoom the page, laggy taps, pull-to-refresh hijacking scroll, content under the notch, long-press selecting button text, carousels that scroll the wrong way, mismatched status bars, and the rule that you test on real hardware. Use when a web app is being built for or reviewed on mobile, when something "works in Chrome but feels wrong on my phone", when building a PWA, a bottom sheet, a carousel, a full-screen layout, or any touch interaction. For motion itself use animate; for React Native use animate-expo.

LIKELION-CAPSULE/Landing_Page

Renders every state of a component you choose on a throwaway page, with mock data and a switcher, so you can work on each state.

LIKELION-CAPSULE/Landing_Page

Builds multiple variants of a component you're working on and helps you iterate and pick one.

相关技能