agentleFS
freemafreema/ai-skills/skills/lighthouse/SKILL.md

lighthouse

Skill5 starsChanged 19 days agoMITView on GitHub

Run local Lighthouse perf audits on PixelDen dev server (localhost:3002). Use when the user asks about Lighthouse, LCP, FCP, CLS, INP, Core Web Vitals, performance score, perf regression, or wants to verify a perf fix locally before release. Triggers: 'lighthouse', 'LCP', 'CWV', 'perf test', 'pustit lighthouse', 'otestovat perf'.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If LCP > 2.5s on mobile, identify the LCP element via largest-contentful-paint-element audit.

    line 103

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Lighthouse Local Perf Testing

Locally audit Core Web Vitals and Lighthouse scores against the dev server before every release / perf-related PR.

Quick run

task lighthouse           # mobile, simulated throttling (most relevant for LCP/SEO)
task lighthouse:desktop   # desktop preset (best-case numbers)

Reports land in .lighthouse/ (gitignored):

  • .lighthouse/mobile.report.html + mobile.report.json
  • .lighthouse/desktop.report.html + desktop.report.json

Pre-flight checklist

  1. Dev server must be up: task dev (Docker, listens on localhost:3002 per memory).
  2. Chrome on host: Lighthouse runs headlessly via npx --yes lighthouse against the host's Chrome — not in container. macOS users typically have it.
  3. First run downloads ~70MB of lighthouse bin into ~/.npm/_npx. Subsequent runs are fast.

Reading results — extract metrics from JSON

The HTML report is for humans. For Claude, parse the embedded JSON to surface key numbers concisely:

# mobile (clean JSON file)
node -e '
const r = JSON.parse(require("fs").readFileSync(".lighthouse/mobile.report.json", "utf8"));
const a = r.audits, c = r.categories;
console.log("=== Scores ==="); for (const [k,v] of Object.entries(c)) console.log(k.padEnd(15), Math.round((v.score??0)*100));
const fmt = (k,t=v=>v.toFixed(0)+" ms") => a[k]?.numericValue!==undefined ? t(a[k].numericValue) : "n/a";
console.log("\n=== Core Web Vitals ===");
console.log("LCP        ", fmt("largest-contentful-paint"));
console.log("FCP        ", fmt("first-contentful-paint"));
console.log("CLS        ", fmt("cumulative-layout-shift", v=>v.toFixed(3)));
console.log("TBT        ", fmt("total-blocking-time"));
console.log("Speed Index", fmt("speed-index"));
console.log("TTFB       ", fmt("server-response-time"));
'

Dev vs prod expectations

The dev server runs Vite dev mode — un-minified ESM, large node_modules/.vite/deps/*.js shipments (lucide-react ~1MB, sentry ~1MB, react-dom ~1MB). So:

Dev (localhost)Prod (after deploy)
Performance (mobile)80–8890+
LCP (mobile)3–4s1.5–2s
TTFB300–500ms<100ms
Network total3–5MB500KB–1MB

Rule of thumb: prod LCP ≈ dev LCP × 0.5. If dev LCP is good (< 4s) and there's no obvious render-blocking, prod will pass CWV.

When dev numbers aren't enough

For tighter prod-like measurement, run against a local prod build:

task build
docker compose exec app pnpm start &   # or run on host via PORT=3002 pnpm start
task lighthouse

For real-world prod numbers post-deploy, use the metrifyr MCP (mcp__metrifyr__psi_analyze) — it hits the public URL with field/lab data and CrUX.

What to flag in a Lighthouse report

signalwhat it meanslook for
LCP > 2.5shero/above-fold image slow or render-blockedlcp-lazy-loaded, largest-contentful-paint-element, prioritize-lcp-image
CLS > 0.1layout shiftinglayout-shifts, missing width/height on <img>
TBT > 200msJS work blocking inputbootup-time, mainthread-work-breakdown, unused-javascript
FCP > 2sfirst paint slowrender-blocking-resources, font loading
SEO < 100meta/markup issuesmeta-description, crawlable-anchors, hreflang

Common PixelDen pitfalls (already known)

  • Hero image as CSS background-image — can never be optimal LCP. Always use <img> with srcset, width/height, fetchPriority="high". (Fixed in v0.2.7.)
  • Public assets (public/assets/**) are NOT fingerprinted by Vite. Combined with Cache-Control: immutable, max-age=31536000 in nginx, content changes need either a filename bump (-v2.webp) or a manual nginx purge — a known nginx static-cache trap.
  • game-canvas useEffect deps can re-mount Phaser unnecessarily. Verify before blaming network.

When NOT to use this skill

  • The user is asking about prod / live-site perf → use mcp__metrifyr__psi_analyze instead (PSI doesn't work against localhost).
  • The user wants accessibility/a11y deep-dive → use the chrome-devtools-mcp:a11y-debugging skill (Lighthouse a11y category is shallow).
  • The user wants traces (call stacks, long tasks frame-by-frame) → use mcp__chrome-devtools__performance_start_trace.

After running

Always summarize:

  1. Top-line scores (Performance / SEO / A11y / BP).
  2. Each Core Web Vital with rating (good / needs-improvement / poor).
  3. Top 1–3 opportunities (audits with details.overallSavingsMs > 100).
  4. If LCP > 2.5s on mobile, identify the LCP element via largest-contentful-paint-element audit.
  5. Don't forget: dev numbers ≠ prod numbers. State both expected.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.