--- name: audit-speed description: > Deep Core Web Vitals and page speed audit. Use when the user asks about page speed, Core Web Vitals, LCP, CLS, INP, FCP, TTFB, Lighthouse scores, why a page is slow, performance optimization, or resource size analysis. For broader technical SEO issues, see diagnose-seo. metadata: version: 1.0.0 --- # Audit Speed Deep Core Web Vitals audit with root-cause analysis trees and resource optimization recommendations. ## Core Web Vitals Thresholds | Metric | Good | Needs Improvement | Poor | |--------|------|-------------------|------| | LCP (Largest Contentful Paint) | < 2.5s | 2.5s - 4.0s | > 4.0s | | CLS (Cumulative Layout Shift) | < 0.1 | 0.1 - 0.25 | > 0.25 | | INP (Interaction to Next Paint) | < 200ms | 200ms - 500ms | > 500ms | | FCP (First Contentful Paint) | < 1.8s | 1.8s - 3.0s | > 3.0s | | TTFB (Time to First Byte) | < 800ms | 800ms - 1800ms | > 1800ms | ## Before You Start Gather this context: 1. **Which pages?** Homepage, key landing pages, or specific slow pages. 2. **Current scores.** If the user has Lighthouse or PageSpeed Insights data, start there. 3. **Tech stack.** CMS, framework, hosting — this determines which optimizations are available. 4. **Known constraints.** Third-party scripts they can't remove, design requirements that limit optimization. If no data is available, suggest running Google PageSpeed Insights on the key URLs. ## LCP Root-Cause Tree LCP measures when the largest visible element finishes rendering. Diagnose: **Is TTFB slow (> 800ms)?** - → Server response time issue - Check: hosting quality, CDN configuration, database queries, server-side rendering time - Fix: upgrade hosting, add CDN, optimize server-side code, enable caching **Is the LCP element an image?** - → Image optimization issue - Check: image format (use WebP/AVIF), image size (serve responsive sizes), lazy loading on LCP image (should NOT be lazy loaded) - Fix: convert to modern formats, add `width`/`height` attributes, use `fetchpriority="high"` on LCP image, preload the LCP image **Is the LCP element text?** - → Font loading issue - Check: custom fonts blocking render, font file size, font-display strategy - Fix: use `font-display: swap` or `optional`, preload critical fonts, subset fonts to used characters **Is render-blocking CSS/JS delaying the LCP?** - Check: large CSS files in ``, synchronous JS before content - Fix: inline critical CSS, defer non-critical CSS, async/defer JS ## CLS Root-Cause Tree CLS measures unexpected layout shifts. Diagnose: **Do images/videos lack dimensions?** - → Browser can't reserve space before loading - Fix: add `width` and `height` attributes to all `` and `