[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F03956M1JZZ1XDNKAV3PJW":3,"skill-same:01M7F03956M1JZZ1XDNKAV3PJW":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":42,"repositoryHtmlUrl":43,"repositoryHomepageUrl":6,"ownerHtmlUrl":44,"ownerBlogUrl":6,"ownerDescription":45,"updatedAt":46,"install":47,"resources":60},"01M7F03956M1JZZ1XDNKAV3PJW","frontend-lighthouse",null,"Add a portable Lighthouse CI gate for production frontend builds with Core Web Vitals budgets, category floors, median runs, and CI artifacts.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Ffrontend-lighthouse\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: frontend-lighthouse\ndescription: \"Add a portable Lighthouse CI gate for production frontend builds with Core Web Vitals budgets, category floors, median runs, and CI artifacts.\"\ncategory: frontend\nrisk: safe\nsource: community\nsource_repo: stareezy-1\u002Ffrontend-architecture-skill\nsource_type: community\ndate_added: \"2026-06-29\"\nauthor: stareezy-1\ntags: [frontend, lighthouse, performance, core-web-vitals, ci]\ntools: [lighthouse, node, github-actions]\nlicense: \"MIT\"\nlicense_source: \"https:\u002F\u002Fgithub.com\u002Fstareezy-1\u002Ffrontend-architecture-skill\u002Fblob\u002Fmain\u002FLICENSE\"\n---\n\n# Frontend Lighthouse (portable performance gate)\n\n> Portable skill — readable by Claude Code, OpenCode, Codex, Cursor, Windsurf, and others.\n> This skill describes a **CI performance gate** — a Lighthouse CI config plus a workflow — not a\n> component library or a visual style. It pairs with the **frontend-seo** and\n> **frontend-architecture** skills: SEO writes the metadata, Lighthouse proves it ships fast.\n\nThe goal: every pull request is **blocked unless the production build meets explicit Core Web\nVitals budgets and category score floors**. Budgets live in **one** `lighthouserc.cjs`, runs are\n**median-of-N** so the gate doesn't flake, and the same config runs locally and in CI.\n\n## When to Use This Skill\n\n- Use when adding a Lighthouse CI performance gate to a web app.\n- Use when setting Core Web Vitals budgets for LCP, CLS, and TBT as the lab proxy for INP.\n- Use when configuring category score floors for performance, SEO, accessibility, and best practices.\n- Use when debugging flaky Lighthouse runs or making reports visible as CI artifacts.\n\n---\n\n## 0. The five core ideas\n\n1. **One config, one source of truth.** All budgets and assertions live in a single `lighthouserc.cjs`. Named constants for each budget — no magic numbers buried in assertion objects.\n2. **Gate the production build, never dev.** Lighthouse runs against `build` + `start` (the real, optimized output). Dev-server numbers are meaningless for a budget.\n3. **Median-of-N kills flakiness.** Run 3+ times and assert on the median run, so per-run jitter (cold caches, CI noise) never red-flags a healthy build.\n4. **Budgets encode Google's \"good\" thresholds.** LCP ≤ 2500 ms, INP ≤ 200 ms (gated via the TBT lab proxy), CLS ≤ 0.1 — the values that earn green scores, not \"needs improvement\".\n5. **Blocking in CI, visible as artifacts.** A GitHub Action runs the gate on every PR touching the app and uploads the HTML\u002FJSON reports so failures are debuggable.\n\n---\n\n## 1. Files this skill adds\n\n```\napps\u002Fweb\u002F                          (or your app root)\n├── lighthouserc.cjs               ← the gate: budgets + assertions + collect settings\n├── package.json                   ← \"lhci\": \"lhci autorun --config=.\u002Flighthouserc.cjs\"\n└── .github\u002Fworkflows\u002Flighthouse.yml  ← PR-blocking CI job (build → start → lhci → upload)\n```\n\nPlus a dev dependency: `@lhci\u002Fcli`.\n\n```bash\npnpm add -D @lhci\u002Fcli        # or npm i -D \u002F yarn add -D\n```\n\n---\n\n## 2. The config (`lighthouserc.cjs`)\n\n`.cjs` (CommonJS) so it loads without ESM\u002FTS transpilation. Every budget is a **named constant**\nwith a comment explaining the threshold — never a bare number inside an assertion.\n\n```js\n\u002F**\n * Lighthouse CI configuration — Core Web Vitals budgets for the marketing surface.\n *\n * Enforces Google's mobile \"good\" CWV thresholds:\n *   - Largest Contentful Paint (LCP) ≤ 2500 ms\n *   - Cumulative Layout Shift (CLS)  ≤ 0.1\n *   - Interaction to Next Paint (INP) ≤ 200 ms\n *\n * INP is a *field* metric with no direct lab audit, so in the lab we gate on\n * Total Blocking Time (TBT) — Lighthouse's recommended lab proxy — at the same\n * budget, and assert the experimental INP audit directly as a warning where the\n * build exposes it.\n *\n * Collection runs against the *production* server (build + start) on Lighthouse's\n * default mobile (Moto G4 \u002F slow 4G) emulation.\n *\u002F\n\n\u002F** The fixed port the production server is started on for the audit. *\u002F\nconst PORT = 3100;\nconst BASE_URL = `http:\u002F\u002Flocalhost:${PORT}`;\n\n\u002F** Pages whose budgets are enforced in CI. *\u002F\nconst MARKETING_URLS = [`${BASE_URL}\u002F`];\n\n\u002F**\n * Core Web Vitals budgets on mobile — Google's \"good\" thresholds.\n * These are the values that earn the best Lighthouse scores.\n *\u002F\nconst LCP_BUDGET_MS = 2500; \u002F\u002F good\nconst INP_BUDGET_MS = 200; \u002F\u002F good (TBT lab proxy)\nconst CLS_BUDGET = 0.1; \u002F\u002F good\n\nmodule.exports = {\n  ci: {\n    collect: {\n      \u002F\u002F Build is run separately in CI; here we only serve the production output.\n      startServerCommand: `pnpm start --port ${PORT}`,\n      startServerReadyPattern: \"Ready in\", \u002F\u002F framework's \"server ready\" log line\n      startServerReadyTimeout: 120000,\n      url: MARKETING_URLS,\n      \u002F\u002F Median of multiple runs keeps the gate stable against per-run jitter.\n      numberOfRuns: 3,\n      settings: {\n        \u002F\u002F Default mobile emulation; opt into desktop via env for a second run.\n        preset:\n          process.env.LHCI_FORM_FACTOR === \"desktop\" ? \"desktop\" : undefined,\n        \u002F\u002F Only gate the categories we care about; skip PWA category noise.\n        onlyCategories: [\n          \"performance\",\n          \"seo\",\n          \"accessibility\",\n          \"best-practices\",\n        ],\n      },\n    },\n    assert: {\n      \u002F\u002F Median across runs is the value compared against each budget.\n      aggregationMethod: \"median-run\",\n      assertions: {\n        \u002F\u002F --- Core Web Vitals budgets (the contract) ---------------------\n        \"largest-contentful-paint\": [\n          \"error\",\n          { maxNumericValue: LCP_BUDGET_MS },\n        ],\n        \"cumulative-layout-shift\": [\"error\", { maxNumericValue: CLS_BUDGET }],\n        \"total-blocking-time\": [\"error\", { maxNumericValue: INP_BUDGET_MS }],\n        \u002F\u002F Direct INP audit where the Lighthouse build exposes it (else ignored).\n        \"interaction-to-next-paint\": [\n          \"warn\",\n          { maxNumericValue: INP_BUDGET_MS },\n        ],\n\n        \u002F\u002F --- Category floors (target top Lighthouse scores) -------------\n        \"categories:performance\": [\"error\", { minScore: 0.9 }],\n        \"categories:seo\": [\"error\", { minScore: 0.95 }],\n        \"categories:accessibility\": [\"error\", { minScore: 0.95 }],\n        \"categories:best-practices\": [\"error\", { minScore: 0.9 }],\n      },\n    },\n    upload: {\n      \u002F\u002F Keep reports in the CI run's filesystem; no external LHCI server.\n      target: \"filesystem\",\n      outputDir: \".\u002F.lighthouseci\",\n    },\n  },\n};\n```\n\n**Hard rules:**\n\n- Every budget is a named constant with a unit in its name (`LCP_BUDGET_MS`) and a comment.\n- `aggregationMethod: \"median-run\"` is non-negotiable — single-run gates flake constantly.\n- `numberOfRuns` ≥ 3 (odd numbers give a clean median).\n- Assert on TBT for INP in the lab; treat the experimental `interaction-to-next-paint` audit as a `warn`, not an `error` (it isn't present in every Lighthouse build).\n- Keep `onlyCategories` to exactly what you gate — fewer audits, faster, less noise.\n\n---\n\n## 3. Choosing budget severity and thresholds\n\n| Audit \u002F category            | Severity | Threshold | Why                                                   |\n| --------------------------- | -------- | --------- | ----------------------------------------------------- |\n| `largest-contentful-paint`  | `error`  | ≤ 2500 ms | Google \"good\" LCP                                     |\n| `cumulative-layout-shift`   | `error`  | ≤ 0.1     | Google \"good\" CLS                                     |\n| `total-blocking-time`       | `error`  | ≤ 200 ms  | INP lab proxy                                         |\n| `interaction-to-next-paint` | `warn`   | ≤ 200 ms  | not in all builds; don't hard-fail on a missing audit |\n| `categories:performance`    | `error`  | ≥ 0.9     | top (green) band                                      |\n| `categories:seo`            | `error`  | ≥ 0.95    | SEO is cheap to keep perfect                          |\n| `categories:accessibility`  | `error`  | ≥ 0.95    | a11y regressions must block                           |\n| `categories:best-practices` | `error`  | ≥ 0.9     | green band                                            |\n\nUse `error` for contracts that must hold and `warn` for audits that are environment-dependent or\naspirational. **Start strict and only loosen with a recorded reason** — a budget you keep raising\nto make CI pass is a budget that no longer protects anything.\n\n---\n\n## 4. The npm script\n\n```jsonc\n\u002F\u002F package.json\n{\n  \"scripts\": {\n    \"lhci\": \"lhci autorun --config=.\u002Flighthouserc.cjs\"\n  }\n}\n```\n\n`lhci autorun` runs `collect` → `assert` → `upload` in sequence. Run it locally before pushing to\nreproduce exactly what CI does:\n\n```bash\npnpm build && pnpm lhci\n# desktop form factor:\nLHCI_FORM_FACTOR=desktop pnpm build && LHCI_FORM_FACTOR=desktop pnpm lhci\n```\n\n---\n\n## 5. The GitHub Actions workflow\n\nRuns on PRs that touch the app or the workflow itself. Builds the production output, runs the\ngate, and **always** uploads the reports (even on failure) so a red check is debuggable.\n\n```yaml\nname: Lighthouse CWV\n\non:\n  pull_request:\n    branches: [main]\n    paths:\n      - \"apps\u002Fweb\u002F**\"\n      - \".github\u002Fworkflows\u002Flighthouse.yml\"\n\npermissions:\n  contents: read\n\njobs:\n  lighthouse:\n    name: Lighthouse CWV (marketing pages)\n    runs-on: ubuntu-latest\n    defaults:\n      run:\n        working-directory: apps\u002Fweb\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Setup pnpm\n        uses: pnpm\u002Faction-setup@v4 # version comes from root package.json packageManager\n\n      - name: Setup Node\n        uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 22\n          cache: pnpm\n\n      - name: Install dependencies\n        working-directory: .\n        run: pnpm install --frozen-lockfile\n\n      - name: Build web app\n        run: pnpm build\n\n      # build + start the production server, run Lighthouse on mobile emulation,\n      # fail the job if any budget in lighthouserc.cjs is exceeded.\n      - name: Run Lighthouse CI\n        run: pnpm lhci\n\n      - name: Upload Lighthouse reports\n        if: always()\n        uses: actions\u002Fupload-artifact@v4\n        with:\n          name: lighthouse-reports\n          path: apps\u002Fweb\u002F.lighthouseci\n          if-no-files-found: ignore\n```\n\n**Hard rules:**\n\n- Trigger on the app path **and** the workflow file so config changes are self-testing.\n- `if: always()` on the upload step — you need the report most when the gate fails.\n- Gate on the **production** build (`pnpm build` then the `start` server in `collect`).\n- Match the CI Node\u002Fpnpm versions to the repo's pinned versions to avoid lockfile drift.\n\n---\n\n## 6. Framework adapters\n\nThe config is framework-neutral except `startServerCommand` and `startServerReadyPattern`.\n\n| Framework     | `startServerCommand`                                              | `startServerReadyPattern`                   |\n| ------------- | ----------------------------------------------------------------- | ------------------------------------------- |\n| **Next.js**   | `pnpm start --port 3100` (after `next build`)                     | `\"Ready in\"`                                |\n| **Remix**     | `pnpm start` (serve the built app)                                | server's listening log line                 |\n| **Astro**     | `node .\u002Fdist\u002Fserver\u002Fentry.mjs` (SSR) or `npx serve dist` (static) | the adapter's ready line \u002F serve's URL line |\n| **SvelteKit** | `node build` (node adapter)                                       | `\"Listening on\"`                            |\n| **Vite SPA**  | `npx vite preview --port 3100`                                    | `\"Local:\"`                                  |\n\nFor purely static output you can skip the server and point `collect.staticDistDir` at the build\nfolder instead of `startServerCommand` — Lighthouse serves it internally.\n\n---\n\n## 7. Debugging failing or flaky runs\n\n- **Flaky LCP\u002FTBT** → raise `numberOfRuns` (5), confirm `median-run`, and make sure nothing else is competing for CPU on the runner.\n- **`interaction-to-next-paint` errors** → it should be `warn`, not `error`; the audit is missing in some Lighthouse versions.\n- **\"server not ready\" timeout** → fix `startServerReadyPattern` to match the framework's actual ready log, and raise `startServerReadyTimeout`.\n- **Real regressions** → open the uploaded report artifact, read the failed audit's \"Opportunities\"\u002F\"Diagnostics\", fix the cause (oversized image, render-blocking JS, layout shift from unsized media) — don't just bump the budget.\n- **Desktop vs mobile divergence** → run both form factors; mobile is the stricter gate and should be the default.\n\n---\n\n## 8. Conventions checklist (enforce in review)\n\n- [ ] All budgets are named constants with units and comments — no magic numbers in assertions.\n- [ ] Gate runs against the **production** build, never the dev server.\n- [ ] `aggregationMethod: \"median-run\"` with `numberOfRuns` ≥ 3.\n- [ ] CWV budgets at Google \"good\" thresholds (LCP ≤ 2500, TBT ≤ 200, CLS ≤ 0.1).\n- [ ] INP gated via TBT (`error`); experimental INP audit is `warn`.\n- [ ] Category floors set as `error` (perf ≥ 0.9, SEO\u002Fa11y ≥ 0.95, best-practices ≥ 0.9).\n- [ ] `onlyCategories` lists exactly the gated categories.\n- [ ] CI triggers on the app path **and** the workflow file; reports upload with `if: always()`.\n- [ ] Local `pnpm lhci` reproduces the CI run.\n- [ ] Budgets are tightened over time, loosened only with a recorded reason.\n\n---\n\n## 9. How to apply this skill\n\n**Adding the gate to a project:** install `@lhci\u002Fcli`, drop in `lighthouserc.cjs` with your URLs\nand `startServerCommand`, add the `lhci` script, and add the workflow. Run `pnpm build && pnpm lhci`\nlocally to confirm it passes before opening a PR.\n\n**Adding a page to the gate:** append its URL to `MARKETING_URLS` (or a second URL array). Each URL\nis audited independently against the same budgets.\n\n**Tuning budgets:** change the named constant, not the assertion. Record why in the comment. Prefer\nfixing the regression over raising the budget.\n\n**Reviewing performance:** run the checklist in §8. The highest-value catches are a gate that runs\nagainst the dev server (meaningless numbers) and single-run assertions (chronic flakiness).\n\n---\n\n## Publishing \u002F installing this skill\n\nThis skill follows the Anthropic `SKILL.md` format and is portable across agents.\n\n1. Keep it under `skills\u002Ffrontend-lighthouse\u002FSKILL.md` in a public GitHub repo.\n2. Keep the frontmatter `name` and high-signal `description` — discovery indexes match against it.\n3. Install with: `npx skills add \u003Corg>\u002F\u003Crepo> --skill \"frontend-lighthouse\"`.\n4. Non-`SKILL.md` agents can be pointed here from `AGENTS.md` \u002F `CLAUDE.md`; Kiro can mirror it as a steering file.\n\n## Limitations\n\n- Lighthouse CI is a lab signal and does not replace field monitoring from real-user metrics.\n- Budgets must be tuned to the actual app route, hosting platform, and device\u002Fnetwork assumptions.\n- A passing Lighthouse gate does not prove business-critical flows, visual correctness, or backend availability.\n","# Frontend Lighthouse (portable performance gate)\n\n> Portable skill — readable by Claude Code, OpenCode, Codex, Cursor, Windsurf, and others.\n> This skill describes a **CI performance gate** — a Lighthouse CI config plus a workflow — not a\n> component library or a visual style. It pairs with the **frontend-seo** and\n> **frontend-architecture** skills: SEO writes the metadata, Lighthouse proves it ships fast.\n\nThe goal: every pull request is **blocked unless the production build meets explicit Core Web\nVitals budgets and category score floors**. Budgets live in **one** `lighthouserc.cjs`, runs are\n**median-of-N** so the gate doesn't flake, and the same config runs locally and in CI.\n\n## When to Use This Skill\n\n- Use when adding a Lighthouse CI performance gate to a web app.\n- Use when setting Core Web Vitals budgets for LCP, CLS, and TBT as the lab proxy for INP.\n- Use when configuring category score floors for performance, SEO, accessibility, and best practices.\n- Use when debugging flaky Lighthouse runs or making reports visible as CI artifacts.\n\n---\n\n## 0. The five core ideas\n\n1. **One config, one source of truth.** All budgets and assertions live in a single `lighthouserc.cjs`. Named constants for each budget — no magic numbers buried in assertion objects.\n2. **Gate the production build, never dev.** Lighthouse runs against `build` + `start` (the real, optimized output). Dev-server numbers are meaningless for a budget.\n3. **Median-of-N kills flakiness.** Run 3+ times and assert on the median run, so per-run jitter (cold caches, CI noise) never red-flags a healthy build.\n4. **Budgets encode Google's \"good\" thresholds.** LCP ≤ 2500 ms, INP ≤ 200 ms (gated via the TBT lab proxy), CLS ≤ 0.1 — the values that earn green scores, not \"needs improvement\".\n5. **Blocking in CI, visible as artifacts.** A GitHub Action runs the gate on every PR touching the app and uploads the HTML\u002FJSON reports so failures are debuggable.\n\n---\n\n## 1. Files this skill adds\n\n```\napps\u002Fweb\u002F                          (or your app root)\n├── lighthouserc.cjs               ← the gate: budgets + assertions + collect settings\n├── package.json                   ← \"lhci\": \"lhci autorun --config=.\u002Flighthouserc.cjs\"\n└── .github\u002Fworkflows\u002Flighthouse.yml  ← PR-blocking CI job (build → start → lhci → upload)\n```\n\nPlus a dev dependency: `@lhci\u002Fcli`.\n\n```bash\npnpm add -D @lhci\u002Fcli        # or npm i -D \u002F yarn add -D\n```\n\n---\n\n## 2. The config (`lighthouserc.cjs`)\n\n`.cjs` (CommonJS) so it loads without ESM\u002FTS transpilation. Every budget is a **named constant**\nwith a comment explaining the threshold — never a bare number inside an assertion.\n\n```js\n\u002F**\n * Lighthouse CI configuration — Core Web Vitals budgets for the marketing surface.\n *\n * Enforces Google's mobile \"good\" CWV thresholds:\n *   - Largest Contentful Paint (LCP) ≤ 2500 ms\n *   - Cumulative Layout Shift (CLS)  ≤ 0.1\n *   - Interaction to Next Paint (INP) ≤ 200 ms\n *\n * INP is a *field* metric with no direct lab audit, so in the lab we gate on\n * Total Blocking Time (TBT) — Lighthouse's recommended lab proxy — at the same\n * budget, and assert the experimental INP audit directly as a warning where the\n * build exposes it.\n *\n * Collection runs against the *production* server (build + start) on Lighthouse's\n * default mobile (Moto G4 \u002F slow 4G) emulation.\n *\u002F\n\n\u002F** The fixed port the production server is started on for the audit. *\u002F\nconst PORT = 3100;\nconst BASE_URL = `http:\u002F\u002Flocalhost:${PORT}`;\n\n\u002F** Pages whose budgets are enforced in CI. *\u002F\nconst MARKETING_URLS = [`${BASE_URL}\u002F`];\n\n\u002F**\n * Core Web Vitals budgets on mobile — Google's \"good\" thresholds.\n * These are the values that earn the best Lighthouse scores.\n *\u002F\nconst LCP_BUDGET_MS = 2500; \u002F\u002F good\nconst INP_BUDGET_MS = 200; \u002F\u002F good (TBT lab proxy)\nconst CLS_BUDGET = 0.1; \u002F\u002F good\n\nmodule.exports = {\n  ci: {\n    collect: {\n      \u002F\u002F Build is run separately in CI; here we only serve the production output.\n      startServerCommand: `pnpm start --port ${PORT}`,\n      startServerReadyPattern: \"Ready in\", \u002F\u002F framework's \"server ready\" log line\n      startServerReadyTimeout: 120000,\n      url: MARKETING_URLS,\n      \u002F\u002F Median of multiple runs keeps the gate stable against per-run jitter.\n      numberOfRuns: 3,\n      settings: {\n        \u002F\u002F Default mobile emulation; opt into desktop via env for a second run.\n        preset:\n          process.env.LHCI_FORM_FACTOR === \"desktop\" ? \"desktop\" : undefined,\n        \u002F\u002F Only gate the categories we care about; skip PWA category noise.\n        onlyCategories: [\n          \"performance\",\n          \"seo\",\n          \"accessibility\",\n          \"best-practices\",\n        ],\n      },\n    },\n    assert: {\n      \u002F\u002F Median across runs is the value compared against each budget.\n      aggregationMethod: \"median-run\",\n      assertions: {\n        \u002F\u002F --- Core Web Vitals budgets (the contract) ---------------------\n        \"largest-contentful-paint\": [\n          \"error\",\n          { maxNumericValue: LCP_BUDGET_MS },\n        ],\n        \"cumulative-layout-shift\": [\"error\", { maxNumericValue: CLS_BUDGET }],\n        \"total-blocking-time\": [\"error\", { maxNumericValue: INP_BUDGET_MS }],\n        \u002F\u002F Direct INP audit where the Lighthouse build exposes it (else ignored).\n        \"interaction-to-next-paint\": [\n          \"warn\",\n          { maxNumericValue: INP_BUDGET_MS },\n        ],\n\n        \u002F\u002F --- Category floors (target top Lighthouse scores) -------------\n        \"categories:performance\": [\"error\", { minScore: 0.9 }],\n        \"categories:seo\": [\"error\", { minScore: 0.95 }],\n        \"categories:accessibility\": [\"error\", { minScore: 0.95 }],\n        \"categories:best-practices\": [\"error\", { minScore: 0.9 }],\n      },\n    },\n    upload: {\n      \u002F\u002F Keep reports in the CI run's filesystem; no external LHCI server.\n      target: \"filesystem\",\n      outputDir: \".\u002F.lighthouseci\",\n    },\n  },\n};\n```\n\n**Hard rules:**\n\n- Every budget is a named constant with a unit in its name (`LCP_BUDGET_MS`) and a comment.\n- `aggregationMethod: \"median-run\"` is non-negotiable — single-run gates flake constantly.\n- `numberOfRuns` ≥ 3 (odd numbers give a clean median).\n- Assert on TBT for INP in the lab; treat the experimental `interaction-to-next-paint` audit as a `warn`, not an `error` (it isn't present in every Lighthouse build).\n- Keep `onlyCategories` to exactly what you gate — fewer audits, faster, less noise.\n\n---\n\n## 3. Choosing budget severity and thresholds\n\n| Audit \u002F category            | Severity | Threshold | Why                                                   |\n| --------------------------- | -------- | --------- | ----------------------------------------------------- |\n| `largest-contentful-paint`  | `error`  | ≤ 2500 ms | Google \"good\" LCP                                     |\n| `cumulative-layout-shift`   | `error`  | ≤ 0.1     | Google \"good\" CLS                                     |\n| `total-blocking-time`       | `error`  | ≤ 200 ms  | INP lab proxy                                         |\n| `interaction-to-next-paint` | `warn`   | ≤ 200 ms  | not in all builds; don't hard-fail on a missing audit |\n| `categories:performance`    | `error`  | ≥ 0.9     | top (green) band                                      |\n| `categories:seo`            | `error`  | ≥ 0.95    | SEO is cheap to keep perfect                          |\n| `categories:accessibility`  | `error`  | ≥ 0.95    | a11y regressions must block                           |\n| `categories:best-practices` | `error`  | ≥ 0.9     | green band                                            |\n\nUse `error` for contracts that must hold and `warn` for audits that are environment-dependent or\naspirational. **Start strict and only loosen with a recorded reason** — a budget you keep raising\nto make CI pass is a budget that no longer protects anything.\n\n---\n\n## 4. The npm script\n\n```jsonc\n\u002F\u002F package.json\n{\n  \"scripts\": {\n    \"lhci\": \"lhci autorun --config=.\u002Flighthouserc.cjs\"\n  }\n}\n```\n\n`lhci autorun` runs `collect` → `assert` → `upload` in sequence. Run it locally before pushing to\nreproduce exactly what CI does:\n\n```bash\npnpm build && pnpm lhci\n# desktop form factor:\nLHCI_FORM_FACTOR=desktop pnpm build && LHCI_FORM_FACTOR=desktop pnpm lhci\n```\n\n---\n\n## 5. The GitHub Actions workflow\n\nRuns on PRs that touch the app or the workflow itself. Builds the production output, runs the\ngate, and **always** uploads the reports (even on failure) so a red check is debuggable.\n\n```yaml\nname: Lighthouse CWV\n\non:\n  pull_request:\n    branches: [main]\n    paths:\n      - \"apps\u002Fweb\u002F**\"\n      - \".github\u002Fworkflows\u002Flighthouse.yml\"\n\npermissions:\n  contents: read\n\njobs:\n  lighthouse:\n    name: Lighthouse CWV (marketing pages)\n    runs-on: ubuntu-latest\n    defaults:\n      run:\n        working-directory: apps\u002Fweb\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Setup pnpm\n        uses: pnpm\u002Faction-setup@v4 # version comes from root package.json packageManager\n\n      - name: Setup Node\n        uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 22\n          cache: pnpm\n\n      - name: Install dependencies\n        working-directory: .\n        run: pnpm install --frozen-lockfile\n\n      - name: Build web app\n        run: pnpm build\n\n      # build + start the production server, run Lighthouse on mobile emulation,\n      # fail the job if any budget in lighthouserc.cjs is exceeded.\n      - name: Run Lighthouse CI\n        run: pnpm lhci\n\n      - name: Upload Lighthouse reports\n        if: always()\n        uses: actions\u002Fupload-artifact@v4\n        with:\n          name: lighthouse-reports\n          path: apps\u002Fweb\u002F.lighthouseci\n          if-no-files-found: ignore\n```\n\n**Hard rules:**\n\n- Trigger on the app path **and** the workflow file so config changes are self-testing.\n- `if: always()` on the upload step — you need the report most when the gate fails.\n- Gate on the **production** build (`pnpm build` then the `start` server in `collect`).\n- Match the CI Node\u002Fpnpm versions to the repo's pinned versions to avoid lockfile drift.\n\n---\n\n## 6. Framework adapters\n\nThe config is framework-neutral except `startServerCommand` and `startServerReadyPattern`.\n\n| Framework     | `startServerCommand`                                              | `startServerReadyPattern`                   |\n| ------------- | ----------------------------------------------------------------- | ------------------------------------------- |\n| **Next.js**   | `pnpm start --port 3100` (after `next build`)                     | `\"Ready in\"`                                |\n| **Remix**     | `pnpm start` (serve the built app)                                | server's listening log line                 |\n| **Astro**     | `node .\u002Fdist\u002Fserver\u002Fentry.mjs` (SSR) or `npx serve dist` (static) | the adapter's ready line \u002F serve's URL line |\n| **SvelteKit** | `node build` (node adapter)                                       | `\"Listening on\"`                            |\n| **Vite SPA**  | `npx vite preview --port 3100`                                    | `\"Local:\"`                                  |\n\nFor purely static output you can skip the server and point `collect.staticDistDir` at the build\nfolder instead of `startServerCommand` — Lighthouse serves it internally.\n\n---\n\n## 7. Debugging failing or flaky runs\n\n- **Flaky LCP\u002FTBT** → raise `numberOfRuns` (5), confirm `median-run`, and make sure nothing else is competing for CPU on the runner.\n- **`interaction-to-next-paint` errors** → it should be `warn`, not `error`; the audit is missing in some Lighthouse versions.\n- **\"server not ready\" timeout** → fix `startServerReadyPattern` to match the framework's actual ready log, and raise `startServerReadyTimeout`.\n- **Real regressions** → open the uploaded report artifact, read the failed audit's \"Opportunities\"\u002F\"Diagnostics\", fix the cause (oversized image, render-blocking JS, layout shift from unsized media) — don't just bump the budget.\n- **Desktop vs mobile divergence** → run both form factors; mobile is the stricter gate and should be the default.\n\n---\n\n## 8. Conventions checklist (enforce in review)\n\n- [ ] All budgets are named constants with units and comments — no magic numbers in assertions.\n- [ ] Gate runs against the **production** build, never the dev server.\n- [ ] `aggregationMethod: \"median-run\"` with `numberOfRuns` ≥ 3.\n- [ ] CWV budgets at Google \"good\" thresholds (LCP ≤ 2500, TBT ≤ 200, CLS ≤ 0.1).\n- [ ] INP gated via TBT (`error`); experimental INP audit is `warn`.\n- [ ] Category floors set as `error` (perf ≥ 0.9, SEO\u002Fa11y ≥ 0.95, best-practices ≥ 0.9).\n- [ ] `onlyCategories` lists exactly the gated categories.\n- [ ] CI triggers on the app path **and** the workflow file; reports upload with `if: always()`.\n- [ ] Local `pnpm lhci` reproduces the CI run.\n- [ ] Budgets are tightened over time, loosened only with a recorded reason.\n\n---\n\n## 9. How to apply this skill\n\n**Adding the gate to a project:** install `@lhci\u002Fcli`, drop in `lighthouserc.cjs` with your URLs\nand `startServerCommand`, add the `lhci` script, and add the workflow. Run `pnpm build && pnpm lhci`\nlocally to confirm it passes before opening a PR.\n\n**Adding a page to the gate:** append its URL to `MARKETING_URLS` (or a second URL array). Each URL\nis audited independently against the same budgets.\n\n**Tuning budgets:** change the named constant, not the assertion. Record why in the comment. Prefer\nfixing the regression over raising the budget.\n\n**Reviewing performance:** run the checklist in §8. The highest-value catches are a gate that runs\nagainst the dev server (meaningless numbers) and single-run assertions (chronic flakiness).\n\n---\n\n## Publishing \u002F installing this skill\n\nThis skill follows the Anthropic `SKILL.md` format and is portable across agents.\n\n1. Keep it under `skills\u002Ffrontend-lighthouse\u002FSKILL.md` in a public GitHub repo.\n2. Keep the frontmatter `name` and high-signal `description` — discovery indexes match against it.\n3. Install with: `npx skills add \u003Corg>\u002F\u003Crepo> --skill \"frontend-lighthouse\"`.\n4. Non-`SKILL.md` agents can be pointed here from `AGENTS.md` \u002F `CLAUDE.md`; Kiro can mirror it as a steering file.\n\n## Limitations\n\n- Lighthouse CI is a lab signal and does not replace field monitoring from real-user metrics.\n- Budgets must be tuned to the actual app route, hosting platform, and device\u002Fnetwork assumptions.\n- A passing Lighthouse gate does not prove business-critical flows, visual correctness, or backend availability.\n",{"name":5,"risk":24,"tags":25,"tools":31,"author":34,"source":35,"license":15,"category":26,"date_added":36,"description":7,"source_repo":37,"source_type":35,"license_source":38},"safe",[26,27,28,29,30],"frontend","lighthouse","performance","core-web-vitals","ci",[27,32,33],"node","github-actions","stareezy-1","community","2026-06-29","stareezy-1\u002Ffrontend-architecture-skill","https:\u002F\u002Fgithub.com\u002Fstareezy-1\u002Ffrontend-architecture-skill\u002Fblob\u002Fmain\u002FLICENSE","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","05-技能与代理开发\u002Ffrontend-lighthouse",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill frontend-lighthouse",{"tool":53,"command":54},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill frontend-lighthouse",{"tool":56,"command":57},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill frontend-lighthouse","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Ffrontend-lighthouse\u002FSKILL.md",true,[],[62,69,74,81,88,95],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],{"skillNo":70,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]