Communitygithub.com

AlessandroFare/fluxychat

使用《Refactoring UI》(Wathan & Schoger) 的具體規則來設計和改善使用者介面 — 包含受約束的間距/字體/色彩/陰影比例,透過字重和色彩而非尺寸來建立視覺層次,以及透過模擬光源來創造深度。適用於建構或美化任何 UI(網頁、應用程式、儀表板、登陸頁面、元件)、挑選字體大小、間距、色彩、陰影或邊框圓角、設計調色盤或設計標記,以及每當有人說 UI「看起來怪怪的」、「看起來很業餘」、「感覺雜亂/平淡/未完成」,或要求「讓它看起來更好」時。

fluxychat 是什麼?

這項技能將 Steve Schoger 與 Adam Wathan 在《Refactoring UI》一書中提出的視覺設計原則,轉化為可供 AI 代理直接遵循的具體規則與步驟。它定義了一系列嚴格的設計系統:間距與尺寸應從一個以 16px 為基礎、相鄰數值差距約 25% 的比例表中選取;字體大小應使用精心挑選的固定比例;字重僅需兩種;色彩需要比一般工具所提供的 5 色調色盤更多的層次(灰色 8–10 階、主要色 5–10 階),並使用 HSL 而非十六進位來表示。此技能也提供了建立視覺層次的關鍵技巧:透過淡化次要元素來凸顯主要元素、使用最多三種文字色彩、以及根據階層而非語意來設定操作按鈕的樣式。最後,它列出了 9 條「硬性規則」,這些是初學者最容易犯、且能立即辨識出「業餘設計」的典型錯誤。這項技能特別適合與 Claude Code、Cursor、Codex 等支援 AI 代理的工具搭配使用,在這些工具中,開發者可以透過自然語言描述 UI 問題,由代理依據這些規則執行具體的 CSS 或設計標記修改。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AlessandroFare/fluxychat/tree/HEAD/.agents/skills/refactoring-ui-skill-main

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Refactoring UI

視覺設計不是天賦。它是一小套一次性決定的系統性決策,加上少數幾種建立層次的技巧。這項技能就是這些系統和這些技巧。

業餘 UI 最大的單一原因就是隨意挑選數值 — 這裡 17px、那裡 #3B82F6、滑鼠懸停狀態用 lighten(5%)。永遠從一個比例表來設計。


系統 — 使用這些,不要重新推導

從這些列表中挑選。永遠不要發明一個不在列表中的數值。

間距與尺寸

以 16px 為基礎,由其因數與倍數構成:

4  8  12  16  24  32  48  64  96  128  192  256  384  512  640  768

小端緊密,大端疏開。相鄰的兩個數值差距不得小於 ~25% — 這正是讓選擇顯而易見的關鍵。線性的「4 的倍數」比例表是失敗的:它無法幫助你在 120px 和 124px 之間做出決定。

將其用於邊距、內距、寬度、高度、圖示尺寸、邊框寬度 — 所有空間相關屬性。也固定一組少數的不透明度數值(例如 .05 .1 .2 .4 .6 .8),用於禁用狀態、疊加層與懸停色調,而不是每次都憑感覺滑動滑桿。與其他比例表的邏輯相同:一次決定,到處重用。

字體比例

12  14  16  18  20  24  30  36  48  60  72

不是用比例(4:5、2:3、黃金比例)建構的模數比例。那些比例會產生在各瀏覽器中進位不一致的分數像素值,且對介面密度而言過於稀疏 — 改用手工挑選的數值,根據它們帶來的感覺來選擇,效果更好。

單位:僅用 px 或 rem。永遠不要用 em。 em 是相對於目前字體大小的,所以在 1.25em 的父元素內寫 .875em 會計算出 17.5px — 這不在你的比例表中。比例表就會默默失效。

字重

兩種字重就夠了:

  • 400 或 500 — 內文與多數 UI 文字
  • 600 或 700 — 任何需要強調的內容

