Index of every page on this site: llms.txt
All skills
fubits1 avatar

/pixel-perfect

@a024d57
by Iljafubits1/svelte-skills11 stars
2
Run it yourself

Pixel drift detection, mandatory measurement workflow for any CSS or HTML element change. Auto-invoke when editing CSS, changing HTML elements, or replacing DOM structures.

Use this Skill: https://skilld.dev/gh/fubits1/svelte-skills/pixel-perfect

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈47 tokens for metadata: the name and description. ≈869 when used: this file.

Description uses 2.4% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈188 characters, or 2.4%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Pixel-Perfect: Mandatory Measurement Workflow

When making any CSS change or HTML element swap (e.g. <dl> to <ul>, <div> to <section>), follow this workflow exactly. Screenshots alone prove NOTHING about pixel parity, only measured numbers do.

Step 1: Measure BEFORE (while original code is still in place)

Use browser_evaluate to capture exact values for every affected element:

// Capture dimensions
el.getBoundingClientRect() // width, height, x, y

// Capture computed styles — the ACTUAL rendered values, not what CSS says
getComputedStyle(el).display     // may differ from your CSS (global overrides!)
getComputedStyle(el).gap
getComputedStyle(el).margin
getComputedStyle(el).padding
getComputedStyle(el).lineHeight
getComputedStyle(el).fontSize

Store these numbers. Report them. They are your baseline.

Critical: Measure ACTUAL computed styles, not what you think the CSS does

Global styles, resets, and browser defaults frequently override scoped CSS. A <dl> might render as display: grid; gap: 16px even though scoped CSS says display: flex; gap: 8px. Never assume, always measure.

Step 2: Make the code change

Edit the HTML/CSS.

Step 3: Measure AFTER

Navigate to the same page. Measure the same elements with browser_evaluate. Report the numbers side by side.

Beware HMR staleness

After git stash pop, git checkout, or file restoration, the dev server may serve stale CSS. Touch the file (touch path/to/file) and hard-reload before measuring.

Step 4: Compare and report

Report a table:

| Metric         | Before | After | Diff |
| -------------- | ------ | ----- | ---- |
| footer height  | 396px  | 396px | 0    |
| section height | 98px   | 98px  | 0    |

Step 5: Investigate any diff

If any measurement differs by even 1px:

  1. Do not dismiss it. Do not say "close enough" or "imperceptible."
  2. Investigate the root cause: default margins, line-heights, display mode, gap values, global style overrides.
  3. Fix it to 0px diff.
  4. Measure again to prove the fix.

Common traps when replacing HTML elements

Trap Example Fix
Browser default margins <ul> has margin: 0 0 16px, <dl> has margin: 1em 0 Explicitly reset margin: 0
Browser default padding <ul> has padding-left: 40px Explicitly reset padding: 0
Default line-height <li> gets line-height: 1.5 from UA stylesheet Set line-height: 1 or match original
Global CSS overrides A global dl { display: grid } overrides scoped display: flex Measure computed styles BEFORE changing elements
Scoped CSS not matching Changed & dl to & ul but Astro scoping attrs differ Touch file + reload to force CSS rebuild

NEVER

  • NEVER claim "no visual regression" or "looks identical" from eyeballing screenshots
  • NEVER skip the BEFORE measurement: you cannot compare without a baseline
  • NEVER report "approximately the same": report exact pixel values
  • NEVER proceed if you don't have BEFORE numbers: revert and measure first

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    The skill provides a rigorous workflow for ensuring visual consistency during CSS and HTML changes by measuring element properties using browser tools. It contains no malicious code, data exfiltration, or obfuscation.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: LOW · No issues

Signed by skilld at a024d57. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Activeupdated 5 months ago
user-invocable
true

README badge

README badge for fubits1/svelte-skills/pixel-perfect