Agent skill

Core Web Vitals

by addyosmani in addyosmani/web-quality-skills

Optimize Core Web Vitals (LCP, INP, CLS) for better page experience using field and lab evidence.

MITAuto-check passedFrontend & Design

Install Core Web Vitals

skills CLI
$ npx skills add addyosmani/web-quality-skills --skill core-web-vitals -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install addyosmani/web-quality-skills core-web-vitals --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/addyosmani/web-quality-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/core-web-vitals .claude/skills/core-web-vitals && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
core-web-vitals
GitHub stars
2.9k
Token cost
~2.4k tokens
SKILL.md length
809 words
Files
4 (incl. references)
Skills in repo
2
Repo updated
First seen
Licence
MIT

At a glance

Optimize Core Web Vitals (LCP, INP, CLS) for better page experience using field and lab evidence.

  • Works in 4 steps: Check page-level CrUX p75 data, with a… → Record a browser performance trace under… → Analyze only the insights associated… → …
  • Asked to improve Core Web Vitals
  • SKILL.md covers Measure before optimizing, The three metrics, LCP: Largest Contentful Paint and INP: Interaction to Next Paint, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Core Web Vitals is an agent skill from addyosmani/web-quality-skills. Optimize Core Web Vitals (LCP, INP, CLS) for better page experience 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".

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/CLS.md`, `references/INP.md` and `references/LCP.md`).

It sits in Frontend & Design, covering Web performance. The repository describes itself as: Agent Skills for optimizing web quality based on Lighthouse and Core Web Vitals. The licence is MIT.

When your agent uses it

  • Asked to improve Core Web Vitals
  • Page experience optimization
  • Fix layout shifts

Example prompts

  • “improve Core Web Vitals”
  • “fix LCP”
  • “reduce CLS”
  • “/core-web-vitals”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Check page-level CrUX p75 data, with a clearly labeled origin fallback when page data is unavailable.
  2. Record a browser performance trace under stated conditions. With Chrome DevTools MCP, trace summaries can include CrUX alongside the…
  3. Analyze only the insights associated with the failing metric, then inspect the implicated code and resources.
  4. Re-run equivalent lab measurements after the fix. Do not claim an immediate field improvement; CrUX and first-party RUM need new user…

What it can do on your machine

Read from SKILL.md and the folder at commit afa8da9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript, html, markdown and vue).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • web.dev
    • developer.chrome.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Core Web Vitals loads about 2.4k tokens when it runs, and up to ~5.8k if it reads all its reference files. Until then it costs about 64 tokens; SKILL.md has 809 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~64
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from addyosmani/web-quality-skills at commit afa8da9, republished under its MIT licence (© addyosmani). 809 words, ~2,436 tokens.

Download SKILL.mdSave it as .claude/skills/core-web-vitals/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
core-web-vitals
description
Optimize Core Web Vitals (LCP, INP, CLS) for better page experience 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".
license
MIT
metadata.author
web-quality-skills
metadata.version
2.0

Core Web Vitals optimization

Targeted optimization for the three Core Web Vitals using field data to identify user impact and browser traces to diagnose causes.

Measure before optimizing

When a runnable URL is available, read the performance measurement workflow. Prefer this sequence:

  1. Check page-level CrUX p75 data, with a clearly labeled origin fallback when page data is unavailable.
  2. Record a browser performance trace under stated conditions. With Chrome DevTools MCP, trace summaries can include CrUX alongside the observed lab metrics.
  3. Analyze only the insights associated with the failing metric, then inspect the implicated code and resources.
  4. Re-run equivalent lab measurements after the fix. Do not claim an immediate field improvement; CrUX and first-party RUM need new user visits.

If only source code is available, identify likely causes but do not claim that LCP, INP, or CLS is failing without runtime evidence.

The three metrics

MetricMeasuresGoodNeeds workPoor
LCPLoading≤ 2.5s2.5s – 4s> 4s
INPInteractivity≤ 200ms200ms – 500ms> 500ms
CLSVisual Stability≤ 0.10.1 – 0.25> 0.25

Google measures at the 75th percentile — 75% of page visits must meet "Good" thresholds.


LCP: Largest Contentful Paint

LCP measures when the largest visible content element renders. Usually this is:

  • Hero image or video
  • Large text block
  • Background image
  • <svg> element
Common LCP issues

1. Slow server response (TTFB > 800ms)

Fix: CDN, caching, optimized backend, edge rendering

2. Render-blocking resources

html
<!-- ❌ Blocks rendering -->
<link rel="stylesheet" href="/all-styles.css">

<!-- ✅ Critical CSS inlined, rest deferred -->
<style>/* Critical above-fold CSS */</style>
<link rel="preload" href="/styles.css" as="style" 
      onload="this.onload=null;this.rel='stylesheet'">

3. Slow resource load times

html
<!-- ❌ LCP image is discovered only after a stylesheet loads -->
<div class="hero"></div>

<!-- ✅ Discoverable in initial HTML and prioritized -->
<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">
<img src="/hero.webp" alt="Hero" fetchpriority="high">

Prefer a discoverable <img> with fetchpriority="high". Add the preload only when the trace shows that the resource would otherwise be discovered late; duplicate or speculative preloads can compete for bandwidth.

4. Client-side rendering delays

javascript
// ❌ Content loads after JavaScript
useEffect(() => {
  fetch('/api/hero-text').then(r => r.json()).then(setHeroText);
}, []);

// ✅ Server-side or static rendering
// Use SSR, SSG, or streaming to send HTML with content
export async function getServerSideProps() {
  const heroText = await fetchHeroText();
  return { props: { heroText } };
}

5. Make navigations instant with the Speculation Rules API

For sites with predictable same-origin journeys, prerendering a likely next page can make a successful subsequent navigation much faster. Treat this as a measured navigation optimization, not a substitute for fixing the current page's LCP.

html
<script type="speculationrules">
{
  "prerender": [{
    "where": { "href_matches": "/*" },
    "eagerness": "moderate"
  }]
}
</script>

Current Chrome behavior is specific enough to guide the choice:

eagernessTrigger
conservativePointer or touch down
moderateDesktop: 200ms hover, or earlier pointer down; mobile: viewport heuristics
eagerChrome 143+: desktop 10ms hover; mobile 50ms after the anchor enters the viewport
immediateAs soon as the rules are observed

Start conservatively and measure prediction hit rate, transferred bytes, server load, and navigation improvement before expanding the rules. Recheck Chrome's maintained eagerness documentation before hardcoding timing-sensitive behavior.

Caveats:

  • Bandwidth/CPU cost. Each prerender is roughly a full page load. Scope where carefully (href_matches patterns, exclude logout/checkout) and avoid immediate outside small sites.
  • Side effects fire early. Analytics, ads, and any code that runs on load will fire when the prerender starts, not when the user navigates. Gate side effects on the prerenderingchange event or document.prerendering.
  • Chromium-only. Safari and Firefox ignore the script — it's a progressive enhancement, never a regression.
LCP optimization checklist
markdown
- [ ] TTFB < 800ms (use CDN, edge caching)
- [ ] LCP resource is discoverable in initial HTML and prioritized; preload only if the trace shows late discovery
- [ ] LCP image optimized (WebP/AVIF, correct size)
- [ ] Critical CSS inlined (< 14KB)
- [ ] No render-blocking JavaScript in <head>
- [ ] Fonts don't block text rendering (font-display: swap)
- [ ] LCP element in initial HTML (not JS-rendered)
- [ ] Speculation Rules added for likely-next navigations (moderate eagerness)
LCP element identification

This snippet diagnoses the current page session. It is not field data.

javascript
// Find your LCP element
new PerformanceObserver((list) => {
  const entries = list.getEntries();
  const lastEntry = entries[entries.length - 1];
  console.log('LCP element:', lastEntry.element);
  console.log('LCP time:', lastEntry.startTime);
}).observe({ type: 'largest-contentful-paint', buffered: true });

Show full SKILL.md (334 more words)Show less

INP: Interaction to Next Paint

INP measures responsiveness across clicks, taps, and key presses during a visit. Diagnose its input delay, processing time, and presentation delay separately; a slow interaction may involve main-thread contention before the handler, expensive application work, or delayed rendering after it.

When field INP is poor or a trace identifies a slow interaction, read the INP reference for trace interpretation, yielding patterns, third-party and rendering causes, a single-session observer, and first-party attribution.


CLS: Cumulative Layout Shift

CLS measures unexpected layout shifts across a page visit. Use field attribution or a trace to identify the shifted node and the trigger; do not assume the visible victim caused the shift.

When field CLS is poor or a trace reports shifts, read the CLS reference for reserved-space patterns, dynamic content, font and animation fixes, a debugging observer, and a verification checklist.


Measurement sources

SourceUse
Browser performance trace (Chrome DevTools MCP: performance_start_trace)Observe one load or interaction and diagnose focused insights; use included CrUX context when available
CrUX or Search ConsolePrioritize aggregated real-user outcomes at p75
Lighthouse CLI or PageSpeed InsightsControlled lab fallback when DevTools tools are unavailable
First-party RUMSegment current production experience by route, device, release, and attribution
Raw PerformanceObserverInspect one page session during debugging

Do not route performance through Chrome DevTools MCP's lighthouse_audit; that capability intentionally covers non-performance Lighthouse categories. Do not compare a single lab value directly with a field p75 as if they were equivalent samples.

When adding or reviewing production collection, read the first-party RUM reference. Prefer the web-vitals library because raw browser APIs do not by themselves implement every Core Web Vital's lifecycle and reporting rules.


Framework quick fixes

Next.js
jsx
// LCP: Use next/image with priority
import Image from 'next/image';
<Image src="/hero.jpg" priority fill alt="Hero" />

// INP: Use dynamic imports
const HeavyComponent = dynamic(() => import('./Heavy'), { ssr: false });

// CLS: Image component handles dimensions automatically
React
jsx
// LCP: Preload in head
<link rel="preload" href="/hero.jpg" as="image" fetchpriority="high" />

// INP: Memoize and useTransition
const [isPending, startTransition] = useTransition();
startTransition(() => setExpensiveState(newValue));

// CLS: Always specify dimensions in img tags
Vue/Nuxt
vue
<!-- LCP: Use nuxt/image with preload -->
<NuxtImg src="/hero.jpg" preload loading="eager" />

<!-- INP: Use async components -->
<component :is="() => import('./Heavy.vue')" />

<!-- CLS: Use aspect-ratio CSS -->
<img :style="{ aspectRatio: '16/9' }" />

References

© addyosmani, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/core-web-vitals of addyosmani/web-quality-skills.

  • SKILL.md
  • references/CLS.md
  • references/INP.md
  • references/LCP.md

Open the folder on GitHubat commit afa8da9

Compare with similar skills

Core Web Vitals next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Core Web Vitals compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Core Web Vitals this skilladdyosmani/web-quality-skills2.9k—~2.4kAutomated safety check: PassMIT
React Doctormakeplane/plane61k12 repos~657Automated safety check: PassAGPL-3.0
Fixing Motion Performanceibelick/ui-skills9.5k5 repos~1.4kAutomated safety check: PassMIT
GSAP Performance Tuninggreensock/gsap-skills16k4 repos~1kAutomated safety check: PassMIT
React Frontend Development Guidelinesdiet103/claude-code-infrastructure-showcase10k2 repos~2.9kAutomated safety check: PassMIT
SEO GoogleAgriciDaniel/codex-seo7972 repos~3.4kAutomated safety check: PassMIT

Similar skills

  • React Doctor

    makeplane/plane

    Scans React code for lint, accessibility, bundle size and architecture issues, reports a health score and checks that changes do not lower it.

    61k GitHub starsUsed in 12 repos~657 tokens
    Frontend & DesignAuto-check passed
  • Fixing Motion Performance

    ibelick/ui-skills

    Audits and fixes web animation performance: layout thrashing, work that belongs on the compositor, scroll-linked motion and costly blur effects.

    9.5k GitHub starsUsed in 5 repos~1.4k tokens
    Frontend & DesignAuto-check passed
  • GSAP Performance Tuning

    greensock/gsap-skills

    Guides the agent to keep GSAP animations smooth by animating transforms and opacity, batching DOM reads and writes, and avoiding layout-heavy properties.

    16k GitHub starsUsed in 4 repos~1k tokens
    Frontend & DesignAuto-check passed
  • React Frontend Development Guidelines

    diet103/claude-code-infrastructure-showcase

    Guidelines for React 18 and TypeScript apps covering Suspense data fetching, lazy loading, feature folders, MUI v7 styling, TanStack Router and performance.

    10k GitHub starsUsed in 2 repos~2.9k tokens
    Frontend & DesignAuto-check passed
  • SEO Google

    AgriciDaniel/codex-seo

    Google SEO APIs: Search Console (Search Analytics, URL Inspection, Sitemaps), PageSpeed Insights v5, CrUX field data with 25-week history, Indexing API v3, and GA4 organic traffic.

    797 GitHub starsUsed in 2 repos~3.4k tokens
    Frontend & DesignAuto-check passed
  • Core Web Vitals

    vmDeshpande/ai-agent-automation

    Optimize Core Web Vitals (LCP, INP, CLS) for better page experience and search ranking.

    178 GitHub starsUsed in 4 repos~3.6k tokens
    Frontend & DesignAuto-check passed

More from addyosmani/web-quality-skills

  • Web Quality Audit

    addyosmani/web-quality-skills

    Run an evidence-led web quality audit covering performance, accessibility, SEO, best practices, and agentic browsing.

    2.9k GitHub stars~2.6k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Core Web Vitals

What does Core Web Vitals do?

Optimize Core Web Vitals (LCP, INP, CLS) for better page experience using field and lab evidence. Core Web Vitals is an agent skill from addyosmani/web-quality-skills. Optimize Core Web Vitals (LCP, INP, CLS) for better page experience using field and lab evidence.

When should I use Core Web Vitals?

Core Web Vitals fits situations like: asked to improve Core Web Vitals; page experience optimization; fix layout shifts.

How do I install Core Web Vitals in Claude Code?

Run `npx skills add addyosmani/web-quality-skills --skill core-web-vitals -a claude-code`. Or copy the skill folder (skills/core-web-vitals in addyosmani/web-quality-skills) into .claude/skills/core-web-vitals in your project. Claude Code loads it when a task matches its description.

How do I install Core Web Vitals in Codex?

Run `npx skills add addyosmani/web-quality-skills --skill core-web-vitals -a codex`. Or copy the skill folder (skills/core-web-vitals in addyosmani/web-quality-skills) into .agents/skills/core-web-vitals in your project. Codex loads it when a task matches its description.

Can I use Core Web Vitals in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add addyosmani/web-quality-skills --skill core-web-vitals -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/core-web-vitals, .gemini/skills/core-web-vitals, .github/skills/core-web-vitals and .opencode/skills/core-web-vitals in your project.

What does Core Web Vitals need to run?

SKILL.md names no scripts, command-line tools or credentials: Core Web Vitals is instructions for the agent only.

Does Core Web Vitals access the network?

SKILL.md names 2 domains. As links in the text: web.dev and developer.chrome.com. This is read from the text; nothing was executed.

Is Core Web Vitals safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Core Web Vitals use?

Core Web Vitals is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Core Web Vitals use?

About 2.4k tokens (SKILL.md is roughly 9.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.4k tokens, read only when the agent opens those files.

What are the alternatives to Core Web Vitals?

Skills that share tags, products or a category with Core Web Vitals: React Doctor (makeplane/plane, 61k stars), Fixing Motion Performance (ibelick/ui-skills, 9.5k stars), GSAP Performance Tuning (greensock/gsap-skills, 16k stars) and React Frontend Development Guidelines (diet103/claude-code-infrastructure-showcase, 10k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Core Web Vitals?

addyosmani (a GitHub user) maintains it in addyosmani/web-quality-skills, which has 2,909 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on August 24, 2026.

Source: addyosmani/web-quality-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.