Core Web Vitals: Optimizing LCP, INP, and CLS Using Field and Lab Evidence

Introduction

Core Web Vitals (CWV) are three metrics Google uses to measure page experience: LCP (Largest Contentful Paint), INP (Interaction to Next Paint), and CLS (Cumulative Layout Shift). Search rankings and page experience signals reference these metrics, evaluated at the 75th percentile (p75)—meaning approximately 75% of visits must meet the “good” threshold.

In daily troubleshooting, Lighthouse or PageSpeed Insights can often point out “which metric is failing,” but rarely directly corresponds to “which DOM element, which resource, or which line of code.” Generic performance advice also tends to be too broad. Below introduces the core-web-vitals Skill: it breaks down the three CWV metrics into actionable diagnostic and repair paths, emphasizing measuring before changing, using field data to prioritize, and using browser traces to find root causes.

What is This

core-web-vitals is an Agent Skill in the web-quality-skills repository (metadata indicates the author as web-quality-skills, version 2.0, MIT licensed). In one sentence: it combines field and lab evidence for targeted optimization of LCP, INP, and CLS.

The official description states applicable scenarios include: when asked to “improve Core Web Vitals,” “fix LCP,” “reduce CLS,” “optimize INP,” “page experience optimization,” or “fix layout shifts.” The description on officialskills.sh also mentions: covers image preloading, main thread optimization, layout shift prevention, and field measurement using the web-vitals library; includes patterns for Next.js, React, and Vue (subject to Skill documentation).

Maintenance and attribution: Skill files are located in Addy Osmani’s web-quality-skills repository path skills/core-web-vitals; installation entry point is shown below.

Three Metrics and Thresholds

The Skill documentation uses a table to define the boundaries of “good / needs improvement / poor” (consistent with Google’s public standards):

Metric What it measures Good Needs Improvement Poor
LCP Loading ≤ 2.5s 2.5s – 4s > 4s
INP Interaction responsiveness ≤ 200ms 200ms – 500ms > 500ms
CLS Visual stability ≤ 0.1 0.1 – 0.25 > 0.25

Before optimization, first confirm which specific metric is failing at p75, then only dive into insights and code related to that metric, avoiding “broadly adding cache across the entire site” while missing the actual LCP element or CLS trigger.

Core Features

Measure First, Then Optimize

When an accessible URL is available, the Skill requires prioritizing reading the performance measurement process in the same repository (../performance/references/MEASUREMENT.md), and suggests the following order:

  1. Check page-level CrUX p75; if no page-level data exists, use clearly labeled origin fallback.
  2. Record browser performance traces under declared conditions; when working with Chrome DevTools MCP, trace summaries can include both CrUX and current lab metrics.
  3. Only analyze insights related to failing metrics, then examine the code and resources involved.
  4. After fixing, rerun with equivalent lab measurements; do not claim that field metrics will immediately improve—CrUX and first-party RUM require new user visits to update.

If only source code is available without runtime evidence, the Skill allows inferring possible causes, but must not assert that LCP, INP, or CLS are definitely failing without evidence.

LCP: Common Issues and Checklist

LCP measures the time it takes for the largest visible content element to finish rendering. Common LCP elements include hero images/videos, large text blocks, background images, or <svg>.

Typical issues summarized in the documentation include: high TTFB (> 800ms), render-blocking CSS/JS, late discovery of LCP resources, client-side rendering causing content to appear after JS loads, and using the Speculation Rules API for measurable “next navigation” optimization (the documentation emphasizes that this cannot replace fixing the current page’s LCP, and requires attention to bandwidth, side effects, and Chromium limitations).

The Skill includes an LCP optimization checklist (TTFB, discoverability and fetchpriority, image format and size, critical CSS, font font-display, SSR/SSG, Speculation Rules, etc.), and a debugging snippet using PerformanceObserver to locate LCP elements in the current session (this is a single lab session, not field data).

