Skip to content
Back to skills

Core Web Vitals

ASecurity

Diagnose and fix Core Web Vitals (LCP, INP, CLS) regressions in apps/ui and the other Next.js frontends using field and lab evidence. Use when asked to "improve Core Web Vitals", "fix LCP", "reduce CLS", "optimize INP", "page experience optimization", or "fix layout shifts". Not for accessibility.

  • 1,773 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added May 26, 2026
developmentgonextjsnodedebuggingapifrontendperformance

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add theopenco/llmgateway --skill core-web-vitals --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Core Web Vitals?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Core Web Vitals
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/theopenco-core-web-vitals/badge)](https://www.skillsdirectory.com/skills/theopenco-core-web-vitals)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: core-web-vitals
description: Diagnose and fix Core Web Vitals (LCP, INP, CLS) regressions in apps/ui and the other Next.js frontends using field and lab evidence. Use when asked to "improve Core Web Vitals", "fix LCP", "reduce CLS", "optimize INP", "page experience optimization", or "fix layout shifts". Not for accessibility.
---

# Core Web Vitals

Adapted from addyosmani/web-quality-skills (MIT).

## Repo anchors

- `apps/ui` is a Next.js 16 App Router app. Render above-the-fold content in server components, not `useEffect`; stream slow parts with `Suspense` or `loading.tsx`.
- LCP image: `next/image` with `preload` (`priority` is deprecated in Next 16) and `sizes` when using `fill`. Give images `width` and `height`, or `fill` in a sized parent, to avoid CLS.
- Fonts are subsetted local fonts loaded through `next/font/local` in `apps/ui/src/fonts`. Those modules are generated by `apps/ui/scripts/fonts/subset_fonts.py`; change the script, not the output.
- Load heavy client widgets (charts, editors) with `next/dynamic`. Check what a route ships with the `--analyze` build in the `frontend` skill.
- Measure a production build (`next build` then `next start`), never `next dev`.

## Measure before optimizing

When a runnable URL is available:

1. Check page-level CrUX p75 data, with a clearly labeled origin fallback when page data is missing.
2. Record a browser performance trace under stated conditions (Chrome DevTools MCP `performance_start_trace`; its summary can include CrUX).
3. Analyze only the insights for the failing metric, then inspect the implicated code and resources.
4. Re-run equivalent lab measurements after the fix. Don't claim a field improvement yet: CrUX and RUM need new visits.

With source code only, name likely causes but don't claim a metric fails without runtime evidence.

## Thresholds (p75 of page visits)

| Metric | Measures         | Good          | Poor       |
| ------ | ---------------- | ------------- | ---------- |
| LCP    | Loading          | 2.5s or less  | over 4s    |
| INP    | Interactivity    | 200ms or less | over 500ms |
| CLS    | Visual stability | 0.1 or less   | over 0.25  |

## Diagnose by metric

- LCP: split into TTFB, resource load delay, load duration and render delay; fix the largest part. Read [the LCP reference](references/LCP.md) for discovery, preload, render blocking, server rendering, Speculation Rules and a checklist.
- INP: separate input delay, processing time and presentation delay. Read [the INP reference](references/INP.md) for yielding, third-party and rendering causes, and attribution.
- CLS: find the shifted node and its trigger in a trace or field attribution; the visible victim is often not the cause. Read [the CLS reference](references/CLS.md) for reserved space, dynamic content, font and animation fixes.

## Measurement sources

| Source                               | Use                                              |
| ------------------------------------ | ------------------------------------------------ |
| Browser performance trace            | One load or interaction, focused insights        |
| CrUX or Search Console               | Real-user outcomes at p75                        |
| Lighthouse CLI or PageSpeed Insights | Lab fallback when DevTools tools are unavailable |
| First-party RUM                      | Production split by route, device and release    |
| Raw `PerformanceObserver`            | One page session while debugging                 |

- Don't use Chrome DevTools MCP `lighthouse_audit` for performance; it covers the other Lighthouse categories.
- Never compare one lab value with a field p75 as if they were equivalent samples.
- For production collection use the `web-vitals` library (in Next.js, `useReportWebVitals` from `next/web-vitals`); raw browser APIs don't implement each metric's reporting rules.

## References

- [web.dev LCP](https://web.dev/articles/lcp), [INP](https://web.dev/articles/inp), [CLS](https://web.dev/articles/cls)

Files in this skill

  • SKILL.md11.4 KB
  • references/LCP.md4.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.