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:
| Dependency | Description |
|---|---|
| Python 3.x | Base for running the project |
| Claude Code CLI | The core engine for AI writing |
| Anthropic API Key | To 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:
- Analyze your topic
- Research competitors
- Generate keyword suggestions
- Create search intent analysis
- 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:
- Write a full blog post based on the research brief (2000+ words)
- Automatically trigger the SEO Optimization Agent
- Generate meta tags (Title, Description, Keywords)
- Create internal link suggestions
- 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:
- Upgrade pip:
pip install --upgrade pip - 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:
- Add more to
writing-examples.md, providing at least 3 good articles. - Describe tone and style in
brand-voice.mdin more detail. - 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:
- Ensure you are typing in the Claude Code dialog (not the terminal).
- Check the command spelling.
- Ensure you are using the forward slash:
/research.
Issue 4: Article Quality Not Good Enough
Symptom: The AI-written article feels too bland.
Solution:
- Add more writing examples to the Context files.
- Use
/researchfirst so the AI can be more targeted. - Manually modify the prompt or add more requirements during
/write.
Issue 5: WordPress Publishing Failed
Symptom: Message indicating unable to connect to WordPress.
Solution:
- Check the WordPress URL and API Key in
.env. - Verify that the WordPress REST API is enabled.
- Check if the Yoast SEO plugin is installed.
Issue 6: Insufficient API Quota
Symptom: Message indicating "API quota exceeded".
Solution:
- Go to the Anthropic console to check quota usage.
- Reduce the size of Context files (streamline writing examples).
- 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:
| Module | Function |
|---|---|
search_intent_analyzer.py | Search intent classification (Informational/Navigational/Transactional) |
keyword_analyzer.py | Detection of keyword density, distribution, and stuffing |
content_length_comparator.py | Compares content length of the top 10 SERP results |
readability_scorer.py | Readability scoring (Flesch Reading Ease) |
seo_quality_rater.py | Comprehensive 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:
| Factor | Weight |
|---|---|
| Search Volume | 25% |
| Position (Current Ranking) | 20% |
| Intent (Search Intent) | 20% |
| Competition | 15% |
| Cluster (Topic Clustering) | 10% |
| CTR (Click-Through Rate) | 5% |
| Freshness (Content Freshness) | 5% |
| Trend | 5% |
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