/pale-env:gui-layout-comparefrom pale-env
Compares web page layouts between an app and original using Playwright in a real browser, scoring structural similarity from 0 to 1 for PR evidence.
Ships in pale-env. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Measure the implemented page and the original page in a real browser and compare the structure the browser laid out, instead of judging screenshots. Both sides answer the same questions, and anyone can rerun the measurement. A report page shows each pair side by side with its score, for a reviewer to look at.
--pass-mark). Missing, failed or unscored pairs make the result incomplete, even if the scored
subset has a high average. This is a layout result, not App acceptance.Read these from the repository the PR targets. They change over time, so follow what they say now.
docs/submission-evidence.md: section 1, the GUI evidence and its index; the delivery evidence index.docs/review/app-implementation-checklist.md: the GUI reference comparison, and what GUI evidence records.proposals/templates/environment-proposal.md: where a proposal plans the comparison.proposals/templates/pr-summary.md: where a PR links its evidence.This skill adds a measurement to the reference comparison. It does not replace the reference and implementation screenshots or the ordered demonstration, it says nothing about whether controls work, and it adds no acceptance rule. If this skill and those files disagree, follow the files. If the working directory is not a clone of the repository, read them from GitHub at the PR's revision.
Page.captureSnapshot. Internet Archive snapshots and screenshots do not
work (references/what-does-not-work.md).pip install playwright, and Google Chrome. Without Chrome, run
python3 -m playwright install chromium once and pass --browser chromium.Choose the pages from the evidence. Each layout pair is one screenshot pair of the PR's evidence.
Measure both sides at the evidence viewport, with a picture of each page for the report:
python3 scripts/layout_facts.py reference.json --width 1920 --height 1080 --shots shots-ref home=https://www.example.com/ item=file:///path/item.mhtml
python3 scripts/layout_facts.py candidate.json --width 1920 --height 1080 --shots shots-app --first "http://127.0.0.1:4317/#access=…" home="http://127.0.0.1:4317/#/" item="http://127.0.0.1:4317/#/item/123"
--first: a PALE App on the shared Web Host needs its access URL, as the server prints it, so every page
is measured in that session.--click: a state with no URL of its own, such as a view switched by a sidebar button, takes
--click NAME=TEXT: once page NAME loads, it clicks the visible button, link or tab named TEXT. Repeat it for
more clicks, in order. A page whose control is not found is retained with a measurement error.--click does not fill in forms or apply Infra events. For such a state, reach it
with a Playwright script, as the PR's own capture script does, then evaluate FACTS from
scripts/layout_facts.py on the page and save the result, and a picture with its shoot, in the same JSON
shape.measurement_error in the facts JSON. The comparison keeps its name and reports an incomplete run.
A sign-in or error page served in its place is not caught: check the title printed for each page
and the pictures in the report, and measure again any page that is not the page.Score and write the report page.
python3 scripts/layout_compare.py reference.json candidate.json --title "My App and the original" > layout-compare.txt
For each page it prints the score, and each compared structure with the candidate value, the reference value and their agreement; the worst rows show what to fix. When a page is more alike another reference page than its own, it says so: check that the pair shows the same page. The last line gives the average and pass, fail or incomplete.
The same command writes the report page, report/index.html beside reference.json (--report DIR puts it
elsewhere): the verdict and the average, every page's score, and one card per pair with the two pictures side by
side (they scroll together) and its structure table. Missing or failed pairs have a card explaining the reason.
It loads nothing from elsewhere; open it in a browser. Look
through the pictures: they show at once a pair whose state went wrong. Add --json to print the results as JSON
instead of text.
Put the results in the PR (next section).
The structure facts, all from what the browser laid out:
| Facts | Meaning |
|---|---|
| top bar height | the band of bars across the top: a header or navigation element, or a full-width bar that stands apart (fixed, a shadow, its own background, a border) |
| side rail width | a column on the left or right edge from the top bar down, 120 px to 40% of the page wide |
| columns, widest column | 2 to 4 blocks side by side in the main area, filling most of their container, the tallest at least 60% of the window tall; a shorter band, such as a picture beside a paragraph, is not a column layout |
| content starts at, content width | the main area's text: the 5th to 95th percentile of its left and right edges |
| cards across, card width, card height | the largest grid of at least three blocks of one kind, 150-520 px wide |
| list row width, list row height, cells per row | the largest list of at least three blocks of one kind wider than 520 px and up to 60% of the window tall, one under another in a single column |
| picture share | the share of the page covered by images, video, maps and stretched background images |
Blocks and text count within the first 2400 px, outside the site footer, which repeats on every page of a site, and
not where an ancestor's overflow: hidden cuts them away, as with a carousel's other slides. Elements whose
combined opacity through their ancestors is at most 0.05 are excluded. A block's kind is its
tag and first class: the items of a list share it, a page's sections do not.
1 - |candidate - reference| / the larger of the two (for the content start the divisor is at least 100 px, for
the picture share at least 0.10). One that only one page has agrees 0. The similarity is the mean, with no weights.--ceiling, default 0.97: how alike two real pages of one type
with different content usually are. Capped at 1. A blank page has none of the reference's structures, so it
scores 0. A reference with no content column, card grid or list is unscored.status, complete,
expected_pairs and unscored_pages, alongside the existing average and Boolean pass. Facts version 9
requires remeasuring older captures because ancestor-opacity visibility changed.Files, in apps/<app>/evidence/layout/, beside the App's GUI screenshots:
reference.json, candidate.json;layout-compare.txt;report/, the report page with its pictures;README.md, with what the implementation checklist asks GUI evidence to record:
The screenshot pairs of the GUI evidence index that section 1 asks for, in apps/<app>/evidence/README.md
or the App README. Section 1 asks each implementation screenshot to explain intentional layout differences.
Beside each pair, give the page's score, for example in a Layout column reading 0.83, and cite the worst
rows of its structure table where a difference is explained. Write N/A with the reason for a pair with no
measured page.
The delivery evidence index at the end of docs/submission-evidence.md. Its Reference screenshots cell
takes a link or a justified N/A. In each GUI workflow's row, add a link to evidence/layout/report/index.html
whose text gives the result, for example [layout 0.61 -> pass](evidence/layout/report/index.html).
The PR description: link apps/<app>/evidence/layout/ in the Evidence line of the PR summary. GitHub
shows an HTML file as source, so say that the report opens from a checkout.
Not committed:
file:// page by
its file name only.In review: in the review report of the implementation checklist, the layout result is an artifact of the GUI reference comparison, sequence and isolation row, not its verdict. A reference is a workflow comparison, not an order to copy branding or pixels, so a low page is answered by fixing the layout or by explaining the difference.
--width and --height for other sizes, the same on both sides.--settle-ms.From the repository root, run python3 -m unittest discover -s tests -p 'test_gui_layout_compare.py' -v for coverage,
report images and duplicate-name checks. The GUI layout comparison tests workflow also installs the pinned
dependency from tests/gui_layout_compare/requirements.txt and runs
python3 tests/gui_layout_compare/browser_checks.py in Chromium. These browser fixtures check ancestor opacity,
visible descendants, failed captures and distinct screenshots. To use installed Google Chrome locally, set
LAYOUT_BROWSER_CHANNEL=chrome for the browser-check command.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
layout-comparison, visual-regression, playwright, pr-evidence
npx claudepluginhub matraix-ai/personal-agents-last-exam --plugin pale-env3 skills in this plugin
/app-delivery-reviewVerify a completed PALE App implementation against its approved scope, with reproducible business and MCP tests, GUI reference comparisons and workflow sequences, real dependency demonstrations, and historical-data evidence. Use for delivery acceptance or implementation evidence gaps, not initial proposal approval./env-proposal-reviewTurn an Environment Track proposal review into feedback the proposal author can act on, by combining the agent checklist results with the human reviewer's decisions. Use this whenever someone reviews an environment proposal PR, asks what the human reviewer still has to decide, answers earlier review questions, or wants feedback written for a proposal author (for example "审一下这个 proposal", "给作者写反馈", "哪些需要我判断").Other plugins' skills for the same job