Communitygithub.com

設計參考擷取與映射 (design-ref)

從參考網站或貼上的 HTML 中擷取視覺系統(色彩角色、字體比例、間距比例、圓角、陰影、按鈕/卡片/眉標結構、色調),並將其映射到當前專案的既有代碼符記中,產出簡短的符記對照表。當使用者分享參考(「讓它看起來像 <網站>」、「用這個風格」、一個 URL 或 HTML 貼上)以便進行重新設計時使用。

設計參考擷取與映射 (design-ref) 是什麼?

此技能旨在將設計參考的視覺系統系統化地萃取出來,並映射到現有專案的代碼符記上,避免直接複製貼上或建立分支。它支援從截圖(透過無頭瀏覽器)、貼上的 HTML 或電子郵件內容中擷取色彩角色(畫布、表面、文字、強調色等)、字體(系列、比例、行高、字重、字母間距)、間距(實際使用的節奏)、形狀(圓角、陰影、邊框粗細)、元素結構(按鈕、卡片、眉標)以及整體色調。 技能會讀取專案的 CSS 變數、Tailwind 設定或主題檔案,然後產出一個三欄對照表:參考值、目前專案符記、以及建議(保留、微調或新增)。它內建了可及性對比檢查(文字 ≥ 4.5:1,UI ≥ 3:1),並要求每個新增的符記都必須附上一行理由,避免不必要的膨脹。 輸出是一個符記對照表,不會直接修改任何程式碼;使用者同意後,再由後續的「design-pass」技能來執行變更。此技能特別適合用於在重新設計初期,快速理解並規劃如何將參考設計的風格融入現有專案。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/iamk3nnyt/claude-skills/tree/HEAD/skills/design-ref

在你喜歡的 AI 中提問

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

說明文件

設計參考擷取與映射 (design-ref) 是做什麼的?

參考來源:$ARGUMENTS

1. 擷取參考

URL: 使用共享工具包在 1440 與 375 寬度下截圖,然後讀取其樣式表:

node ${CLAUDE_SKILL_DIR}/../ui-audit/scripts/audit.mjs <url> --widths 375,1440 --no-axe --out /tmp/design-ref/<host>

使用 --inject 參數拉取計算後的樣式,或透過一次性 CDP 腳本引用 ${CLAUDE_SKILL_DIR}/../ui-audit/scripts/cdp.mjs(launch() → navigate() → evaluate())。對 body、h1–h3、p、a、button、主要 CTA、卡片、眉標/kicker、輸入框以及頁尾進行 getComputedStyle 取樣。收集 font-family/size/weight/line-height/letter-spacing、color、background、border-radius、box-shadow、padding 以及 gap。

貼上的 HTML / 電子郵件: 將其儲存到 /tmp/design-ref/ref.html,使用 render-html.mjs 渲染,並直接讀取內聯樣式。

2. 提煉系統

  • 色彩角色: 畫布背景、表面、文字、淡化文字、強調色、強調色文字、邊框、成功/警告色。給出十六進位值以及每個角色出現的位置。
  • 字體: 字體家族(若字體需要授權,則提供最接近的免費替代字型)、比例階梯(含 px/行高/字重/字距),以及大小寫設定(眉標是否為大寫且加字距?)。
  • 間距: 實際使用的節奏(例如 8/16/24/40/64)、區段內邊距、卡片內邊距。
  • 形狀: 各元素類別的圓角、陰影配方、邊框粗細。
  • 結構: 按鈕(高度、內邊距、圓角、字重、圖示)、卡片、眉標、以及主視覺區的構成。
  • 色調: 3 個形容詞,外加文案的寫法(短句?第二人稱?數字?)。

3. 映射到專案(不要複製專案)

讀取專案的符記(app/globals.css 中的 @theme/:root、tailwind.config、或主題檔案)及其現有元件。產出:

角色參考值當前專案符記建議
強調色#FF5A1F--color-brand #…保留 / 微調數值 / 新增(說明理由)

規則:

  • 先嘗試微調現有符記,再新增。每個新增的符記都必須附上一行理由。
  • 品牌鎖定的項目不更動:標誌、專案已有的品牌色、以及已授權或正在使用的字型。
  • 對每個提議都檢查強調色在畫布上、文字在表面上的對比度(文字 ≥ 4.5:1,UI ≥ 3:1)。
  • 若專案有與程式碼同步的 Figma 檔案,則符記變更應在同一個任務中更新到 Figma。

退出標準

  • 符記對照表已完成,每個列都標記為保留、微調或新增。
  • 已檢查提議配對的對比度。
  • 尚未修改任何程式碼。那將是「design-pass」的工作,在使用者同意對照表之後進行。
  • 向使用者提供一句總結,並附上表格。

Individual skills in this repo

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

iamk3nnyt/claude-skills

Turns a feature idea into a one-page spec covering problem, audience, MVP scope, non-goals, numbered Given/When/Then acceptance criteria, affected routes, data and emails, and open questions. Use when the user says "brief", "spec this", "scope this" or "what would it take", or before starting a feature whose scope is unclear.

iamk3nnyt/claude-skills

Checks UI copy across locales by comparing key parity between next-intl message catalogs and in-code sv/en COPY objects, finding placeholder and array mismatches and words from the other language leaking in (the "och" in English bug), then manually reviewing claims against terms and pricing and the project's banned phrases. Use after editing copy or translations, before shipping a page with new text, or when asked to proofread or check translations.

iamk3nnyt/claude-skills

Applies an agreed visual direction to a page or component by reusing existing components first, then verifies every width and dark mode with the headless-Chrome audit plus a before/after pixel diff, and reviews against Refactoring UI, Nielsen and WCAG 2.2. Use when asked to redesign, restyle, polish or "make it look like the reference", after design-ref or when the direction is already clear.

iamk3nnyt/claude-skills

QAs a project's transactional and digest emails by rendering every template without DB or network, screenshotting at 600 and 375 px in light, dark and images-off, and checking for placeholder leaks (undefined, NaN, {{…}}), preheader, unsubscribe, alt text, absolute links, Outlook-safe buttons, viewport meta and Gmail's 102 KB clip. Use when email templates change, before sending a campaign, or when asked to check how emails look.

相關技能