> lighthouse-ci
Automate Lighthouse audits in CI with Lighthouse CI. Use when a user asks to track Core Web Vitals, prevent performance regressions, audit accessibility in CI, or set performance budgets for web apps.
curl "https://skillshub.wtf/TerminalSkills/skills/lighthouse-ci?format=md"Lighthouse CI
Overview
Lighthouse CI runs Google Lighthouse audits automatically on every PR. Set performance budgets, track Core Web Vitals over time, and prevent regressions. Catches performance issues before they reach production.
Instructions
Step 1: Configuration
// lighthouserc.js — Lighthouse CI config
module.exports = {
ci: {
collect: {
url: [
'http://localhost:3000/',
'http://localhost:3000/dashboard',
'http://localhost:3000/pricing',
],
startServerCommand: 'npm run start',
startServerReadyPattern: 'ready on',
numberOfRuns: 3, // average 3 runs for stability
settings: {
preset: 'desktop', // or 'mobile' (default)
},
},
assert: {
assertions: {
'categories:performance': ['error', { minScore: 0.9 }],
'categories:accessibility': ['error', { minScore: 0.95 }],
'categories:best-practices': ['warn', { minScore: 0.9 }],
'categories:seo': ['warn', { minScore: 0.9 }],
// Core Web Vitals
'first-contentful-paint': ['error', { maxNumericValue: 2000 }],
'largest-contentful-paint': ['error', { maxNumericValue: 2500 }],
'cumulative-layout-shift': ['error', { maxNumericValue: 0.1 }],
'total-blocking-time': ['error', { maxNumericValue: 300 }],
},
},
upload: {
target: 'temporary-public-storage', // free, reports available for 7 days
},
},
}
Step 2: GitHub Actions
# .github/workflows/lighthouse.yml — Lighthouse CI in GitHub Actions
name: Lighthouse CI
on: [pull_request]
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: pnpm }
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Run Lighthouse CI
uses: treosh/lighthouse-ci-action@v11
with:
configPath: './lighthouserc.js'
uploadArtifacts: true
temporaryPublicStorage: true
Step 3: Performance Budgets
// budget.json — Resource budgets
[
{
"path": "/*",
"resourceSizes": [
{ "resourceType": "script", "budget": 300 },
{ "resourceType": "total", "budget": 500 },
{ "resourceType": "image", "budget": 200 },
{ "resourceType": "stylesheet", "budget": 50 }
],
"resourceCounts": [
{ "resourceType": "third-party", "budget": 5 }
]
}
]
Guidelines
- Set
numberOfRuns: 3minimum — single runs have high variance. - Start with
warnassertions, switch toerroronce baselines are stable. - Test critical user paths (landing, dashboard, checkout), not every page.
- Performance budgets prevent "just one more script" — bundle size creep caught early.
- Use
temporary-public-storagefor free report hosting; self-host LHCI Server for history.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.