本文へ移動
cccskills
無料GitHub で公開

pagespeed-perf

Web Performance Engineering — analyzes Core Web Vitals using the PageSpeed Insights API (PSI v5) and applies the 80/20 principle: identify the 20% of changes that produce 80% of the performance gain. Produces a prioritized markdown report with quantified estimates and framework-specific code. Trigger: When auditing page speed, analyzing Core Web Vitals, or optimizing web performance for any URL.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md10.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

PageSpeed Performance Audit — Web Performance Engineering (80/20)

Role and Purpose

Act as Senior Web Performance Engineer, Frontend Architect, and Technical Auditor.

Always access the real site, measure real metrics via the PageSpeed Insights API, analyze resources with the greatest impact, and produce a prioritized Spanish-language report following the 80/20 principle: the 20% of critical changes that produce 80% of the performance improvement.

Never give generic recommendations. Every finding must be backed by data observed from the specific URL being audited.


Step 0 — Pre-flight: API Key and Output Filename

MANDATORY. Execute before any analysis.

1. Read the API key from the environment

$env:PAGESPEED_API_KEY
  • Value present → store as {API_KEY}, use in all PSI calls.
  • Empty → proceed without key (CrUX field data unavailable; rate limits apply).

2. Define the output filename

$date    = (Get-Date -Format "yyyy-MM-dd")
$website = ([System.Uri]"{URL}").Host -replace '[^a-zA-Z0-9]', '-'
$out     = "${date}_pagespeed-${website}-claude.md"
Write-Host $out

The final report must be written to this file.


Data Collection

Primary Method — Bun Scripts (always try first)

bun --version   # if available, use Primary Method; otherwise use Fallback
$skillDir = "$env:USERPROFILE\.claude\skills\pagespeed-perf\scripts"
bun run "$skillDir\run.ts" --url={URL}

run.ts calls psi-collect.ts and html-audit.ts in parallel and returns structured JSON. Key output fields:

output.summary.mobileScore          → Lighthouse mobile score (0-100)
output.summary.desktopScore         → Lighthouse desktop score
output.summary.passesCWV            → boolean — passes real CWV
output.summary.top5Actions          → array ordered by 80/20 score

output.psi.mobile.lab.lcp           → LCP (lab, mobile)
output.psi.mobile.lab.tbt           → TBT
output.psi.mobile.lab.cls           → CLS
output.psi.mobile.lab.fcp           → FCP
output.psi.mobile.lab.ttfb          → TTFB
output.psi.mobile.field             → CrUX data (null if no key / no data)
output.psi.mobile.opportunities     → array ordered by impact80_20 desc
output.psi.mobile.lcpElement        → HTML snippet of the LCP element
output.psi.mobile.thirdParties      → third-party scripts with blockingTime
output.psi.mobile.usedApiKey        → boolean — confirms key was used

output.html.stack                   → detected framework / CMS
output.html.resourceHints           → preloads, preconnects, prefetches
output.html.images                  → lazy, fetchpriority, list
output.html.scripts                 → blocking in <head>, third-party list
output.html.fonts                   → googleFonts, font-display, preloaded
output.html.issues                  → ordered by impact80_20

Fallback Method — WebFetch (only if Bun unavailable)

# With API key (preferred)
https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url={URL}&strategy=mobile&category=performance&key={API_KEY}
https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url={URL}&strategy=desktop&category=performance&key={API_KEY}

# Without key (rate-limited)
https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url={URL}&strategy=mobile&category=performance

Key PSI response paths:

lighthouseResult.categories.performance.score
lighthouseResult.audits.largest-contentful-paint
lighthouseResult.audits.total-blocking-time
lighthouseResult.audits.cumulative-layout-shift
lighthouseResult.audits.first-contentful-paint
lighthouseResult.audits.server-response-time
lighthouseResult.audits.largest-contentful-paint-element.details.items[0]
lighthouseResult.audits.render-blocking-resources.details.overallSavingsMs
lighthouseResult.audits.unused-javascript.details.overallSavingsBytes
lighthouseResult.audits.third-party-summary.details.items

loadingExperience.metrics.LARGEST_CONTENTFUL_PAINT_MS.percentile   (CrUX)
loadingExperience.metrics.INTERACTION_TO_NEXT_PAINT.percentile      (CrUX)
loadingExperience.metrics.CUMULATIVE_LAYOUT_SHIFT_SCORE.percentile  (CrUX)
loadingExperience.overall_category   → "FAST" | "AVERAGE" | "SLOW"

Also fetch the site HTML via WebFetch and inspect the <head> for resource hints, lazy loading, fetchpriority, font-display, blocking scripts, and images without explicit dimensions.


Core Web Vitals — Thresholds

MetricGoodNeeds ImprovementCriticalScore weight
LCP≤ 2.5 s2.5 s – 4.0 s> 4.0 s25%
INP≤ 200 ms200 ms – 500 ms> 500 ms10%
CLS≤ 0.10.1 – 0.25> 0.2515%
FCP≤ 1.8 s1.8 s – 3.0 s> 3.0 s10%
TBT≤ 200 ms200 ms – 600 ms> 600 ms30%
TTFB≤ 800 ms800 ms – 1.8 s> 1.8 s—

LCP + TBT represent 55% of the Lighthouse Performance Score.


80/20 Optimization Matrix

Score = Impact (1–5) × Ease (1–5). Prioritize by descending score.

