Use when CLS is at or over 0.1, when DevTools CLSCulprits reports shifts with "no potential root causes identified" or blames a non-composited animation, or when many tiny layout shifts accumulate over seconds.
Ships in web-perf. 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.
None: SKILL.md is the whole skill.
DevTools' CLS attribution is a pattern-matching heuristic — it only recognizes font swaps, unsized media, and CSS animations. JS-driven text mutation (typewriters, GSAP ScrambleText) comes back "no root causes identified", and the animation it DOES blame may be a bystander. Get ground truth from layout-shift entry sources, never from the insight.
| State of the shifted content | Counts? |
|---|---|
Inside a position: fixed overlay | YES — fixed exempts nothing; children that move are counted |
At opacity: 0 | YES — opacity-0 content is still painted; if its geometry moves, it counts |
| Under an opaque covering element | YES — being visually covered is not an exemption |
At visibility: hidden | NO — not painted, the only practical exemption |
Moved via transform | NO — transforms don't shift layout |
The killer pattern: an overlay faded to opacity: 0 but stayed mounted while a typewriter kept cycling inside it — invisible keystrokes accrued CLS forever. Fix shape: transition the overlay to visibility: hidden at fade end (transition: opacity, visibility — visible→hidden flips at transition END, so the fade looks identical) AND stop the animation loop (gate it on the same ready signal that dismissed the overlay — reuse the existing store, don't write a new <html> class observer).
// Run on the live page (chrome-devtools evaluate_script).
const entries = [];
const po = new PerformanceObserver((l) => entries.push(...l.getEntries()));
po.observe({ type: 'layout-shift', buffered: true });
await new Promise((r) => setTimeout(r, 8000));
po.disconnect();
entries.filter((e) => !e.hadRecentInput).map((e) => ({
t: Math.round(e.startTime),
score: parseFloat(e.value.toFixed(4)),
// Text nodes have no tagName — climb to parentElement or you'll log "unknown".
nodes: (e.sources ?? []).map((s) => (s.node?.nodeType === 3 ? s.node.parentElement : s.node)),
}));
Read the timing fingerprint: dozens of evenly-spaced tiny shifts ≈ per-tick JS text mutation; one or two large discrete shifts ≈ font swap or content insertion.
Glyphs have varying advance widths, so every scramble refresh nudges following inline content (e.g. a trailing punctuation mark after a scrambled heading, ~0.02 per tick). Pin the animated span's box for the tween's lifetime:
gsap.set(el, { display: 'inline-block', width: el.offsetWidth }); // settled text is already rendered
gsap.to(el, { ..., overwrite: true, onComplete: () => gsap.set(el, { clearProps: 'display,width' }) });
overwrite: true stops a hover re-entry's stale onComplete from unlocking mid-scramble. In practice this took a scrambled heading from CLS 0.122 to 0.012.
opacity: 0 exempts content from CLS — it does not; only visibility: hidden does.astro dev — measure a production build (pnpm build + astro preview --port <port>).What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
/web-perf:debugging-cumulative-layout-shiftfrom web-perf
npx claudepluginhub naporin0624/astro-agent-starter --plugin web-perf