Layout from image

From SteelMorgan/1c-agent-based-dev-framework · View interactive version

Layout from image is an AI agent skill from the GitHub repository SteelMorgan/1c-agent-based-dev-framework. Extraction of a verifiable visual specification of a layout from a reference image: geometry, borders, fills, text styles, and negative checks. Use when the visual reference is given as a PNG/JPG/screenshot.

How to use this skill

Skill file

Layout from Reference Image

Purpose

Use this skill when the source of truth for appearance is an image: a screenshot, PNG/JPG mockup, export from a designer, an image of a printed form or report.

An image is not a ready-made specification. Before implementation, you need to extract a verifiable model from it:

This skill is independent of the implementation technology. Its result can be used by an MXL layout, СКД layout, printed form, HTML report, or another output system.

Output Artifact

Create a markdown specification with sections:

1. Source
2. Normalization
3. Layout spec
4. Border spec
5. Style spec
6. Negative checks
7. Acceptance tolerances
8. Open questions

Do not move on to implementation until at least the major areas, borders, and text styles have been identified.

1. Source

Record:

2. Normalization

Before comparing the result and the sample, bring them into the same coordinate system:

If screenshots of different sizes are compared, do not compare absolute pixels without normalization.

3. Layout Spec

Describe the geometry:

| Field | What to record |

|---|---|

| Zone | Name of the semantic block: header, KPI, table, row, footer |

| bbox | Coordinates in crop or in a normalized grid |

| Size | Width/height |

| Position | Relative to neighboring zones |

| GAP | Empty spaces between zones |

| Repetition | A single zone or a row/group template |

Layout proof answers only the question "where is the zone and what is its size". It does not prove the correctness of borders, color, or font.

4. Border Spec

Describe borders as segments, not as a general impression:

| Field | What to record |

|---|---|

| Segment | top, left, right, bottom, inner line, separator |

| From/to | Coordinates of the start and end |

| Color | RGB/HEX or an allowed range |

| Thickness | px or a range |

| Continuity | Solid, dashed, gap |

| Purpose | Outer contour, header line, table border |

Be sure to separate:

For each important line, add a negative check for zones where the line should not be present. An extra line is the same defect as a missing one.

Border proof must confirm not only the presence of the required lines, but also the absence of extra segments:

check negative zones on the runtime image separately from the source spec. If in the source

layout/DSL the line is not defined, but runtime still renders it, this does not count as a passed check -

you need to record the discrepancy as a limitation or defect of the output technology and verify an alternative

layout structure.

5. Style Spec

Describe the styling:

| Field | What to record |

|---|---|

| Fill | Background color of the zone |

| Text | Meaningful text or a parameter pattern |

| Text color | RGB/HEX or a range |

| Size | Relative to the zone or an estimated px/pt value |

| Style | Regular, bold, italic, underline |

| Alignment | Horizontal and vertical |

| Indents | Internal text padding from the borders |

| Format | Numbers, dates, percentages, digit grouping spaces |

If the exact font cannot be proven from the image, record measurable traits: letter height, boldness, color, alignment, relative size.

6. Negative Checks

List the prohibitions separately:

These checks are needed because visual defects often appear as extra elements.

7. Acceptance Tolerances

For each class of check, specify the allowed deviation:

Do not declare "looks similar" as acceptance. Acceptance must refer to specific measurements.

8. Proof Workflow

  1. Extract layout/border/style spec from the image.
  2. For disputed visual requirements, check the target technology API before implementation:
  1. Implement the layout.
  2. Get the runtime result in the same way the user will see it.
  3. Normalize target and actual.
  4. Check three layers:
  1. Check negative checks separately.
  2. In the report, separate:

What Not To Do


depends_on: []


Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.