---
name: "lighthouse-ci-budget-performance-gate"
description: "Automate Core Web Vitals audits and prevent performance regressions in pull requests."
metadata:
  author: "Google Chrome"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure lighthouserc.json"
  - "enforce performance budget lhci"
  - "core web vitals ci gate"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Lighthouse CI Performance Budget Gates in PRs

Configures Lighthouse CI (@lhci/cli): authoring lighthouserc.json, setting performance budgets (LCP < 2.5s, CLS < 0.1, FID < 100ms), asserting scores (min 0.90), and failing CI pull requests on budget violations.

## When to Invoke
Invoke this skill whenever you need to:
- configure lighthouserc.json
- enforce performance budget lhci
- core web vitals ci gate

## Execution SOP & Rules
1. Create lighthouserc.json with collect: { numberOfRuns: 3, url: ['http://localhost:3000'] }.
2. Define assertions: assert: { assertions: { 'categories:performance': ['error', { minScore: 0.9 }], 'largest-contentful-paint': ['error', { maxNumericValue: 2500 }] } }.
3. Run in CI step: npx @lhci/cli autorun.
4. Catch layout shifts, uncompressed images, and unused JavaScript before releasing to production.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
