跳到正文
cccskills
免费在 GitHub 公开中文介绍

debug-optimize-lcp

使用 Chrome DevTools MCP 测量页面主要内容出现所需的 LCP 时间,定位延迟来自服务器响应、资源加载还是绘制,并提出改进方法,比较修改前后的结果。

原文查看原文说明

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions "largest contentful paint", "page load speed", "CWV", or wants to improve how fast their hero image or main content renders.

asgeirtj/system_prompts_leaks星标 70,416(GitHub 70,416 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • 排查主图显示缓慢的原因
  • 改善 LCP 或 Core Web Vitals
  • 区分图片、服务器和绘制延迟

中文介绍

功能

本技能使用 Chrome DevTools MCP 测量和分析最大内容绘制(LCP),即页面主要图片或文本显示所需的时间。它会在重新加载页面时记录性能跟踪,并将延迟拆分为服务器响应、资源发现与加载、下载以及元素绘制等阶段。技能可以定位 LCP 元素,检查网络请求和 HTML 中的延迟加载、优先级设置及阻塞绘制的脚本,再根据瓶颈提出改进方法。修改后还可以重新测量并比较结果。

适用场景

页面的主图或正文迟迟不显示时,可以用它查找原因。它有助于判断问题来自图片体积、请求启动过晚、服务器响应,还是绘制过程;也可在较慢的网络或设备条件下进行测量。

使用示例

  • “请测量这个页面的 LCP,并找出哪个阶段出现延迟。”
  • “主图显示很慢的原因是什么?可以怎样改进?”
  • “修改后请重新测量,并比较 LCP 各阶段的耗时。”

注意事项

测量和分析需要 Chrome DevTools MCP 工具。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
B部分不足会重新加载页面并调整网络和 CPU 模拟条件,但未说明确认步骤。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足需要 Chrome DevTools MCP,但资料未提供安装步骤或其他前提。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月30日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(5)

  • SKILL.md6.5 KB
  • references/elements-and-size.md1.3 KB
  • references/lcp-breakdown.md2.5 KB
  • references/lcp-snippets.md2.4 KB
  • references/optimization-strategies.md2.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

What is LCP and why it matters

Largest Contentful Paint (LCP) measures how quickly a page's main content becomes visible. It's the time from navigation start until the largest image or text block renders in the viewport.

  • Good: 2.5 seconds or less
  • Needs improvement: 2.5–4.0 seconds
  • Poor: greater than 4.0 seconds

LCP is a Core Web Vital that directly affects user experience and search ranking. On 73% of mobile pages, the LCP element is an image.

LCP Subparts Breakdown

Every page's LCP breaks down into four sequential subparts with no gaps or overlaps. Understanding which subpart is the bottleneck is the key to effective optimization.

SubpartIdeal % of LCPWhat it measures
Time to First Byte (TTFB)~40%Navigation start → first byte of HTML received
Resource load delay<10%TTFB → browser starts loading the LCP resource
Resource load duration~40%Time to download the LCP resource
Element render delay<10%LCP resource downloaded → LCP element rendered

The "delay" subparts should be as close to zero as possible. If either delay subpart is large relative to the total LCP, that's the first place to optimize.

Common Pitfall: Optimizing one subpart (like compressing an image to reduce load duration) without checking others. If render delay is the real bottleneck, a smaller image won't help — the saved time just shifts to render delay.

Debugging Workflow

Follow these steps in order. Each step builds on the previous one.

Step 1: Record a Performance Trace

Navigate to the page, then record a trace with reload to capture the full page load including LCP:

  1. navigate_page with pageId to the target URL.
  2. performance_start_trace with pageId, reload: true and autoStop: true.

The trace results will include LCP timing and available insight sets. Note the insight set IDs from the output — you'll need them in the next step.

Step 2: Analyze LCP Insights

Use performance_analyze_insight to drill into LCP-specific insights. Look for these insight names in the trace results:

  • LCPBreakdown — Shows the four LCP subparts with timing for each.
  • DocumentLatency — Server response time issues affecting TTFB.
  • RenderBlocking — Resources blocking the LCP element from rendering.
  • LCPDiscovery — Whether the LCP resource was discoverable early.

Call performance_analyze_insight with pageId, the insight set ID, and the insight name from the trace results.

Step 3: Identify the LCP Element

Use evaluate_script (with pageId) and the "Identify LCP Element" snippet found in references/lcp-snippets.md to reveal the LCP element's tag, resource URL, and raw timing data.

The url field tells you what resource to look for in the network waterfall. If url is empty, the LCP element is text-based (no resource to load).

Step 4: Check the Network Waterfall

Use list_network_requests to see when the LCP resource loaded relative to other resources:

  • Call list_network_requests with pageId filtered by resourceTypes: ["Image", "Font"] (adjust based on Step 3).
  • Then use get_network_request with pageId and the LCP resource's request ID for full details.

Key Checks:

  • Start Time: Compare against the HTML document and the first resource. If the LCP resource starts much later than the first resource, there's resource load delay to eliminate.
  • Duration: A large resource load duration suggests the file is too big or the server is slow.

Step 5: Inspect HTML for Common Issues

Use evaluate_script (with pageId) and the "Audit Common Issues" snippet found in references/lcp-snippets.md to check for lazy-loaded images in the viewport, missing fetchpriority, and render-blocking scripts.

Optimization Strategies

After identifying the bottleneck subpart, apply these prioritized fixes.

1. Eliminate Resource Load Delay (target: <10%)

The most common bottleneck. The LCP resource should start loading immediately.

  • Root Cause: LCP image loaded via JS/CSS, data-src usage, or loading="lazy".
  • Fix: Use standard <img> with src. Never lazy-load the LCP image.
  • Fix: Add <link rel="preload" fetchpriority="high"> if the image isn't discoverable in HTML.
  • Fix: Add fetchpriority="high" to the LCP <img> tag.

2. Eliminate Element Render Delay (target: <10%)

The element should render immediately after loading.

  • Root Cause: Large stylesheets, synchronous scripts in <head>, or main thread blocking.
  • Fix: Inline critical CSS, defer non-critical CSS/JS.
  • Fix: Break up long tasks blocking the main thread.
  • Fix: Use Server-Side Rendering (SSR) so the element exists in initial HTML.

3. Reduce Resource Load Duration (target: ~40%)

Make the resource smaller or faster to deliver.

  • Fix: Use modern formats (WebP, AVIF) and responsive images (srcset).
  • Fix: Serve from a CDN.
  • Fix: Set Cache-Control headers.
  • Fix: Use font-display: swap if LCP is text blocked by a web font.

4. Reduce TTFB (target: ~40%)

The HTML document itself takes too long to arrive.

  • Fix: Minimize redirects and optimize server response time.
  • Fix: Cache HTML at the edge (CDN).
  • Fix: Ensure pages are eligible for back/forward cache (bfcache).

Verifying Fixes & Emulation

  • Verification: Re-run the trace (performance_start_trace with pageId and reload: true) and compare the new subpart breakdown. The bottleneck should shrink.
  • Emulation: Lab measurements differ from real-world experience. Use emulate to test under constraints:
    • emulate with pageId, networkConditions: "Fast 3G" and cpuThrottlingRate: 4.
    • This surfaces issues visible only on slower connections/devices.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

3d-object

免费有简介

使用three.js创建立体模型,在交互式查看器中从各个角度检查形状和材质,并以OBJ + MTL或GLB格式保存,供其他三维制作软件使用。

  • 创建立体模型并从各个角度检查
  • 制作可在Blender中继续编辑的模型
  • 检查模型轮廓和材质效果
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

Audit web accessibility with Chrome DevTools MCP and Lighthouse. Inspect semantic structure, labels, keyboard focus, tap target size, and color contrast, then identify page elements that may need changes based on web.dev guidance.

中文简介正在准备中。当前显示英语简介。

  • Finding missing labels or image alternatives
  • Checking heading structure and reading order
  • Testing keyboard navigation and modal focus
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

action-items

免费有简介

在个人任务清单中记录待办事项、承诺、期限、下一步、待回复对象和阻碍原因,更新进度与依赖关系,合并重复项并归档已结束的任务。

  • 记录有期限的任务与承诺
  • 整理待回复事项及阻碍原因
  • 前置任务完成后更新依赖关系
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

agents

免费

Coordinate a task from a verifiable goal through completion. Handle work directly or split independent tasks across separate agent sessions, track progress, verify results, and arrange pull request merging when included in the goal.

中文简介正在准备中。当前显示英语简介。

  • Split independent tasks across agents
  • Check progress across ongoing tasks
  • Resume a previously started project
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

agy-customizations

免费有简介

了解 Antigravity 如何发现和加载自定义配置,包括配置位置与优先级。借助本指南选择并创建技能、规则、插件、钩子或 MCP 服务器,用于智能体工作流程和外部工具连接。

  • 选择合适的自定义配置类型
  • 查看配置的发现位置和加载顺序
  • 创建技能或规则
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

animated-video

免费有简介

将动画制作成可播放、暂停和定位时间的HTML页面,通过时间轴调整场景时长与速度,并为横屏或竖屏视频导出做好准备。

  • 制作产品操作演示动画
  • 用文字和图形解释内容
  • 制作竖屏动画
asgeirtj/system_prompts_leaks7万2026年10月29日 更新

查看 asgeirtj 的全部技能

报告此技能的问题