⌘ SEO Evaluation API for Cursor IDE
Give your Cursor AI agent the ability to test SEO quality of any page it edits.
Cursor is the AI-native code editor. By adding a custom rule, you can teach Cursor’s AI to automatically evaluate SEO quality whenever it generates or modifies web pages. The agent calls SEODiff’s agentic evaluation API and interprets the results inline.
System Prompt / Configuration
Copy this prompt and paste it into your IDE’s AI configuration:
# SEO Quality Rule for Cursor
# Add this to your .cursor/rules file or Cursor Settings > Rules for AI
Whenever you create or edit an HTML page, a Next.js page component, or a
template that renders HTML:
1. After making the change, call the SEODiff API to evaluate the page:
POST https://seodiff.io/api/v1/agent/evaluate
Headers: Authorization: Bearer $SEODIFF_API_KEY
Body: {
"urls": ["<the URL of the page you edited>"],
"assertions": [
{"rule": "has_h1"},
{"rule": "has_meta_description"},
{"rule": "has_schema"},
{"rule": "no_placeholders"},
{"rule": "min_word_count", "value": 200},
{"rule": "max_token_bloat", "value": 8.0}
],
"wait": true
}
2. If any assertion fails, fix the issue before considering the task complete.
3. Report the ACRI score and any failing assertions to the user.Setup
# Set your API key in Cursor's environment # Cursor Settings > Features > Terminal > Environment Variables SEODIFF_API_KEY=your_api_key_here
Example Interaction
User: "Create a landing page for our new product, SuperWidget." Cursor AI: 1. Creates the page with H1, meta description, schema markup 2. Calls SEODiff API: POST /api/v1/agent/evaluate 3. Result: 5/6 assertions pass, "has_schema" failed (missing Product schema) 4. Adds JSON-LD Product schema 5. Re-evaluates: 6/6 pass, ACRI score: 78 6. Reports: "Page created with ACRI score 78. All SEO assertions pass."
Assertion Rules to Use
The best assertion rules for AI agent workflows:
has_h1
Ensure every page has exactly one H1 heading tag.
has_schema
Ensure every page has valid JSON-LD schema markup for rich results.
no_placeholders
Find template variables like {{city}} or [TBD] that leaked into production HTML.
max_token_bloat
Detect when boilerplate overwhelms useful content for LLM crawlers.
max_js_ghost_ratio
Flag pages where content is rendered client-side and invisible to crawlers.
min_word_count
Prevent thin content by requiring a minimum number of words per page.