SEO Audit Tool

Analyze web pages for SEO issues and generate actionable improvement recommendations.

This workflow crawls pages, analyzes on-page SEO factors, and generates prioritized fix lists.

Implementation

1import { relay } from "@relayplane/workflows";
2import { fetchHTML } from "./utils";
3
4const result = await relay
5 .workflow("seo-audit")
6
7 // Step 1: Analyze technical SEO
8 .step("technical-analysis")
9 .with("openai:gpt-4o")
10 .prompt(`Analyze this HTML for technical SEO issues:
11
12{{htmlContent}}
13
14Check:
15- Title tag (50-60 chars, keyword placement)
16- Meta description (150-160 chars, compelling)
17- Heading hierarchy (H1 unique, proper H2/H3 structure)
18- Image alt attributes (all images, descriptive)
19- Internal linking (min 3-5 relevant links)
20- URL structure (readable, keyword-rich)
21- Canonical tag
22- Schema markup opportunities
23
24Return JSON with issues array and score (0-100).`)
25
26 // Step 2: Content quality analysis
27 .step("content-analysis")
28 .with("anthropic:claude-3.5-sonnet")
29 .depends("technical-analysis")
30 .prompt(`Analyze content quality for SEO:
31
32{{htmlContent}}
33
34Target Keyword: {{targetKeyword}}
35
36Evaluate:
37- Keyword density (2-3% ideal)
38- Keyword placement (title, H1, first 100 words)
39- Content depth (min 1000 words for pillar)
40- Reading level (8th grade target)
41- Paragraph length (3-4 sentences)
42- Use of transition words
43- External authority links (2-3 minimum)
44
45Score each factor and provide specific fixes.`)
46
47 // Step 3: Competitive analysis
48 .step("competitive-gap")
49 .with("perplexity:sonar-pro")
50 .depends("content-analysis")
51 .prompt(`Analyze top-ranking competitors for this keyword:
52
53Keyword: {{targetKeyword}}
54
55Current Page Content Summary: {{contentSummary}}
56
57Research:
58- What topics do top 3 ranking pages cover that we don't?
59- Average word count of ranking pages
60- Common headings/sections they include
61- Unique angles they take
62
63Identify content gaps.`)
64
65 // Step 4: Generate action plan
66 .step("action-plan")
67 .with("anthropic:claude-3.5-sonnet")
68 .depends("technical-analysis", "content-analysis", "competitive-gap")
69 .prompt(`Create prioritized SEO improvement plan:
70
71Technical Issues: {{technical-analysis.output}}
72Content Issues: {{content-analysis.output}}
73Competitive Gaps: {{competitive-gap.output}}
74
75Prioritize fixes by:
76P0 (Critical): Major ranking factors, quick wins
77P1 (High): Moderate impact, reasonable effort
78P2 (Low): Minor improvements, nice-to-haves
79
80For each item:
81- Issue description
82- Current state
83- Recommended fix
84- Estimated impact
85- Implementation difficulty
86
87Format as actionable checklist.`)
88
89 .run({
90 htmlContent: pageHTML,
91 targetKeyword: "enterprise workflow automation",
92 contentSummary: "Overview of workflow automation tools...",
93 });
94
95console.log("SEO Score:", JSON.parse(result.steps["technical-analysis"].output).score);
96console.log("Action Plan:", result.steps["action-plan"].output);

Batch Site Audit

1// Audit entire site
2const sitemap = await fetchSitemap("https://example.com/sitemap.xml");
3
4const results = [];
5for (const url of sitemap.urls.slice(0, 50)) {
6 const html = await fetchHTML(url);
7
8 const audit = await relay
9 .workflow("seo-audit")
10 .run({
11 htmlContent: html,
12 targetKeyword: extractKeyword(url),
13 contentSummary: extractTextContent(html).slice(0, 500),
14 });
15
16 results.push({
17 url,
18 score: JSON.parse(audit.steps["technical-analysis"].output).score,
19 issues: audit.steps["action-plan"].output,
20 });
21}
22
23// Generate site-wide report
24const sortedByScore = results.sort((a, b) => a.score - b.score);
25console.log("Pages needing most work:", sortedByScore.slice(0, 10));

Automated Monitoring

1# Weekly SEO health check
2relayplane schedules create weekly-seo-audit \
3 --workflow seo-audit \
4 --cron "0 8 * * MON" \
5 --input '{"url": "https://example.com/blog"}'

Sample Output

Action Plan Example:**P0 - Critical (Fix This Week)** - Missing H1 tag - Add "Enterprise Workflow Automation Guide" - Title too short (38 chars) - Expand to include target keyword - No meta description - Write compelling 155-char description **P1 - High Priority** - Content thin (620 words) - Expand to 1,500+ words - Only 1 internal link - Add 4-6 contextual links - 3 images missing alt text - Add descriptive alt attributes **P2 - Nice to Have** - Add FAQ schema for featured snippets - Improve reading level (current: 12th grade, target: 8th)