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.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Core Web Vitals?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/theopenco-core-web-vitals)
---
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)