image-to-code
Elite website image-to-code skill for Codex. For visually important web tasks, it must first generate the design image(s) itself, deeply analyze them, then implement the website to match them as closely as possible. In Codex, it must prefer large, readable, section-specific images instead of tiny compressed boards, generate fresh standalone images for sections or detail views instead of cropping old ones, avoid lazy under-generation, avoid cards-inside-cards-inside-cards UI, and keep the hero clean, spacious, readable, and visible on a small laptop.
1How It Works & Mechanism
Enforces a strict three-stage workflow: Image Generation → Deep Analysis → Implementation, defined as hard rules; 'mandatory for visually dominant tasks', strictly prohibiting coding directly from scratch.
image generation first deep image analysis second implementation third
Relies on the host environment's image generation capabilities rather than built-in tools: The text repeatedly qualifies rules with 'when image generation is available', executing the strictest rules within Codex.
Do not skip image generation when image generation is available.
Outputs images at the section granularity ('1 section = 1 image'): Explicitly specifies the required image count for 1–10 sections, strongly advising against cramming an entire site into a single long image.
- 1 section requested → generate 1 image - 2 sections requested → generate 2 images - 3 sections requested → generate 3 images - 4 sections requested → generate 4 images - 5 sections requested → generate 5 images - 6 sections requested → generate 6 images - 7 sections requested → generate 7 images - 8 sections requested → generate 8 images - 9 sections requested → generate 9 images - 10 sections requested → generate 10 images
Prohibits cropping old images and encourages full-section regeneration: Cropping degrades critical extractable data like spacing, font-size ratios, and margins; it mandates generating a fresh, standalone section image in the same design language instead.
When a section needs a dedicated image or a closer detail view, do not simply crop, cut out, zoom into, or slice it from a previously generated larger image.
Defines the analysis phase as 'extracting the design system' rather than casual skimming: Explicitly lists extractable elements (copy, typography, scale relationships, spacing, grids, button hierarchy, palettes, border-radius logic, image treatment, etc.) and allows generating close-up images for unclear details.
Carefully inspect and extract: - exact visible text where readable - hero headline wording - subheadline wording - CTA wording - section titles - typography character - type scale relationships
Employs dual constraints during implementation: copy-discipline + anti-drift: Stays strictly faithful to reference images, prohibiting 'convenient on-the-fly improvements' that degrade into generic templates during coding.
Do not “improve” the design by replacing it with a generic coded layout.
Reiterative prompt engineering: Core rules (such as 'avoid lazy under-generation', 'forbid cards-in-cards', and 'keep hero clean') recur across multiple sections with varying detail, establishing a gradient of mandatory tone.
Do not be lazy with image count.
2Core Capabilities
4Recommended Governance & Evidence
- SKILL.md: Pure prompt instructions and rule text; no script execution or external side effects
5Second-Pass Verification
- [ok] 目录资产面(含隐藏/未跟踪文件) — git ls-files + ls -A 双查:该 skill 目录仅 1 个文件 SKILL.md,无 scripts/references/模板/数据/隐藏文件,无可执行代码。
- [ok] 执行类 token 扫描 — 逐文件扫描 bash/exec/child_process/curl/wget/fetch/axios/process.env/API_KEY/.env/fs./writeFile/.github 等零命中(brutalist 一处 'sans-serifs.' 单词结尾 fs. 为误报,人工复核排除)。
- [ok] 引文逐条 grep -F 字节复核 — 本 JSON 所用全部 quote 均以 grep -F 在 pin commit 工作树中逐条验证存在,无 paraphrase 冒充。
- [ok] 元数据与 pin 核对 — 本地 git HEAD == 任务 pin ccbc15639c97057cbfcf32ecebc38ef716e4bb37(README 显示该提交为 docs/sponsor 修订 #102,2026-08-24);GitHub API 实查 stars=85698、MIT、pushed_at=2026-08-24T15:23:56Z。frontmatter name 与任务给定名一致。
- [ok] 功能声明 vs 实际能力夸大检查 — description 声称均由 SKILL.md 正文纯 prompt 机制兑现,无脚本可调用、无越界承诺(详见本文件 how_it_works 引文)。
- [ok] 『generate the design image(s) itself』的实现主体 — 文件全部以指令口吻要求模型出图('you must first generate the design image(s) yourself'),并自限『when image generation is available』;实际图像工具属宿主能力,在 skill 文件内不可定位实现——此为能力前提而非 skill 缺陷,已在 how_it_works/traits 明示。
- [ok] 读取中途出现的省略号是否为文件内容(影响引证准确) — raw 复查+grep:文件内不存在字面 '…' 行;先前读取中的省略是展示层对重复行的压缩,全部引文均已逐条 grep -F 复核,无受影响条目。
- [ok] Codex 内外规则是否冲突 — Codex 内一区一图(§4)与 Codex 外『may still allow more compact multi-section composition』明确按宿主分流,非矛盾;§18 亦以 'Inside Codex' 为界重申 section-first 生成规则。
6Verdict & Scenarios
60f16fb068787a1c…