Communitygithub.com

LIKELION-CAPSULE/Landing_Page

精準打磨專案中的表面、圖標與動態效果,提供邊框圓角、光學校準、陰影、圖標狀態與動畫的精確數值。

Landing_Page 是什麼?

這項技能為 UI 的視覺打磨提供了精確的數值規範,涵蓋表面、圖標與動態效果。其核心原則是:在底層互動邏輯確認無誤後,才套用打磨規則,且任何打磨發現都不應凌駕於損壞的互動之上。技能定義了多項明確規範,例如:嵌套表面的外層圓角需為內層圓角加上內距;以陰影建立層次感、以邊框建立結構感;按壓按鈕應縮放至 `0.96`;以及高頻互動(如按鍵輸入)不應使用動畫。所有動畫效果都必須遵守 `prefers-reduced-motion` 偏好設定。此外,還提供了詳盡的實作範例、常見問題檢測表與回報格式。這項技能可應用於任何支援 Markdown 指令的 AI 代理工具(如 Claude Code、Cursor),協助開發者確保 UI 實作的一致性和品質。

相容平台~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。光學校準和同心內距的臨界值是例外,它們是起點,最終需由肉眼判斷。

請保留專案的元件庫、代碼標記(tokens)與密度,並在沒有規範提供數值的地方,遵循專案的動態語言。一個經過審慎設計且一致的專案慣例(例如完全沒有陰影的風格)是一種偏好,而非需修正的發現。但同一細節在專案中出現兩種不同做法,則屬於發現。

文字換行、字型渲染、表格數字與文字間距歸屬於 better-typography。點擊區域、鍵盤支援、ARIA 與減少動畫需求歸屬於 better-accessibility。分組、區塊間距、響應式斷點與 RTL 空間歸屬於 better-layout(方向性圖標鏡像除外)。顏色代碼標記與對比度測量歸屬於 better-colors。

外層圓角等於內層圓角加上內距

當嵌套表面之間有可見且均勻的內縮時,外層表面的圓角等於內層表面的圓角加上內距,再加上任何邊框寬度。當內距超過 24px,或內距刻意不對稱時,請將各層視為獨立表面,並保留各自的圓角代碼標記。詳細作法請參考 surfaces.md。

在幾何對齊看起來不對時進行光學校準

當幾何置中看起來不對時,請用肉眼進行微調。按鈕的圖標側減少 2px 內距,播放三角形向尖端偏移,並直接在 SVG 中修正不對稱的字形。詳細作法請參考 surfaces.md#optical-alignment。

陰影用於建立層次,邊框用於建立結構

如果邊框僅用於建立深度感,請以分層的透明 box-shadow 取代。保留分隔線、分隔器、表格儲存格與選取狀態的邊框。也保留表單輸入框的邊框,其邊界在 better-accessibility 規範下需要 3:1 的非文字對比度。焦點環(focus ring)也歸屬於 better-accessibility。

強制色彩模式(forced-colors mode)會移除所有 box-shadow。請在陰影環(shadow ring)下方保留 border: 1px solid transparent,以便在該模式下仍能繪製邊緣。詳細作法請參考 surfaces.md#shadow-recipes。

以純黑或純白為圖片添加輪廓

為內容圖片添加 1px 的內縮 1px 輪廓。淺色模式使用 oklch(0 0 0 / 0.1),深色模式使用 oklch(1 0 0 / 0.1)。切勿使用接近黑色的調色板、有色中性色或強調色,因為這些色調會像彩色邊紋一樣出現在圖片邊緣。跳過透明素材,例如標誌和插圖。詳細作法請參考 surfaces.md#image-outlines。

互動狀態使用過渡(transitions),而非關鍵影格(keyframes)

使用 CSS 過渡或動畫庫的彈簧(springs)來驅動互動狀態變化,因為它們可以在使用者中途反向操作時重新定向。關鍵影格執行固定的時間線且無法反向,因此保留給只執行一次的序列。請參閱 animations.md。

按壓縮放至 0.96

按壓狀態的按鈕應在 150ms 內以 ease-out 縮放至 0.96,停用狀態的按鈕則永遠不縮放。為按鈕提供一個選擇退出(opt-out)機制,以便在動畫可能造成干擾的情況下(透過元件現有的變體 API 或 static prop)避免動畫。請參閱 CSS、Tailwind 和 Motion 的配方。

高頻互動不套用動畫

按鍵輸入、行懸停和分頁切換應獲得即時回饋,或在 opacity 或 background-color 上使用不超過 150ms 的過渡。保留富有表現力的動畫給不常發生的時刻,例如頁面首次載入、成功狀態或空狀態。

每個動畫狀態變化也應留下靜態提示,例如顏色、圖標或標籤。動畫絕不應是唯一的回饋通道。

將動畫限制在減少動畫偏好設定之後

