Improve Largest Contentful Paint (LCP) — Windsurf
LCP measures how fast the main content appears. Slow LCP loses visitors and rankings. Main culprits: unoptimized hero images and render-blocking scripts.
Fixing this in Windsurf
Codeium agentic AI IDE with Cascade
Windsurf Cascade can walk the entire project and apply multi-file edits in one pass. Paste the prompt below into your Windsurf chat and the fix rolls out across the project in one pass.
Using a different tool? Pick your stack:
The prompt for Windsurf
Copy and paste this into your Windsurf chat exactly as-is.
Using Windsurf Cascade, apply these edits across the project in one pass: Improve Largest Contentful Paint 1. Preload the LCP image with <link rel="preload" as="image">. 2. Optimize the image format (use WebP/AVIF) and compress it. 3. Remove render-blocking resources above the fold.
Why this matters
LCP is one of three Core Web Vitals and the one users feel most viscerally. It is "when does the page look done". Over 4 seconds nearly doubles bounce on mobile.
Google uses LCP as a ranking signal (part of the page experience score). Sites that fail LCP get demoted on mobile results.
How to use this prompt in Windsurf
- 1. Open your Windsurf project.
- 2. Copy the prompt above with the copy button.
- 3. Paste into the Windsurf chat and send.
- 4. Review the diff, accept the changes, redeploy.
- 5. Verify the fix using the checklist below.
Common mistakes to avoid
- error_outlineLazy-loading the LCP image — becomes slower, not faster.
- error_outlineServing a 3MB JPEG when a 200KB WebP would do.
- error_outlineLoading analytics/chat widgets synchronously before content.
- error_outlineUsing a slow DNS/CDN for the main origin.
How to verify the fix worked
- check_circlePageSpeed Insights → LCP value < 2.5s on mobile.
- check_circleDevTools Performance tab — LCP event under 2.5s.
- check_circleCrUX (Chrome UX Report) in GSC — LCP "Good" threshold met.
Frequently asked questions
What counts as the LCP element?expand_more
Does preloading actually help?expand_more
Want all 34 prompts tailored to your Windsurf site?
Pantra scans your site in 10 seconds, detects the stack, and generates the exact prompts that apply — only the ones you actually need.
Scan my siteRelated Windsurf prompts
Fix Cumulative Layout Shift (CLS) — Windsurf
Prompt to eliminate CLS — add width/height to images, reserve space for ads, avoid late-loading fonts.
PerformanceImprove Interaction to Next Paint (INP) — Windsurf
Prompt to get INP under 200ms — split long tasks, lazy-load heavy JS, debounce handlers.
ImagesConvert images to WebP or AVIF — Windsurf
Prompt to convert JPEG/PNG to WebP or AVIF — 30-50% smaller at the same quality. Helps LCP and CLS.
PerformanceFix Core Web Vitals (LCP, CLS, INP) — Windsurf
Prompt to address Google Core Web Vitals thresholds: LCP < 2.5s, CLS < 0.1, INP < 200ms. Works in any AI-coded stack.