跳到正文
cccskills
免费在 GitHub 公开

screenshot-to-code-expert

Expert guide for converting UI screenshots, mockups, Figma frames, and whiteboard sketches into production-ready frontend code using vision-capable frontier models (Gemini 4 Pro, Claude 5.5, GPT Astra 6) — multi-pass visual extraction, component decomposition, responsive generation, and design token mapping / Panduan ahli konversi screenshot UI, mockup, frame Figma, dan sketsa whiteboard menjadi kode frontend siap produksi menggunakan model frontier berkemampuan vision — ekstraksi visual multi-pass, dekomposisi komponen, generasi responsif, dan pemetaan design token.

中文简介正在准备中。当前显示原文说明。

集成工具FigmaGemini

实测评分 未实测

查看安装方法

包含的文件(1)

  • SKILL.md10.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

screenshot-to-code-expert — vibes-plug Skill

English | Bahasa Indonesia


<a name="english"></a>

English

Orchestration & Integration

Connects and orchestrates with modern-web-guidance, visual-ui-auditor, senior-frontend, design-system-architect, tailwind-expert, ui-ux-pro-max, modern-css-native-expert, multimodal-spatial-video-cloner, website-design-cloner, hig, svg-animation-motion-expert, frontier-ai-models-expert, and anti-slop to produce pixel-perfect, accessible, production-grade code from visual inputs.

Description

