Community图像github.com

plugin87/image-to-code

将参考图像、截图或设计稿转换为基于设计令牌的可访问代码,同时推断并复用原始设计系统。

image-to-code 是什么?

该技能旨在帮助AI代理根据视觉参考(如截图、设计稿或模型)生成与原始设计系统一致的高质量UI代码。它首先要求代理像设计师一样分析参考图像,推断其设计系统,包括调色板、字体、间距、圆角深度和布局原型等核心元素。然后,它会指导代理从已知的设计系统库中寻找匹配项,并将推断出的设计值映射到三层DTCG设计令牌,最终生成一个统一的`theme.css`文件。之后,代理会基于这些令牌和适配器协议重建布局和组件,确保所有组件状态和可访问性都得到正确处理。最后,该技能还包含严格的验证步骤,包括对比度检查、渲染对比、以及代码规范性审计,确保输出的代码完全基于单一且一致的设计主题,并且视觉上贴近参考设计。该技能支持在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. 根据推断的值构建令牌主题 → 3层 DTCG(design-tokens 技能);生成一个 theme.css。用 scripts/contrast.py / scripts/validate_contrast.py 验证每对颜色(浅色 + 深色)—— 如果采样的品牌颜色未通过 AA 标准,则进行调整;品味绝不能超越 POUR 原则。
  4. 通过令牌驱动重建布局和组件,使用 frameworks/adapter-protocol.md + components/*:一个共享的基元层,所有 8 种状态,连接了无障碍(a11y),不使用 emoji(使用 lucide),单一主题。应用品味(design-taste.md)以确保不会退化为通用设计。
  5. 对照参考进行验证 — 渲染并截图,将结果与参考并排比对;运行 node scripts/measure_render.mjs、lint_hardcodes.py、taste_audit.mjs 以及 npm run verify。

验证(完成定义)

  • npm run verify 通过率为 100%(令牌解析正确,对比度满足浅色+深色 AA 标准,无硬编码/emoji,真实渲染符合 WCAG)。
  • 重建的 UI 仅使用一个推断出的令牌主题 — 没有按部分设置的调色板。
  • 结果的截图在视觉上与参考的设计语言匹配。

诚实限制:此技能匹配设计的系统,而不是像素级完美的复制。不要复制参考中的照片、徽标或受版权保护的文案 — 用你自己的替代品或通用的占位符替换它们。

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.

相关技能