UI 中不要使用低於 400 的字重。若要降低強調程度,請使用較淡的色彩或較小的尺寸 — 永遠不要用更輕的字重。

色彩

你需要比五色調色盤產生器給你的多很多的色彩。

  • 灰色:8–10 階色調。 幾乎整個 UI 都是灰色 — 文字、背景、面板、邊框、表單控制項。三或四階色調永遠不夠用。從非常深的灰色開始,不要用純黑(純黑看起來不自然)。
  • 主要色:5–10 階色調,一種或最多兩種主要色。
  • 強調色:各 5–10 階色調 — 破壞性紅色、警告黃色、正面綠色,加上產品需要區分的其他顏色(圖表數列、日曆事件、標籤)。十種顏色 × 5–10 階色調對複雜 UI 來說是正常的。

將它們命名為 100(最亮)→ 900(最暗),基準為 500。

按此順序建構比例表: 先選取 500(對於主要色/強調色,它應該是可以用作按鈕背景的色調)。然後找出邊界 — 900 通常是你的文字色彩,100 是背景色調;一個提示元件會同時用到兩者,所以設計一個元件並從中讀取兩個數值。接著填入 700 和 300,作為其相鄰色調的最佳妥協,然後以同樣方式填入 800 600 400 200。

使用 HSL 而非十六進位來撰寫色彩。 hsl(220, 95%, 34%) 和 hsl(220, 65%, 61%) 在視覺上有關聯性;但 #03369E 和 #507DD7 則沒有。

永遠不要在執行期用 lighten() / darken() 產生色調。這正是你最後會得到 35 種略微不同的藍色的原因。

陰影 — 五個高度

0 1px 3px  hsla(0,0%,0%,.2)   /* 幾乎沒有凸起 — 按鈕 */
0 4px 6px  hsla(0,0%,0%,.2)   /* 下拉選單 */
0 5px 15px hsla(0,0%,0%,.2)
0 10px 24px hsla(0,0%,0%,.2)
0 15px 35px hsla(0,0%,0%,.2)  /* 模態視窗 */

選擇時問自己「這個元素在 Z 軸上的哪個位置?」,而不是「哪種陰影看起來好看?」。離使用者越近 = 越多的注意力。在 :active 時縮小按鈕的陰影會讓它感覺被按壓;在拖曳重新排序時放大列表項目的陰影則相反 — 它會解讀為「現在在其兄弟元素之上」,同時也作為拖曳的視覺提示。

這五種是預設值,在任何地方都適用。references/techniques.md 提供了同一個比例表的雙層精煉版本 — 平行但不完全相同的數值(其頂層較重)。當陰影在設計中較為突出時使用精煉版本;當不明顯時使用這些預設值。不要在一個專案中混合使用兩者。

行高與行長

行高與字體大小成反比,與行寬成正比:

  • 小文字 / 寬欄位 → 1.5 到 2
  • 大標題 → 1 就夠了

行長:45–75 個字元,即 max-width: 20em–35em。這適用於段落,即使其容器更寬 — 在一個內容區域中使用混合寬度看起來更精緻,而非更不精緻。

(這裡使用 em 是對的 — 度量應與其包圍的文字一起縮放。「永遠不要用 em」的規則範圍限定在字體比例表中,因為 em 會在巢狀結構中複合。不要「修正」這個。)

邊框圓角

挑選一個並保持一致。小圓角 = 中性。大圓角 = 趣味性。無圓角 = 嚴肅/正式。在同一個介面中混合方形和圓角看起來總是更糟。


步驟

1. 從功能開始,而非佈局。 不要設計「應用程式」— 在你了解產品內容之前,你無法在頂部導航和側邊欄之間做決定。設計一個實際的功能(搜尋表單、訊息編輯器),然後讓外殼自然浮現。

