LLM Prompting Guide for SEO
Essential techniques and patterns for prompting LLMs in SEO automation. Part of the Building Agentic SEO Consultants course. Use this with Module 2: Python for SEO Automation (code generation), Module 3: APIs & JSON (workflows and API prompts), and Module 4: Building SEO Agents (goal and constraint prompts).
Core Prompting Principles
1. Be Specific and Detailed
Bad: “Write Python code for SEO” Good: “Create a Python script that reads Google Search Console CSV data, calculates CTR by keyword, and exports the top 20 performing keywords to a new CSV file”
2. Include Context and Requirements
- Specify the SEO tool (Ahrefs, SEMrush, GSC)
- Mention data formats and column names
- Include performance requirements
- Specify output formats
3. Request Comments and Documentation
Always add: “Please include detailed comments explaining each step of the code”
Essential Prompt Templates
Python Script Generation
Create a Python script that:
- Reads [SEO_TOOL] data from [FILE_FORMAT]
- Performs [SPECIFIC_ANALYSIS]
- Exports results to [OUTPUT_FORMAT]
- Includes detailed comments for each step
- Handles common data issues like missing values
Data Analysis Prompts
Analyse [SEO_DATA_TYPE] data to:
- Identify [SPECIFIC_PATTERNS]
- Calculate [METRICS]
- Create [VISUALISATIONS]
- Export [FORMATTED_RESULTS]
Automation Workflow Prompts
Create an automated workflow that:
- Connects to [DATA_SOURCE]
- Processes [DATA_TYPE]
- Applies [ANALYSIS_METHODS]
- Sends [NOTIFICATIONS/REPORTS]
- Runs [SCHEDULE]
SEO-Specific Prompting Techniques
1. Keyword Analysis Prompts
"Create a Python script to analyze keyword data from Ahrefs that:
- Groups keywords by search intent
- Calculates keyword difficulty scores
- Identifies content gaps
- Exports prioritised keyword lists
- Includes data validation and error handling"
2. Technical SEO Prompts
"Build a technical SEO audit tool that:
- Crawls website URLs
- Checks for common technical issues
- Generates prioritised fix recommendations
- Creates executive summary reports
- Handles large site crawls efficiently"
3. Content Optimization Prompts
"Develop a content analysis system that:
- Analyses content performance metrics
- Identifies optimization opportunities
- Suggests content improvements
- Tracks content ROI
- Integrates with multiple data sources"
Advanced Prompting Strategies
1. Chain of Thought Prompting
"Think step by step:
1. First, identify the data requirements
2. Then, design the analysis approach
3. Next, implement the solution
4. Finally, add error handling and validation"
2. Role-Based Prompting
"You are an expert SEO data analyst. Create a comprehensive solution for [SPECIFIC_TASK] that follows industry best practices and handles edge cases."
3. Iterative Refinement
"Based on the previous code, improve it by:
- Adding [SPECIFIC_FEATURE]
- Optimizing [PERFORMANCE_ASPECT]
- Enhancing [USER_EXPERIENCE]
- Fixing [IDENTIFIED_ISSUES]"
Common Prompting Mistakes to Avoid
1. Vague Requests
- ❌ “Make it better”
- ✅ “Add error handling for missing data and improve performance for files over 10MB”
2. Missing Context
- ❌ “Create a dashboard”
- ✅ “Create a Streamlit dashboard for Google Search Console data with filters for date range, device type, and country”
3. No Output Specifications
- ❌ “Analyse the data”
- ✅ “Analyse the data and export a CSV with columns: keyword, clicks, impressions, CTR, and position”
SEO Tool-Specific Prompts
Google Search Console
"Create a Python script for Google Search Console data that:
- Handles the standard GSC export format
- Processes query, page, and country data
- Calculates performance metrics
- Filters by date range and device type"
Ahrefs Data
"Build an Ahrefs data processor that:
- Reads Ahrefs keyword export files
- Handles different export formats
- Calculates keyword metrics
- Identifies ranking opportunities"
SEMrush Data
"Create a SEMrush data analyser that:
- Processes SEMrush CSV exports
- Handles encoding issues
- Calculates competitive metrics
- Generates actionable insights"
Prompting for Different Outputs
Code Generation
- Specify programming language
- Include error handling requirements
- Request documentation and comments
- Mention performance considerations
Data Analysis
- Define metrics and calculations
- Specify visualisation requirements
- Include data validation steps
- Request export formats
Automation Workflows
- Define triggers and schedules
- Specify integration requirements
- Include monitoring and alerting
- Request deployment instructions
Best Practices Summary
- Be Specific: Include exact requirements and constraints
- Provide Context: Explain the SEO use case and data sources
- Request Documentation: Always ask for comments and explanations
- Include Error Handling: Specify how to handle common issues
- Test and Iterate: Refine prompts based on results
- Use Examples: Provide sample data or expected outputs
- Specify Formats: Include input/output format requirements
Related support guides
- Python Quick Reference Guide – Commands, libraries, and patterns for the code your prompts generate
- SEO Tools Integration Guide – Data sources, API patterns, and tool-specific details to include in prompts
This guide supports Module 2: Python for SEO, Module 3: APIs & JSON, Module 4: Building SEO Agents, and Module 5: Data Analysis.