Home / Blog / How to Use Claude Code for SEO
AI SEO 8 April 2025 8 min read

How to Use Claude Code for SEO

Traditional SEO agencies still operate like dinosaurs. They pay junior executives to pull Google Search Console data into spreadsheets, manually.

LB
Lee Beirne
leebeirne.com

Traditional SEO agencies still operate like dinosaurs. They pay junior executives to pull Google Search Console data into spreadsheets, manually rewrite title tags, and stare blindly at Screaming Frog crawls for hours on end. They then package these basic observations into a 50-page PDF audit that takes four weeks to deliver and another six months for the client's engineering team to implement.

It is slow, it bleeds capital, and the latency kills your growth velocity. The era of the manual technical read-out is dead. I no longer write PDF audits. I use Claude Code instead.

Claude Code is an agentic CLI tool built by Anthropic. I run it through OpenRouter, which gives me access to Claude, GPT-4, Gemini, and dozens of other models through a single API. That means I can switch models depending on the task without changing my workflow. Unlike traditional LLM interfaces like ChatGPT where you have to manually copy and paste code into a browser window, Claude Code operates natively inside your terminal. You give it access to your machine, hook it into your local repository, and let it autonomously read, write, execute, and refactor structural architecture in real time.

Most marketers think LLMs are strictly for writing content. They use AI to pump out average blog posts, which is the fastest way to invite a manual Google penalty. Using AI to write fluffy human copy is the least interesting thing you can do with it. I use Claude Code to execute massive technical SEO changes across thousands of files simultaneously.

For a broader look at how SEO is changing, the shift from manual execution to agentic workflows is one of the biggest developments in the industry right now.

Use Case 1: Autonomous Next.js Refactoring

Claude Code is an AI coding assistant that can write, debug, and optimise code for SEO tasks. It excels at generating structured data markup, creating redirect rules, building sitemaps, writing meta tags, and automating technical SEO fixes. Unlike ChatGPT, Claude Code can process entire codebases, understand project context, and make changes across multiple files simultaneously. For SEO professionals who work with code, Claude Code reduces the time spent on repetitive technical tasks from hours to minutes.

When an enterprise client asks me why their Next.js site is failing Core Web Vitals on mobile, the old process involved running manual Lighthouse tests, tracking down Layout Shifts in Chrome DevTools, identifying the offending un-sized images, and submitting a massive Jira ticket to the dev team.

Today, I just point Claude Code at the repository. I instruct it to run a local Lighthouse CI audit, identify the heavily loaded React components that are causing the LCP (Largest Contentful Paint) delays, and execute the fix. The agent uses grep to scan the entire codebase, finds every instance of a raw img tag missing explicit height and width attributes, and autonomously rewrites them to use the optimised Next.js Image component.

It does not just suggest the code. It edits the files, runs npm run build to verify there are no compilation errors, and stages the git commit. A process that used to take weeks of back-and-forth is completed in twelve minutes.

I have a client whose Next.js site had 340 unoptimised images across 50 pages. The old approach would have been to manually identify each image, write a Jira ticket, wait for the dev team to fix it, and verify the changes. That process takes 2-3 weeks. Claude Code did it in 15 minutes. The site passed Core Web Vitals the next day.

For a complete guide to technical SEO fundamentals, see my technical SEO guide.

Use Case 2: Programmatic Entity Schema at Scale

LLMO (Large Language Model Optimisation) relies heavily on strict JSON-LD schema markup. AI answer engines like ChatGPT and Perplexity do not read your CSS. They ingest your raw structured data.

If an iGaming client needs complex, nested Entity Schema deployed across a 5,000-page programmatic cluster, relying on a developer to write a custom Python script or battling with a bloated WordPress plugin is inefficient.

Instead, I provide Claude Code with the exact JSON-LD architecture rules. I instruct the terminal agent to recursively walk through the directory structure, parse the frontmatter metadata from every single markdown or JSX file, format that specific location and odds data into my strict JSON-LD template, and inject it cleanly into the head of the page structure. It executes thousands of file writes flawlessly and provides a verified diff summary.