2. 細節稍後再補。 早期忽略字體、陰影和圖示。先以灰階進行 — 這會迫使層次來自間距、對比和尺寸,而非色彩。一旦佈局可行再加入色彩。

3. 不要在低保真度上過度投資。 草圖、線框稿和模型都是可拋棄的 — 沒有人能使用應用程式的靜態圖片。它們存在的目的是探索想法;一旦做出決定就拋棄它們,然後去建構真正的東西。

4. 設計最小可用版本,然後建構它。 以短的設計→編碼循環工作。不要暗示你尚未準備好要建構的功能 — 一個帶有你還沒辦法上線的附件區域的留言框會阻塞整個功能。錦上添花的功能稍後再設計。

5. 透過淘汰來選擇。 當從比例表中挑選數值時:猜測你認為正確的值,然後與相鄰的兩個值進行比較。其中兩個會明顯錯誤。如果外側選項勝出,則以該值作為新的中間值重新比較。

6. 從過多的空白開始,然後移除它。 增加空間直到某物看起來不再糟糕,你會得到最小值。從寬裕開始然後修剪,你會得到正確的量。密集的 UI(儀表板)是合理的 — 但這是有意識的決定,不是預設值。

7. 縮小畫布。 在 1400px 的畫板上設計一個小組件往往會擴張,因為空間就在那裡等著被填滿。從 ~400px 開始,先設計手機版佈局,此時限制是真實的 — 然後將其帶到大螢幕,只放寬那些真正感到擁擠的部分。你會比你預期的改得更少。


層次 — 最有效的技巧

螢幕上的所有東西都處於一個金字塔中:主要、次要、第三級。當所有東西都在競爭時,UI 讀起來就像雜訊。這就是讓設計看起來「有設計感」的關鍵 — 不是樣式。

尺寸不是一切。 僅依賴字體大小會讓你得到太大的主要內容和太小的次要內容。改為使用字重和色彩來承載強調效果,並將尺寸保持在合理範圍。

最多三種文字色彩:

  • 深色 — 主要內容
  • 灰色 — 次要內容
  • 較淺灰色 — 第三級內容(腳註、版權)

這三種色彩都承載實際的內文大小文字,所以都需要 4.5:1 的對比度。「較淺灰色」指的是仍能達到該對比度的最淺色調 — 大約是 9 階色階的中間,而不是尾端。淺色色調僅用於禁用狀態和大型文字。

透過降低強調來強調。 當重要元素無法突出,且已沒有其他東西可以添加時,改為柔化與其競爭的元素。淡化不活躍的導航項目;降低側邊欄的背景色彩,讓主要內容往前靠。

操作按鈕: 依照階層而非語意來設定樣式。

  • 主要 → 實心、高對比。通常每頁只有一個。
  • 次要 → 外框線,或低對比背景。
  • 第三級 → 樣式像連結。

破壞性的操作 ≠ 大紅按鈕。如果「刪除」不是頁面上的主要操作,就給它第三級的處理方式 — 然後在確認對話框內讓它變成一個大紅色的主要按鈕,在那裡它確實是主要操作。

標籤是最後的手段。 標籤: 值 會給每筆資料相等的權重。大多數資料會透過格式($19.99、電子郵件地址)或上下文來自我識別。在真正需要標籤的地方,將其融入數值中(「庫存剩 12 件」,而不是「庫存:12」),或將其新增為明顯的次要內容。例外情況:在規格表風格的頁面上,使用者為了找標籤而掃視,此時應反過來強調標籤。

平衡字重與對比度。 實心圖示在視覺上很重,會壓過旁邊的文字 — 可以柔化它們的色彩來補償。反之亦然:當 1px 邊框在柔和色彩中太微妙,但加深色彩後又太突兀時,保留柔和色彩並改用 2px。增加重量來修正低對比;降低對比來修正過重的視覺重量。

