
Debug Optimize LCP
FreeOptimize Largest Contentful Paint for faster page loads.
Free · Opens the source repo
What Debug Optimize LCP does
The Debug Optimize LCP skill provides a structured approach to diagnosing and improving the Largest Contentful Paint (LCP) metric on web pages, a critical component of user experience and search ranking. By utilizing Chrome DevTools MCP tools, this skill guides users through a systematic debugging workflow to identify bottlenecks in LCP performance. It breaks down the LCP metric into its four subparts, allowing developers to pinpoint specific areas for optimization, such as Time to First Byte (TTFB), resource load delays, and render delays.
To start, users are instructed to record a performance trace of their page, capturing essential timing data. Subsequent steps involve analyzing LCP-specific insights to understand where delays occur, identifying the LCP element, and checking network requests to assess loading times. This skill emphasizes the importance of a holistic approach to LCP optimization, warning against the common pitfall of focusing on a single subpart without considering the others.
Once the bottlenecks are identified, the skill offers targeted optimization strategies. These strategies include eliminating resource load delays by ensuring that the LCP resource is prioritized in loading, reducing element render delays through efficient script and style management, and minimizing resource load durations by optimizing images and leveraging CDNs. The skill also guides users on verifying their fixes and emulating real-world conditions to ensure that optimizations are effective across different network speeds.
This skill is ideal for web developers and designers looking to enhance their site's performance metrics, particularly those focused on improving user experience and SEO rankings. By following the outlined steps, users can systematically address LCP issues and create faster, more responsive web pages.
When to use it
Use this skill when needing to diagnose and optimize LCP performance on web pages, particularly during development or performance audits.
When not to use it
This skill may not be suitable for static sites with no dynamic content or for users unfamiliar with Chrome DevTools.
What you can build with it
Improving E-commerce Page Load Speed
Use this skill to analyze and optimize LCP on an e-commerce site, ensuring product images load quickly for better user experience.
Enhancing Blog Performance
Apply this skill to a blog site to diagnose LCP issues and implement strategies that improve content visibility and engagement.
Optimizing Landing Pages for SEO
Utilize this skill to optimize landing pages by improving LCP, thereby enhancing search rankings and user retention.
How to install Debug Optimize LCP
View source1. Install with the skills CLI
npx skills add chromedevtools/chrome-devtools-mcp/debug-optimize-lcp --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by chromedevtoolsWhat 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.
| Subpart | Ideal % of LCP | What 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:
navigate_pageto the target URL.performance_start_tracewithreload: trueandautoStop: 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 the insight set ID and the insight name from the trace results.
Step 3: Identify the LCP Element
Use evaluate_script with 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_requestsfiltered byresourceTypes: ["Image", "Font"](adjust based on Step 3). - Then use
get_network_requestwith 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 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-srcusage, orloading="lazy". - Fix: Use standard
<img>withsrc. 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-Controlheaders. - Fix: Use
font-display: swapif 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_tracewithreload: true) and compare the new subpart breakdown. The bottleneck should shrink. - Emulation: Lab measurements differ from real-world experience. Use
emulateto test under constraints:emulatewithnetworkConditions: "Fast 3G"andcpuThrottlingRate: 4.- This surfaces issues visible only on slower connections/devices.
Frequently asked questions about Debug Optimize LCP
Similar skills
Heap Snapshot Analysis
Investigate V8 heap snapshots for memory issues.
VS Code Performance Workflow
Automate performance investigations in VS Code.
Memory Leak Audit
Prevent memory leaks with effective coding patterns.
CPU Profile Analysis
Analyze V8 and Chrome performance profiles for optimization.
Chat Performance Testing
Benchmark and validate chat UI performance in VS Code.
Vercel React Best Practices
Optimize your React and Next.js applications for performance.
