Makes one rule true: every built screen is compared with its approved design reference on every
device, theme and language of the app, and fixed until it matches. Machines check geometry, text,
colour, borders, type and shape per element; the agent checks the rest by looking at side-by-side
sheets; check-signoff.mjs proves both happened for the current build and writes the summary a report's
"Design match" line names.
Rules that must hold
- No screen is done until every run of the done set passes: each design frame on every device of
the contract (an iOS simulator and an Android emulator by default), in light and dark, in every
language the app ships (its RTL one included), at every scroll offset
run-parity.mjsplans for a tall frame, against the reference the app's facts pick. Narrowing is for iteration: a narrowed check printsnarrowed: not a sign-offand fails. Why: dark mode and right to left are where screens break; one passing variant proves little. (narrowed,not-captured,coverage) - The committed references are the authority. They change only after the reviewer approved a
design change, logged first in the manifest's
referenceChanges, rendered withshoot-design.mjs --update-reference --change <id>; never to make a screen pass, and a change is never a waiver. Why: a reference edited to match the app turns the check into a mirror. (reference-change-unlogged,reference-drift,stale-reference) - The app's facts pick the reference; nobody guesses. A frame that depends on what the app has
gets design-derived variants (contract
facts,variants), composed when several match; a fact left out stops every script; a variant is derived from the rendered mockup, never drawn by hand. Why: a missing element that only another fact has is a wrong reference, not a waiver. (reference-variant,variant-derive,contract-invalid) - Never widen a tolerance, add a mask or skip a gate to get a pass. Every number is a measured
noise floor; type-role floors need their probe evidence and stay at or under 3 pt. What the platform
truly cannot draw gets a waiver: one element, one rule, its class (
platform,platform-text-shapingnaming the glyphs,design-artefactquoting the mockup CSS), the reason, the date the reviewer was told. Why: a widened number hides every future defect of that size. (waiver-invalid) - Capture the real app with
capture-app.mjson this session's own named device: a Release build of a development or preview variant, launched straight into the frame (iOS: the-paritylaunch argument, neversimctl openurl; Android: the parity link sent to the named package). Every call names its device (a UDID,adb -s <serial>, Maestro--deviceand this run's own driver port before the command, on both platforms), and every launch carries a nonce the hierarchy dump must contain. Why: a dump once came from another session's simulator; a Debug build, a deep link alert or a hand-made screenshot compares nothing. (system-alert,unstable,changed-during-capture,not-a-capture) - Machine gates first, then the look.
check-parity.mjsmust pass, then every sheet image is read and the seven eye checks and every difference go into the ledger for exactly that sheet. Why: the gates have tolerances; icons, pictures, shadow feel, wrapping and mirroring need eyes. (not-looked,eye-check-open,difference-open,looked-at-old-sheet,stale-sheet) - Fix the app one gate at a time, in the printed order (reached, scroll, missing, bounds, text, fill, border, text-ink, structure); read the element's crop before changing code; stop and report after three failed fixes of the same failure. Why: a wrong padding moves everything below it.
- testIDs exactly as the screen contract says, on the accessible element; bounds only for what
Maestro can list. Parts inside an accessible element (
parent) and decoration hidden from screen readers (a11yHidden) are crop-only, judged in theircoveredByancestor's aligned crop, nevermissing; never un-hide decoration to measure it. Why: Maestro reads the accessibility tree. (element-reach,element-cover,missing) - The harness is the shipped templates, test-only. One strict launch parser (an error screen on
bad input, never a silent fallback), the consent moment held (in an app with ads only an
ADS_MODE=offbuild launches), every test-build switch set on every launch, the design's fixture written unchanged through the app's repositories, each frame state opened by its owning model'suseFrameStateOpenerthrough the handler a press uses, motion held still through the one reduce-motion path, reached only through the test-only gate, the launch marker in every modal root as the first child of itsaccessibilityViewIsModalview (the shared Scrim and ConfirmDialog included), no capture-only branch (harness-capture-branch). Why: a hand-written harness kept stale state across frames and drew things the screen never would. (harness-*, check-harness.mjs) - The mockup is static, offline and marked. One
data-frameper design frame, onedata-testidper element of the frame and no unknown ones, fonts from the exact files the app bundles. Why: both sides must rasterise the same outlines, and a mockup that disagrees with the contract renders references nobody can match. (mockup-*,fonts,design-text) - Pixel identity is never promised. Anti-aliasing, 1/3 pt rounding and each type role's measured glyph offset always differ; the whole-screen difference is printed for information and never decides. Why: correct builds scored 0.13-0.51 %, overlapping real defects.
- The waivers, references (with the manifest), fixture, mockup and device profiles are gated
paths, the sign-off ledger is not; the summary backs the report. A commit that changes a gated
one carries a
Gate-Change:trailer; a report's Design match line namesreports/parity/summary.json. Why: what the gate accepts changes only on purpose and in sight. (gated-paths)
Workflow
- Look first. From the app root run
node ${CLAUDE_SKILL_DIR}/scripts/check-mockup.mjs .andnode ${CLAUDE_SKILL_DIR}/scripts/check-harness.mjs .. NOT APPLICABLE means the app keeps no parity contract yet: step 2. Read references/contract-format.md once. - The contract and the mockup, once per app. Copy
templates/contracts/visual-parity.json(+ schema) tocontracts/,templates/design/parity/todesign/parity/(device profiles, empty waivers and ledger, the fixture, the demo mockup), and give each design frame's screen-contract state its"reference": "<frame>.png"(screen-contracts; examples/screens.json shows the shape; step 3 writes the image it names). Draw or port the approved design into the mockup following references/mockup-and-references.md; runcheck-mockup.mjs .untilRESULT: PASS. - The references, once per approved design. Install the pinned Playwright once (
npm ci --prefix ${CLAUDE_SKILL_DIR}/scripts, or into.skill-tooling/design-visual-paritywith--toolingwhen the skill folder is read-only or shared). The first render of an approved design:node ${CLAUDE_SKILL_DIR}/scripts/shoot-design.mjs . --update-reference(it also writes the screen contract's<frame>.png); later ones only after logging the change (--change <id>); prove them withshoot-design.mjs . --check. The reviewer looks at the renders and approves them. - The harness, once per app. Read references/parity-harness.md.
Copy
templates/src/features/parity/(the parity kitparity-root-kit.tsxincluded),templates/src/hooks/use-frame-request.tsx,use-frame-state-opener.tsanduse-frame-scroll-target.ts, andtemplates/src/ui/parity-launch-marker.tsx(each with its test); exportcreateParityKitand the app's launch screen from the test-only entry (examples/test-only-entry-additions.ts), register the kit in the app's root-kit registry among the test build's kits (examples/create-root-kits-parity.ts: the root skeleton stays unchanged) and add the launch route (examples/parity-route.tsx); build the appliers,consentincluded; open each planned frame state in its model; add the marker to the shared modal roots; register the launch route incontracts/navigation.json(routes,debugRoutes) andcontracts/screens.json(ignoredRoutes); keep.parity/git-ignored and the parity paths gated (both in the canonical.gitignoreandquality-gates.json; rule 12: listed one by one, neverdesign/parity/**, plusdesign/parity/<device>/**for a device beyond the two defaults). Run the harness tests (npx jest src/features/parity src/hooks/use-frame src/ui/parity-launch-marker.test.tsx --ci --maxWorkers=2), thencheck-harness.mjs .until it passes. Before the first approved design,contracts/visual-parity.jsonmay plan no frame ("frames": {}and no screen state with areference): check-harness still proves the wiring and the frame scripts print NOT APPLICABLE. - Before building or changing a screen, open its references (light and dark RTL first), the
frame's elements (screen-contracts'
list-screen.mjs) and the frame kind and masks in the contract. - The device, once per session.
node ${CLAUDE_SKILL_DIR}/scripts/setup-parity-device.mjs . --device iphone-16-pro --appearance light --name <project>-parity-<key>(and the same forandroid-parity); it prints the UDID or serial. Build and install the Release build of the preview variant on it (ios-simulator-build, android-emulator-build). Read references/devices-and-capture.md when anything fails. - Run the machine side:
node ${CLAUDE_SKILL_DIR}/scripts/run-parity.mjs . --screen <id> --device iphone-16-pro --name <project>-parity-<key>: capture, check and sheets for every frame of the screen in every theme and language (tall frames at every planned offset). A run takes 10 to 20 s, so run a whole screen in the background or narrow with--frame,--themes,--langswhile fixing, never for the sign-off. Repeat per device. After a hand-runcheck-parity.mjs,node ${CLAUDE_SKILL_DIR}/scripts/make-sheet.mjs . --run <run-dir>redraws that run's sheets. - On FAIL, read references/failure-messages.md for the rule, open
crops/<testID>.png, the reference.layout.jsonand, for a gap inside an element, the mockup's CSS; fix the first failing rule of each run in the app code, rebuild (or swap the bundle on iOS), run step 7 again. references/what-exact-means.md explains every gate. - On PASS, look. Follow references/signoff-and-waivers.md:
read
sheet.png, everyzoom-*.pngand everyeye-*.pngof every run, answer the seven eye checks, fix every visible difference. A difference the app cannot fix becomes a waiver (its class and why), reported to the reviewer. - Record and prove. For each run,
node ${CLAUDE_SKILL_DIR}/scripts/check-signoff.mjs . --draft <run-dir>prints the ledger entry dated today (after a rebuild add--from-ledger); complete it indesign/parity/signoff.json. Then runcheck-signoff.mjs . --screen <id>untilRESULT: PASS. examples/worked-loop.md shows the whole loop. - Report per frame: the reference used, the runs that pass, what was checked by eye, every waiver
with its class and reason, every intended reference change, open questions, and the dark RTL
sheet.png; the Design match line namesreports/parity/summary.json. - Clean up: shut down this session's own devices by UDID or serial, never another one.
Definition of done
-
contracts/visual-parity.jsonlists the app's themes, languages and devices, and every design frame is a screen-contract state with a reference. -
node ${CLAUDE_SKILL_DIR}/scripts/check-mockup.mjs .printsRESULT: PASS, andshoot-design.mjs . --checkpasses (it needs Playwright and Google Chrome). -
run-parity.mjspassed every frame of the screen on every device, theme and language (never a narrowed set), at every planned scroll offset, against the reference the facts select, with no tolerance, mask or reference changed. - Every sheet image of every run was read; the ledger has an entry for each run's current sheet with all seven eye checks answered and no open difference.
- Every waiver names one element, one rule and its class, gives the reason and the reviewer-report date, and is in the report.
- Allowed SKIP lines of check-harness.mjs, only before the owning skill adopted its file:
SKIP src/test-only-entry.ts [harness-not-exported] not yet created (debug-menu-and-test-hooks creates it)(and[harness-not-wired]),SKIP contracts/architecture.json [harness-test-only-folder] not yet created (architecture-and-boundaries creates it),SKIP quality-gates.json [gated-paths] not yet created (quality-gates creates it). -
node ${CLAUDE_SKILL_DIR}/scripts/check-harness.mjs .printsRESULT: PASS. -
node ${CLAUDE_SKILL_DIR}/scripts/check-signoff.mjs . --screen <id>printsRESULT: PASS
Anti-patterns
- Judging a screen by one whole-screen percentage or SSIM. Correct builds and real defects score the same; only the per-element gates and the look decide.
- Re-rendering the references, adding a mask or loosening a number after a failure. Fix the app; ask the reviewer when the design itself seems wrong.
- A screenshot from the everyday simulator, a Debug build,
simctl openurlor manual navigation. Wrong geometry, dev overlays, an "Open in ...?" alert, a state that is almost right. - The testID on the inner Text of a button. Maestro lists only the Pressable:
missing. - Un-hiding a decorative icon so Maestro lists it. Screen readers would read decoration; the contract already judges hidden parts by their cover's crop.
- Signing off after reading only
sheet.png. Icons, radii and shadows show in the zoom bands and eye pages; the ledger demands every image. - A waiver for "close enough". A waiver is for what the platform cannot draw; anything else is a fix.
- A capture-only branch (
if (isParityRun)) in a view or a model, or a parity-only layout. Open the state throughuseFrameStateOpenerand the real handler; hold motion throughuseReduceMotion(). - Fixing several rules at once. A wrong padding moves everything below it; fix the first failing element from the top, then run again.
- Hand-writing the harness or editing the fixture. Copy the templates; the fixture is the design's.
- Nudging glyphs to pass
text-ink. A translate or padding breaks the boxes that match; rule out a type-role mismatch first, and measure the role when its floor is unknown. - Copying the reference in as
app.png.not-a-capture, and it proves nothing. - Signing off a narrowed set, or one device only. The done set is every device, theme and language.
- Sharing a device or a driver port with another session, or
simctl ... booted. Name your own device, let the scripts pick a free port, trust the nonce check. - Hand-drawing a reference variant. Variants are derived from the rendered mockup by the contract's
derive. - A mockup loading fonts from the web, or
system-uifor an app that bundles its own font. The outlines differ and every text run fails.
Files in this skill
| File | What it is | Read/run when |
|---|---|---|
| references/contract-format.md | The parity contract, device profiles, the fixture, rn-skills.config keys | Workflow steps 1-2 |
| references/mockup-and-references.md | Mockup conventions, rendering, frame kinds, variants, masks, when references change, the change log | Workflow steps 2-3 and 5 |
| references/parity-harness.md | The app side: the launch contract, templates, appliers, openers, markers, wiring, testIDs, React Navigation appendix | Workflow step 4; a frame not reached |
| references/devices-and-capture.md | iOS simulator and Android emulator setup, launching into a frame, probes, screenshots, Maestro bounds, the nonce, bundle swap | Workflow steps 6-7; capture problems |
| references/what-exact-means.md | The gates, their measured tolerances, text ink, measuring type-role floors, what only a look proves | Workflow step 8; when a tolerance seems wrong |
| references/signoff-and-waivers.md | Reading the sheets, the done set, the ledger, waivers, known platform causes, the summary and the report | Workflow steps 9-11 |
| references/failure-messages.md | Every rule id of every script: meaning, real cause, fix | Any FAIL line |
templates/contracts/visual-parity.json |
The contract, filled for the demo Tasks app | Workflow step 2 (copy) |
templates/contracts/visual-parity.schema.json |
Its JSON Schema | Workflow step 2 (copy beside it) |
templates/design/parity/devices/ |
Device profiles: iphone-16-pro.json, android-parity.json |
Workflow step 2 (copy) |
templates/design/parity/mockup/index.html |
The demo mockup (3 frames, light/dark, en/ar) showing the conventions | Workflow step 2 |
templates/design/parity/fixture.json |
The design's data in every language | Workflow step 2 (copy) |
templates/design/parity/waivers.json |
An empty waiver file | Workflow step 2 (copy) |
templates/design/parity/signoff.json |
An empty sign-off ledger | Workflow step 2 (copy) |
templates/src/features/parity/ |
The test-only harness: plans, parser, fixture, session, launch, launch root, frame root, error screen, launch reader and bridge, each with its test | Workflow step 4 (copy) |
templates/src/hooks/use-frame-request.tsx |
Production: the frame request (FrameRequestProvider, useFrameRequest) |
Workflow step 4 (copy) |
templates/src/hooks/use-frame-request.test.tsx |
Its test | Workflow step 4 (copy) |
templates/src/hooks/use-frame-state-opener.ts |
Production: the model's frame-state opener (one hook per file) | Workflow step 4 (copy) |
templates/src/hooks/use-frame-state-opener.test.tsx |
Its test | Workflow step 4 (copy) |
templates/src/hooks/use-frame-scroll-target.ts |
Production: a tall frame's scroll offset | Workflow step 4 (copy) |
templates/src/hooks/use-frame-scroll-target.test.tsx |
Its test | Workflow step 4 (copy) |
templates/src/ui/parity-launch-marker.tsx |
Production: the launch marker for the parity root and every modal root | Workflow step 4 (copy) |
templates/src/ui/parity-launch-marker.test.tsx |
Its test | Workflow step 4 (copy) |
| examples/screens.json | Shape: screen-contracts' contracts/screens.json with a reference on each design-frame state and checks on compared elements |
Workflow step 2 |
| examples/parity-route.tsx | Shape: the launch route src/app/(debug)/debug/parity.tsx |
Workflow step 4 |
| examples/create-root-kits-parity.ts | Shape: the parity kit registered among the test build's kits in the app's root-kit registry | Workflow step 4 |
| examples/test-only-entry-additions.ts | Shape: the entry's harness exports | Workflow step 4 |
| examples/parity-launch-screen.tsx | Shape: the app's test-only screen that builds the appliers (consent hold, switches, repositories, settings target) and renders the launch | Workflow step 4 |
| examples/model-opener.ts | Shape: a model that opens its frame state and passes the scroll target | Workflow step 4 |
| examples/worked-loop.md | The whole loop for one screen, with outputs | First time through the loop |
scripts/check-mockup.mjs |
Contracts and mockup agree, statically | Workflow steps 1-2 |
scripts/shoot-design.mjs |
Renders references (--update-reference), proves them (--check), renders for a look (--out) |
Workflow step 3 |
scripts/check-harness.mjs |
The app side of parity | Workflow steps 1 and 4 |
scripts/setup-parity-device.mjs |
Creates, boots and pins this session's simulator or emulator; --check |
Workflow step 6 |
scripts/capture-app.mjs |
One capture: launch into the frame, still screenshot, Maestro bounds, run.json | Called by run-parity; alone for one run |
scripts/check-parity.mjs |
The per-element gates; writes report.json | Called by run-parity; alone to check again |
scripts/make-sheet.mjs |
sheet.png, zoom bands, failing-element crops, eye pages | Called by run-parity; alone after a check |
scripts/run-parity.mjs |
Capture, check and sheets for every frame x theme x language on one device | Workflow step 7 |
scripts/check-signoff.mjs |
Definition of done per screen; --draft prints a ledger entry; writes the summary |
Workflow step 10 |
scripts/selftest.mjs |
Proves every script on good and planted-defect fixtures | After changing a script |
scripts/lib/ |
Contract, gates, pixel difference, images, hierarchy, runs and waivers, reference changes, device tools, rendering, mockup reader, self-test scenes; synced helpers (do not edit those) | Never directly |
scripts/check-lib.mjs |
Shared script library, synced (do not edit here) | Never by hand |
scripts/package.json |
The one pin: playwright 1.63.0 (only shoot-design.mjs uses it) | Workflow step 3 (npm ci --prefix) |
scripts/package-lock.json |
Its lockfile | Never by hand |
assets/shared.json |
Declares the shared files this skill copies in | When adding a shared file |
tests/bases/ |
The self-test apps: the demo contracts, scene-drawn frames, a wired harness | When the self-test base changes |
tests/fakes/ |
Fake xcrun, adb, emulator tools, maestro and clock for the self-test | When a device script changes |
tests/fixtures/ |
Good, pass, planted-bad and error cases for every script (overlay format) | When adding a rule |
Related skills
screen-contracts- the screens, states, testIDs and screenshot reach this skill checks.ui-component-library- the components whose parts the gates measure; as-rendered border widths.design-system-structure- tokens and fonts; afillortext-inkfailure usually points there.icons-app-icon-and-splash- icons and pictures the eye checks look at.rtl-and-direction- the mirroring rules behind thedirectioneye check.debug-menu-and-test-hooks- the test-only gate, the switches and the settings target the launch uses.ios-simulator-build,android-emulator-build- the builds that are captured.e2e-maestro- installing Maestro and Java 17; the device-binding helper.git-commits-and-reporting- the Gate-Change trailer and the Design match line.golden-and-snapshot-tests- pixel goldens of what the app itself renders (canvas, pictures).