d2c-fidelity-evaluator
Evaluate design-to-code fidelity for a generated page by comparing design inputs and implementation outputs. Use when the user provides or references a design…
от didi★ 468 звёзд на GitHub
Установить d2c-fidelity-evaluator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
D2C Fidelity Evaluator
Purpose
Score how faithfully a code-generated page restores its design source, then produce an optimization-oriented report that another D2C skill can use to improve the implementation in the next pass.
This skill evaluates visible output fidelity. Source code is used to locate likely causes and suggest implementation changes; source quality is not scored unless it creates visible design mismatch.
Inputs
Expect these inputs from the user or surrounding task context:
- Design screenshot: the original design image.
- Design DSL: structured design data for the same page or frame.
- Implementation source: code files, snippets, or repo paths for the generated page.
- Rendered screenshot: screenshot of the implementation result.
- Overlay screenshot: optional but preferred; a transparent design-over-render overlay image.
If the overlay is available, use it primarily to diagnose layout, size, edge, and alignment drift. Do not use the overlay as the main evidence for color or typography, because the colors are blended.
For v1, assume the screenshots are comparable and the page has rendered successfully. Do not perform viewport, DPR, asset-loading, or blank-page comparability checks unless the user explicitly asks for that.
Host Chrome Boundary
App, WebView, and mini-program container chrome is not part of the page fidelity target. Do not score system status bars, WebView title bars, mini-program capsule controls, native back controls, or bottom gesture bars as implementation omissions or extra elements.
If the design screenshot includes host chrome but the rendered screenshot represents only the H5/business page, evaluate the business page content boundary. When the surrounding workflow provides design_crop_top, treat that top crop as the intended material alignment and do not deduct for the removed host chrome.
If the overlay appears vertically shifted because host chrome was not cropped from the design side, report this as a material alignment issue before assigning implementation deductions. In that case, avoid turning the whole-page offset caused by host chrome into code optimization advice such as adding fake status bars or drawing mini-program capsules.
DSL-Only Mode
When no design screenshot (image-source.png) is available, the evaluator operates in dsl-only mode:
- Activation: Set
D2C_FIDELITY_MODE=dsl-onlyor pass--mode dsl-only - What changes:
- Pixel-level overlay comparison is skipped
- Scoring based on geometry-diff.json (40%) + render-diff.json (40%) + vertical-diff.json (20%)
- Report marked with "基于 DSL 评测(无设计原图)"
- What stays: All DSL-based checks (text, font, spacing, color, layout) still run
Workflow
- Inventory the provided inputs and identify the design frame/page being evaluated.
- Read the design DSL enough to understand the intended element hierarchy, text, bounds, style tokens, and key node IDs.
- Inspect the design screenshot, rendered screenshot, and overlay screenshot if present.
- Compare the implementation against the design across the four scoring dimensions in
references/scoring-rubric.md. - Calculate the overall fidelity score as a weighted average.
- Produce a report using
references/report-schema.md. - Write the complete Markdown report to the target workspace root's
d2c/temp/d2c-fidelity-evaluator-report/folder. Create the folder if needed. - Sort findings by optimization value, not by visual narration order. The highest-priority items should be the ones most likely to raise the next score.
Report File
Every evaluation must create a new Markdown report file on disk.
Determine the target workspace root as follows:
- If the user provides a code file path inside a project, use that project's repository root when it can be detected.
- Otherwise use the current working directory for the evaluation task.
Save reports under:
<target-workspace-root>/d2c/temp/d2c-fidelity-evaluator-report/
Use this filename pattern:
d2c-fidelity-evaluator-r{round}.md
Round selection:
- If the user provides an explicit round number, use it.
- Otherwise, if a screenshot or branch/file name contains a clear round marker such as
r6, use that number. - Otherwise, inspect existing
d2c/temp/d2c-fidelity-evaluator-report/d2c-fidelity-evaluator-r*.mdfiles and use the next integer round. - Never overwrite an existing report. If the selected round file already exists, append
-run-{n}before.md, wherenis the next available integer.
The chat response should include the report path and a concise score summary. The full Markdown report file should include both the human-readable report and the JSON report block.
Scoring Dimensions
Use these weights:
- Layout structure: 40%
- Visual style: 25%
- Content and assets: 15%
- Perceptual similarity: 20%
Overall score:
overallScore =
layoutStructure * 0.40 +
visualStyle * 0.25 +
contentAssets * 0.1
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- agents/openai.yaml
- references/report-schema.md
- references/scoring-rubric.md
FAQ
Что делает скилл d2c-fidelity-evaluator?
Evaluate design-to-code fidelity for a generated page by comparing design inputs and implementation outputs. Use when the user provides or references a design screenshot, design DSL, source code, rendered page screenshot, and optionally a transparent design-over-render overlay image, and wants a restoration/fidelity percentage plus an actionable report that can drive the next D2C optimization pass.
Как установить скилл d2c-fidelity-evaluator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл d2c-fidelity-evaluator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…