For a deeper look at structured data for AI search, see my schema markup for AI search article.

The key difference between Claude Code and a WordPress plugin is precision. A plugin applies generic schema to every page. Claude Code applies specific, contextual schema to each page based on its content. A product page gets Product schema with Offer and Review. A location page gets LocalBusiness schema with geo-coordinates. A blog post gets Article schema with author and publisher. Each page gets exactly the schema it needs, nothing more, nothing less.

This matters for getting cited by Google AI Overviews. AI systems use structured data to understand your content. If your schema is generic or incomplete, the AI has to work harder to parse your pages. If your schema is specific and contextual, the AI can extract information more easily and is more likely to cite your content.

Use Case 3: The "Executioner" Pruning Script

Massive enterprise websites, whether e-commerce brands or tech publishers, are drowning in index bloat. They have thousands of zombie pages receiving zero clicks, which cannibalises their crawl budget and dilutes their domain authority.

Before agentic AI, Content Pruning was a nightmare of VLOOKUPs, matching Search Console data to Screaming Frog exports. Now, I ask Claude Code to build a local Python environment. I instruct it to hit the Google Search Console API, download the last 16 months of impression data, and identify every URL that has received zero clicks.

But the real magic is the next step. The agent uses local semantic embeddings to compare the dead URLs to the high-performing URLs. If a dead page matches the topical intent of a live page, Claude Code autonomously writes the Nginx 301 server redirects mapping the dead URL to the live one. Finally, it generates a neat Nginx configuration file ready for immediate server deployment.

I used this approach with a client who had 12,000 pages on their site. Claude Code identified 3,200 pages with zero clicks in 16 months. It then mapped 1,800 of those pages to existing live pages using semantic similarity. The result: 1,800 redirects that consolidated link equity and freed up crawl budget. The entire process took 45 minutes. Doing it manually would have taken a team of three people two weeks.

For a deeper look at content pruning, see my content refresh strategy article.

Use Case 4: Automated Internal Linking

Internal linking is one of the most impactful and most neglected SEO tasks. Most sites have orphan pages, broken internal links, and inconsistent anchor text. Fixing this manually means crawling the site, exporting the data, analysing it in a spreadsheet, and making changes one page at a time.

Claude Code can automate this entire process. I point it at the repository and ask it to:

  • Crawl the site structure and build a map of all pages
  • Identify orphan pages (pages with no internal links pointing to them)
  • Find broken internal links
  • Suggest contextual internal links based on content similarity
  • Implement the changes across the codebase
The agent reads every page, understands the content, and suggests internal links that make sense contextually. It does not just link random pages together. It identifies topical relationships and creates links that help both users and search engines navigate the site.

For a complete technical audit checklist, see my SEO audit checklist.

Building the Infrastructure, Not Selling Hours

The traditional SEO agency model charges clients for the manual friction of execution. Agencies justify £10,000 monthly retainers by hiding behind the sluggishness of manual audits and Jira tickets.

I charge for the architecture. Setting up the pipeline is where the actual value lives. Once the local agent environment is active, technical execution takes seconds. The client achieves zero-latency updates, and I spend my time actually mapping competitive growth strategies rather than fixing broken title tags.

If you are an SEO consultant, spending your time on manual technical execution is a mistake. Stop managing spreadsheets. Deploy Claude Code, orchestrate the architecture, and move faster than the agencies you compete against.

For help with technical SEO, automation strategy, and AI visibility, my technical SEO services cover all of it.

Get SEO insights in your inbox

Weekly insights on AI SEO, LLMO, technical SEO, and what actually moves rankings. No fluff.

No spam. Unsubscribe anytime.

LB
Lee Beirne
AI SEO Consultant · 30 Years Experience

Blending battle-tested SEO expertise with cutting-edge AI to deliver measurable growth.

Work With Lee
Back to all posts