better-accessibility 擁有此要求的主導權,這裡的配方在沒有此要求的情況下絕不發布。僅在 prefers-reduced-motion: no-preference 條件下執行移動、縮放和模糊效果。在減少動畫模式下,以透明度交叉淡入淡出取代,而不是立即移除元素。CSS、Tailwind 和 Motion 的配方請參閱 animations.md#reduced-motion-fallback。

不頻繁的進場動畫間隔 100ms

當順序在分階段進場中傳達層級結構時,請將內容分成語義區塊,例如標題、描述和操作。每個區塊間隔 100ms,以透明度、4px 模糊和 12px 的 translateY 在 300ms 和 ease-out 條件下進場。切勿對例行互動使用交錯進場。請參閱 enter-exit.md。

出場動畫比進場更短、更小

以透明度、4px 模糊和固定的 -12px translateY 在 150ms 和 ease-out 條件下出場,切勿使用容器的完整高度。僅在目的地具有意義時才完全滑出,例如抽屜關閉。在動畫不增加任何資訊的情況下,直接移除元素。請參閱 enter-exit.md#exit-animations。

在首次渲染時跳過狀態動畫

在包裝狀態交換的 AnimatePresence 上設定 initial={false},這樣預設狀態就不會在掛載時執行動畫。切勿在刻意安排的進場動畫(例如交錯的英雄區塊)上設定此屬性。請參閱 animations.md#skip-animation-on-page-load。

使用精確數值對上下文相關圖標進行交叉淡入淡出

當圖標在不常發生的狀態變化中進行交換時(例如播放到暫停、複製到已複製),請使用交叉淡入淡出。縮放從 0.25 到 1,透明度從 0 到 1,模糊從 4px 到 0px。使用動畫庫時,採用 { type: "spring", duration: 0.3, bounce: 0 },且彈跳(bounce)始終為 0。如果沒有動畫庫,則將兩個圖標都保留在 DOM 中,並以 cubic-bezier(0.2, 0, 0, 1) 在 300ms 內進行交叉淡入淡出。

分頁的圖標交換以及行在懸停時顯示的操作,屬於高頻互動不套用動畫的範疇。兩種作法請參閱 icon-transitions.md。

在主題切換時抑制過渡

為主題切換停用所有過渡,強制進行樣式刷新,並在下一幀後恢復過渡。否則所有色彩過渡會同時觸發,導致切換畫面模糊。請參閱 配方。

僅過渡變化的屬性

明確指定要過渡的屬性,例如 transition-property: scale, opacity,切勿使用 all。請參閱 performance.md。

在 will-change 中指定動畫屬性

僅在發現首幀卡頓後才添加 will-change,並指定您要動畫化的屬性:scale 用於 scale,transform 用於 transform。將其限制在 transform 屬性、opacity 和 filter,切勿使用 all。請參閱 performance.md#use-will-change-sparingly。

僅在支援懸停的指針上使用懸停效果

將僅在懸停時使用的樣式放在 @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#icons-in-rtl。

完成前檢查

檢測項目修正方式
具有相同 rounded-* 或 border-radius 的內外層父元件和子元件將內距加到外層圓角
box-shadow: 0 0 0 1px 環,但旁邊沒有 border添加 border: 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 或 whileTap 低於 0.96改為 0.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 或在 @media (hover: hover) 之外的 Tailwind 3 hover:將其包裹在查詢中
對話框、抽屜或選單上的 overflow: auto 或 overflow-y-auto,但沒有 overscroll-behavior添加 overscroll-behavior: contain

回報

嚴重性。 HIGH(高)會破壞互動,例如無法反向的關鍵影格切換,或在觸控裝置上卡住的懸停狀態。better-interface 的兩個升級觸發條件屬於此類,一見即為 HIGH:一個是忽略 prefers-reduced-motion 的動畫,另一個是僅由動畫承載的狀態變化。MEDIUM(中)是表面、圖標或動態效果中可見的不一致。LOW(低)是孤立的打磨問題。

驗證。 如果沒有瀏覽器,請閱讀程式碼中元件定義的每個狀態(例如懸停、按壓、選取、載入和空狀態),以及其持續時間和緩動函數。如果有瀏覽器,請逐一操作每個狀態,並在瀏覽器的「動畫」面板中以 10% 速度重播動畫。對於每個無法執行的檢查,請回報為 Not verified。

格式。 將發現的問題按其違反的原則分組,按嚴重性排序,每個根本原因列出其出現的所有位置,佔一行:

嚴重性位置修改前修改後原因

位置 為 path/to/file:line。原因 說明違反的原則以及對使用者的影響。

結束時,如果仍有任何 HIGH 等級的問題,則標記 Block(阻止);否則標記 Approve(核准),並將剩餘問題留在表格中作為待辦事項。切勿對您未檢查的範圍給予 Approve。如果沒有需要報告的事項,請陳述「無需處理的 UI 打磨發現」並報告驗證結果。

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.

相關技能