How to automate SEO content with Claude Code
A bounded Claude Code workflow for SEO articles: rules in CLAUDE.md, a skill per step, research in a subagent, a hook that blocks bad drafts, human review.
Published 10 min readBy Piyush Aaryan, founder
- seo
- content
- ai search
- google policy
Short answer: Don't ask Claude Code to "write 50 SEO posts". Give it a bounded job. Put your rules in CLAUDE.md, turn each step (brief, draft, check) into a skill, run research in a subagent that has to save its sources, and add a hook that blocks publishing until the checks pass. Keep a person on the publish step, because Google says AI-generated content needs a manual fact-check before it goes live. Then run it on a schedule, at a pace your domain can absorb.
Claude Code is Anthropic's coding agent. It runs in the terminal, IDEs, a desktop app and the web, reads and edits the files in your repo, and runs commands. That makes it a natural fit for sites whose posts live in the repo as Markdown or MDX, and a workable one for CMS sites through an API or an MCP server.
The risk is the one every automated content setup carries. Google's spam policies say scaled content abuse is "when many pages are generated for the primary purpose of manipulating search rankings and not helping users", "no matter how it's created". A workflow that makes publishing easy also makes that easy. So this guide spends as much time on the limits you build in as on the steps.
Everything about Claude Code below comes from Anthropic's Claude Code docs, read on 21 October 2026. Features change, so check them before you build.
What to automate and what to keep
Split the job into steps, and decide for each one what the agent does and what a person does.
| Step | Claude Code does | Feature | A person does |
|---|---|---|---|
| Choose topics | Pulls ideas from your data and what ranks now | MCP server or web search | Approves the list |
| Research | Reads the ranking pages and their sources, saves quotes and URLs | Subagent with web tools | Spot-checks sources |
| Brief | Turns research into an angle, an outline and links | Skill | Rejects briefs with no angle |
| Draft | Writes the post in your format, on a branch | Skill + CLAUDE.md | Nothing yet |
| Check | Lengths, links, banned words, unsourced numbers | Script + hook | Reads the failures |
| Review | Opens a pull request or a CMS draft | Git or MCP | Fact-checks, edits, approves |
| Publish | Merges or schedules approved drafts | Headless run | Sets the pace |
| Measure | Reads Search Console four weeks later | MCP server | Decides what to fix |
The right-hand column is the part not to automate. Google's guidance on generative AI content, updated on 1 October 2026, says "generative models don't retrieve facts, but predict a likely sequence of words", and that "it is critical to manually factcheck and review all AI-generated content for accuracy and trustworthiness before publishing." It adds that the review covers titles, meta descriptions, structured data and image alt text too.
For the wider question of what's safe to automate in SEO beyond writing, see our page on SEO automation.
Step 1: put the rules in CLAUDE.md
Anthropic's memory docs describe CLAUDE.md files as "markdown files that give Claude persistent instructions", which Claude "reads at the start of every session." They suggest keeping the file to facts Claude needs every time, and moving multi-step procedures into skills.
For SEO writing, that's a short list:
# Content rules
- Posts live in content/blog/<slug>.md. Copy the front matter of an existing post.
- Titles 60 characters or fewer, meta descriptions 155 or fewer.
- Open with a two- or three-sentence answer, then the detail.
- Every fact, number or quote links to the page it came from, opened in this session.
If you can't find a source, leave the claim out.
- Never invent statistics, customers, quotes or reviews.
- Link to 3-5 of our existing pages where they help the reader. Only link to paths that exist.
- Follow docs/style.md for voice and the banned-word list.
- Never publish. Drafts go on a branch and into a pull request.
The last line matters most, and it isn't enough on its own. A line in CLAUDE.md is an instruction the model follows most of the time, not a lock. The lock is a hook, in step 4.
Step 2: make each step a skill
A skill is a SKILL.md file with instructions. In Anthropic's words, "Claude uses skills when relevant, or you can invoke one directly with /skill-name", and unlike CLAUDE.md, "a skill's body loads only when it's used". Project skills live in .claude/skills/<name>/SKILL.md, and the folder name becomes the command.
Three skills cover most of the work:
/seo-briefreads the research for one keyword and writes the brief: what the ranking pages cover, what none of them answer, the questions people ask, the angle, and 3-5 of your pages to link./seo-draftwrites the post from an approved brief, following CLAUDE.md, on a new branch./seo-checkruns your checks on a draft and lists what failed.
A skill is YAML front matter plus plain instructions:
---
description: Write an SEO brief for one keyword. Use when asked to plan or brief an article.
---
1. Read research/<keyword>.md. If it doesn't exist, stop and ask for research first.
2. List what the top pages cover, and the questions none of them answer.
3. Write the angle in one sentence: what this post can say that they don't.
If you can't, say so and stop. Don't write a brief without an angle.
4. Outline the h2 sections, answer first.
5. Pick 3-5 of our pages to link, from the sitemap.
Step 3 of that skill is the one to be strict about. Google's AI optimization guide contrasts commodity content, "often based on common knowledge", with content that offers "experienced takes that go beyond common knowledge" (our summary). A model can write the commodity version of any article. If your brief can't name what the post adds, drop the topic.
Step 3: run research in a subagent
Research fills the context with search results and page text you won't need again. That's what subagents are for: "each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions," and returns only a summary to the main conversation.
A project subagent is a Markdown file in .claude/agents/:
---
name: seo-researcher
description: Researches one keyword for an SEO article. Use before writing a brief.
tools: WebSearch, WebFetch, Read, Write
---
Search the keyword. Read the top pages and the primary sources they cite:
official docs, vendor pages, studies. Save research/<keyword>.md with:
- each claim worth making, the exact quote, the URL and the date you read it
- what the top pages agree on, and what none of them cover
Never record a number you didn't read on a page.
The research file is the audit trail. When a reviewer asks where a number came from, the answer is in the file, with the quote.
Keep this subagent's tools narrow. Pages on the web can carry text written to steer an AI agent, and Anthropic's MCP docs warn that servers fetching external content "can expose you to prompt injection risk". A researcher that can read the web and write one notes file can't do much harm if a page tries.
Step 4: check every draft, and block what fails
Most quality problems in AI drafts are mechanical, so a script catches them before a person spends time:
- title and meta description over your limits
- more than one H1, or skipped heading levels
- internal links to paths that don't exist
- external links that don't load
- numbers with no link in the same paragraph (a heuristic, but a useful one)
- banned words from your style guide
- a title or slug too close to a post you already have
The /seo-check skill can run the script, but a skill is still something Claude chooses to use. Hooks aren't: they're commands that "execute automatically at specific points in Claude Code's lifecycle." A PreToolUse hook runs before a tool call. If it exits with code 2, the call is blocked, and Claude receives the hook's stderr as the tool's error.
This hook, in .claude/settings.json, runs your checks before any git push:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"if": "Bash(git push *)",
"command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/check-drafts.sh"
}
]
}
]
}
}
check-drafts.sh runs the checks on the posts that changed. If any fail, it prints the failures to stderr and exits 2. Claude reads why, fixes the draft and tries again. If your drafts go to a CMS instead of git, put the same hook in front of the publish tool.
For page-level checks on a live URL, our free SEO checker and meta tag checker cover the basics, and the on-page SEO checklist lists what each check is for.
Step 5: a person reviews every draft
Drafts should arrive as pull requests or CMS drafts, never as live pages. The reviewer's job is specific:
- Open every source link and find the quoted sentence on the page.
- Check each number against its source. A real link next to a wrong number is the most common failure.
- Look for claims with no link. They usually came from the model's memory, which is where outdated prices and retired features live.
- Check anything about your own product. Features and prices change faster than any research file.
- Rewrite what sounds generic. If a paragraph could sit on any competitor's blog, it adds nothing.
Google also suggests telling readers how content was made where that helps them: "consider adding information on how your content was created in a way that makes sense for your audience." A named reviewer who actually read the post is the simplest version.
Step 6: run it on a schedule, at a slow pace
Once the steps work by hand, headless mode runs them without you: "add the -p (or --print) flag to any claude command to run it non-interactively." The --allowedTools flag pre-approves tools using permission rules, so the run can't do more than you allowed:
claude -p "Run /seo-draft for the oldest brief in briefs/approved/, then /seo-check, then open a pull request." \
--allowedTools "Read,Write,Edit,Bash(git checkout *),Bash(git add *),Bash(git commit *),Bash(git push *),Bash(gh pr create *)"
Run it from cron or CI. With --output-format json, the result includes total_cost_usd, so you can log what each article costs. Anthropic also offers cloud scheduled tasks, created with /schedule, which run even when your computer is off.
Then set the pace. Google doesn't publish a safe number of new pages a day. On Versely, our own product, about 2,500 posts in one month got indexing throttled, and the pace we use now is about 20 a day (what happened). A new domain should start far slower. A heuristic: no faster than Google is indexing what you already have. If Search Console's Page indexing report shows a growing pile of Discovered, currently not indexed pages, slow down.
When not to automate
Some situations call for fewer pages, not a faster pipeline:
- Google hasn't indexed what you have. More pages won't fix a crawl backlog. Our 90-day plan for a new domain covers what to do first.
- You'd be making a page per keyword variant. One strong page per topic beats ten near-duplicates. That pattern is what the scaled content abuse policy describes, and programmatic SEO without deindexing shows how to build page families that stay indexed.
- You have nothing to add. If your brief can't name an angle, the post will be a rewrite of the top three results.
- A wrong answer could cost a reader money or their health. Write those pages with someone qualified, and use the agent for research and checks only.
- Nobody has time to review. Then the drafts wait. An unreviewed post is the one that ships a wrong price.
Where an MCP server fits
Claude Code connects to MCP servers with one command: claude mcp add --transport http <name> <url>. You need one for data the agent can't get by reading pages: keyword volumes and difficulty, your own Search Console numbers, and a publish step for your CMS. Our roundup of SEO MCP servers lists the ones that exist and what they cost. Anthropic's advice applies to all of them: "Verify you trust each server before connecting it."
LaunchRanked's server is one option. Its page checks (audit_page, audit_ai_search and others) work without a paid plan. The SEO Skills plan adds keyword data (plan_content, keyword_metrics), briefs (build_brief), draft checks (check_draft) and publishing to your CMS at a daily pace (publish_article), and a draft that fails the checks is never published. Setup for Claude Code is on the MCP docs page. We used the same server to fix our own site from Claude Code. If you'd rather not run any of this yourself, Autopilot writes and publishes for you.
Checklist before the first automated post
- CLAUDE.md has the voice, sourcing and linking rules, and "never publish"
- Skills for the brief, the draft and the checks
- A research subagent with web tools that saves quotes and URLs to a file
- A check script, enforced by a
PreToolUsehook on push or publish - Drafts arrive as pull requests or CMS drafts, never as live pages
- A named person checks every source and number before approving
- A written pace, slower than Google is indexing your existing pages
- Search Console reviewed monthly; the five reports that matter are enough
Frequently asked questions
Can Claude Code write and publish SEO articles on its own?
It can run every step: research with web search, a brief, a draft in your repo, checks, a commit or a call to your CMS. Google's guidance says it's critical to manually fact-check and review all AI-generated content before publishing, titles and meta descriptions included. So automate the steps and keep a person on the publish step.
Does Google penalize AI-written content?
Not for being AI-written. Google's scaled content abuse policy targets many pages made mainly to manipulate rankings, no matter how they're created, and its guidance warns that using generative AI to make many pages without adding value for users may break it. What Google asks for is accuracy, quality and relevance.
What should go in CLAUDE.md for SEO writing?
The facts Claude needs in every session: your voice rules, where posts live and their front matter, the rule that every fact links to a source opened in the session, how to link to your own pages, and that it never publishes. Anthropic's docs suggest moving multi-step procedures into skills, which load only when used.
How many AI articles a day is safe to publish?
Google doesn't give a number. On Versely, our own product, about 2,500 posts in one month got indexing throttled, and the pace we use now is about 20 a day. A new domain should start far slower and add pages only while Search Console's Page indexing report stays healthy.
Do I need an MCP server to do this?
No. Claude Code can search the web, fetch pages and edit files on its own. An MCP server adds what it can't get by reading pages: keyword volumes, your Search Console numbers, or a publish step to your CMS.
Tools and pages for this topic
Free tools, templates, lists and glossary entries on the same subject.
- Free toolAI visibility checkerDo ChatGPT, Claude, Perplexity and Gemini name you? Free check
- Free toolGEO checkerCan AI search fetch, read and cite this page? Scored checklist
- GlossaryGenerative engine optimization (GEO)Generative engine optimization (GEO) is the practice of making your content more likely to be retrieved, used and…