INP and CLS: Reference Specialized Documentation

  • INP: Requires separating input delay, processing time, and presentation delay; when field INP is poor or traces show slow interactions, read references/INP.md in the Skill (trace interpretation, long tasks, third-party and rendering causes, single-session observer, first-party attribution, etc.).
  • CLS: Emphasizes using field attribution or traces to find shifted nodes and triggers, not assuming that “what you see as victims” is the root cause; when field CLS is poor, read references/CLS.md (reserving space, dynamic content, fonts and animations, debugging observer, verification checklist).

Measurement Sources and Boundaries

Source Purpose
Browser performance trace (Chrome DevTools MCP: performance_start_trace) Single load or interaction diagnosis; can include attached CrUX context
CrUX or Search Console Aggregated real user p75 for prioritization
Lighthouse CLI or PageSpeed Insights Controlled lab fallback when DevTools is unavailable
First-party RUM Segmenting online experience by route, device, version, etc.
Native PerformanceObserver Debugging single sessions

The documentation explicitly states: do not use Chrome DevTools MCP’s lighthouse_audit for performance (this capability is for non-performance Lighthouse categories); do not directly compare single lab values with field p75 as the same population.

Installation and Activation

The official installation method provided at officialskills.sh is:

npx skills add https://github.com/addyosmani/web-quality-skills --skill core-web-vitals

You can also provide the Skill directory link to coding assistants for installation:

https://github.com/addyosmani/web-quality-skills/tree/main/skills/core-web-vitals

The Skill itself is in a generic SKILL.md format; specific UI differences for Cursor, Codex CLI, Claude Code, etc., are subject to each product’s current support for npx skills add or pasting repository paths; this article does not cover configuration items not verified on the official page.

Typical Usage (Reproducible Scenarios from Official Documentation)

The following scenarios are from officialskills.sh’s When to use it, consistent with the Skill documentation direction, and can serve as conversation entry examples:

  • Preload hero images using fetchpriority or similar methods to reduce LCP to under 2.5s.
  • Break up long array processing into chunks to avoid click handlers blocking the main thread for extended periods (improving INP).
  • Add width/height to product images to reduce thumbnail grid jumps (CLS).
  • Reserve min-height before injecting ad slots to avoid layout shifts caused by async insertion by ad networks.
  • Integrate the web-vitals library and write to Google Analytics to track p75-related field metrics.

When fixing LCP, the HTML/JS comparison examples in the documentation show: inlining critical CSS, deferring non-critical styles, using preload + fetchpriority="high" only when traces prove “late discovery,” and using SSR/SSG to replace pure client-side data fetching for rendering above-the-fold content.

Applicable Scenarios and Considerations

Who it’s for: Front-end and full-stack developers who need to turn CWV from “red letters on reports” into specific changes; teams that already have CrUX, Search Console, or first-party RUM and want Agents to follow the Skill process to first check p75, then traces.

Limitations and pitfalls:

  • Do not conclude without runtime evidence; field improvements require new access cycles, only lab equivalent measurements can be verified after fixing.
  • Speculation Rules and some DevTools MCP capabilities depend on the Chromium ecosystem; Safari/Firefox behavior is subject to each browser’s documentation.
  • Deep-dive steps for INP/CLS are in the Skill-referenced INP.md and CLS.md, which need to be used together with the main SKILL.md.
  • Compared with web-quality-audit in the same repository (broader Lighthouse-style audit), this Skill is specialized in the three CWV metrics, with shorter paths and easier reproduction of the “metric → pattern → patch” chain in conversations—this is also one reason why it’s more easily spread among teams than generic performance advice (the spread effect itself is not quantified in official materials, this is only a comparison of working methods).

Conclusion

core-web-vitals incorporates Google’s three public Core Web Vitals thresholds, measurement order, and LCP/INP/CLS division of labor into an Agent-followable SKILL.md, and connects with CrUX, traces, and common framework-side anti-patterns. If you are working on performance tickets related to search and experience signals, you can install from the official repository and directly reference metric names or URLs in conversations.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye