Auditing site speed with AI
Auditing speed with AI means putting your own reports and your own page source in front of a model and asking for a pattern and a priority, not for generic advice. What the model does not do is see the rendered page or the real user data, which is why the last step is always measuring again.
- Lesson 10 of 10
- Intermediate
- 16 min read
- Free, no signup
A full audit, from measurement to verification
- 1
Measure
several page templates, not one URL
- 2
Export
the summarised report, the page facts, and each page role
- 3
Prompt
the pattern first, then the cause of one named metric
- 4
The plan
in order, with what we will not do and why
- 5
Verify
three measurements before and three after, medians compared
The model works in the two middle steps only. The first and the last are yours, and dropping either leaves you with something that is not an audit.
What separates an audit from a report
A report is the numbers of one page. An audit is a decision about a site: which page template has the problem, what causes it, in what order it gets fixed, and what we deliberately will not fix. Between the two sits a purely mechanical job that humans do badly and a model does well: reading several reports side by side and finding what repeats across all of them.
This is exactly where most people go wrong. The question they ask a model is how do I make my site faster, and the answer they get is a list that has been repeated in a thousand articles since 2015. That list is not wrong; it is simply not about your site, because nothing from your site was in the input.
A proper audit is made of three things. The measurement, which is your job and whose method is in the lesson on measuring site speed. The analysis, which is the model job, and two ready-made prompts for it follow. And the verification, which is your job again and is the last section here. Remove any one of the three and what remains is not an audit; it is either a raw measurement or a model opinion with nothing behind it.