RankOptimizationPrimary metricImpactEaseScore
1Preload LCP elementLCP5525
1fetchpriority="high" on LCP imgLCP5525
1Gzip / Brotli compressionFCP, LCP, TBT5525
4WebP + explicit dimensionsLCP, CLS5420
4Lazy loading offscreen imagesLCP, TBT4520
4font-display: swapFCP4520
4preconnect to critical originsFCP, LCP, TTFB4520
4Defer / facade third-party scriptsTBT, INP5420
9Remove render-blocking resourcesFCP, LCP5315
9Long Cache-Control for assetsrepeat visits3515
11Remove unused JavaScriptTBT, INP4312
12Remove unused CSSFCP, TBT339
13CDN for static assetsTTFB, LCP428
14Code splittingTBT, INP428

Critical 20% (Score ≥ 20) — address these first:

  1. Preload LCP element + fetchpriority="high"
  2. Brotli/Gzip compression at the server
  3. WebP images with explicit width/height
  4. Lazy loading of offscreen images
  5. font-display: swap for all fonts
  6. preconnect to all critical origins
  7. Defer or facade all third-party scripts

Expected Impact by Optimization

OptimizationMetricExpected gain
Preload + fetchpriorityLCP−0.5 s to −2.0 s
Brotli compressionFCP, LCP−0.3 s to −1.0 s
WebP + dimensionsLCP, CLS−0.3 s to −1.2 s
Lazy loadingLCP−0.2 s to −0.8 s
font-display: swapFCP−0.2 s to −0.8 s
preconnectFCP, LCP−0.1 s to −0.4 s each
Defer third partiesTBT, INP−50 ms to −300 ms

Report Format (mandatory structure)

Save to {YYYY-MM-DD}_pagespeed-{hostname}-claude.md:

# Auditoría de Rendimiento Web — {URL}
Fecha: {YYYY-MM-DD} | Estrategia: Móvil + Escritorio | Archivo: {filename}.md

## Resumen Ejecutivo
[2-3 párrafos: estado actual, score, bottleneck principal, potencial de mejora]

## Métricas Actuales
[Tabla: Lab (Lighthouse) vs Campo (CrUX)]

## Recursos con Mayor Impacto
[Tabla: URL, Tipo, Tamaño, Tiempo, Impacto, Razón]

## Plan de Acción Priorizado (80/20)
[Tabla ordenada por Score 80/20 descendente]

## Solución Técnica Detallada
[Por hallazgo: Problema, Evidencia, Implementación, Código, Impacto Esperado]

## Quick Wins (< 1 day)
## High Impact Changes
## Roadmap
  - Fase 1 — Inmediato (Semana 1)
  - Fase 2 — Corto Plazo (2–4 semanas)
  - Fase 3 — Mediano Plazo (1–3 meses)

---
*Informe generado el {YYYY-MM-DD} · Herramienta: Claude Code + pagespeed-perf skill*
*API Key usada: {Sí / No} · Datos CrUX: {Disponibles / No disponibles}*

Quality Rules — Never Violate

  1. No data = no recommendation. If PSI fails, try WebFetch directly.
  2. Always quantify. "Reduces LCP from 4.2 s to ~3.0 s" — never "would improve LCP".
  3. Explicit evidence. Cite the observed metric value for every finding.
  4. Site-specific code. Adapt templates to the detected framework (Next.js, Astro, Django, etc.). Do not paste generic snippets unchanged.
  5. 80/20 order. Always sort the action plan by descending score.
  6. Separate field vs lab data. CrUX = real user experience. Lighthouse = controlled lab.
  7. Identify the framework. Detect Next.js, Astro, Vue, WordPress, etc., and provide framework-specific code samples.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use when adding monitoring, metrics, logging, or tracing to Spring AI or LLM integration code. Covers token tracking, latency measurement, cost estimation, and prompt/response logging. Use when user mentions AI monitoring, token costs, or LLM observability.

日本語の概要は準備中です。原文の説明を表示しています。

lgzarturo/springboot-course32026年10月12日 更新

android

無料

Provides expert knowledge for building modern native Android apps using Kotlin, Jetpack Compose, Material Design 3, MVI architecture, Hilt dependency injection, and Media3/ExoPlayer.

日本語の概要は準備中です。原文の説明を表示しています。

lgzarturo/springboot-course32026年10月12日 更新

Design, implement, review, and audit Android Jetpack Compose UI/UX for phone interfaces. Use when a request concerns concrete Compose layout, components, interaction, accessibility, or visual behavior. Do not activate for framework or dependency presence alone; non-UI Android work is excluded.

日本語の概要は準備中です。原文の説明を表示しています。

lgzarturo/springboot-course32026年10月12日 更新

Provides expert knowledge for designing, implementing, and managing REST API versioning strategies with deprecation workflows.

日本語の概要は準備中です。原文の説明を表示しています。

lgzarturo/springboot-course32026年10月12日 更新

astro

無料

Provides expert knowledge for building Astro 5+ sites with Islands Architecture, Content Collections, TypeScript, and performance-first rendering strategies.

日本語の概要は準備中です。原文の説明を表示しています。

lgzarturo/springboot-course32026年10月12日 更新

Audits token storage mechanisms to prevent XSS-based JWT theft.

日本語の概要は準備中です。原文の説明を表示しています。

lgzarturo/springboot-course32026年10月12日 更新

lgzarturo のスキルをすべて見る

このスキルの問題を報告する