centering-judge

Validates UI element alignment in PNG screenshots with pixel-level Python scripts.

Updated May 20, 2026
One-click install
npx skills add https://github.com/TeXmeijin/agent-skills --skill centering-judge-texmeijin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: centering-judge
Source: https://github.com/TeXmeijin/agent-skills/tree/main/.apm/skills/centering-judge
Command: npx skills add https://github.com/TeXmeijin/agent-skills --skill centering-judge-texmeijin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, Pillow, scipy, and includes scripts (resource) components.

What problem does it solve? LLMs tend to subjectively judge screenshots as "aligned" and miss subtle pixel-level misalignment in UI layouts. This Skill replaces visual guesswork with objective, per-proposition Python scripts that measure alignment in pixels and produce numeric verdicts. ## Core Features & Use Cases - Proposition-driven script design: For each alignment claim (vertical centering, left-edge alignment, equal spacing), design the ROI, detection algorithm, and threshold, then implement a fresh script rather than relying on a fixed tool. - Reusable toolkit: Background masking, content profiles, run extraction with gap merging, debug overlay PNGs, and a standardized exit-code convention (0=PASS, 1=FAIL, 2=ERROR). - Reference implementations: Includes scripts for center-y alignment of a left circular icon vs. right-side elements, and left-edge x alignment of text across multiple rows. - Use Case: After a CSS change, verify that a circular avatar and the badges beside it share the same vertical center; the script reports a 6.5px offset, generates a debug overlay, and you fix it by adding items-center to the outer flex container. ## Quick Start Check this screenshot to verify whether the icon and the text rows are vertically centered, and report the exact pixel offset with a debug overlay image.

Frequently Asked Questions about centering-judge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if UI elements are vertically centered in a screenshot?

Write a Python script that masks the background, detects each element's bounding box via content profiles, and compares center-y coordinates against a threshold in pixels. The reference implementation left_circle_vs_right_row_center_y.py shows this pattern for a left icon versus right-side elements.

How to verify text left-edge alignment across multiple rows in an image?

Specify a row ROI (y_top, y_bot) per line, extract column content profiles, merge blocks separated by small gaps, and compare the leftmost x of the text block in each row. The multi_row_text_left_x_after_icon.py reference script implements this with a configurable threshold.

What Python libraries are needed for pixel-level image alignment checks?

The scripts require Python 3.10+, numpy for array operations, and Pillow for image loading and debug overlay drawing. scipy is only needed when connected-component labeling is required for element detection.

Why does the alignment script fail to detect elements in my screenshot?

Detection fails when the layout violates the script's assumptions, such as avatar size limits or zone ratios. Adjust parameters like --vertical-margin, --cluster-merge-x-gap, or --max-avatar-height, or write a new script matching your specific proposition.

Can I reuse the same alignment script for different layouts?

No, the bundled scripts are reference implementations tied to specific layout assumptions. For a different proposition, such as equal spacing or container centering, design a new ROI and detection algorithm using the shared toolkit patterns.