Getting Started with SEO Machine: Automatically Generating SEO-Optimized Blog Posts with AI

March 7, 2026

Difficulty: β­β­β˜†β˜†β˜† (Beginner) | Duration: 10-15 minutes | Takeaway: Master the complete workflow of using AI to automatically generate SEO-optimized blog posts.


Target Audience

This article is intended for technical personnel with 1-3 years of development experience. You don't need to be an SEO expert; you only need:

  • Basic familiarity with command-line operations
  • An interest in AI writing and SEO optimization
  • A desire to learn how to produce blog content in bulk using AI

TIP

SEO Machine is an open-source Claude Code workspace specifically designed to create SEO-optimized blog content. It combines custom commands, professional Agents, and Python analysis modules to research, write, optimize, and publish articles.


Core Dependencies and Environment

Before we begin, let's prepare the development environment. You will need to install the following software:

DependencyDescription
Python 3.xBase for running the project
Claude Code CLIThe core engine for AI writing
Anthropic API KeyTo call the Claude large language model

TIP

If you haven't installed Claude Code yet, you can download and install it at https://claude.ai/code.

Optional Dependencies (for advanced features):

  • Google Analytics 4 (GA4) - Traffic analysis
  • Google Search Console (GSC) - Search ranking data
  • DataForSEO - Keyword and SERP data
  • WordPress - Article publishing

Project Structure

After cloning, you will find a very clear project structure:

seomachine/
β”œβ”€β”€ .claude/                    # Claude Code configuration
β”‚   β”œβ”€β”€ commands/               # Slash command definitions
β”‚   β”‚   β”œβ”€β”€ research.md         # Research command
β”‚   β”‚   β”œβ”€β”€ write.md            # Writing command
β”‚   β”‚   β”œβ”€β”€ rewrite.md          # Rewriting command
β”‚   β”‚   └── optimize.md         # Optimization command
β”‚   └── agents/                 # Specialized Agents
β”‚       β”œβ”€β”€ seo-optimizer.md    # SEO Optimization Agent
β”‚       β”œβ”€β”€ meta-creator.md     # Meta tag creation Agent
β”‚       β”œβ”€β”€ internal-linker.md  # Internal link building Agent
β”‚       └── keyword-mapper.md   # Keyword mapping Agent
β”œβ”€β”€ data_sources/               # Data sources and Python analysis modules
β”‚   β”œβ”€β”€ modules/                # Analysis modules
β”‚   β”‚   β”œβ”€β”€ search_intent_analyzer.py   # Search intent analysis
β”‚   β”‚   β”œβ”€β”€ keyword_analyzer.py         # Keyword analysis
β”‚   β”‚   β”œβ”€β”€ content_length_comparator.py # Content length comparison
β”‚   β”‚   β”œβ”€β”€ readability_scorer.py        # Readability scoring
β”‚   β”‚   └── seo_quality_rater.py        # SEO quality scoring
β”‚   β”œβ”€β”€ google_analytics.py     # GA4 integration
β”‚   β”œβ”€β”€ google_search_console.py # GSC integration
β”‚   β”œβ”€β”€ dataforseo.py           # DataForSEO integration
β”‚   └── wordpress_publisher.py # WordPress publishing
β”œβ”€β”€ context/                    # Brand guidelines and context
β”‚   β”œβ”€β”€ brand-voice.md         # Brand tone and voice
β”‚   β”œβ”€β”€ style-guide.md          # Writing style guide
β”‚   β”œβ”€β”€ seo-guidelines.md      # SEO guidelines
β”‚   β”œβ”€β”€ features.md             # Product features
β”‚   └── writing-examples.md     # Writing examples
β”œβ”€β”€ research/                   # Research brief output directory
β”œβ”€β”€ drafts/                     # Draft article output directory
β”œβ”€β”€ published/                  # Published articles directory
β”œβ”€β”€ rewrites/                   # Rewritten articles directory
β”œβ”€β”€ topics/                     # Topic Ideas
β”œβ”€β”€ research_*.py              # Collection of analysis scripts
└── README.md                   # Project documentation

Step-by-Step Tutorial

Next, we will complete the entire configuration and writing process step by step.

Step 1: Install Dependencies

First, pull the project locally and install the Python dependencies:

# Clone the repository
git clone https://github.com/your-repo/seo-machine.git
cd seo-machine

# Install Python dependencies
pip install -r data_sources/requirements.txt

WARNING