視覺層次 ≠ 文件層次。 語意標記和視覺重量是分開的決定。章節標題通常是標籤,而不是標題 — h1 使用 16px 是完全可以的,有時標題甚至應該完全視覺隱藏,因為內容本身就說明了問題。


硬性規則

偏離這些規則會產生特定、可辨識的失敗。

  1. 絕不要在彩色背景上使用灰色文字。 灰底白之所以有效,是因為它降低對比度;彩色背景上的灰色看起來只是髒髒的。降低不透明度的白色看起來像褪色和禁用,並且會讓圖案的筆畫穿透出來。應手動挑選一種帶有背景色調、並調整飽和度和亮度的色彩。
  2. 絕不使用 em 作為字體比例的單位。 使用 px 或 rem。
  3. 絕不在執行期產生色調。 預先定義好它們。
  4. 絕不使用百分比寬度於不該縮放的東西。 側邊欄使用固定寬度;主要區域彈性伸縮。元素應有 max-width,且只在螢幕實際更小時縮小 — 登入卡片不應該在中型螢幕上比在大螢幕上更寬。
  5. 絕不跨中斷點按比例縮放東西。 大元素必須比小元素更快縮小。一個 2.5em 的標題搭配 14px 的手機版內文會計算出 35px — 太大了;它應該在 20–24px 附近。同樣地,按鈕的內距應隨著按鈕縮小而按比例變得更緊,而不是隨著其字體大小縮放。
  6. 總是讓群組外部的空間大於內部的空間。 這是修復「哪個標籤屬於哪個欄位」、擁擠的項目符號列表,以及看起來連接到錯誤段落的標題的關鍵。模稜兩可的間距是功能性的錯誤,而不僅僅是美觀問題。
  7. 絕不將顏色當作唯一的信號。 請加上圖示、形狀或文字提示。對於圖表,請透過對比度(同一顏色的淺→深色調)而非色相來區分數列 — 色盲使用者能可靠地感知亮度,但對色相則不然。
  8. 對比度最小值: 一般文字 4.5:1。3:1 的寬限僅適用於大文字,WCAG 將其定義為 24px 一般字重或 18.66px 粗體 — 而不是 18px。除非文字真的那麼大,否則假設需要 4.5:1。當白字在彩色背景上失敗時,反過來:在淺色調上使用深色文字(參見 references/systems.md)。另外,3:1 也適用於非文字(WCAG 1.4.11):如果邊框是識別控制項的唯一方式 — 例如輸入框的外框、核取方塊的邊緣 — 它需要與其背景達到 3:1 的對比。僅僅用來分隔內容的細線則不需要。這是兩種不同的標記,不是同一種。
  9. 絕不將圖示縮放到遠離其原本尺寸。 一個 16–24px 的圖示放到 48px 看起來會很笨重且細節不足。應將其放入一個彩色圓圈中。

參考資料

assets/tokens.css — 一個完整的、經過對比驗證的起始集,包含以上所有內容作為 CSS 自訂屬性:間距、字體、字重、邊框寬度、固定不透明度比例、9 階冷灰色階、9 階主要色、三組強調色、五個高度、一個語意角色層(--surface、--text-primary、--action…)和一個深色模式區塊,僅覆蓋這些角色。複製它並調整色相,而不是從這段文字重新推導比例表。在元件中參考角色,而不是原始色階 — 這正是讓深色模式運作的關鍵。每個文字/表面組合在兩種模式下均已驗證 ≥4.5:1,每個功能性邊框 ≥3:1;故意低於閾值的色調(禁用狀態、裝飾性分隔線、僅用於大型文字的步驟)根據標準豁免,並已內嵌註解說明。

