agentleFS
HeathWangHeathWang/hw-cc-plugin/skills/reconstructing-ui-from-screenshots/SKILL.md

reconstructing-ui-from-screenshots

Skill1 starsChanged 3 months agoMITView on GitHub

Use when implementing or correcting an app or web UI from a design image, screenshot, mockup, or reference PNG where accurate size, spacing, color, typography, assets, and alignment matter.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the fast path for one component or section in an existing screen.

    line 18
  2. Distinctive:

    Do not run the analyzer merely to satisfy the workflow.

    line 26
  3. Distinctive:

    Run at most one analyzer command before the first edit:

    line 32
  4. Very specific:

    Run --help for crops and ROI.

    line 40
  5. Distinctive:

    Stop when no high-impact visible mismatch remains.

    line 50
  6. Distinctive:

    Check overflow, clipping, missing assets, and essential interactions.

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Reconstructing UI from Screenshots

Overview

Choose the shortest evidence path that can produce a correct edit. Measure only values that affect the implementation.

Workflow

1. Define the Change

Inspect the reference, target view, and direct dependencies. Record the changed region, unchanged anchors, and material unknowns.

Use the fast path for one component or section in an existing screen. Use the mapping path for a new/full screen, coupled regions, unknown crop origin, or absolute screenshot coordinates.

2A. Fast Path — Local Change

Reuse existing constraints, tokens, components, fonts, and assets. Record three to five inputs: container bounds, inset or gap, alignment, text style, color, or asset behavior.

Global viewport and DPR are unnecessary when values come from existing anchors, tokens, or relative relationships. Once these inputs distinguish the implementation, edit immediately. Use the nearest project value for low-impact ambiguity.

Do not run the analyzer merely to satisfy the workflow.

2B. Mapping Path — Full Reconstruction

Resolve viewport from runtime/project configuration, design specifications, or capture metadata. Image dimensions alone never prove viewport or DPR.

Run at most one analyzer command before the first edit:

python3 <skill_path>/scripts/analyze_ui_image.py reference.png \
  --viewport 375x812 \
  --json reference-report.json --annotated reference-boxes.png

Run --help for crops and ROI. Install dependencies only after ModuleNotFoundError. Confirmed mapping leads directly to recording major geometry and editing; blocked mapping leads to one focused question. Never replace an inaccurate result with chained ad-hoc Python scans.

3. Implement the First Pass

Correct geometry and assets first, then text, spacing, colors, and effects. Preserve unaffected behavior. Reconsider a settled value only when new evidence contradicts it.

4. Precision Pass

For each visible, code-relevant mismatch, make one targeted measurement or focused --roi run, then edit. Do not rescan anti-aliasing noise or infer fonts from text pixels; use project definitions.

Stop when no high-impact visible mismatch remains. Do not complete unrelated checklist entries.

5. Verify

Check overflow, clipping, missing assets, and essential interactions. Run formatting, static analysis, and the smallest relevant build. Use image diff only when requested or already available.

Analysis Budget

SituationEvidence before first editAnalyzer budget
Existing local component3–5 relevant inputsNone by default
New or full-screen layoutMapping plus major regionsOne run
Visible mismatch after implementationOne decision-specific measurementOne focused run

Analyzer regions and shapes are candidates, not ground truth. Sample solid interiors, not anti-aliased edges. Device DPR remains unconfirmed unless independently sourced. Require confirmed mapping only before converting absolute image pixels to logical layout constants.

Common Mistakes

  • Proving viewport, Safe Area, or system bars for a local component replacement.
  • Writing temporary pixel-scanning scripts instead of making the edit.
  • Measuring the same value repeatedly without contradictory evidence.
  • Treating image scale as DPR or detector candidates as final semantics.

Output

Report implementation changes, material assumptions, and code-check results.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.