If you are using macOS, the system's default Python version might be outdated. It is recommended to install a newer version via Homebrew:

brew install python3

Step 2: Configure Context Files

This is the most critical step! Context files determine the style and quality of AI writing. You need to fill out these core files:

2.1 Brand Voice (brand-voice.md)

Define your brand's voice and tone:

# Brand Voice

## Voice Pillars
1. Professional but approachable
2. Educational and informative
3. Trustworthy and authoritative

## Tone Guidelines
- Avoid overly academic jargon; use plain, easy-to-understand language
- Use short sentences and stay concise
- Add a touch of humor where appropriate

## Do's and Don'ts
- βœ… Address the reader as "you"
- βœ… Use specific examples to illustrate points
- ❌ Avoid industry buzzwords
- ❌ Don't sound condescending

TIP

There is a complete example for reference: examples/castos/brand-voice.md

2.2 Product Features (features.md)

List the features of your product or service:

# Features

## Core Features
- Feature 1: Automated writing
- Feature 2: SEO optimization
- Feature 3: One-click publishing

## Value Propositions
- Save 80% on content creation time
- Write great articles without professional SEO knowledge

2.3 Writing Examples (writing-examples.md)

This is the most important part! Find 3-5 of your best blog posts and paste them in:

# Writing Examples

## Example 1: [Article Title]
[Full article content...]

## Why this is good
- Clear structure
- Vivid language
- Includes practical cases

TIP

The more detailed the Context files, the higher the quality of the AI-written articles! It is recommended to spend 5 minutes filling them out carefully.

Step 3: Launch Claude Code

Now open Claude Code and enter the project directory:

claude-code .

Alternatively, open the project in VS Code, then use Cmd+Shift+P to bring up the command palette and type "Claude Code: Start".

Step 4: Execute Research Command

In the Claude Code dialog box, enter:

/research [your topic]

For example:

/research Python Asynchronous Programming Tutorial

This will:

  1. Analyze your topic
  2. Research competitors
  3. Generate keyword suggestions
  4. Create search intent analysis
  5. Generate a research brief in the research/ directory

Step 5: Generate the Article

Once the research is complete, start writing the article:

/write Complete Guide to Python Asynchronous Programming

This will:

  1. Write a full blog post based on the research brief (2000+ words)
  2. Automatically trigger the SEO Optimization Agent
  3. Generate meta tags (Title, Description, Keywords)
  4. Create internal link suggestions
  5. Generate the following in the drafts/ directory:
    • Complete Markdown article
    • SEO optimization report
    • Internal link suggestion report
    • Keyword analysis report

TIP

If you want to write a simple article more quickly, use:

/article [topic]

This is a simplified version of the writing command.

Step 6: View the Optimization Report

Open the drafts/ directory to see the generated files. An SEO optimization report looks something like this:

# SEO Optimization Report

## Keyword Density
- "Python Asynchronous Programming": 2.5% (βœ… Target Met)
- "async await": 1.8% (βœ… Target Met)

## Content Length
- Current: 2400 words
- Competitor Average: 2100 words (βœ… Exceeded)

## Readability
- Flesch Reading Ease: 72 (Good)
- Grade Level: 8 (Easy to understand)

## SEO Score: 85/100

Step 7: Publish to WordPress (Optional)

If you have a WordPress site, you can publish with one click:

/publish-draft drafts/your-article.md

Requires pre-configuration of the WordPress API:

  • Add WordPress URL and API Key in data_sources/config/.env
  • Ensure the Yoast SEO plugin is installed

Step 8: Other Common Commands

In addition to the above, SEO Machine has several other useful commands:

# Rewrite existing articles (update content)
/rewrite [topic]

# Final SEO polish
/optimize [file]

# Analyze existing articles or URLs
/analyze-existing [URL]

# Performance review (based on GA4/GSC data)
/performance-review

# Content priority matrix
/priorities

# SERP analysis
/research-serp [keyword]

# Competitor gap analysis
/research-gaps

# Trending topic research
/research-trending

Troubleshooting

Issue 1: Python Dependency Installation Failed

Symptom: Error when running pip install.

Solution:

  1. Upgrade pip: pip install --upgrade pip
  2. Use a local mirror (if applicable):
    pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn
    

Issue 2: Incomplete Context File Configuration

Symptom: Poor article quality that doesn't meet expectations.

