frontend-lighthouse
Fungsinya
Tool ini memeriksa apakah performa website Anda sudah cukup baik. Tool ini memastikan halaman dimuat dengan cepat dan elemen tidak bergeser secara tak terduga, serta menghentikan pembaruan yang tidak memenuhi standar tersebut.
Kapan dipakai
- βSaat menambahkan pemeriksaan performa untuk website.
- βSaat menetapkan batas untuk kecepatan pemuatan dan kestabilan halaman.
- βSaat mengatur bagaimana website harus berperilaku dalam pengujian otomatis.
Link skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/frontend-lighthouse/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βPeriksa apakah kecepatan pemuatan halaman utama masih dalam batas wajar dan apakah elemen tidak bergerak saat dimuat.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Tool ini menjalankan pengujian pada website Anda setelah dibangun, lalu membandingkan hasilnya dengan batas yang sudah ditentukan. Jika pengujian gagal, pembaruan akan dicegah agar tidak dipublikasikan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Frontend Lighthouse (portable performance gate)
Portable skill β readable by Claude Code, OpenCode, Codex, Cursor, Windsurf, and others. This skill describes a CI performance gate β a Lighthouse CI config plus a workflow β not a component library or a visual style. It pairs with the frontend-seo and frontend-architecture skills: SEO writes the metadata, Lighthouse proves it ships fast.
The goal: every pull request is blocked unless the production build meets explicit Core Web
Vitals budgets and category score floors. Budgets live in one lighthouserc.cjs, runs are
median-of-N so the gate doesn't flake, and the same config runs locally and in CI.
When to Use This Skill
- Use when adding a Lighthouse CI performance gate to a web app.
- Use when setting Core Web Vitals budgets for LCP, CLS, and TBT as the lab proxy for INP.
- Use when configuring category score floors for performance, SEO, accessibility, and best practices.
- Use when debugging flaky Lighthouse runs or making reports visible as CI artifacts.
0. The five core ideas
- 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. - Gate the production build, never dev. Lighthouse runs against
build+start(the real, optimized output). Dev-server numbers are meaningless for a budget. - 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.
- 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".
- Blocking in CI, visible as artifacts. A GitHub Action runs the gate on every PR touching the app and uploads the HTML/JSON reports so failures are debuggable.
1. Files this skill adds
apps/web/ (or your app root)
βββ lighthouserc.cjs β the gate: budgets + assertions + collect settings
βββ package.json β "lhci": "lhci autorun --config=./lighthouserc.cjs"
βββ .github/workflows/lighthouse.yml β PR-blocking CI job (build β start β lhci β upload)
Plus a dev dependency: @lhci/cli.
pnpm add -D @lhci/cli # or npm i -D / yarn add -D
2. The config (lighthouserc.cjs)
.cjs (CommonJS) so it loads without ESM/TS transpilation. Every budget is a named constant
with a comment explaining the threshold β never a bare number inside an assertion.
/**
* Lighthouse CI configuration β Core Web Vitals budgets for the marketing surface.
*
* Enforces Google's mobile "good" CWV thresholds:
* - Largest Contentful Paint (LCP) β€ 2500 ms
* - Cumulative Layout Shift (CLS) β€ 0.1
* - Interaction to Next Paint (INP) β€ 200 ms
*
* INP is a *field* metric with no direct lab audit, so in the lab we gate on
* Total Blocking Time (TBT) β Lighthouse's recommended lab proxy β at the same
* budget, and assert the experimental INP audit directly as a warning where the
* build exposes it.
*
* Collection runs against the *production* server (build + start) on Lighthouse's
* default mobile (Moto G4 / slow 4G) emulation.
*/
/** The fixed port the production server is started on for the audit. */
const PORT = 3100;
const BASE_URL = `http://localhost:${PORT}`;
/** Pages whose budgets are enforced in CI. */
const MARKETING_URLS = [`${BASE_URL}/`];
/**
* Core Web Vitals budgets on mobile β Google's "good" thresholds.
* These are the values that earn the best Lighthouse scores.
*/
const LCP_BUDGET_MS = 2500; // good
const INP_BUDGET_MS = 200; // good (TBT lab proxy)
const CLS_BUDGET = 0.1; // good
module.exports = {
ci: {
collect: {
// Build is run separately in CI; here we only serve the production output.
startServerCommand: `pnpm start --port ${PORT}`,
startServerReadyPattern: "Ready in", // framework's "server ready" log line
startServerReadyTimeout: 120000,
url: MARKETING_URLS,
// Median of multiple runs keeps the gate stable against per-run jitter.
numberOfRuns: 3,
settings: {
// Default mobile emulation; opt into desktop via env for a second run.
preset:
process.env.LHCI_FORM_FACTOR === "desktop" ? "desktop" : undefined,
β¦
Pertanyaan umum
Apa itu 'Core Web Vitals'?
Ini adalah metrik penting yang digunakan Google untuk mengukur pengalaman pengguna di sebuah website, dengan fokus pada kecepatan pemuatan, interaktivitas, dan kestabilan visual.
Mengapa pengujian dijalankan beberapa kali?
Menjalankan pengujian berkali-kali dan menggunakan nilai median membantu menghindari hasil gagal yang salah, yang bisa terjadi karena gangguan jaringan atau server sementara.
Di mana pengaturannya disimpan?
Pengaturan, seperti batas performa, disimpan dalam file bernama `lighthouserc.cjs`.
Detail
Deskripsi asli dari pembuat
Add a portable Lighthouse CI gate for production frontend builds with Core Web Vitals budgets, category floors, median runs, and CI artifacts.
Popularitas
- Bintang GitHub
- 48k
- Peringkat
- #4667
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- β¦
Skill lain dari repositori ini
00-andruia-consultant
48kMembantu agent Anda memulai atau meningkatkan proyek AI. Agent menganalisis kode, menyarankan tools, dan membuat rencana aksi dalam bahasa Spanyol.
007
48kMemungkinkan agent Anda melakukan audit keamanan dan threat modeling. Berguna untuk melindungi proyek dari serangan dan celah keamanan.
10-andruia-skill-smith
48kMembantu agent Anda membuat atau meningkatkan tools AI. Agent mendefinisikan cara kerja tools, menulis dokumentasi, dan memvalidasi strukturnya.
20-andruia-niche-intelligence
48kMemungkinkan agent Anda membuat ringkasan industri tertentu. Berguna untuk memahami konteks, aturan, pola penggunaan, dan risiko proyek dengan sumber terpercaya.
Skill serupa
test-driven-development
311kMengajari agent Anda menulis tes yang gagal dulu, melihatnya gagal, lalu menulis kode terkecil yang lulus, sebelum membangun fitur atau perbaikan apa pun.
verification-before-completion
311kMengajari agent Anda menjalankan pemeriksaan nyata dan membaca keluarannya sebelum menyatakan tugas, perbaikan, atau build sudah selesai atau lulus.
migrate-to-shoehorn
310kMengganti type cast berisiko di file tes Anda dengan pustaka shoehorn, sehingga tes bisa memakai data parsial dan tetap lulus pemeriksaan tipe.