Web Performance Audit

作者 secondsky88378361314fMIT227 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫10 天前更新

Web performance audits with Core Web Vitals, bottleneck identification, optimization recommendations. Use for page load times, performance reviews, UX optimization, or encountering LCP, FID, CLS issues, resource blocking, render delays.

AI 產生的概覽

依據 Core Web Vitals、Lighthouse、最佳化策略與效能預算指導網頁效能稽核。

功能
提供一套稽核並改善網頁效能的結構化方法。它給出 LCP、FID、CLS、INP 的 Core Web Vitals 目標值,展示使用 web-vitals 函式庫與 Lighthouse 自動化的量測程式片段,並依投入程度列出最佳化策略。此外還提供效能預算範例和稽核清單,涵蓋基準量測、套件大小檢查、慢速網路測試與監控告警。
適用情境
適用於評估頁面載入時間、診斷 LCP、FID、CLS 或 INP 問題,或規劃效能最佳化工作時。也適合懷疑存在阻擋算繪資源或算繪延遲的效能審查與使用者體驗最佳化情境。
執行需求
不附帶指令碼,僅為說明性內容。涉及的工具有 web-vitals 函式庫、Lighthouse、chrome-launcher 以及無頭 Chrome 瀏覽器,並需要網路存取以稽核線上頁面。

Web Performance Audit

Conduct comprehensive performance audits and implement optimizations.

Core Web Vitals Targets

MetricGoodNeeds ImprovementPoor
LCP (Largest Contentful Paint)<2.5s2.5-4s>4s
FID (First Input Delay)<100ms100-300ms>300ms
CLS (Cumulative Layout Shift)<0.10.1-0.25>0.25
INP (Interaction to Next Paint)<200ms200-500ms>500ms

Performance Measurement

javascript
// Using web-vitals libraryimport { getCLS, getFID, getLCP, getTTFB } from 'web-vitals';
function sendToAnalytics({ name, value, id }) {  console.log({ name, value, id });}
getCLS(sendToAnalytics);getFID(sendToAnalytics);getLCP(sendToAnalytics);getTTFB(sendToAnalytics);

Lighthouse Automation

javascript
const lighthouse = require('lighthouse');const chromeLauncher = require('chrome-launcher');
async function runAudit(url) {  const chrome = await chromeLauncher.launch({ chromeFlags: ['--headless'] });  const result = await lighthouse(url, {    port: chrome.port,    onlyCategories: ['performance']  });
  await chrome.kill();  return result.lhr;}

Optimization Strategies

Quick Wins (1-2 days)

  • Enable gzip/brotli compression
  • Minify CSS/JS
  • Defer non-critical scripts
  • Optimize images (WebP, lazy loading)

Medium Effort (1-2 weeks)

  • Implement code splitting
  • Add service worker caching
  • Preload critical resources
  • Eliminate render-blocking resources

Long-term (1-3 months)

  • Architecture improvements
  • CDN optimization
  • Database query optimization

Performance Budget

json
{  "timings": [    { "metric": "first-contentful-paint", "budget": 1500 },    { "metric": "largest-contentful-paint", "budget": 2500 }  ],  "resourceSizes": [    { "resourceType": "script", "budget": 150 },    { "resourceType": "image", "budget": 300 }  ]}

Audit Checklist

  • Measure baseline Core Web Vitals
  • Run Lighthouse audit (mobile & desktop)
  • Analyze real user metrics (RUM)
  • Identify largest contentful element
  • Check for layout shifts
  • Review JavaScript bundle size
  • Test on slow 3G connection
  • Set performance budget
  • Configure monitoring alerts

來源與署名

來源:secondsky/claude-skills位於plugins/web-performance-audit/skills/web-performance-audit提交8837836

授權條款: MIT

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架