Solution:

  1. Add more to writing-examples.md, providing at least 3 good articles.
  2. Describe tone and style in brand-voice.md in more detail.
  3. Include unique selling points (USPs) of the product in features.md.

Issue 3: Claude Code Command Not Working

Symptom: No response after entering /research.

Solution:

  1. Ensure you are typing in the Claude Code dialog (not the terminal).
  2. Check the command spelling.
  3. Ensure you are using the forward slash: /research.

Issue 4: Article Quality Not Good Enough

Symptom: The AI-written article feels too bland.

Solution:

  1. Add more writing examples to the Context files.
  2. Use /research first so the AI can be more targeted.
  3. Manually modify the prompt or add more requirements during /write.

Issue 5: WordPress Publishing Failed

Symptom: Message indicating unable to connect to WordPress.

Solution:

  1. Check the WordPress URL and API Key in .env.
  2. Verify that the WordPress REST API is enabled.
  3. Check if the Yoast SEO plugin is installed.

Issue 6: Insufficient API Quota

Symptom: Message indicating "API quota exceeded".

Solution:

  1. Go to the Anthropic console to check quota usage.
  2. Reduce the size of Context files (streamline writing examples).
  3. Consider upgrading your API plan.

Core Functionality Analysis

You might be curious how SEO Machine actually works. The core lies in its command system and Agent collaboration.

Command System

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Claude Code                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚  /research    β†’  Generate research brief                      β”‚
β”‚       ↓                                                         β”‚
β”‚  /write       β†’  Generate article + Trigger optimization Agentβ”‚
β”‚       ↓                                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚              Auto-triggered Optimization Agents       β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚    β”‚
β”‚  β”‚  β”‚ SEO        β”‚ β”‚ Meta       β”‚ β”‚ Internal   β”‚       β”‚    β”‚
β”‚  β”‚  β”‚ Optimizer  β”‚ β”‚ Creator    β”‚ β”‚ Linker     β”‚       β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚       ↓                                                         β”‚
β”‚  /optimize   β†’  Final SEO polish                             β”‚
β”‚       ↓                                                         β”‚
β”‚  /publish    β†’  Publish to WordPress                         β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Python Analysis Pipeline

The project also includes complete Python analysis modules:

ModuleFunction
search_intent_analyzer.pySearch intent classification (Informational/Navigational/Transactional)
keyword_analyzer.pyDetection of keyword density, distribution, and stuffing
content_length_comparator.pyCompares content length of the top 10 SERP results
readability_scorer.pyReadability scoring (Flesch Reading Ease)
seo_quality_rater.pyComprehensive SEO score (0-100)

Run these scripts directly:

python3 seo_baseline_analysis.py
python3 seo_competitor_analysis.py
python3 research_serp_analysis.py

Opportunity Scoring Algorithm

The project features a built-in opportunity scoring algorithm (opportunity_scorer.py) that evaluates keywords using 8 weighted factors:

FactorWeight
Search Volume25%
Position (Current Ranking)20%
Intent (Search Intent)20%
Competition15%
Cluster (Topic Clustering)10%
CTR (Click-Through Rate)5%
Freshness (Content Freshness)5%
Trend5%

Advanced Directions

Once you've mastered the basics, you can explore these advanced features:

1. Custom Agents

Add new Agents in the .claude/agents/ directory following the existing templates. For example, you could create an Agent specifically for writing "Comparison & Review" articles.

2. Add More Data Sources

The project supports integration with:

  • Google Analytics 4 - Traffic and engagement data
  • Google Search Console - Ranking and impression data
  • DataForSEO - SERP positions and keyword metrics

Configure the corresponding API Keys in data_sources/config/.env.

3. SEO Analysis Scripts

The project includes several analysis scripts that can be run independently:

# Quick wins analysis
python3 research_quick_wins.py

# Competitor gap analysis
python3 research_competitor_gaps.py

# SERP analysis
python3 research_serp_analysis.py

# Topic clustering
python3 research_topic_clusters.py

# Trend analysis
python3 research_trending.py

4. Bulk Content Production

Combined with cron or GitHub Actions, you can schedule research commands to run periodically and generate content automatically. For example, automatically analyze competitor gaps every week to generate new content ideas.

5. Landing Page Support

The project also supports creating Landing Pages:

/landing-write [topic]      # Create a Landing Page
/landing-audit [file]       # Audit for conversion rate issues
/landing-research [topic]   # Research positioning
/landing-competitor         # Competitor analysis
Updated March 7, 2026