ai newsDi., 1. Dez.

Warum UI-Screenshots Cursor und Claude hallucinieren lassen

Ein Entwickler beschreibt, wie DevTools bei UI-Analysen hunderte Zeilen geerbter CSS-Defaults ausgeben statt der relevanten Stile. Er baute einen 64KB-Inspector auf Shadow-DOM-Basis, um das Problem zu umgehen.

dev.toSonntag 15:51 · 29.11.DE1 Min. Lesezeit
Bild: dev.to

Whenever I see a clean bento card, navbar, or pricing layout on a site like Linear or Stripe and want to understand how it's built—or rebuild a similar pattern in my own app—two things always break the flow:

So over the past weeks (I'm a 17-year-old indie dev in Sweden), I built PRISM CSS —a ~64KB, zero-dependency vanilla JS inspection engine that runs 100% locally inside an isolated Shadow DOM.

Injecting inspector styles directly into a live website usually mutates or breaks the host page's CSS. PRISM mounts its entire HUD, box-model laser overlays, and dock inside an isolated Shadow root so host styles never bleed in—and PRISM never dirties the page's DOM.

Instead of dumping getComputedStyle() verbatim, the engine compares an element against baseline tag defaults, collapses directional shorthands ( padding-top/right/bottom/left -> p-6 ), snaps values to standard Tailwind scales (falling back to arbitrary rounded-[14px] or bg-[#0D1122] only when exact precision matters), and outputs clean React/JSX or HTML:

Originaltitel: Why UI Screenshots Make Cursor & Claude Hallucinate (And How I Built a 64KB Shadow-DOM Inspector to Fix It)Quelle: dev.to (dev.to). Original öffnen