當工作需要時載入這些:

  • references/systems.md — 從頭建立調色盤:選擇基底色彩、在亮端和暗端保持飽和度、色相旋轉、暖/冷灰色,以及在不使用難看色彩的情況下達到對比度的兩個脫離方法。
  • references/diagnose.md — 症狀 → 修復對照表。每當任務是改善現有 UI 而非建構新 UI 時,優先載入此檔案。
  • references/techniques.md — 深度與光源模擬、雙層陰影、基線對齊、字距、跳出預設元件形狀,以及處理使用者上傳的圖片。

Individual skills in this repo

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

AlessandroFare/fluxychat

Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet `anchor` rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.\n

AlessandroFare/fluxychat

Use when audio already placed in a HyperFrames composition needs to be mixed: a music bed that fights a voiceover (voiceover carve), effects on a track (EQ, compressor, limiter, gate, saturation, delay, reverb, chorus, phaser, bitcrush), or automation envelopes drawn on a track's volume or any effect parameter. Don't use for sourcing or generating audio — finding BGM, SFX, or making a voiceover is `/media-use`. Don't use for clip timing or track layout, which is `/hyperframes-core`.\n

AlessandroFare/fluxychat

Use the HyperFrames CLI development loop: init, add, catalog, capture, lint, check, snapshot, compare, grade-compare, preview, play, present, beats, keyframes, single or batch render, publish, cloud, cloudrun, feedback, lambda, doctor, browser, info, upgrade, skills, compositions, docs, benchmark, telemetry, transcribe, auth, tts, and remove-background. Also use when diagnosing build or render failures. validate, inspect, and layout are deprecated aliases; use check. Covers local, HeyGen-hosted cloud, AWS Lambda, and Google Cloud Run rendering.\n

AlessandroFare/fluxychat

Install, discover, and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add or hyperframes catalog, installing one item or every block matching a tag, wiring an installed item into index.html, or working with hyperframes.json. Covers discovery, install locations, block sub-composition wiring, component snippet merging, and authoring a new block or component to contribute upstream (idea → scaffold → validate → PR).

AlessandroFare/fluxychat

Mandatory entry point: read this first for any request to make, create, edit, animate, or render a video, animation, or motion graphic, including a promo, explainer, captioned clip, title card, overlay, slideshow or interactive deck, Remotion port, or any HyperFrames HTML composition. Also use it to inspect, diagnose, validate, preview, publish, or batch-render an existing HyperFrames project. Inputs may be a website URL, GitHub PR, Figma design or URL, text or brief, existing footage, or music. It resumes project state, captures intent when applicable, selects and installs the owning workflow, and routes domain capabilities. HyperFrames is the default output framework unless the user explicitly chooses another framework for the deliverable or asks only to record a browser session.\n

AlessandroFare/fluxychat

Overlay doctrine for the embedded-captions workflow — the caption MODEL (drop / rail / embed) and the rule that captions are an OVERLAY composited on top of the film, never a reserved bottom band you shift content up to avoid. Load when adding captions/subtitles to a talking-head or launch video, when deciding whether a phrase should be dropped, ride the verbatim rail, or be promoted to a scarce embedded climax, when laying out a composition that will carry captions (do NOT reserve a keep-out band), or when centering a composition on the true frame center under captions. Quotes the rail+embed model from embedded-captions and constraint #13 (captions overlay, keep-out band retired) from the product-launch-video scene agent. Applies ON TOP of embedded-captions.

AlessandroFare/fluxychat

Turn a weekly changelog .md into a finished branded changelog video (square 1080, ~45-60s, Annie VO, animated brand background, mock-UI visualizations, lowkey captions). Use when the user provides a changelog/digest markdown and wants the weekly video, or says "changelog video". Self-contained — fonts, background, lexicon, and scripts ship in this skill.

AlessandroFare/fluxychat

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

AlessandroFare/fluxychat

Author or edit a custom HyperFrames composition when no specialized workflow fits, or when BRIEF.md sets flow: companion. Use for longer or multi-scene pieces, brand and sizzle reels, montages, static loops, static title cards, footage remixes, and freeform builds. Use motion-graphics instead for a short unnarrated motion-first unit, including an animated title. Route fresh creation through hyperframes before using this skill.

