--- name: web-perf description: Structured 5-phase web performance audit workflow with Core Web Vitals thresholds and actionable optimization recommendations. Use when auditing website performance, diagnosing slow page loads, optimizing Core Web Vitals scores, or reviewing frontend performance patterns. Covers Webpack, Vite, Next.js, and Nuxt optimization. license: MIT metadata: author: cloudflare version: '1.0.0' source: cloudflare/skills verified: true lastVerifiedAt: 2026-02-22T00:00:00.000Z version: 1.0.0 tools: [] --- # Web Performance Audit Structured 5-phase web performance audit workflow. Diagnose performance bottlenecks, measure Core Web Vitals, and produce actionable optimization recommendations. ## When to Apply Use this skill when: - Auditing website performance for Core Web Vitals compliance - Diagnosing slow page loads, high Time to Interactive, or layout shifts - Optimizing Largest Contentful Paint (LCP), Cumulative Layout Shift (CLS), or Interaction to Next Paint (INP) - Reviewing frontend code for performance anti-patterns - Preparing a site for Google's page experience ranking signals - Optimizing build output for Webpack, Vite, Next.js, or Nuxt ## Core Web Vitals Thresholds | Metric | Good | Needs Improvement | Poor | What It Measures | | ------- | -------- | ----------------- | ------- | ---------------------------- | | **LCP** | <= 2.5s | 2.5s - 4.0s | > 4.0s | Loading performance | | **CLS** | <= 0.1 | 0.1 - 0.25 | > 0.25 | Visual stability | | **INP** | <= 200ms | 200ms - 500ms | > 500ms | Interactivity (replaced FID) | ### Additional Performance Metrics | Metric | Good | Poor | What It Measures | | --------------- | -------- | -------- | ----------------------------- | | **FCP** | <= 1.8s | > 3.0s | First content rendered | | **TTFB** | <= 800ms | > 1800ms | Server response time | | **TBT** | <= 200ms | > 600ms | Main thread blocking | | **Speed Index** | <= 3.4s | > 5.8s | Visual completeness over time | ## 5-Phase Audit Workflow ### Phase 1: Performance Trace Capture a performance trace to establish baseline metrics. **Browser-Based (Chrome DevTools):** 1. Open Chrome DevTools (F12) > Performance tab 2. Click "Record" and reload the page 3. Stop recording after page fully loads 4. Analyze the flame chart for: - Long tasks (> 50ms, marked in red) - Layout thrashing (forced reflow cycles) - Render-blocking resources - JavaScript execution bottlenecks **Lighthouse Audit:** ```bash # CLI-based Lighthouse audit npx lighthouse https://example.com --output=json --output-path=./lighthouse-report.json # With specific categories npx lighthouse https://example.com --only-categories=performance --output=html # Mobile simulation (default) npx lighthouse https://example.com --preset=perf --throttling-method=simulate ``` **Key Trace Indicators:** - **Main thread busy time**: Should be < 4s total - **Largest task duration**: Should be < 250ms - **Script evaluation time**: Should be < 2s - **Layout/style recalculation**: Should be < 500ms ### Phase 2: Core Web Vitals Analysis Measure each Core Web Vital and identify specific causes. #### LCP Diagnosis LCP measures loading performance -- when the largest content element becomes visible. **Common LCP Elements:** - `` elements (hero images) - `