core-web-vitals

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SEO Technical: Core Web Vitals

SEO技术:Core Web Vitals

Guides optimization of Core Web Vitals (CWV)—Google's user experience metrics that affect search ranking. CWV are confirmed ranking factors for mobile and desktop.
When invoking: On first use, if helpful, open with 1–2 sentences on what this skill covers and why it matters, then provide the main output. On subsequent use or when the user asks to skip, go directly to the main output.
指导Core Web Vitals(CWV)的优化,CWV是谷歌推出的衡量影响搜索排名的用户体验指标,已被证实是移动端和桌面端的搜索排名因素。
调用规则首次使用时如果合适,可以先用1-2句话介绍该技能覆盖的内容及重要性,再输出核心内容。后续调用或用户要求跳过介绍时,直接输出核心内容即可。

Scope (Technical SEO)

覆盖范围(技术SEO)

  • LCP (Largest Contentful Paint): Loading performance; time to render largest content element
  • INP (Interaction to Next Paint): Responsiveness; replaced FID in March 2024
  • CLS (Cumulative Layout Shift): Visual stability; unexpected layout shifts
  • LCP(Largest Contentful Paint):加载性能,指渲染最大内容元素所需的时间
  • INP(Interaction to Next Paint):响应性指标,2024年3月正式取代FID
  • CLS(Cumulative Layout Shift):视觉稳定性指标,衡量页面意外布局偏移的情况

Target Thresholds (75th percentile, field data)

目标阈值(75百分位,现场数据)

MetricTargetGoodNeeds ImprovementPoor
LCP≤2.5s≤2.5s2.5–4.0s>4.0s
INP≤200ms≤200ms200–500ms>500ms
CLS<0.1≤0.10.1–0.25>0.25
指标目标良好需要优化较差
LCP≤2.5s≤2.5s2.5–4.0s>4.0s
INP≤200ms≤200ms200–500ms>500ms
CLS<0.1≤0.10.1–0.25>0.25

Initial Assessment

初步评估

Check for project context first: If
.claude/project-context.md
or
.cursor/project-context.md
exists, read it for site URL.
Identify:
  1. Tools: GSC Core Web Vitals report, PageSpeed Insights, Chrome DevTools
  2. Metrics: Which metric is failing (LCP, INP, CLS)
  3. Page type: Hero, article, product, list—LCP candidate differs
优先检查项目上下文:如果存在
.claude/project-context.md
.cursor/project-context.md
,读取文件中的站点URL信息。
确认以下信息:
  1. 工具:GSC Core Web Vitals报告、PageSpeed Insights、Chrome DevTools
  2. 指标:哪项指标未达标(LCP、INP、CLS)
  3. 页面类型:首屏页、文章页、产品页、列表页——不同页面的LCP候选元素存在差异

LCP Optimization

LCP优化

LCP measures the time until the largest content element (image, video, or text block) is visible.
CauseFix
Slow server responseReduce TTFB; use CDN; optimize server
Render-blocking resourcesDefer non-critical CSS/JS; inline critical CSS
Large imagesWebP/AVIF; compress;
width
/
height
to prevent CLS; see image-optimization
Client-side renderingSSR/SSG for above-fold content; see rendering-strategies
Third-party scriptsLoad async; defer non-critical
LCP candidates: Hero image, large text block, video poster. Ensure above-fold images use
loading="eager"
(default); never lazy-load LCP.
LCP衡量最大内容元素(图片、视频或文本块)变为可见状态所需的时间。
问题原因解决方案
服务器响应缓慢降低TTFB;使用CDN;优化服务器配置
渲染阻塞资源延迟加载非关键CSS/JS;内联关键CSS
图片体积过大使用WebP/AVIF格式;压缩图片;设置
width
/
height
属性避免CLS;参考image-optimization
客户端渲染首屏内容使用SSR/SSG;参考rendering-strategies
第三方脚本影响异步加载;延迟加载非关键脚本
LCP候选元素:首屏图、大文本块、视频封面图。确保首屏图片使用
loading="eager"
(默认值);绝对不要对LCP元素设置懒加载。

INP Optimization

INP优化

INP measures responsiveness—time from user interaction to next paint. Replaced FID in March 2024.
CauseFix
Long-running JSBreak tasks >50ms; use
requestIdleCallback
; Web Workers
Heavy event handlersDebounce/throttle; defer non-critical work
Main thread blockingReduce third-party scripts; defer non-critical JS
Layout thrashingBatch DOM reads/writes; avoid forced reflows
INP衡量页面响应性——从用户发起交互到下一次页面绘制的间隔时间,2024年3月取代了FID。
问题原因解决方案
JS任务运行时间过长拆分执行时长超过50ms的任务;使用
requestIdleCallback
;使用Web Workers
事件处理函数逻辑过重防抖/节流处理;延迟执行非关键任务
主线程阻塞减少第三方脚本;延迟加载非关键JS
布局抖动批量处理DOM读/写操作;避免强制回流

CLS Optimization

CLS优化

CLS measures unexpected layout shifts.
CauseFix
Images without dimensionsAlways set
width
and
height
attributes
Dynamic contentReserve space for ads, embeds; use
min-height
Web fonts
font-display: optional
or
swap
; preload critical fonts
AnimationsUse
transform
instead of
top
/
left
/
width
Reserve space: For images, ads, embeds—define dimensions before load. Avoid inserting content above existing content without reserved space.
CLS衡量页面意外布局偏移的情况。
问题原因解决方案
图片未设置尺寸始终为图片设置
width
height
属性
动态内容插入为广告、嵌入内容预留空间;使用
min-height
占位
网页字体加载影响使用
font-display: optional
swap
配置;预加载关键字体
动画实现不合理使用
transform
属性实现动画,避免修改
top
/
left
/
width
属性
预留空间提示:针对图片、广告、嵌入内容,在资源加载前先定义占位尺寸。不要在已有内容上方插入未提前预留空间的内容。

Tools & Monitoring

工具与监控

ToolUse
GSCCore Web Vitals report; URL grouping; field data
PageSpeed InsightsLab + field data; mobile + desktop
Chrome DevToolsPerformance panel; LCP element; layout shift overlay
工具用途
GSC查看Core Web Vitals报告;URL分组;获取现场数据
PageSpeed Insights同时提供实验室+现场数据;支持移动端+桌面端检测
Chrome DevTools性能面板分析;定位LCP元素;查看布局偏移叠加层

Output Format

输出格式

  • 当前状态:列出未达标的指标(LCP、INP、CLS)
  • 优先级修复方案:按影响程度从高到低排序
  • 参考资料Web VitalsPage Experience

Related Skills

相关技能

  • image-optimization: LCP image optimization; WebP; lazy loading (below-fold only)
  • google-search-console: CWV report; field data monitoring
  • mobile-friendly: Mobile-first indexing; mobile CWV targets
  • rendering-strategies: SSR/SSG for LCP; content in initial HTML
  • site-crawlability: Redirect chains waste crawl; fix for performance
  • image-optimization:LCP图片优化;WebP格式适配;懒加载(仅适用于非首屏内容)
  • google-search-console:CWV报告查看;现场数据监控
  • mobile-friendly:移动端优先索引;移动端CWV指标达标
  • rendering-strategies:针对LCP的SSR/SSG优化;初始HTML包含核心内容
  • site-crawlability:修复重定向链减少爬取资源浪费,提升页面性能