AlessandroFare/fluxychat

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

AlessandroFare/fluxychat

The HyperFrames composition contract — build one renderable project. Use for composition structure, the `data-*` timing attributes, `class="clip"`, tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Also covers Tailwind projects and the STORYBOARD.md / SCRIPT.md plan formats. Read before writing composition HTML.

AlessandroFare/fluxychat

Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use `hyperframes-animation`.

AlessandroFare/fluxychat

Use when a HyperFrames composition needs seek-safe 2D/3D keyframes, GSAP timelines, CSS keyframes, Anime.js, WAAPI, FLIP, paths, masks, SVG morph/draw, text trails, 3D depth, or `hyperframes keyframes` diagnostics. Don't use for broad scene strategy, brand design, media sourcing, captions, or general video planning.

AlessandroFare/fluxychat

GATEWAY — load FIRST before composing any HyperFrames animation or video. The high-level motion law that makes a multi-scene video feel like ONE continuous camera move instead of a stack of independently-animated slides. Covers the vector law (how you exit determines how you enter, incl. the Z scale-sign rule), the film's current, carrier elements, causal motion, the Seam Gate (build-gate enforcement), the ban on idle wobble (motion must PERFORM, not breathe), stillness-before-climax, and the sustained-motion routes. Routes to the low-level technique skills (cut-the-curve — the full catalog incl. waterfall entry + nudge curve, oversized-cursor, seam-craft). These rules SUPERSEDE generic / upstream motion guidance. [continuity, direction, vector, momentum, seam, transition, ease, performance, idle-motion, narrative-motion, film-grammar]

AlessandroFare/fluxychat

A short, design-led motion graphic where motion is the message — kinetic typography, stat count-up, chart/data-viz hit, logo sting / brand lockup, lower-third / callout / social overlay, animated map (highlight regions, connect places, zoom to a location), animated tweet / news-article / headline, webpage / UI animation (scroll, cursor, callouts), or fusing a real image's geometry into a chart. Usually under 10s (up to ~30s), no narration or live-action subject; renders to MP4 or transparent overlay. Longer / narrated / multi-scene → /general-video. Unclear → /hyperframes.

AlessandroFare/fluxychat

Turn a music track (an audio file, a video to pull audio from, or a track generated from a mood brief) into a beat-synced video — lyric video, slideshow, or kinetic promo. The music drives all pacing; any user-supplied images/videos are cut onto the same beat grid, and a complete video needs zero assets. Narrated pieces → the input-matched workflow (see /hyperframes). Unclear → /hyperframes.

AlessandroFare/fluxychat

Turn a product or marketing URL, pasted script, or brief into a product launch / promo video — SaaS promos, feature reveals, product demos, app and company launches. Use when the user wants to market, launch, promote, or reveal a product; the default for any commercial URL. Site tours / showcases of a website route here too — the brief carries the show-it-as-is intent. Unclear → /hyperframes.

AlessandroFare/fluxychat

Turn a GitHub pull request (a PR URL, owner/repo#N, or 'this PR' in a checked-out repo) into a code-change explainer video — changelog, feature reveal, fix, or refactor walkthrough built from the diff, commits, and files: the input is a code change, not a website. Not a product promo (/product-launch-video) or a no-PR topic explainer (/faceless-explainer). Unclear → /hyperframes.

AlessandroFare/fluxychat

Port an existing Remotion (React) composition''s source to HyperFrames HTML. Use ONLY on an explicit ask to port/convert/migrate/translate a Remotion source — one-way, Remotion-only. A passing Remotion mention, reference-only code, or "make something like my Remotion video" is a fresh build (/general-video). Unclear → /hyperframes.

AlessandroFare/fluxychat

Use before UI-related work to select the smallest useful UI Skills context through the ui-skills CLI.

相關技能