| name | lighthouse |
| description | Run Lighthouse audits on a website, analyze the results across all four categories (Performance, Accessibility, Best Practices, SEO), prioritize fixes by impact, implement them, and verify the scores improved. Use when asked to improve Lighthouse scores, optimize web performance, fix Core Web Vitals, or audit a site. |
| argument-hint | <URL or local dev server address> |
Lighthouse
You are auditing and optimizing a website for Lighthouse scores. Work through each phase in order. Do not skip phases.
Target: {{args}}
Phase 1: Setup & Baseline
If {{args}} is empty, ask for the target URL before running anything. If it's a local dev server, start it first.
Ensure Lighthouse is available: npx lighthouse --version 2>/dev/null
On Windows, run the multi-line bash commands and 2>/dev/null (here and in Phase 5) via the Bash tool / Git Bash. PowerShell does not support \ line continuation or 2>/dev/null - use a single line with backtick continuation and 2>$null instead.
Run the baseline audit:
npx lighthouse {{args}} --output=json --output-path=./lighthouse-baseline.json \
--chrome-flags="--headless --no-sandbox" \
--only-categories=performance,accessibility,best-practices,seo --quiet
Display scores (🔴 0–49, 🟡 50–89, 🟢 90–100) and Core Web Vitals:
LCP < 2.5s | INP < 200ms | CLS < 0.1 | FCP < 1.8s | TTFB < 800ms | TBT < 200ms
Phase 2: Spawn Analysis Subagents
Spawn 4 parallel subagents, each reading ./lighthouse-baseline.json:
| Subagent | Category | What to extract |
|---|
| 1 | Performance | Failed audits, opportunity savings (ms/KB), diagnostics sorted by impact |
| 2 | Accessibility | Failed audits, affected element counts, WCAG failure type |
| 3 | Best Practices | Failed audits, deprecation warnings, console errors, security issues |
| 4 | SEO | Failed audits, missing meta tags, crawlability issues, structured data problems |
Phase 3: Prioritize & Plan
Consolidate findings. Assign Impact (High/Medium/Low), Effort (Low/Medium/High), and Category (P/A/B/S) to each issue. Present a ranked table and ask: "Which issues should I fix? (all / just Performance / select numbers)" Do not implement anything until the user answers.
Phase 4: Implement Fixes
Work through selected fixes one at a time. For each fix:
- Read the relevant source files first
- Make the minimal surgical change
- Run the dev server and confirm no regressions
Performance fixes: see references/performance-fixes.md
Accessibility fixes: see references/accessibility-fixes.md
Best Practices & SEO fixes: see references/best-practices-seo-fixes.md
Phase 5: Re-audit & Compare
Re-run Lighthouse (same flags, --output-path=./lighthouse-after.json) and display a before/after table for all four categories plus Core Web Vitals.
If any score went down, investigate why and fix before reporting done.
Phase 6: Verify in Browser
If running locally: open in browser, run DevTools Lighthouse to confirm scores match CLI results, verify the golden path (navigation, forms, key interactions), and check for visual regressions.
Completion Checklist