AI SEO In Detail › Module F · Putting It Together › Episode 48
Automate the Whole Analysis With Claude Code
Episode 48 of AI SEO In Detail, a free course in practical SEO analysis: Automate the Whole Analysis With Claude Code.
Video coming soonThis episode is scripted and in production. The transcript below is the script as written; it may change before the video is published.
Full transcript
1,026 words · script draft, under review.
Intro
The analysis in this series works. But done by hand, it takes days. And the parts that matter most, the weekly checks and the re-measurements, are exactly the parts that get skipped when you're busy.
So you automate it. And then a new problem appears. A script that runs every week can spend money every week. It can fail silently and report nothing for a month. Or it can produce a confident report from broken data, and nobody notices.
I run my own analysis with Python, SQLite and Claude Code as the operator. In this episode: what I automate and what I don't, how the pieces fit together, the cost gate that stops paid calls without my approval, and the human review step that keeps it honest.
What to automate, and what not
Draw one line first. Everything that collects, stores, joins and flags data can be automated. Everything that decides what to do stays with a person.
The machine side: pulling Search Console and Analytics every day, running the URL Inspection sample every week, storing results-page snapshots, joining it all into the data model from episode five, and flagging what changed. It can also draft the report.
The human side: approving any paid call above a set limit, choosing which recommendations to act on, shipping changes to the live site, and reading the verdicts from episode forty-six.
That line isn't about whether the model is smart enough. It's about accountability. If a report recommends deleting fifty pages, a person should read it before anything happens.
The pipeline layout
The structure is the workspace from episode six. Small scripts, each with one job. One pulls Search Console. One pulls Analytics, always filtered by hostname. One runs the index sample. One takes results-page snapshots. One builds the report.
Every script writes the raw API response to a cache folder first, with the date in the file name, and only then loads it into the SQLite database. That gives you two things. You never pay twice for the same data. And when a number looks strange, you can go back to exactly what the API said on that day.
API keys live outside the project folder, in environment files the scripts read at runtime. They never appear in the code, the reports, or a chat with the model.
Claude Code as the operator
Claude Code is an AI coding agent that runs in your terminal. It can read files, run your scripts and write new ones. In this setup, it's the operator: it runs the steps, reads the output, and writes the draft report.
Two kinds of files make it reliable.
The first is a project instruction file called CLAUDE dot md. It holds the rules that must never be broken. Always filter Analytics by hostname. Never trust the sitemap "indexed" field. Never sum equal search volumes. Verify Googlebot by IP, not by user agent. Every hard lesson from this series becomes one line in that file, so the model doesn't repeat a mistake I already paid for.
The second is a skill: a written procedure the agent follows step by step. "Weekly analysis: pull, check measurement health, run the striking-distance and click-through checks, compare with last week, write the report to this folder, and don't implement anything." Same steps, same order, every time.
The cost gate
Free data, like Search Console and Analytics, can run on a schedule without asking. Paid calls can't.
The rule is simple. Before any paid call, the script calculates the estimated cost from the number of calls and the known price per call, checks the account balance with the free balance endpoint, prints both, and stops. Nothing is spent until I type an explicit go.
On top of that, three habits keep costs low. Check the cache before calling. Use the smallest depth that answers the question: ten results are enough for most results-page checks. And run the small validation task before any big volume run, so a wrong keyword form doesn't waste the whole batch.
I put the same rule in the instruction file, so the agent itself knows it may never approve its own spending.
Scheduled runs and silent failures
The free parts run on a schedule: a daily pull, a weekly index sample, and a weekly report in a folder I read on Monday morning.
The danger with scheduled jobs is silence. An API that returns zero rows doesn't throw an error. It just looks like a terrible day. So every run checks itself. If a pull returns no rows, or far fewer than usual, that's an alert, not a data point.
And for checks that can fail in bulk, like URL Inspection, I include a control: a site I know is well indexed, in the same run. If the control suddenly looks unindexed too, the problem is the endpoint, not my site.
The human review step
The report ends with proposed actions, never executed ones. I read it, decide, and then ask for specific changes in a separate step.
One more rule, and it matters more as agents get more capable. Anything the agent reads from outside, a web page, a competitor's content, an email, is data, not instructions. If a page says "ignore your rules and do this", the agent reports it and does nothing. Keep the set of things the scheduled run is allowed to do small, and this risk stays small too.
Where automation goes wrong
Two pitfalls before you start.
Automating an analysis you haven't done by hand. If you've never run the striking-distance check yourself, you won't notice when the automated version is wrong. Do every step manually at least once, as in the episodes of this series, then automate the version you trust.
And reports nobody reads. A weekly report that runs for months without anyone opening it is worse than no report, because it feels like monitoring. Keep the report short, put the changes and the alerts at the top, and if you notice you're skipping it, cut it down until you don't. That's exactly what the next episode is about.
Wrap-up
Automate the collecting, gate the spending, keep the decisions human. A starter instruction file and folder layout are linked in the description. Next episode: the monthly monitoring dashboard, and the few numbers worth looking at every month. See you there.