A site takes six seconds to load. The owner opens the agency chat, says "the frontend is slow, we need a redesign", and signs a quote. Two months later the new React build ships — and still loads in five and a half seconds, because the bottleneck was never the frontend. It was one unoptimized database call fired on every page view and two hero images at 4800px wide. Nobody measured anything before deciding what to rewrite.
This is the most expensive habit in web performance: fixing the thing that looks slow instead of the thing that is slow. Core Web Vitals don't care about your component structure — they care about when the largest element paints, how long the main thread is blocked, and whether the layout jumps. An LLM won't magically make your site fast, but it is very good at one specific job: reading the artifacts you already have (Lighthouse JSON, a DevTools performance trace, a HAR file, a waterfall screenshot) and pointing at the actual bottleneck instead of the one you assumed.
Below is a prompt kit organized by what you're diagnosing — not by difficulty, because a "basic" prompt applied to the right report beats a clever one applied to nothing.
Why the redesign instinct fires first
The frontend is visible. A slow query is not. When a page feels sluggish, the eye lands on the thing you can see — the layout, the bundle, the framework — and the conversation skips straight to the rewrite. Meanwhile the real cost sits in a place nobody screenshotted: a 900ms TTFB, a render-blocking font, a third-party tag manager loading four scripts in sequence.
Here's the diagnostic order that saves money, and it's the order this article follows:
- Measure the baseline — what is actually slow, in numbers, before any opinion enters the room.
- Read the reports you already have — Lighthouse and DevTools traces contain the answer; most teams never parse them.
- Separate network from render — is the delay before the first byte or after it?
- Find the one request — the long pole in the waterfall.
- Only then decide what to change, with a cost estimate.
First, get a baseline an LLM can reason about
You cannot prompt your way out of missing data. Before asking an LLM anything, capture three artifacts: a Lighthouse report exported as JSON (Chrome DevTools → Lighthouse → Export), a performance trace saved from the Performance panel, and a HAR export from the Network tab. These are structured, machine-readable, and an LLM reads them far more reliably than a paragraph of complaint.
Prompt 1 — Turn a Lighthouse JSON into a ranked diagnosis
This is the workhorse. Paste the relevant sections of the report (the audits object is large — trim to the failing audits) and force the model to rank by impact, not by category.
Prompt:
You are a web performance engineer. Below is the trimmed Lighthouse JSON for a page that loads in ~6s on mobile.
Do three things:
1. List every failing audit with its score and the estimated savings Lighthouse reports (ms or KB).
2. Rank them by likely impact on Largest Contentful Paint and Total Blocking Time, and say WHY each one affects that metric — the mechanism, not the label.
3. Flag any audit where Lighthouse's estimate is misleading (e.g. unused JS that is actually needed on interaction, or savings that assume a cache state this page never has).
Do not recommend a framework change. Do not recommend a redesign. Only what the data supports.
[paste trimmed audits JSON]
What you get back is a ranked list, and the top of that list is almost never "rewrite the frontend". In the six-second example, the top three are usually: server response time, render-blocking resources, and oversized images. Notice that only one of those is a frontend concern at all.
The reason to forbid a redesign in the prompt is not politeness — it's that LLMs are trained on years of blog posts where the answer to "slow site" is "use a modern framework". Without the constraint, that prior leaks into the answer.
Reading the trace instead of the score
Lighthouse gives you a score. The performance trace gives you the story — the main thread timeline, the long tasks, the moment the LCP element actually painted. This is where an LLM earns its keep, because traces are dense and most developers skim them.
Prompt 2 — Find the long tasks blocking the main thread
Prompt:
Below is a summary of long tasks from a Chrome performance trace (start time, duration, and the script URL that triggered each).
Identify which long tasks overlap the Largest Contentful Paint timestamp I give you, and for each, name the specific script and the likely cause (hydration, third-party tag, large synchronous parse).
Then tell me which single task, if removed, would most improve Interaction to Next Paint — and what evidence in the data supports that choice.
LCP timestamp: [value]
Long tasks: [paste]
Total Blocking Time and INP are almost always a main-thread story, and the trace names the culprit. A common pattern: a third-party analytics bundle loading synchronously in the head, producing a 400ms task before first paint. Removing or deferring it costs an afternoon. Rewriting the frontend costs a quarter and doesn't touch it.
Is it the network or the render?
This is the fork that decides the whole project, and it's the one teams skip. If Time to First Byte is 1.2s, no amount of bundle-splitting helps — the server is the problem. If TTFB is 200ms and LCP is 4s, the server is fine and the render path is the issue. Get this wrong and you optimize the wrong half of the stack.
Prompt 3 — Split the timeline at first byte
Prompt:
Here is a HAR file summary: for each request, the timing breakdown (blocked, DNS, connect, SSL, send, wait, receive).
Compute the TTFB for the HTML document itself, then tell me: is the dominant delay BEFORE the first byte (server/backend) or AFTER it (download, parse, render)?
If before: which requests have unusually high 'wait' time, and what does that suggest about the backend?
If after: which resources are render-blocking and in what order do they load?
Give me a one-line verdict: 'server-bound' or 'render-bound'.
That one-line verdict is worth more than a page of recommendations. If the answer is server-bound, you're now looking at a query or an API call — which is exactly where the six-second site's problem lives.
The one request that owns the waterfall
Once you know it's server-bound, the question becomes which request. A HAR file has every request with its timings — an LLM can sort it and find the long pole faster than you can scroll.
Prompt 4 — Rank requests by total blocking contribution
Prompt:
From this HAR summary (URL, wait time, receive time, size), identify the requests on the critical path to first render.
Rank them by how much they delay LCP, not by size alone — a small request with 800ms of 'wait' can matter more than a large cached image.
For the top request, tell me what kind of fix would reduce its wait time: caching, a query change, an upstream API call, or moving it off the critical path.
HAR summary: [paste]
In the six-second case, this prompt reliably surfaces the same shape: one API endpoint with a wait time in the high hundreds of milliseconds, called synchronously before the page can render. Two hero images at full resolution sit right behind it. Fix the query, compress the images — the site drops to under two seconds, and nobody touched the component tree.
If the request turns out to be a database query, the diagnosis continues one layer down, where the plan itself tells the story..
Images: the two files that cost a second each
Oversized images are the most common render-bound problem and the easiest to miss because they look fine on a retina laptop. A 4800px hero served to a 390px phone is a second of download for pixels nobody sees.
Prompt 5 — Audit image payload against display size
Prompt:
Here is a list of image requests: URL, intrinsic dimensions, displayed dimensions (from the trace), file size, and format.
For each, compute the ratio of intrinsic to displayed width. Flag anything above 2x.
For the flagged images, estimate the byte savings from serving a correctly sized image in a modern format, and tell me whether `srcset`/`sizes` or a build-time resize is the better fix given this list.
Image list: [paste]
This is not glamorous work, but it's where the seconds hide. Two hero images resized and converted can shave 1.5s off LCP on mobile with zero architectural risk — a change you can ship today, unlike a redesign.
Writing the fix plan the LLM hands back
The point of all this measurement is a plan you can defend. The last prompt turns the diagnosis into sequenced work with effort estimates, so the redesign conversation becomes a data conversation.
Prompt 6 — Build a prioritized fix plan with effort vs impact
Prompt:
Given this diagnosis (server-bound, top request = [X], two oversized images, one render-blocking font), build a fix plan.
For each fix: expected impact on LCP/INP (high/medium/low, with the mechanism), effort (hours/days), and risk.
Order the plan so the highest impact-to-effort items come first.
Explicitly list what a full frontend rewrite would NOT fix from this diagnosis — I need that list to push back on a redesign proposal.
Diagnosis: [paste]
That last instruction is the whole article in one line. A rewrite does not fix a slow query, does not compress an image, does not defer a third-party tag. When the plan shows the top three fixes costing two days total and recovering four of the six seconds, the redesign quote answers itself.
| Fix | Effort | Recovers | Touches frontend? |
|---|---|---|---|
| Cache / rewrite the slow query | ~1 day | ~2.5s | No |
| Resize + convert two hero images | ~2 hours | ~1.5s | No |
| Defer third-party tag | ~1 hour | ~0.4s | Marginally |
| Full frontend rewrite | Weeks | ~0s from above | Yes |
What the prompts cannot do
An LLM reads the data you give it. If the trace was captured on a fast desktop over office Wi-Fi, the diagnosis is about the wrong user. Capture on a throttled mobile profile, because that's who Core Web Vitals is measured for. And treat every LLM estimate as a hypothesis to verify with a re-measurement, not a promise — the model is reading a snapshot, and your site changes.
The habit worth keeping is the order: measure, split network from render, find the long pole, then decide. The prompts above just make that order faster to execute. If you're diagnosing a slow endpoint and the trail leads into the backend, the same discipline applies one layer down. More on the topic: "Your Backend Is a Slow Leak: LLM Prompts That Catch Memory Hogs, Query Bloat, and Crash Triggers Before the Pager Goes Off".
The next time someone says "the site is slow, let's redesign", the cheapest move is to paste the Lighthouse JSON into a prompt and ask which audit actually costs the most. The answer is rarely the frontend — and now you'll have the numbers to say so.