AI PromptsLighthouseCore Web VitalsChatGPTClaudeCursor

Best AI Prompts for Fixing Lighthouse & Core Web Vitals

Copy-paste AI prompts for ChatGPT, Claude, Cursor, and Codex to turn a stripped Lighthouse AIReport (<50KB) into exact Core Web Vitals code fixes.

PageSpeed Exporter Team··5 min read

The best AI prompts for fixing Lighthouse and Core Web Vitals share three rules: attach a stripped AIReport JSON (<50KB) instead of a 2MB raw PSI dump, tell the model to rank work by scorePlan.pointsAtRisk (never savings.ms), and constrain edits to first-party fixLocation surfaces so the model does not hallucinate changes to third-party scripts.

Below are five battle-tested, copy-paste prompts you can use with ChatGPT, Claude, Cursor, OpenAI Codex, or any MCP coding agent.


Which Prompt Should You Use?

GoalBest Prompt BelowBest AI Tool
| First audit — understand everything | Prompt 1: Full scorePlan Triage | ChatGPT, Claude |

| Ship the highest-impact fix in 15 minutes | Prompt 2: Single-Metric Quick Win | Cursor, Claude Code, Codex |

| Get copy-paste unified diffs for a PR | Prompt 3: Code Diffs by fixLocation | Cursor, Windsurf, Cline |

| Autonomous edit + re-scan loop | Prompt 4: MCP Fix-Until-90 Loop | Claude Code, Cursor, Windsurf |

| Explain performance to a non-technical client | Prompt 5: Plain-English Executive Summary | ChatGPT, Claude |


Prompt 1: Full scorePlan Triage (Best First Prompt)

Use this when you attach an AIReport for the first time and want a clear, ranked plan:

The attached JSON is a stripped AIReport from PageSpeed Exporter for [URL].
My stack is [Next.js 16 / WordPress / Shopify / React / plain HTML].

1. Read scorePlan first. State each lab metric's numericValue, pointsAtRisk, and targetFor90.
2. List the failing issues whose affectsMetrics includes the metric with the largest pointsAtRisk. Do not sort by savings.ms.
3. For each issue, cite the exact culprit from details (selector, URL, source module, or LCP subpart) and its fixLocation.
4. Provide the exact code or config change needed for each first-party issue. Do not pretend to edit remote third-party files.
5. Apply any relevant stackPacks hints, skip passedAuditIds, and note if fieldData (CrUX) diverges from lab metrics.

Prompt 2: Single-Metric Quick Win (LCP, CLS, or TBT)

When you want to move the needle fast without getting buried in 20 minor diagnostics:

From this PageSpeed Exporter AIReport:
1. Name the single lab metric in scorePlan with the highest pointsAtRisk.
2. Give me only the top 3 failing issues whose affectsMetrics includes that metric.
3. For each of the 3 issues, output:
   - Audit ID and fixLocation
   - Exact culprit row from details
   - Exact code or config change to reach targetFor90
4. Skip passedAuditIds and ignore any audit that does not affect that top metric.

Prompt 3: Unified Code Diffs for Your Codebase

Best inside Cursor, OpenAI Codex, or GitHub Copilot when your repo is open:

Read @aireport.json (a stripped PageSpeed Exporter AIReport for [URL]).

1. Pick the highest pointsAtRisk metric in scorePlan.
2. Map each culprit in details (selector, script URL, unused source module) to the real file paths in this workspace.
3. Produce minimal unified diffs (--- before / +++ after) for every first-party fixLocation ("code", "build-config", "asset").
4. For thirdParty culprits, show how to defer or lazy-load the embed from our layout instead of editing remote files.
5. Tell me the exact targetFor90 threshold we are verifying on the next re-scan.

Prompt 4: Autonomous MCP Fix-Until-90 Loop

Use this with our MCP server in Claude Code, Cursor, Windsurf, or Cline:

Call analyze_url on https://[preview-url] using strategy "mobile" (or "both" on Starter/Pro).

1. Read scorePlan and fix the metric with the largest pointsAtRisk first.
2. Edit the project files directly using fixLocation and culprit details, then run our build/tests.
3. After deployment, call analyze_url again. Remember lab scores vary by about ±5 points.
4. Stop only when every pointsAtRisk metric has reached targetFor90 and no accessibility, best-practices, or SEO issues remain.

Prompt 5: Plain-English Client or Stakeholder Summary

Useful for agencies and consultants sharing findings with non-technical teams:

Translate this PageSpeed Exporter AIReport for [URL] into a clear 1-page summary for a non-technical stakeholder.

1. Summarize the current mobile score and whether Core Web Vitals (LCP, INP, CLS) pass or fail in plain English.
2. List the top 3 bottlenecks from scorePlan in priority order, explaining what the user experiences (slow hero image, jumping buttons, sluggish clicks) rather than jargon.
3. Separate quick wins (under 1 hour) from larger engineering work.
4. Note whether real-user CrUX fieldData matches the lab test.

Built-In Prompt Templates in PageSpeed Exporter

You do not have to maintain these prompts manually. After running any audit at speedexporter.com, click Copy Prompt on the results page to copy your stripped AIReport pre-wrapped with a tuned template:

  • Free (\$0, 5 reports/month): 2 templates (Full Analysis, Plain English)
  • Starter (\$9/month, 50 reports/month): All 5 templates + Desktop/Both strategies + before/after comparison
  • Pro (\$29/month, 200 reports/month): All 5 templates + batch ZIP export for agencies (view pricing)

Further Reading


Sources

Frequently Asked Questions

Why do generic 'fix my Lighthouse score' prompts produce bad advice?

Without structured audit data, an LLM guesses common issues instead of reading your actual LCP element, shifting DOM selectors, or blocking script URLs. Feeding a stripped AIReport (<50KB) and telling the model to follow scorePlan.pointsAtRisk grounds every diff in your real page.

Why should my prompt tell the AI not to sort by savings.ms?

Lighthouse's 0–100 score only changes when one of the five weighted lab metrics moves (TBT 30%, LCP 25%, CLS 25%, FCP 10%, Speed Index 10%). Estimated savings.ms values on opportunity audits do not directly move the score. Ranking by scorePlan.pointsAtRisk guarantees higher-impact fixes.

Does PageSpeed Exporter include built-in prompt templates?

Yes. Free accounts include 2 built-in prompt templates (Full Analysis and Plain English). Starter ($9/month) and Pro ($29/month) unlock all 5 templates, including Quick Wins, Code Diffs, and Performance Score Analysis.


Further reading

Try it yourself

Run a free Lighthouse audit on any URL and export a stripped AIReport JSON under 50KB for your AI agent — no account required.

Analyze a URL for free