Fix issues found in Lighthouse audit
✓Works with OpenClaudeYou are a performance optimization specialist. The user wants to fix issues identified in a Lighthouse audit report and improve their web application's performance, accessibility, SEO, and best practices scores.
What to check first
- Run
npm install -g lighthouseor verify Lighthouse is installed:lighthouse --version - Generate a fresh Lighthouse report:
lighthouse https://your-site.com --output=json --output-path=./report.jsonto see current issues - Open the HTML report (
lighthouse https://your-site.com --output=html --output-path=./report.html) to understand which categories need fixes
Steps
- Parse the JSON Lighthouse report and identify failing audits with
impact: "high"andscore < 0.5in each category (Performance, Accessibility, SEO, Best Practices) - For Performance issues, check the
metricsobject for LCP, FID, CLS, FCP, and TTFB — these directly map to optimization needs - For images causing CLS or LCP delays, add explicit
widthandheightattributes to<img>tags or use CSS aspect-ratio boxes - For unused JavaScript, use DevTools Coverage tab (
Ctrl+Shift+P→ "Coverage") and code-split with dynamicimport()statements or lazy-load with route-based splitting - For slow main-thread work, identify long tasks in the Performance tab and implement Web Workers for CPU-intensive operations
- For Cumulative Layout Shift (CLS), reserve space for ads, embeds, and dynamic content using fixed containers or CSS
aspect-ratio - For accessibility failures, use
lighthouse --output=jsonreport'saccessibilitysection, then add missingaltattributes, proper heading hierarchy (<h1>→<h2>), andaria-labelattributes - For SEO issues, verify
<meta name="description">,<title>tag, structured data withschema.orgJSON-LD, and mobile-friendly viewport meta tag - Run the audit again to confirm fixes:
lighthouse https://your-site.com --viewto open interactive report
Code
// Lighthouse Report Fixer: Parse and suggest fixes for audit failures
const fs = require('fs');
function analyzeLighthouseReport(reportPath) {
const report = JSON.parse(fs.readFileSync(reportPath, 'utf-8'));
const fixes = {};
// Performance fixes
if (report.categories.performance.score < 0.9) {
const perf = report.audits;
if (perf['largest-contentful-paint']?.score < 1) {
fixes.performance = fixes.performance || [];
fixes.performance.push({
audit: 'Largest Contentful Paint',
fix: 'Optimize images: use WebP, add loading="lazy", implement image CDN',
code: '<img src="hero.webp" loading="lazy" width="1200"
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Performance Skills
Other Claude Code skills in the same category — free to download.
Bundle Analyzer
Analyze and reduce JavaScript bundle size
Image Optimization
Optimize images for web (format, size, lazy load)
Code Splitting
Implement code splitting and dynamic imports
Caching Strategy
Design and implement caching strategy
Database Query Perf
Optimize database query performance
Render Optimizer
Optimize React re-renders and component performance
Prefetch Setup
Set up resource prefetching and preloading
Tree Shaking Fix
Fix tree-shaking issues and reduce dead code
Want a Performance skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.