What to collect so the model has something to read
The quality of any audit hangs on its input, not on the prompt you write. Collect four things, and each one has a specific job.
First, the summarised report for several page templates rather than for one URL. The front page, a product or service page, a post, and a page with a form. One page gives you a problem; four pages give you a pattern, and the pattern is what a decision comes out of. The command that summarises a PageSpeed response is in the measuring lesson and is not repeated here.
One practical warning that buys you time: the free keyless PageSpeed address no longer answers. We called it from this server today and got a 429 back, with a daily quota whose value is zero. Either get a key or take the report from the browser; there is no third route left.
Second, a few raw facts about the page itself, because a speed report does not state them. This command gives exactly what the model needs to reason about cause and what no report contains:
curl -s --compressed "https://example.com/" -o page.html
python3 -c "
import re
h = open('page.html', encoding='utf-8', errors='replace').read()
d = h.split('</head>')[0]
p = lambda k, v: print(k.ljust(24), v)
p('bytes', len(h.encode()))
p('img tags', len(re.findall(r'<img', h)))
p('css links in head', len(re.findall(r'<link[^>]+stylesheet', d)))
p('scripts in head', len(re.findall(r'<script[^>]*src=', d)))
p('scripts total', len(re.findall(r'<script[^>]*src=', h)))
p('inline style bytes', sum(len(s.encode()) for s in re.findall(r'<style[^>]*>(.*?)</style>', d, re.S)))
"Third, one line about each page: what that page does for the business, and how much you are allowed to change. You have the theme code, or you only have the dashboard, or you can even move hosts. The model estimates the effort of every task from that one line, and if you leave it out the estimate becomes fiction.
Fourth, and this is the one people forget: if the real user data was missing from the report, write a line yourself saying it was missing. A model reads silence as "no problem here", when what it means is "we do not know". One sentence in the input prevents one wrong conclusion.
Four things the input needs, and four it must not carry
Must be there
- the summarised report of several page templates, each named
- the raw page facts, from the command in this lesson
- one line on each page business role and what you may change
- one sentence saying whether real user data exists or not
Must not be there
- the raw report file, which fills the window and adds nothing
- an API key or any secret left inside the page source
- addresses of client pages that are not published yet
- your own guess at the cause, which steers the answer
The fourth row of the top column is the only item no tool produces for you: the absence of field data has to be written in by hand as a fact.
Prompt one: from several pages to one pattern
This prompt does one job and only that: across several reports, it works out which problem belongs to the template and repeats on every page, and which belongs to one specific page. That separation is the value of the whole audit, because the first kind you fix once and it works everywhere, while the second you have to walk page by page.
You are a senior web performance consultant. Today your job is to find the
pattern, not to fix anything. Judge only from the data below and add nothing
from memory.
The summarised report of each page:
{for each page: the page name, the report summary output, and the page-facts
command output}
The business role of each page and what I am allowed to change:
{one line per page}
Real user data: {was present | was absent from the response}
Write four things:
1. Build a table with one row per problem, with columns for the problem name,
the pages it appeared on, and whether it belongs to the template or to a page.
2. Pick the one problem that explains the most pages and say why you picked it.
3. Say which findings should be ignored and why. Anything seen on only one page
where that page has no important business role belongs in this group.
4. For the chosen problem write two to four cause hypotheses, and for each
hypothesis one test that would rule it out if it is wrong.
Rules: do not write any audit, file or plugin name unless it is in the input.
Do not write any number about sales, conversion or ranking; this data does not
produce one. If the real user data was absent, state plainly that your
conclusion rests on a lab run alone. If the data shows no shared pattern, say
so; "there is no pattern, each page has its own problem" is a correct answer.Point four is the most important line in this prompt and it is usually missing from the ones people write. When you ask a model to pair every hypothesis with the way to rule it out, two things happen: hypotheses that cannot be tested drop out by themselves, and instead of an opinion you get a list of work.
Prompt two: why this one metric is failing
Once you have the pattern, go after one metric on one page, and this time paste the page source too. What separates this prompt from the first is the input rather than the tone: here the model sees the source instead of a number.
You are a performance engineer. We have one failing metric and I want to
understand its cause from evidence. Judge only from the data below.
The failing metric and its value: {for instance LCP, the reported number}
The element the tool named as LCP: {exactly what the report says}
Page facts: {the output of the page-facts command}
The head of the page: {paste here, up to two thousand characters}
What I have access to: {the theme code | only the dashboard | I can move hosts too}
Write three things:
1. Two to four cause hypotheses, ordered by which fits the evidence above
best. For each one, say which piece of the input supports it.
2. For each hypothesis, one test that takes ten minutes and rules it out if
the hypothesis is wrong. The test must be a measurement, not a fix.
3. One warning: say which of the possible changes, done wrong, would break
something that currently works.
Rules: assume nothing that is not in the input. If the LCP element is not in
the input, ask rather than guess. If you conclude this number is not really
a serious problem, say that.The reason point three exists is best told with an example from this site. Hand a model the report of our front page and you get two recommendations with complete confidence: move the stylesheet out of the page into a separate file so it can be cached, and lazy load the images. The front page of this site has no images at all; we counted today and it was zero. And those roughly 89 KB of CSS are inside the page on purpose, because the HTML of this site is cached at the edge for a long time and a separate file would only add a request that does not currently exist. Both recommendations are right in general and wrong on this page.
Why the verify step is not optional
There are three things the model does not see, and no prompt changes that. First, the rendered page: the model reads HTML source and does not know what is actually seen first when the page opens, where it jumps, or which element is above the fold. Second, the real user data, unless you paste it in; and if you do not, the model will not tell you it is missing, it will simply conclude without it. Third, what devices and what networks your visitors arrive on.
The consequence is one specific, frequent mistake worth knowing by name: the model will confidently propose removing the very thing that is your LCP element. Its logic is sound from where it sits, because that element is the heaviest thing on the page; what it does not know is that the same element is your main product image, and removing it makes the page fast and useless.
Verification has three steps and none of them is hard. Before the change, measure the same page three times and write down the median. Apply changes one at a time rather than several together, because if the number moves you have to know which task caused it. After each change, take three more and compare the medians again. And the rule everything hangs on: if the difference between the two medians is smaller than the spread of those three runs, nothing happened. The number moved; the site did not.
And one step that is not technical but prevents more trouble than the rest: search your own input for every claim the model wrote. An audit name that was not in your report, a file that was not in the list, a plugin that is not installed. If it is not found, it does not exist; and that is the simplest check there is to run over a model output.
What the model reads and what it cannot see
It cannot see
- the rendered page and what is actually seen first
- the real user data, unless you paste it in
- the devices and networks your visitors actually use
- which element your business cannot afford to lose
It reads
- the numbers in the report you pasted
- the page HTML source, as far as it fits in the input
- the counts you took yourself with the command
- the page business role, if you wrote it down
The right column cannot be made up for with a better prompt. The only route is to add whatever you have of it into the input yourself.
The fast path, with AI
The third prompt produces the only output of this cycle that leaves your office, which is why it carries the most rules. Its job is to turn verified findings into a plan a non-technical person can read and approve: what work, why, in what order, what we are not doing and why not, and what we will measure afterwards. The usual way is somebody spending two hours writing a document that is half jargon, which the client approves without having understood it. This one takes ten minutes, and more importantly every sentence in it is tied to a finding.
Click any step to check it off as you go.
Copy-ready recipe
Write a speed improvement plan for a non-technical reader. Write only from the findings below and add nothing to them.
Verified findings:
{one finding per line: what, on which pages, on what evidence}
The reader and what they can approve: {for instance the sales manager, approves the budget, knows no jargon}
Constraints: {time, budget, anything that must not be touched}
Write these five sections, with no preamble and no conclusion:
1. Where things stand today, in three sentences, in plain language, with no jargon. Every number you use must be in the findings.
2. The work you propose, in the order it should be done. For each item: what it is in one sentence, why this one before the others, and an effort estimate in hours or working days. If you do not have enough information to estimate the effort, write unknown.
3. The work you are not proposing, with reasons. Do not drop this section; if the client hears something elsewhere later, this section is their answer.
4. What we measure after each item to tell whether it worked.
5. What is still unknown and what we would need in order to know it.
Rules: do not write any number about sales, conversion, Google ranking or a final score, even if asked; this plan makes no such promise. Do not add any finding that is not in the input. Do not use a technical term without a short explanation in the same sentence. If a finding means nothing to this reader, drop it and do not say you dropped it. The tone should be calm and free of self-congratulation.Before you trust the output: Two rules survive whatever the model writes, because you pay for breaking them three months later. First, let no number about sales or ranking stay in that document; speed data does not produce one, and the client will hand that single sentence back to you at the next meeting. Second, promise no score; a score is affected by the conditions of the test run as well, and you do not control those. And one reminder tied to both: before sending it, read the final text once as the person who will have to stand behind it, not as the person who delegated the writing.
AI in this kind of work
Our position on this is blunt: a language model is useful for analysing speed and not for diagnosing it. The difference between the two is the input. Put your own data in front of it and it does in ten minutes what a person does in half an hour. Just ask it why your site is slow and you get an answer as correct as a generic list can be, which is not very.
Tools that actually help
- RGB Guide
A fit for all three prompts here, and especially the third, which is writing work where tone matters. Iran is on neither of Anthropic two supported-countries lists, so there is no official sign-up and no Iranian card is accepted.
- RGB Guide
It makes a real difference at the export stage, because it runs on your own server or laptop: it takes the commands in this lesson itself, keeps the output and compares across several pages without you pasting anything by hand. The tool installs for free but needs a Claude subscription or an Anthropic Console account, and Iran is not on the supported-countries list.
- RGB Guide
If you decide not to summarise the reports and hand over the whole JSON of several pages at once, it handles very long inputs well. Google own page says the Gemini web app runs in over 230 countries and territories, and Iran is not on that list.
- RGB Guide
Enough for the first and second prompts, which are the sorting and classifying of reports. We make no claim about access from Iran, because OpenAI supported-countries page, like the rest of that domain, returns 403 to this server.
Where it backfires
Three risks, and the first is specific to this job: the model invents audit names that are not in your report. It has seen the Lighthouse naming pattern and can produce something that looks right and does not exist, and because it looks right nobody questions it. The simple prevention is the one in the last section: search your own input for every title the model wrote. Anthropic itself calls a model stating something confidently without support a hallucination, and names forcing the model to quote only from the document you gave it as one way to reduce it. The second risk is about the input rather than the model: report output carries page addresses and sometimes the addresses of client pages that are not published, and what happens to text you paste into a service depends on that service, your plan and your settings. Anthropic own page says that for its consumer products chats are used to improve the model if you choose to allow it, and it counts its commercial products separately; before pasting client data, read the page of whichever service you use. The third risk is the most serious because it happens quietly: the model will tell you with complete confidence to remove the very thing that is your LCP element, and if your input did not name the LCP element it has no way of knowing. Our position: the model may form hypotheses and write plans, and it may not add findings; any claim that is not in the input does not exist until you have confirmed it yourself.
Sources: Anthropic: reduce hallucinations Anthropic: is my data used for model training Anthropic: supported countries Google: where Gemini Apps are available
Where this advice stops
This lesson is a way of working, not a diagnostic tool; it makes no page faster and finds nothing by itself. It has four boundaries. First, the quality of the output hangs entirely on the input: if you have no field data, all three prompts are talking about a single lab run, and you have to write that into the text. Second, the prompts are crafted examples and not facts; shorten and lengthen them for your own site, and search your input for the output every time. Third, models and their classes change constantly and we have deliberately written no version number here; the current pick in each class is kept in our AI reference. And fourth, this method is written for small and medium business sites; at the scale where there is a dedicated performance team and continuous real-user monitoring, the cycle is different and we have no first-hand experience there.
From our own work
The front page of this site is a live example of what a model does not see, and we measured it again today. With the same page-facts command printed above: zero image tags, zero stylesheet links in the head, zero scripts in the head, seven scripts on the whole page, and 91050 bytes of CSS inside the page itself. Now take a speed report of that same page without those counts, and two things come up red: the weight of CSS in the render path, and an image optimisation opportunity. A model reading only that report recommends both with confidence, and both are wrong on this page: there is no image to optimise, and that CSS is inside the page on purpose, by the RGB_CSS_EXTERNAL decision in our theme, because the HTML of this site is cached at the edge for a long time and a separate file would only add a request. What this taught us, and what is in the prompts above: the input must not be built from the report alone. Those six lines of counts make both wrong recommendations meaningless from the start.
Real follow-up questions
Need a specific answer? Ask our team directly:
Can I just hand the whole raw PageSpeed report to the model?
You can, but you usually get a worse answer. The raw file is full of sections that have nothing to do with your problem, and those are what pull the model attention towards things that do not matter. Summarising the report first, with the command in the measuring lesson, is both cheaper and gives a more focused answer.
What if I have no real user data?
For most Persian language sites that is exactly what happens, and it is not a fault. What you should do is write into the input, plainly, that it was absent, and ask the model to state its conclusion under that condition. What you then get is a hypothesis about a simulated run, which is enough for small decisions and not enough for spending money.
Can the model apply the changes to the site itself?
Tools that run on your own server technically can, but that is not the right question. The question is who notices if something breaks and how it gets reverted. Until you have a test environment separate from the live site and a clear way back, the model output is a list to review and not a patch to run.
Finished this lesson?
Mark it done to track your progress across all 16 tracks on this device.