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.05compatibility: Claude Code, Codex, Gemini CLI6metadata:7 author: ai-skills8 version: "1.0"9 category: web-development10 tags: performance, lighthouse, web-vitals, bundle-analysis, optimization11---1213## Overview1415Performs 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.1617## When to Use This Skill1819- A page or app feels slow.20- Lighthouse score is low (<90 in Performance).21- User complains about load time, interactivity, or layout shift.22- Preparing for a performance budget or before a major launch.2324## Prerequisites2526- The running application (local dev or deployed preview).27- Node.js for running Lighthouse CLI.28- Access to build output for bundle analysis.29- Browser DevTools.3031## Steps32331. **Run Lighthouse**:34 ```bash35 npx lighthouse https://example.com --view --preset=desktop36 npx lighthouse https://example.com --view --preset=mobile37 ```38392. **Measure real user metrics**:40 - Add `web-vitals` library and log to console or analytics.41 - Or use Chrome DevTools Performance panel + Web Vitals extension.42433. **Bundle analysis**:44 - For webpack/Next.js: `next build` + `ANALYZE=true` or `webpack-bundle-analyzer`.45 - Identify large dependencies, duplicate code, unused exports.46474. **Network waterfall review**:48 - Record in DevTools Network tab (disable cache).49 - Look for: render-blocking resources, large unoptimized images, many small requests, no compression, long TTFB.50515. **Caching & headers audit**:52 - Check `Cache-Control`, `ETag`, `Last-Modified`.53 - Recommend immutable assets for hashed files, stale-while-revalidate for others.54556. **Image & media optimization**:56 - Use `next/image` or `<picture>` + modern formats (AVIF, WebP).57 - Proper `width`/`height` or aspect-ratio to prevent CLS.58 - Lazy loading.59607. **JavaScript & interactivity**:61 - Code splitting, dynamic imports.62 - Defer non-critical scripts.63 - Optimize event handlers and re-renders (React Profiler).64658. **Generate prioritized fix list**:66 - Format: Issue | Current metric | Target | Effort | Impact | How to fix (concrete steps).67689. **Output**:69 - Lighthouse report summary.70 - Bundle size breakdown.71 - Specific code patches for top 5-7 issues.72 - Monitoring recommendation (add web-vitals to analytics).7374## Examples7576Sample 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.7778## Edge Cases & Error Handling7980- **Third-party scripts**: Identify and suggest async/defer or partytown.81- **Large vendor bundles**: Recommend tree-shaking, replacing heavy libs (e.g., moment → date-fns).82- **SPA vs MPA**: Different strategies for each.8384## Verification85861. Re-run Lighthouse after fixes — score improvement documented.872. Measure LCP, CLS, INP before/after with web-vitals.883. Bundle size reduced (compare `next build` output).894. Real user metrics improve in analytics.905. Success: Measurable, sustained improvement in user-perceived performance.9192## References9394- [Lighthouse](https://developer.chrome.com/docs/lighthouse/)95- [web-vitals](https://github.com/GoogleChrome/web-vitals)96- [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)97- [Next.js Performance](https://nextjs.org/docs/app/building-your-application/optimizing)98- [web.dev Performance](https://web.dev/performance/)