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.
In this repository13 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bug-analysisSkill
- cavemanSkill
- code-review-with-filesSkill
- diagnoseSkill
- fetch-yuque-docSkill
- git-commit-workflowSkill
- handoffSkill
- improve-codebase-architectureSkill
- ios-i18n-workflowSkill
- java-to-nextjsSkill
- java-to-swiftSkill
- question-answerSkill
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
- Distinctive: line 18
Use the fast path for one component or section in an existing screen.
- Distinctive: line 26
Do not run the analyzer merely to satisfy the workflow.
- Distinctive: line 32
Run at most one analyzer command before the first edit:
- Very specific: line 40
Run --help for crops and ROI.
- Distinctive: line 50
Stop when no high-impact visible mismatch remains.
- Distinctive: line 54
Check overflow, clipping, missing assets, and essential interactions.
≈ “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.
Files
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.pngRun --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
| Situation | Evidence before first edit | Analyzer budget |
| Existing local component | 3–5 relevant inputs | None by default |
| New or full-screen layout | Mapping plus major regions | One run |
| Visible mismatch after implementation | One decision-specific measurement | One 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.
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
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.

