Community影像github.com

plugin87/image-to-code

將參考圖片、螢幕截圖或模型轉換為基於 token 的無障礙程式碼 — 從參考中推斷設計系統(色板、字體級別、間距、圓角、佈局原型),將其映射到三層 token,重建它,然後使用套件的閘道進行驗證。當使用者提供設計/螢幕截圖並想要匹配的 UI 程式碼時使用。

image-to-code 是什麼?

這個技能讓 AI 助手能夠將視覺參考(如設計稿、螢幕截圖或模擬圖)轉換為結構化、無障礙且基於設計 token 的 UI 程式碼。它不僅僅是複製外觀,而是深入分析參考的設計語言,包括色板、字體、間距、圓角和佈局模式,從而推斷出一個完整的設計系統。接著,它將這些推斷映射到一個三層 DTCG token 主題中,生成單一的 `theme.css` 檔案,並驗證所有顏色組合的對比度是否符合 WCAG AA 標準(淺色與深色模式)。最後,它會根據 token 驅動的元件庫重建佈局和 UI,並進行渲染比對和自動化驗證,確保結果與參考的設計風格一致。此技能支援 Claude Code、Cursor、Codex 等 AI 編碼工具,透過明確的步驟和驗證檢查點,幫助開發者將設計快速、準確地轉換為可維護、可擴展的代碼。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/plugin87/ux-ui-agent-skills/tree/main/.claude/skills/image-to-code

Installed? Explore more 影像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜歡的 AI 中提問

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

說明文件

技能:圖片轉程式碼

從視覺參考重建設計,使其成為真正的設計系統,而非一次性複製。匹配系統(色彩/字體/間距語言),切勿複製受版權保護的圖像或品牌資產。

步驟

  1. 像設計師一樣閱讀參考。 推斷並記錄:
    • 色板 — 1 個主導的表面色系、文字顏色、1 個主要動作色 + 最多 1 個強調色(取樣色調;不要猜隨機的十六進位碼)。
    • 字體 — 字體風格(幾何/無襯線/襯線)、級別跳躍、展示字體與正文對比、字重。
    • 間距與密度 — 基本單位、區塊節奏、卡片內距;寬鬆與緊湊。
    • 圓角與深度 — 圓角語言(銳利/柔和/藥丸形)、陰影與細線分隔。
    • 佈局原型與順序 — 滿版英雄區 / 不對稱分割 / 弁當盒 / 編輯堆疊(taste/design-taste.md → 變異指令)。
  2. 如果接近已知系統,則錨定到它 — 瀏覽 taste/aesthetic-systems.md / python3 scripts/design_systems.py search <詞彙> 並採用該配方來穩定決策。
  3. 從推斷的值建構 token 主題 → 3 層 DTCG(design-tokens 技能);生成單一的 theme.css。使用 scripts/contrast.py / scripts/validate_contrast.py(淺色 + 深色)驗證每個顏色組合 — 抽樣出的品牌顏色若未通過 AA 標準則進行調整;品味永遠不能凌駕於 POUR。
  4. 透過 token 驅動重建佈局與元件,依據 frameworks/adapter-protocol.md + components/*:一個共享的基礎層、所有 8 種狀態、無障礙功能已連接、不使用表情符號(使用 lucide)、單一主題。套用品味(design-taste.md)使其不會退化為通用樣式。
  5. 與參考進行比對驗證 — 渲染並截圖,與參考並排比較;執行 node scripts/measure_render.mjs、lint_hardcodes.py、taste_audit.mjs 和 npm run verify。

驗證(完成定義)

  • npm run verify 100% 通過(token 解析、對比度符合 AA 淺色+深色、無硬編碼/表情符號、真實渲染符合 WCAG)。
  • 重建的 UI 使用一個推斷出的 token 主題 — 沒有逐區塊的色板。
  • 結果的螢幕截圖在視覺上與參考的設計語言匹配。

誠實的限制:這匹配的是設計系統,而非逐像素的完美複製。切勿複製參考中的照片、標誌或受版權保護的文字 — 請自行替換或使用通用佔位符。

Individual skills in this repo

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

plugin87/design-tokens

Generate, extend, or audit design tokens in DTCG format with the 3-tier architecture (primitive → semantic → component). Use when the user wants a color palette, type scale, spacing/shadow/radius/motion tokens, multi-brand theming, or wants to validate token files. Covers colors, typography, spacing, shadows, borders, breakpoints, motion, gradients, opacity, blur, sizing, states, theming.

plugin87/governance

Govern how the design system evolves — SemVer for tokens/components, the contribution workflow, deprecation policy, and change communication. Use when the user wants to add/promote/deprecate a component or token, decide a version bump, set up a contribution process, or keep the system from fragmenting.

plugin87/performance

Optimize UI performance against Core Web Vitals — LCP, INP, CLS — with loading/code-split strategy, layout-shift prevention, and animation performance rules. Use when the user wants to improve speed, fix jank or layout shift, hit Web Vitals budgets, or make a UI feel fast on low-end devices.

plugin87/prototype

Move an idea up the fidelity ladder (content-first → wireframe → low-fi → high-fi → code) with a validation plan at each level, plus user-journey mapping and usability-testing scripts. Use when the user wants to prototype, wireframe, map a user flow, or plan/run usability testing.

plugin87/redesign

Upgrade an existing website or app to premium quality without breaking functionality — audit the current design, identify generic/AI tells, then apply taste and system rules surgically. Use when the user wants to improve, modernize, polish, or "make better" an existing UI/codebase.

plugin87/token-build

Set up or run the token build pipeline — transform the DTCG tokens/*.json (source of truth) into platform artifacts (CSS variables, Tailwind @theme, JS/TS, iOS Asset Catalog, Android, Compose) with Style Dictionary / Tokens Studio / W3C DTCG export. Use when the user wants to generate platform theme files from tokens, wire token CI, or multi-platform token output.

plugin87/ux-writing

Write or review UI copy — buttons, errors, empty states, microcopy, notifications, labels — using the voice & tone system (clear, concise, useful, human, honest) with the what→why→how error formula and inclusive-language rules. Use when the user needs interface copy, error messages, empty-state text, or a copy review.

相關技能