Overview
Performs a structured performance audit using Lighthouse, the web-vitals library, bundle analyzers, network waterfall analysis, and caching review. Produces a prioritized, actionable fix list with estimated impact and implementation effort for each issue.
When to Use This Skill
- A page or app feels slow.
- Lighthouse score is low (<90 in Performance).
- User complains about load time, interactivity, or layout shift.
- Preparing for a performance budget or before a major launch.
Prerequisites
- The running application (local dev or deployed preview).
- Node.js for running Lighthouse CLI.
- Access to build output for bundle analysis.
- Browser DevTools.
Steps
Run Lighthouse:
npx lighthouse https://example.com --view --preset=desktop
npx lighthouse https://example.com --view --preset=mobile
Measure real user metrics:
- Add
web-vitals library and log to console or analytics.
- Or use Chrome DevTools Performance panel + Web Vitals extension.
Bundle analysis:
- For webpack/Next.js:
next build + ANALYZE=true or webpack-bundle-analyzer.
- Identify large dependencies, duplicate code, unused exports.
Network waterfall review:
- Record in DevTools Network tab (disable cache).
- Look for: render-blocking resources, large unoptimized images, many small requests, no compression, long TTFB.
Caching & headers audit:
- Check
Cache-Control, ETag, Last-Modified.
- Recommend immutable assets for hashed files, stale-while-revalidate for others.
Image & media optimization:
- Use
next/image or <picture> + modern formats (AVIF, WebP).
- Proper
width/height or aspect-ratio to prevent CLS.
- Lazy loading.
JavaScript & interactivity:
- Code splitting, dynamic imports.
- Defer non-critical scripts.
- Optimize event handlers and re-renders (React Profiler).
Generate prioritized fix list:
- Format: Issue | Current metric | Target | Effort | Impact | How to fix (concrete steps).
Output:
- Lighthouse report summary.
- Bundle size breakdown.
- Specific code patches for top 5-7 issues.
- Monitoring recommendation (add web-vitals to analytics).
Examples
Sample Lighthouse command output interpretation, a typical "top issues" report, and concrete fixes (e.g., "Replace this 1.2MB hero image with next/image + AVIF", "Add loading="lazy" to below-the-fold images", "Split this heavy modal into dynamic import") are provided.
Edge Cases & Error Handling
- Third-party scripts: Identify and suggest async/defer or partytown.
- Large vendor bundles: Recommend tree-shaking, replacing heavy libs (e.g., moment → date-fns).
- SPA vs MPA: Different strategies for each.
Verification
- Re-run Lighthouse after fixes — score improvement documented.
- Measure LCP, CLS, INP before/after with web-vitals.
- Bundle size reduced (compare
next build output).
- Real user metrics improve in analytics.
- Success: Measurable, sustained improvement in user-perceived performance.
References
1---2name: performance-auditor3description: Audits web application performance and generates an actionable improvement plan. Use when a web app is slow, fails Lighthouse checks, or has poor Core Web Vitals scores.4license: Apache-2.05---67## Overview89Performs a structured performance audit using Lighthouse, the `web-vitals` library, bundle analyzers, network waterfall analysis, and caching review. Produces a prioritized, actionable fix list with estimated impact and implementation effort for each issue.1011## When to Use This Skill1213- A page or app feels slow.14- Lighthouse score is low (<90 in Performance).15- User complains about load time, interactivity, or layout shift.16- Preparing for a performance budget or before a major launch.1718## Prerequisites1920- The running application (local dev or deployed preview).21- Node.js for running Lighthouse CLI.22- Access to build output for bundle analysis.23- Browser DevTools.2425## Steps26271. **Run Lighthouse**:28 ```bash29 npx lighthouse https://example.com --view --preset=desktop30 npx lighthouse https://example.com --view --preset=mobile31 ```32332. **Measure real user metrics**:34 - Add `web-vitals` library and log to console or analytics.35 - Or use Chrome DevTools Performance panel + Web Vitals extension.36373. **Bundle analysis**:38 - For webpack/Next.js: `next build` + `ANALYZE=true` or `webpack-bundle-analyzer`.39 - Identify large dependencies, duplicate code, unused exports.40414. **Network waterfall review**:42 - Record in DevTools Network tab (disable cache).43 - Look for: render-blocking resources, large unoptimized images, many small requests, no compression, long TTFB.44455. **Caching & headers audit**:46 - Check `Cache-Control`, `ETag`, `Last-Modified`.47 - Recommend immutable assets for hashed files, stale-while-revalidate for others.48496. **Image & media optimization**:50 - Use `next/image` or `<picture>` + modern formats (AVIF, WebP).51 - Proper `width`/`height` or aspect-ratio to prevent CLS.52 - Lazy loading.53547. **JavaScript & interactivity**:55 - Code splitting, dynamic imports.56 - Defer non-critical scripts.57 - Optimize event handlers and re-renders (React Profiler).58598. **Generate prioritized fix list**:60 - Format: Issue | Current metric | Target | Effort | Impact | How to fix (concrete steps).61629. **Output**:63 - Lighthouse report summary.64 - Bundle size breakdown.65 - Specific code patches for top 5-7 issues.66 - Monitoring recommendation (add web-vitals to analytics).6768## Examples6970Sample Lighthouse command output interpretation, a typical "top issues" report, and concrete fixes (e.g., "Replace this 1.2MB hero image with next/image + AVIF", "Add `loading="lazy"` to below-the-fold images", "Split this heavy modal into dynamic import") are provided.7172## Edge Cases & Error Handling7374- **Third-party scripts**: Identify and suggest async/defer or partytown.75- **Large vendor bundles**: Recommend tree-shaking, replacing heavy libs (e.g., moment → date-fns).76- **SPA vs MPA**: Different strategies for each.7778## Verification79801. Re-run Lighthouse after fixes — score improvement documented.812. Measure LCP, CLS, INP before/after with web-vitals.823. Bundle size reduced (compare `next build` output).834. Real user metrics improve in analytics.845. Success: Measurable, sustained improvement in user-perceived performance.8586## References8788- [Lighthouse](https://developer.chrome.com/docs/lighthouse/)89- [web-vitals](https://github.com/GoogleChrome/web-vitals)90- [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)91- [Next.js Performance](https://nextjs.org/docs/app/building-your-application/optimizing)92- [web.dev Performance](https://web.dev/performance/)