For visually important web work, generate the design reference images yourself first, deeply
analyze them, then implement frontend code that faithfully matches. The images are the primary
visual source of truth; the code is the translation layer. Do not start with freeform coding when
image generation is available.
When to use
Hero sections, landing pages, marketing sites, product pages, portfolio sites — visually important web tasks
Multi-section website concepts where image-first beats code-first
Redesigns where visual quality matters heavily
Requests described mainly in visual terms ("beautiful hero", "premium landing page", "creative website")
Triggers on "image to code", "设计图转代码", "图片实现", "从设计图实现"
Not for: pure code implementation without image reference (use frontend-design); brand/web/mobile design reference images only, without code (use imagegen).
Tool note: use an available image-generation tool — do not bind to a specific product.
Steps
1. Plan sections and visual direction
If docs/design/references.md exists (produced by design-research), load it first — real
references inform the section count and visual-direction picks before images are generated.
Infer the section count from the request. Pick a coherent visual combination and commit to it
consistently — do not mash everything into chaos.
Load ${CLAUDE_PLUGIN_ROOT}/skills/03-design/frontend-design/references/visual-direction.md for the combinatorial variation engine (9 axes: theme paradigm, background, typography, hero architecture, section system, signature components, motion-implied, narrative spine, second-read moment), hero-scale mapping, and the anti-slop ban list. The narrative-spine and second-read axes are optional for image-to-code.
Default section packs if unspecified: 4-section (hero, features, social proof, CTA); 8-section (hero, trust bar, features, product showcase, benefits, testimonials, pricing, CTA); 12-section (adds workflow, metrics, FAQ, footer).
2. Generate one large image per section
Use an available image-generation tool. Never compress many sections into one tiny unreadable
board — text becomes too small to analyze, spacing collapses, extraction quality drops.
One section requested → one image. N sections → N section images.
It is better to generate too many clear images than too few compressed ones.
Keep the hero especially clean: 1-3 line headline, single strong focal point, generous negative space. No pills, badges, tiny logos, or pseudo-system labels cluttering the first viewport. The first screen must stay readable on a small laptop.
3. Regenerate unclear sections as fresh standalone images
Never crop, slice, or zoom into a previously generated image for a section or detail view —
cropping destroys spacing accuracy, type-scale relationships, and layout proportions.
Generate a fresh image preserving the same design language (palette, typography mood, button style, radius logic) but optimized for readability.
Add extraction-oriented detail images when text or components are too small: closer hero render, pricing card detail, navbar treatment, testimonial close-up.
If a section is still unclear after one regeneration, generate another — do not guess.
4. Deeply analyze every image
Treat the generated images as a design specification, not vibes. For each section image, extract:
If details are unclear, generate another image before coding. Do not fill ambiguity with generic defaults.
5. Implement frontend faithfully
Translate the analyzed design into real frontend code. Avoid design drift — the coded result must
feel like the same website as the generated references.
Do not simplify into default templates, compress generous spacing, or replace distinctive sections with generic rows.
Avoid nested-box layouts: no cards-in-cards-in-cards, no giant rounded wrappers around every section, no dashboard-like compartment stacking. Use boxes only when they have a clear purpose.
Reduce micro-UI clutter: remove pseudo-system markers, fake control labels, decorative code-like tags, filler chips, and fake dashboard jargon.
1---2name: image-to-code3description: Image to Code4---56# Image to Code78For visually important web work, generate the design reference images yourself first, deeply9analyze them, then implement frontend code that faithfully matches. The images are the primary10visual source of truth; the code is the translation layer. Do not start with freeform coding when11image generation is available.1213## When to use1415- Hero sections, landing pages, marketing sites, product pages, portfolio sites — visually important web tasks16- Multi-section website concepts where image-first beats code-first17- Redesigns where visual quality matters heavily18- Requests described mainly in visual terms ("beautiful hero", "premium landing page", "creative website")19- Triggers on "image to code", "设计图转代码", "图片实现", "从设计图实现"2021**Not for:** pure code implementation without image reference (use `frontend-design`); brand/web/mobile design reference images only, without code (use `imagegen`).2223**Tool note:** use an available image-generation tool — do not bind to a specific product.2425## Steps2627### 1. Plan sections and visual direction2829If `docs/design/references.md` exists (produced by `design-research`), load it first — real30references inform the section count and visual-direction picks before images are generated.31Infer the section count from the request. Pick a coherent visual combination and commit to it32consistently — do not mash everything into chaos.3334- Load [${CLAUDE_PLUGIN_ROOT}/skills/03-design/frontend-design/references/visual-direction.md](${CLAUDE_PLUGIN_ROOT}/skills/03-design/frontend-design/references/visual-direction.md) for the combinatorial variation engine (9 axes: theme paradigm, background, typography, hero architecture, section system, signature components, motion-implied, narrative spine, second-read moment), hero-scale mapping, and the anti-slop ban list. The narrative-spine and second-read axes are optional for image-to-code.35- Default section packs if unspecified: 4-section (hero, features, social proof, CTA); 8-section (hero, trust bar, features, product showcase, benefits, testimonials, pricing, CTA); 12-section (adds workflow, metrics, FAQ, footer).3637### 2. Generate one large image per section3839Use an available image-generation tool. Never compress many sections into one tiny unreadable40board — text becomes too small to analyze, spacing collapses, extraction quality drops.4142- One section requested → one image. N sections → N section images.43- It is better to generate too many clear images than too few compressed ones.44- Keep the hero especially clean: 1-3 line headline, single strong focal point, generous negative space. No pills, badges, tiny logos, or pseudo-system labels cluttering the first viewport. The first screen must stay readable on a small laptop.4546### 3. Regenerate unclear sections as fresh standalone images4748Never crop, slice, or zoom into a previously generated image for a section or detail view —49cropping destroys spacing accuracy, type-scale relationships, and layout proportions.5051- Generate a fresh image preserving the same design language (palette, typography mood, button style, radius logic) but optimized for readability.52- Add extraction-oriented detail images when text or components are too small: closer hero render, pricing card detail, navbar treatment, testimonial close-up.53- If a section is still unclear after one regeneration, generate another — do not guess.5455### 4. Deeply analyze every image5657Treat the generated images as a design specification, not vibes. For each section image, extract:5859- **Text:** headline, subheadline, CTA labels, section titles, navbar labels, pricing labels, testimonial names60- **Typography:** size/weight relationships, display vs body contrast, line count, tracking feel, serif/sans behavior61- **Spacing:** headline-to-subheadline distance, text-to-button distance, card gaps, section top/bottom spacing, side gutters, card padding62- **Buttons/components:** size, shape, radius, fill vs outline, icon usage, primary/secondary hierarchy, card structure, dividers, shadows63- **Colors:** background, panel colors, accents, button fills, text hierarchy, border logic, shadow mood, image tint64- **Layout:** grid logic, alignment, section ordering, density, visual rhythm, repeated motifs6566If details are unclear, generate another image before coding. Do not fill ambiguity with generic defaults.6768### 5. Implement frontend faithfully6970Translate the analyzed design into real frontend code. Avoid design drift — the coded result must71feel like the same website as the generated references.7273- Preserve layout logic, spacing rhythm, section ordering, text/image balance, typography mood, and component style.74- Do not simplify into default templates, compress generous spacing, or replace distinctive sections with generic rows.75- Avoid nested-box layouts: no cards-in-cards-in-cards, no giant rounded wrappers around every section, no dashboard-like compartment stacking. Use boxes only when they have a clear purpose.76- Reduce micro-UI clutter: remove pseudo-system markers, fake control labels, decorative code-like tags, filler chips, and fake dashboard jargon.77- Install missing packages as needed (`npm install <pkg>` / `pip install <pkg>` / equivalent).78- For color formula, typography pairing, and interaction states, follow `frontend-design`.7980**Output:** frontend code (HTML/CSS/JS, React, Vue, Svelte, etc.) matching the generated reference images, plus the reference images themselves.8182## Verify8384- [ ] Image-first order followed: reference images generated before any code85- [ ] One large readable image per section — no compressed multi-section boards86- [ ] Enough images generated — no lazy under-generation87- [ ] No cropped/sliced old images — fresh standalone regenerations for detail views88- [ ] Deep analysis completed: text, typography, spacing, buttons, colors, layout all extracted89- [ ] Hero is clean: 1-3 line headline, single focal point, breathable negative space, readable on a small laptop90- [ ] No cards-in-cards-in-cards or giant rounded wrappers around every section91- [ ] No micro-UI clutter: pseudo-system labels, filler pills, fake dashboard jargon removed92- [ ] No design drift: implemented code matches the generated references (layout, spacing, typography, components)93- [ ] Color/typography/interaction states follow `frontend-design` conventions94- [ ] No AI-slop tells: purple/blue gradients, centered dark hero clichés, repeated left-text/right-image blocks, generic card spam9596## References9798- [${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md](${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md) — shared discipline (surface assumptions, verify don't assume, surgical changes)99- [${CLAUDE_PLUGIN_ROOT}/references/design-principles.md](${CLAUDE_PLUGIN_ROOT}/references/design-principles.md) — design discipline (CRAP, hierarchy before decoration, design every state, accessibility non-optional)100- [${CLAUDE_PLUGIN_ROOT}/skills/03-design/frontend-design/references/visual-direction.md](${CLAUDE_PLUGIN_ROOT}/skills/03-design/frontend-design/references/visual-direction.md) — shared web variation engine (9 axes, hero scale, composition anchors, anti-slop)
Run npx skillmds@latest add int2t05/image-to-code in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Image to Code It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
int2t05 (@int2t05) published this skill. Their other Agent Skills are listed on their SkillMD profile.