Production workflow for transforming visual design artifacts (screenshots, Figma exports, whiteboard photos, PDF mockups) into clean, semantic, responsive frontend code. Leverages the native vision capabilities of frontier models (Gemini 4 Pro's 2M multimodal context, Claude 5.5's pixel-level visual understanding, GPT Astra 6's design comprehension) to extract layout structure, color palettes, typography, spacing, and interaction patterns — then maps them to the project's existing design system and component library.

Trigger Conditions

Activate this skill when:

  • The user provides a screenshot, mockup, or design image and asks to "build this" or "convert to code."
  • Translating Figma frames or exported design assets into React, Vue, Svelte, or HTML/CSS components.
  • Reverse-engineering competitor UIs from screenshots for inspiration (not exact cloning).
  • Rapidly prototyping UI from hand-drawn sketches or whiteboard photos.
  • Performing visual QA by comparing rendered output against original design.

Core Concepts & Patterns

1. Multi-Pass Extraction Pipeline

Single-pass screenshot-to-code produces fragile output. Use a structured multi-pass approach:

PASS 1: STRUCTURAL ANALYSIS
  ├── Identify layout grid (columns, rows, flex/grid containers)
  ├── Detect component boundaries and nesting hierarchy
  └── Map semantic HTML elements (header, nav, main, aside, footer)

PASS 2: DESIGN TOKEN EXTRACTION
  ├── Extract color palette (convert to OKLCH for design system)
  ├── Identify typography (font family, size, weight, line-height)
  ├── Measure spacing rhythm (padding, margin, gap patterns)
  └── Detect border radii, shadows, and elevation levels

PASS 3: COMPONENT DECOMPOSITION
  ├── Break UI into reusable atomic components
  ├── Identify repeated patterns (cards, list items, badges)
  ├── Map to existing project components where possible
  └── Define component props and variant slots

PASS 4: RESPONSIVE BEHAVIOR INFERENCE
  ├── Predict mobile/tablet adaptations from desktop layout
  ├── Identify collapsible navigation patterns
  ├── Map breakpoint-appropriate layout shifts
  └── Infer touch targets and mobile interaction patterns

PASS 5: CODE GENERATION & REFINEMENT
  ├── Generate semantic HTML + CSS/Tailwind classes
  ├── Apply project's design tokens and component library
  ├── Add accessibility attributes (ARIA roles, alt text)
  └── Refine with anti-slop review (no placeholder content)

2. Optimal Vision Prompt Template

Analyze this UI screenshot and generate production-ready code.

STRUCTURAL ANALYSIS:
1. Describe the overall layout (grid system, flex containers, positioning).
2. List every distinct component you see, from outermost to innermost.
3. Identify the semantic HTML structure.

DESIGN TOKENS:
4. Extract the exact color values used (provide as HSL and hex).
5. Identify fonts, sizes, weights, and line-heights.
6. Measure the spacing rhythm (base unit and multiples).

CODE GENERATION:
7. Generate the complete component code using [FRAMEWORK] with [STYLING_SYSTEM].
8. Map colors and spacing to the project's existing design tokens where matches exist.
9. Include all hover/focus/active states visible or implied.
10. Add proper ARIA attributes for accessibility.

CONSTRAINTS:
- Use semantic HTML elements, not generic divs.
- No placeholder text like "Lorem ipsum" — use realistic content matching what's shown.
- Implement responsive behavior for mobile breakpoints.
- Follow the project's existing naming conventions: [CONVENTIONS].

3. Design Token Mapping Strategy

export interface ExtractedDesignTokens {
  colors: Array<{
    usage: string;
    hex: string;
    oklch: string;
    closestProjectToken?: string;
  }>;
  typography: Array<{
    element: string;
    fontFamily: string;
    fontSize: string;
    fontWeight: number;
    lineHeight: string;
    closestProjectToken?: string;
  }>;
  spacing: Array<{
    context: string;
    value: string;
    closestProjectToken?: string;
  }>;
}

export function mapToProjectTokens(
  extracted: ExtractedDesignTokens,
  projectTokens: Record<string, string>
): ExtractedDesignTokens {
  const tokenValues = Object.entries(projectTokens);

  for (const color of extracted.colors) {
    const match = tokenValues.find(([, v]) => colorDistance(v, color.hex) < 10);
    if (match) color.closestProjectToken = match[0];
  }

  for (const type of extracted.typography) {
    const match = tokenValues.find(([, v]) => v === type.fontSize);
    if (match) type.closestProjectToken = match[0];
  }

  return extracted;
}

function colorDistance(hex1: string, hex2: string): number {
  const r1 = parseInt(hex1.slice(1, 3), 16), g1 = parseInt(hex1.slice(3, 5), 16), b1 = parseInt(hex1.slice(5, 7), 16);
  const r2 = parseInt(hex2.slice(1, 3), 16), g2 = parseInt(hex2.slice(3, 5), 16), b2 = parseInt(hex2.slice(5, 7), 16);
  return Math.sqrt((r2 - r1) ** 2 + (g2 - g1) ** 2 + (b2 - b1) ** 2);
}

4. Visual QA Comparison Loop

After generating code, render it and compare against the original screenshot:

  1. Capture a screenshot of the rendered component.
  2. Send both original and rendered screenshots to the vision model.
  3. Ask: "Compare these two images. List every visual difference in layout, color, spacing, typography, and alignment."
  4. Iterate on the generated code until the model reports zero material differences.

Best Practices

  1. Always Use Multi-Pass: Single-pass generation produces low-quality code. Run structural analysis before code generation.
  2. Map to Existing Design System First: Never generate ad-hoc hex colors or pixel values. Always check against the project's design tokens.
  3. Validate with Visual QA Loop: Render the generated code and compare screenshots to catch pixel-level discrepancies.
  4. Specify the Target Stack: Always tell the model which framework (React/Vue/Svelte), styling system (Tailwind/CSS Modules), and component library (Radix/Shadcn) to target.
  5. Handle Text Content Realistically: Extract actual text visible in the screenshot. Never substitute with lorem ipsum.

Common Pitfalls to Avoid

Anti-PatternConsequenceRemedy
Single-pass "just convert this" promptFragile, unsemantic code with hardcoded valuesUse structured multi-pass extraction pipeline
Ignoring project's existing design systemGenerated code doesn't match the rest of the appMap extracted tokens to project tokens first
No responsive considerationDesktop-only output, broken on mobileInfer responsive behavior in Pass 4
Accepting first output without visual QAPixel-level differences compound into poor UXAlways run visual QA comparison loop

<a name="bahasa-indonesia"></a>

Bahasa Indonesia

Integrasi Orkestrasi

Terhubung dan mengorkestrasi dengan modern-web-guidance, visual-ui-auditor, senior-frontend, design-system-architect, tailwind-expert, ui-ux-pro-max, modern-css-native-expert, multimodal-spatial-video-cloner, website-design-cloner, hig, svg-animation-motion-expert, frontier-ai-models-expert, dan anti-slop untuk menghasilkan kode presisi-piksel, aksesibel, dan siap produksi dari input visual.

Deskripsi

Alur kerja produksi untuk mentransformasi artefak desain visual (screenshot, ekspor Figma, foto whiteboard, mockup PDF) menjadi kode frontend yang bersih, semantik, dan responsif. Memanfaatkan kemampuan vision native model frontier untuk mengekstrak struktur layout, palet warna, tipografi, jarak, dan pola interaksi — kemudian memetakannya ke design system dan library komponen proyek yang sudah ada.

Kondisi Pemicu

Aktifkan skill ini ketika:

  • Pengguna memberikan screenshot, mockup, atau gambar desain dan meminta "buatkan ini" atau "konversi ke kode."
  • Menerjemahkan frame Figma atau aset desain yang diekspor menjadi komponen React, Vue, Svelte, atau HTML/CSS.
  • Memprototipi UI dengan cepat dari sketsa tangan atau foto whiteboard.

Konsep Inti & Pola Praktik

1. Pipeline Ekstraksi Multi-Pass

Lima tahap terstruktur: Analisis Struktural, Ekstraksi Design Token, Dekomposisi Komponen, Inferensi Perilaku Responsif, dan Generasi Kode & Penyempurnaan.

2. Strategi Pemetaan Design Token

Jangan pernah menghasilkan nilai warna hex atau piksel ad-hoc. Selalu periksa terhadap design token proyek yang sudah ada. Gunakan colorDistance() untuk menemukan kecocokan terdekat.

3. Loop QA Visual

Setelah menghasilkan kode, render dan bandingkan screenshot hasil dengan screenshot asli. Iterasi sampai model melaporkan nol perbedaan material.


Praktik Terbaik

  1. Selalu Gunakan Multi-Pass: Generasi single-pass menghasilkan kode berkualitas rendah.
  2. Petakan ke Design System yang Ada: Jangan pernah gunakan hex atau piksel hardcode.
  3. Validasi dengan Loop QA Visual: Render kode dan bandingkan screenshot.
  4. Spesifikasikan Stack Target: Selalu beritahu model framework, sistem styling, dan library komponen target.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Expert guide for Agent-to-Agent (A2A) Protocol interoperability, /.well-known/agent.json Agent Cards, cross-vendor swarm task negotiation, and bridging A2A with Model Context Protocol (MCP) / Panduan ahli protokol interoperabilitas antar-agen (A2A), Agent Cards, dan integrasi A2A + MCP.

中文简介正在准备中。当前显示原文说明。

roedyrustam/vibes-plug1132026年10月25日 更新

Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.

中文简介正在准备中。当前显示原文说明。

roedyrustam/vibes-plug1132026年10月25日 更新

Expert guide for intelligent model cascading and routing — complexity-scored task routing from Flash/Haiku to Sonnet/Opus/Astra, dynamic escalation with quality gates, 40-60% token cost reduction while maintaining output quality / Panduan ahli untuk kaskade dan routing model cerdas — routing tugas berbasis skor kompleksitas dari Flash/Haiku ke Sonnet/Opus/Astra, eskalasi dinamis dengan gerbang kualitas, pengurangan biaya token 40-60% dengan kualitas output terjaga.

中文简介正在准备中。当前显示原文说明。

roedyrustam/vibes-plug1132026年10月25日 更新

Expert guide for intelligent model cascading and routing — complexity-scored task routing from Fast (Composer 2.5, Grok 4.7/4.6) to Medium (Gemini 4 Argon, GPT-5.6 Sol, Claude Opus 5.5) and High (Claude Sonnet 5.5, Claude Fable 5.1, Muse Wonder) / Panduan ahli untuk kaskade dan routing model cerdas.

中文简介正在准备中。当前显示原文说明。

roedyrustam/vibes-plug1132026年10月25日 更新

Master guide for Affective Computing, emotional AI, and real-time sentiment analysis through native multimodal tokens (voice intonation and facial micro-expressions) / Panduan utama komputasi afektif, AI emosional, dan analisis sentimen real-time melalui token multimodal native.

中文简介正在准备中。当前显示原文说明。

roedyrustam/vibes-plug1132026年10月25日 更新

Expert guide for Affective Computing, emotional AI, and real-time sentiment analysis through native multimodal tokens (voice intonation and facial micro-expressions) / Panduan ahli komputasi afektif, AI emosional, dan analisis sentimen real-time melalui token multimodal native.

中文简介正在准备中。当前显示原文说明。

roedyrustam/vibes-plug1132026年10月25日 更新

查看 roedyrustam 的全部技能

报告此技能的问题