---
name: performance-web-vitals-pass
description: Use when asked to make a website or web app faster or to improve Core Web Vitals (LCP, INP, CLS) - images, fonts, JavaScript and CSS weight, third-party scripts, caching, and server response - using field data where available and lab data to diagnose. Delivers measured before/after numbers in a review PR. Not for visual redesign or feature work.
---

# Performance and Core Web Vitals pass

Last reviewed: 2026-11-10

## Quick prompts

For anyone improving a site or app, whether a small-business owner or someone at a larger company practicing better prompts. Slow pages lose visitors and rank lower in search, and the biggest wins are usually a few images, fonts, or scripts. Paste a prompt into any AI assistant that can see the site or repo.

1. "Measure how fast the home page of the site I work on loads on a phone. Name the three biggest things slowing it down, in plain language, before changing anything."
   *Why this prompt works:* Asking for the top three forces prioritizing instead of a long list.

2. "Using Google's Core Web Vitals targets (LCP under 2.5 s, CLS under 0.1, INP under 200 ms), check one article and the home page of the site I work on. Report pass or fail for each first."
   *Why this prompt works:* Give criteria: published targets make 'fast enough' measurable.

3. "Does anything on the site I work on jump around while loading? Tell me which elements shift and why, with no fixes yet."
   *Why this prompt works:* A specific symptom gets a specific diagnosis.

## Targets (75th percentile of real page loads, mobile and desktop separately)

| Metric | Good | Poor | Measures |
|---|---|---|---|
| LCP, Largest Contentful Paint | ≤ 2.5 s | > 4.0 s | Loading of the main content |
| INP, Interaction to Next Paint | ≤ 200 ms | > 500 ms | Responsiveness to taps, clicks, keys |
| CLS, Cumulative Layout Shift | ≤ 0.1 | > 0.25 | Visual stability |

Supporting: TTFB (server/CDN), FCP, and TBT (lab proxy for INP, since lab tools cannot measure INP without real input).

## Hard limits

- No visible design, content, or behavior changes. Lazy-loading or deferring must not hide content users need, break analytics the owner relies on, or remove a third-party tool without the owner's say.
- Review PR only; host/CDN cache rules, plan upgrades, or paid services need the owner's approval.
- Measure before and after with the same method; do not claim wins from a single noisy run.

## Inputs to gather

1. URL list: one per template, heaviest pages first (home, top landing pages, article, product, dashboard).
2. Field data if available: PageSpeed Insights (CrUX), Search Console Core Web Vitals report, or the site's own RUM (`web-vitals` library). Small sites often have no CrUX data; say so.
3. Stack, image pipeline, font loading, CDN, cache headers, third-party tags.
4. Build/deploy limits (one push per task if metered).

## Step 1: Classify

| Type | Likely bottlenecks | Careful with |
|---|---|---|
| Article / editorial | Hero image as LCP, web fonts, ads and embeds causing CLS, comment widgets | Ad slots and embeds the owner earns from: reserve space, do not remove |
| Marketing / landing | Hero video/image, sliders, tag managers, A/B testing scripts (render-blocking) | Tracking pixels: defer, do not delete without approval |
| Docs | Search index size, syntax highlighter JS, large sidebars | Search behavior |
| E-commerce | Product images, filters re-rendering lists (INP), third-party reviews/chat widgets | Checkout and payment scripts: do not defer or alter |
| Dashboard / SPA | JS bundle size, hydration cost, long tasks on data load (INP), chart libraries | Data freshness and polling intervals |
| SSR/static vs SPA | Static: images, fonts, caching. SPA: code splitting, route-level lazy loading, hydration | — |

## Step 2: Measure baseline

- Field: record p75 LCP/INP/CLS per device type if available.
- Lab: Lighthouse (mobile preset) 3–5 runs per URL, report the median; Chrome DevTools Performance panel for long tasks and the LCP element; WebPageTest for filmstrips if needed.
- Identify the LCP element on each template and what delays it (TTFB, resource load delay, load time, render delay).
- Record page weight by type (JS, CSS, images, fonts, third-party).

## Step 3: Fix (highest impact first)

**LCP**: make the LCP image discoverable in HTML (not CSS background or JS-injected), `fetchpriority="high"` on it, never `loading="lazy"` on it; responsive `srcset`/`sizes`; AVIF/WebP; preconnect to required origins; cut render-blocking CSS/JS; cache HTML at the CDN where safe.

**CLS**: `width`/`height` or `aspect-ratio` on images, videos, iframes and ad slots; reserve space for banners and embeds; `font-display: swap` or `optional` with size-adjusted fallbacks; avoid inserting content above existing content.

**INP**: break up long tasks (yield to main thread), defer non-critical JS, reduce hydration (islands, partial hydration), debounce heavy input handlers, keep DOM size reasonable, move work off the main thread.

**Weight and caching**: remove unused JS/CSS, code-split by route, subset and self-host fonts (WOFF2), lazy-load below-the-fold images and embeds (facades for video players), long `Cache-Control` with fingerprinted filenames, compression (Brotli/gzip).

**Third parties**: inventory each tag, load async/defer, delay non-essential ones until interaction or idle, and list candidates for removal for the owner to decide.

## Validation

- Re-run the same lab method on the same URLs; report medians before/after.
- Visual check in a real browser at desktop and phone sizes: nothing missing, no new layout shift, images sharp.
- Build and tests pass; analytics and forms still fire (in test mode).
- Field data takes about 28 days to reflect changes in CrUX; say when to recheck.

## Report format

1. Interface type(s), URLs, field data availability.
2. Table per URL: LCP element, LCP/CLS/TBT (and INP if field) before → after, page weight before → after.
3. Changes made, each with the metric it targets.
4. Third-party scripts and recommendations needing owner decision.
5. Not verified, and when to check field data. PR link, "not merged".

## References

- Web Vitals: https://web.dev/articles/vitals
- Optimize LCP / INP / CLS: https://web.dev/articles/optimize-lcp , https://web.dev/articles/optimize-inp , https://web.dev/articles/optimize-cls
- Most effective ways to improve Core Web Vitals: https://web.dev/articles/top-cwv
- Lab vs field data: https://web.dev/articles/lab-and-field-data-differences
- PageSpeed Insights: https://pagespeed.web.dev/
- MDN lazy loading and `fetchpriority`: https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/Lazy_loading , https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#fetchpriority
- MDN HTTP caching: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching
