seoanything-cli 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -2
- package/bin/seoanything.js +4 -0
- package/dist/tools.mjs +211 -0
- package/package.json +56 -4
- package/src/api.js +50 -0
- package/src/cli.js +216 -0
- package/src/cli.test.js +38 -0
- package/src/config.js +30 -0
- package/src/config.test.js +27 -0
- package/src/connect.js +260 -0
- package/src/connect.test.js +86 -0
- package/src/login.js +42 -0
- package/src/mcp.js +31 -0
package/README.md
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# seoanything (v2)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Terminal access to [SEOAnything Cloud](https://www.seoanything.dev): trending searches, keyword research, SEO Chat, Blog Studio, audits — plus a local MCP server for Claude Code, Cursor, VS Code and Claude Desktop. Every v1 command (`init`, `install`, `audit`, `schema`, `llms-txt`, `sitemap`, `menu`) still works unchanged.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx seoanything login # device-flow login, opens your browser
|
|
7
|
+
npx seoanything trends daily --geo NP # what Nepal is searching right now
|
|
8
|
+
npx seoanything keywords cluster "ai seo" # clusters with intent + pillar flags
|
|
9
|
+
npx seoanything chat "why is my blog not indexed?"
|
|
10
|
+
npx seoanything blog new "MCP servers for SEO" --words 1500 --out post.md
|
|
11
|
+
npx seoanything audit https://example.com --cloud
|
|
12
|
+
npx seoanything mcp # stdio MCP server (Node ≥ 22.18)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
| Command | What it does |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `login [--server <url>] [--api-key <key>] [--no-browser]` | Device-flow login, or store an API key for CI |
|
|
20
|
+
| `logout` · `whoami` · `usage` | Credentials and today's quota |
|
|
21
|
+
| `trends daily\|realtime [--geo NP] [--hl en] [--limit 20] [--hours 4] [--local]` | Trending searches; `--local` fetches from your machine with google-trends-js |
|
|
22
|
+
| `keywords suggest\|interest\|cluster "<seed>" [--period "today 12-m"] [--geo US]` | Keyword research (`interest` takes a comma list of ≤5) |
|
|
23
|
+
| `topics [--day YYYY-MM-DD]` | Topic Radar across Google, GitHub and GitLab |
|
|
24
|
+
| `repos trending [--source all] [--window 7d] [--language ts] [--topic seo]` | Trending repositories |
|
|
25
|
+
| `chat ["question"] [--mode keywords] [--model fast]` | One-shot answer, or a REPL with `/mode`, `/model`, `/new`, `/exit` |
|
|
26
|
+
| `blog new "<topic>" [--keyword k] [--words 1500] [--tone friendly] [--out post.md] [--frontmatter astro] [--yes]` | Brief → outline → sections → SEO pass; writes the markdown |
|
|
27
|
+
| `blog list` · `blog get <id> [--format md\|html\|mdx]` · `blog publish <id> --target github` | Manage posts |
|
|
28
|
+
| `audit <path\|url> [--cloud]` | v1 local auditor; `--cloud` runs the cloud audit and saves history |
|
|
29
|
+
| `mcp` | Local stdio MCP server exposing cloud tools + `local_audit`, `local_llms_txt`, `local_sitemap`, `local_install_skills` |
|
|
30
|
+
| `config get\|set <key> <value>` | `server`, `geo`, `hl`, `model` defaults |
|
|
31
|
+
|
|
32
|
+
Global flags: `--json` (machine output, no colours), `--server <url>`, `--quiet`, `--no-color`.
|
|
33
|
+
Exit codes: `0` ok · `1` error · `2` usage · `3` not logged in · `4` quota / rate limited · `5` upstream unavailable.
|
|
34
|
+
|
|
35
|
+
## Credentials
|
|
36
|
+
|
|
37
|
+
Saved to `$XDG_CONFIG_HOME/seoanything/config.json` (`~/.config/seoanything/`, `%APPDATA%\seoanything\` on Windows) with mode `0600`.
|
|
38
|
+
Environment overrides for CI: `SEOANYTHING_SERVER`, `SEOANYTHING_API_KEY` (an `sa_…` key from Settings → API keys), `SEOANYTHING_TOKEN`.
|
|
39
|
+
|
|
40
|
+
## Your own AI CLI (`connect`)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
seoanything connect
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Links this computer to your SEOAnything account. The web app's chat and blog studio can then run on the AI CLIs installed here (Claude Code `claude`, Codex `codex`, Gemini CLI `gemini`, Antigravity `agy`) with their own logins, instead of the shared cloud models and their daily limits. Pick the default engine under Settings, "your cli". Keep the window open; close it (Ctrl+C) and the app falls back to the cloud models. The cloud sends prompts and receives text; no credential file is read or sent, tools stay off, and each call runs in an empty temporary folder. Needs Node 22 or newer. Disconnect a computer from Settings at any time.
|
|
47
|
+
|
|
48
|
+
## MCP
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{ "mcpServers": { "seoanything": { "command": "npx", "args": ["-y", "seoanything", "mcp"], "env": { "SEOANYTHING_API_KEY": "sa_xxx" } } } }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Without credentials only the `local_*` tools work; cloud tools answer "run `seoanything login`". Prefer the remote server when your client supports HTTP: `https://www.seoanything.dev/mcp` with `Authorization: Bearer sa_xxx`.
|
|
55
|
+
|
|
56
|
+
## Packaging notes
|
|
57
|
+
|
|
58
|
+
Core commands have zero runtime dependencies (`node:util.parseArgs`, `fetch`, `node:readline`). `seoanything@1` is pulled in as `seoanything-v1` for the legacy commands. `@modelcontextprotocol/sdk`, `zod` and `@alkalisummer/google-trends-js` are optional and loaded with dynamic `import()` only by `mcp` and `--local`. The `mcp` command's tools come from the monorepo packages `@seoanything/tools` and `@seoanything/core`, bundled into `dist/tools.mjs` by `pnpm run build` (run automatically by `prepack`); a checkout without the bundle falls back to the TypeScript source. Published on npm as `seoanything-cli` (the `seoanything` name belongs to the v1 skills package); it installs the `seoanything`, `seoanything-cli` and `seo-skills` commands. Release: bump `version` here and in `src/mcp.js`, then `pnpm publish` from this folder.
|
package/dist/tools.mjs
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// ../tools/src/index.ts
|
|
2
|
+
import { z as z2 } from "zod";
|
|
3
|
+
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
|
|
5
|
+
// ../core/src/skills.generated.ts
|
|
6
|
+
var SKILLS = {
|
|
7
|
+
"seo-audit": '# Comprehensive SEO Audit & Diagnostic Engine\n\nUse this skill to perform rigorous, professional SEO audits on any website or repository. A comprehensive audit examines the technical baseline, content depth, structured data, link graph, and generative AI search readiness.\n\n---\n\n## 1. The 100-Point Master SEO Audit Checklist\n\n### Category 1: Crawlability & Indexability (Weight: 25%)\n- [ ] `robots.txt` is valid, accessible at root domain, and does not block critical CSS/JS assets.\n- [ ] AI crawler user-agents (`GPTBot`, `PerplexityBot`, `ClaudeBot`) are explicitly permitted.\n- [ ] XML Sitemap exists at `/sitemap.xml`, contains only 200 OK canonical URLs, and is registered in Google Search Console.\n- [ ] Every indexable page features an explicit self-referential canonical tag.\n- [ ] Zero internal 404 links or broken redirects (no `301 -> 301` chains).\n- [ ] Parameterized URLs, search results, and admin routes include `noindex, follow` tags.\n\n### Category 2: Performance & Core Web Vitals (Weight: 20%)\n- [ ] Largest Contentful Paint (LCP) is \u2264 2.5s on mobile devices.\n- [ ] Hero image has high fetch priority: `<link rel="preload" as="image" fetchpriority="high">`.\n- [ ] Interaction to Next Paint (INP) is \u2264 200ms with zero long tasks (>50ms) blocking main thread.\n- [ ] Cumulative Layout Shift (CLS) is \u2264 0.1; all images and embeds have explicit `width` and `height`.\n- [ ] Time to First Byte (TTFB) is \u2264 800ms globally via edge CDN caching.\n- [ ] Text assets (HTML, CSS, JS, SVG) are compressed with Brotli or Gzip.\n\n### Category 3: On-Page & Semantic Content (Weight: 20%)\n- [ ] Title tags are 50\u201360 characters, front-loaded with target keyword, and unique per page.\n- [ ] Meta descriptions are 140\u2013160 characters, include target entity terms, and feature an actionable CTA.\n- [ ] Exactly one `<h1>` per page, accurately reflecting search intent.\n- [ ] Strict heading hierarchy (`h1` -> `h2` -> `h3`) with zero skipped levels.\n- [ ] All `<img>` tags possess contextually descriptive `alt` attributes.\n- [ ] Social Open Graph (`og:title`, `og:description`, `og:image`) and Twitter Card tags are present.\n\n### Category 4: Generative Engine Optimization (GEO) & AI Search (Weight: 15%)\n- [ ] `llms.txt` is deployed at domain root and listed in `robots.txt`.\n- [ ] Key informational pages employ BLUF: Direct answer defined in opening 1\u20132 sentences.\n- [ ] Passage independence: Subheaders can be extracted by LLMs without missing contextual pronouns.\n- [ ] Statistical density: At least 1 verifiable benchmark, metric, or data point per 500 words.\n- [ ] Comparative markdown/HTML tables used for commercial evaluation queries.\n\n### Category 5: Structured Data & Schema.org (Weight: 10%)\n- [ ] Valid JSON-LD markup implemented for `Organization`, `WebSite`, and `BreadcrumbList`.\n- [ ] Content pages include `BlogPosting` or `Article` with named author and date timestamps.\n- [ ] FAQ sections include compliant `FAQPage` schema.\n- [ ] Zero syntax errors when tested against Google Rich Results validator.\n\n### Category 6: Internal Link Graph & Architecture (Weight: 10%)\n- [ ] Zero orphan pages (every indexable page has at least 3 incoming internal links).\n- [ ] Maximum click depth is \u2264 3 clicks from homepage for all critical money pages.\n- [ ] Descriptive anchor text used exclusively (zero generic "click here" or "learn more" anchors).\n- [ ] Topical silo integrity: Cluster pages link upward to their parent Pillar page.\n\n---\n\n## 2. Running Automated Audits via CLI\n\nYou can run automated audits locally using the built-in SEOAnything CLI across HTML, Next.js, React, Astro, Vue, Svelte, and Markdown:\n\n```bash\n# Audit a local repository or Next.js / React project\nnpx seoanything audit .\n\n# Audit a specific Next.js page or component\nnpx seoanything audit ./app/blog/[slug]/page.tsx\n\n# Audit a specific production page or URL\nnpx seoanything audit https://example.com/blog/guide\n```\n\n### Full Modern Framework Support:\n- **Next.js (App & Pages Router)**: Detects `metadata`, `generateMetadata()`, `<Image priority>`, `app/robots.ts`, and `app/sitemap.ts`.\n- **TanStack Start**: Detects `createFileRoute` / `createRootRoute` with `head()` (parsing `meta`, `links: [{ rel: \'canonical\' }]`, and `scripts: [{ type: \'application/ld+json\' }]`).\n- **Astro**: Inspects `.astro` frontmatter, `<SEO />` component attributes, and `astro:assets` `<Image loading="eager" />` for LCP optimization.\n- **Remix & React Router v7**: Inspects `export const meta: MetaFunction = () => [...]` (title, description, canonical link objects).\n- **Nuxt 3**: Inspects `useSeoMeta()`, `useHead()`, and `<NuxtImg priority />` composables and components.\n- **SvelteKit**: Inspects `<svelte:head>` blocks containing titles, descriptions, and canonical links.\n\n---\n\n## 3. SEO Diagnostic Scorecard & Grade System\n\nWhen delivering an audit report to a stakeholder, summarize the score:\n\n| Overall Score | Health Status | Priority Action |\n| :--- | :--- | :--- |\n| **90 \u2013 100** | Grade A (Elite) | Maintain topical fresh updates, expand cluster breadth, execute Digital PR. |\n| **75 \u2013 89** | Grade B (Healthy) | Optimize Core Web Vitals (INP/LCP), expand schema coverage, refine internal anchor text. |\n| **50 \u2013 74** | Grade C (Deficient) | Fix canonical loops, resolve missing title/meta tags, eliminate orphan pages. |\n| **< 50** | Grade F (Critical) | Emergency intervention: Verify robots.txt, fix broken rendering, remove accidental noindex tags. |',
|
|
8
|
+
"seo-content": '# High-Ranking Content, Blog Playbook & E-E-A-T\n\nSearch engines no longer rank generic, rehashed AI content. Google\'s Helpful Content System strictly demotes content written solely for search engines without genuine value. To rank in modern SERPs and AI answers, content must demonstrate **E-E-A-T** (Experience, Expertise, Authoritativeness, Trustworthiness) and deliver instantaneous value through **BLUF** formatting.\n\n---\n\n## 1. On-Page Anatomy Checklist\n\nEvery page must follow this strict on-page architecture:\n\n ON-PAGE CONTENT ANATOMY \nElement | Optimal Length / Format | Formula / Rule \nTitle Tag | 50 \u2013 60 characters | [Primary Keyword] \u2013 \n | (< 580px desktop, 960 mobile) | [CTR Hook / Year] \nMeta Description | 150 \u2013 160 characters | [Core Benefit] + \n | (< 960px limit) | [Entity Terms] + CTA\nURL Slug | 2 \u2013 5 words, lowercase | /blog/[primary-kw] \n | Hyphen-separated, no dates | (Never include dates)\nHeading 1 (H1) | 1 per page, 40-70 characters | Matches search intent\n | | with natural keyword\nHeading 2 (H2) | Logical section dividers | Uses secondary KWs &\n | | question phrasing \nHeading 3 (H3) | Sub-points & PAA questions | Specific sub-answers\nImages | WebP / AVIF format | Descriptive filename\n | Width/height attributes | & contextual alt text\n\n---\n\n## 2. The BLUF (Bottom Line Up Front) Writing Framework\n\nLLMs and human searchers both prioritize immediate clarity over narrative build-up. Never hide the answer at the end of an article.\n\n### Bad (Generic AI Fluff):\n> "In today\'s fast-paced digital landscape, search engine optimization is more important than ever before. Many businesses wonder how to improve their technical SEO. In this comprehensive guide, we will explore the wonderful world of Core Web Vitals..."\n\n### Good (BLUF Answer-First):\n> **Interaction to Next Paint (INP)** measures page responsiveness and must stay **under 200 milliseconds** to pass Google Core Web Vitals. To fix poor INP, break long JavaScript tasks (>50ms) using `scheduler.yield()`, debounce input listeners, and eliminate CPU-heavy client-side hydration.\n\n### Structure of a High-Ranking Section:\n1. **Direct Answer (BLUF)**: First 1-2 sentences define or directly answer the question.\n2. **Key Takeaway Box / Bulleted Summary**: 3-5 concise bullets summarizing critical points.\n3. **Data / Benchmark Table**: Structured comparison or measurable criteria.\n4. **Step-by-Step Implementation**: Clear code snippets, instructions, or workflow.\n5. **Nuance & Edge Cases**: Common traps, trade-offs, and troubleshooting.\n\n---\n\n## 3. Demonstrating E-E-A-T (Google Helpful Content System)\n\nGoogle explicitly rates pages based on Experience, Expertise, Authoritativeness, and Trustworthiness:\n\n### 1. Experience (First-Hand Proof)\n- Include original screenshots of software, dashboards, or test results.\n- Share specific benchmarks run by your team: *"In our benchmark across 50,000 Next.js pages, switching to edge middleware reduced TTFB by 142ms."*\n- Detail real-world failures and lessons learned.\n\n### 2. Expertise (Author Credentials)\n- Every article must have a dedicated author byline.\n- Author bio must detail relevant industry credentials, background, and years of experience.\n- Link author profile to external identity proofs: LinkedIn, GitHub, personal website, or Wikipedia/Wikidata entity.\n\n### 3. Authoritativeness (Industry Recognition)\n- Cite primary academic studies, official documentation, or verified industry data (with standard outbound links).\n- Avoid circular linking to low-quality content mills.\n\n### 4. Trustworthiness (Transparency & Security)\n- Clear editorial guidelines and date transparency (`datePublished` and `dateModified`).\n- Valid SSL certificate, clear contact information, terms of service, and privacy policy.\n\n---\n\n## 4. Content Decay Audit & Refresh Protocol\n\nOver time, high-ranking articles decay as competitors publish fresher content. Run this quarterly refresh workflow:\n\n1. **Identify Decaying URLs**: In Google Search Console, filter pages with a >20% decline in clicks over the past 90 days.\n2. **Update Stale References**: Update outdated years, deprecated APIs, broken links, and outdated stats.\n3. **Analyze New SERP Entrants**: Inspect the top 3 ranking competitors to identify new subtopics or angles they cover.\n4. **Expand Passage Optimization**: Add a summary table, FAQ schema, or actionable code snippet.\n5. **Update Timestamp**: Update `dateModified` in the JSON-LD schema (do not change original `datePublished` unless completely rewritten).',
|
|
9
|
+
"seo-geo": '# Generative Engine Optimization (GEO) & AI Search\n\nGenerative Engine Optimization (GEO) is the discipline of optimizing digital content so Large Language Models (LLMs) and AI search engines (**Google AI Overviews, Perplexity, ChatGPT Search, Gemini, Claude**) discover, synthesize, and cite your brand as the authoritative source.\n\nAcademic research (Princeton & Georgia Tech) demonstrates that targeted GEO formatting increases an asset\'s visibility and citation rate in AI responses by **up to 40%**.\n\n---\n\n## 1. How AI Search Engines Retrieve & Cite Information\n\nGenerative search engines operate via **Retrieval-Augmented Generation (RAG)**:\n\n[User Prompt]\n \n \u25BC\nWeb Search Index | Traditional SEO wins the retrieval phase\n | (Top 10-20 HTML pages retrieved)\n \u25BC\nPassage Chunking | Content broken into ~200-400 token semantic chunks\n \n \u25BC\nLLM Reranking & | GEO rules dictate which passages are selected\nSynthesis | for the final response\n \n \u25BC\nAnswer + Citation | Direct quotes, markdown tables, and clickable footnotes\n\n---\n\n## 2. The 6 Core Ranking Factors of GEO\n\n### 1. Statistical Density & Quantitative Verification\nAI engines favor definitive factual anchors over subjective claims.\n- **Fluff**: *"Our caching strategy significantly boosts speed."*\n- **GEO-Optimized**: *"Implementing stale-while-revalidate edge caching reduced p99 latency by 64.2% across 1.2M daily requests in Q1 2026."*\n- Always include verifiable metrics, percentages, dollar amounts, sample sizes, and dates.\n\n### 2. Passage-Level Semantic Independence\nLLMs parse and extract individual passages, not full pages.\n- Every H2 and H3 section must function as an independent, standalone answer.\n- Avoid relying on pronouns or context established three paragraphs earlier (e.g., replace *"As mentioned above, this method..."* with *"In static site generation, pre-rendering HTML at build time..."*).\n\n### 3. Answer-First Definitional Framing\nWhen defining a term or answering a query:\n- Format the opening sentence as a definitive noun phrase: `[Entity] is [Category] that [Primary Mechanism] to achieve [Core Outcome].`\n- Follow with 3 bulleted key characteristics.\n\n### 4. Comparison Tables & Structured Markdown\nAI search engines heavily prioritize synthesized comparative tables.\n- Include structured markdown tables with clear column headers (`Feature`, `Method A`, `Method B`, `Best For`).\n- LLMs frequently pull markdown tables directly into the response UI.\n\n### 5. Multi-Source Consensus (The Web Presence Loop)\nPerplexity and ChatGPT Search verify entity validity by cross-referencing external platforms:\n- **Aggregators & Reviews**: Active listings on G2, Capterra, ProductHunt, GitHub.\n- **Community Consensus**: Unprompted mentions in Reddit threads (`r/webdev`, `r/SEO`), Hacker News, and Stack Overflow.\n- If the broader web agrees that your tool is a leader, AI synthesizers will automatically include you in "Best [Category]" prompts.\n\n### 6. The `llms.txt` and `llms-full.txt` Standard\nPlace an `llms.txt` file at the domain root (`https://example.com/llms.txt`). This provides a structured, markdown-first index designed specifically for LLM ingestion.\n\n---\n\n## 3. Production `llms.txt` Specification\n\nCreate an `llms.txt` file at the repository root or public directory:\n\n```markdown\n# Your Brand / Site Name\n\n> Concise one-sentence summary of what your product, service, or documentation does.\n\n## Core Documentation & Guides\n\n- [Getting Started](https://example.com/docs/getting-started): Step-by-step onboarding guide.\n- [Architecture & Standards](https://example.com/docs/architecture): Technical deep-dive and performance specifications.\n- [API Reference](https://example.com/docs/api): Complete endpoints, payloads, and authentication.\n\n## Benchmarks & Research\n\n- [2026 Core Web Vitals Benchmark](https://example.com/research/cwv-study): Original study analyzing 50k domains.\n- [GEO Performance Guide](https://example.com/blog/geo-playbook): How to optimize content for generative search.\n\n## Company & Entities\n\n- Official Name: Example Inc.\n- Founded: 2024\n- Primary Entity Type: Web Infrastructure Software\n- Contact: team@example.com\n```\n\n---\n\n## 4. GEO Audit Checklist\n\nWhen reviewing any page for AI Search citation readiness, verify:\n- [ ] Contains at least 1 statistical data point or quantitative benchmark per 500 words.\n- [ ] Uses BLUF formatting: First sentence directly answers the search intent.\n- [ ] Includes a structured markdown or HTML comparison table.\n- [ ] Standalone sections: Each H2 can be read independently without context loss.\n- [ ] Schema markup (`Article`, `FAQPage`, `Organization`) is valid JSON-LD.\n- [ ] `llms.txt` is present at domain root and listed in `robots.txt`.',
|
|
10
|
+
"seo-keywords": '# Keyword Research, Search Intent & Topical Clustering\n\nModern SEO has evolved from keyword stuffing into **Topical Authority** and **Entity Salience**. Search engines (and generative AI models) understand the semantic relationship between entities and reward websites that comprehensively cover an entire domain rather than chasing isolated keywords.\n\n---\n\n## 1. The 4-Tier Search Intent Taxonomy\n\nEvery search query has a primary intent. Creating content that mismatches this intent will prevent your page from ranking, regardless of backlink volume.\n\nSearch Intent | Query Modifiers / Examples | Optimal Content Type \nInformational | "how to", "what is", "guide", | Deep-dive blog post, tutorial,\n | "examples", "benefits", "why" | definition, FAQ, documentation\nCommercial | "best [x] for [y]", "vs", | Comparison table, review, \nInvestigation | "alternatives", "review 2026" | buyer\'s guide, benchmark data\nTransactional | "buy", "pricing", "discount", | Product page, pricing table, \n | "demo", "hire", "quote", "api" | checkout, free trial signup \nNavigational | "[Brand] login", "[Brand] app" | Dedicated portal or homepage \n\n---\n\n## 2. Pillar & Cluster (Hub & Spoke) Architecture\n\nTo establish topical authority, group related keywords into a **Pillar & Cluster** model:\n\n | MASTER PILLAR PAGE \n | "Complete Guide to GEO"\n \n \u25BC \u25BC \u25BC\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n | Cluster Page 1 | | Cluster Page 2 | | Cluster Page 3 \n | "llms.txt Setup" | | "Perplexity Citations" | "AI Overviews BLUF"\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n | | \n (Interlinked bi-directionally)\n\n### Linking Blueprint:\n1. **Pillar Page**: Covers the broad topic at a high level (2,500\u20135,000 words). Links out to each cluster page in relevant sections.\n2. **Cluster Pages**: Deep-dive into specific long-tail questions (1,200\u20132,000 words).\n3. **Cluster-to-Pillar Link**: Every cluster page **MUST** link back to the main Pillar page using the primary target keyword as anchor text.\n4. **Cluster-to-Cluster Link**: Siblings link to each other when contextually relevant.\n\n---\n\n## 3. Keyword Prioritization Framework\n\nPrioritize keyword opportunities using the **Opportunity Score Formula**:\n\n$$\\text{Opportunity Score} = \\frac{\\text{Search Volume} \\times \\text{Business Value (1-5)}}{\\text{Keyword Difficulty (KD)} + 1}$$\n\n### Keyword Selection Matrix:\n1. **Low-Hanging Fruit (Quick Wins)**:\n - Keyword Difficulty (KD): 0 \u2013 25\n - Search Volume: 100 \u2013 1,000 / month\n - Strategy: Publish precise, answer-first cluster articles. These rank quickly (2-6 weeks) and build domain momentum.\n2. **Core Growth (Medium-Term)**:\n - KD: 25 \u2013 50\n - Search Volume: 1,000 \u2013 10,000 / month\n - Strategy: Commercial comparison pages, interactive tools, calculators, templates.\n3. **Trophy Targets (Long-Term Topical Pillars)**:\n - KD: 50+\n - Search Volume: 10,000+ / month\n - Strategy: Massive pillar guides, definitive industry reports, unique proprietary studies.\n\n---\n\n## 4. Entity Mapping & Semantic Co-Occurrence\n\nGoogle\u2019s Hummingbird and Gemini NLP algorithms use Knowledge Graph entities. When writing about a topic, incorporate its **Salient Entities**:\n\n- **Subject Entity**: The core concept (e.g., `Next.js SEO`).\n- **Parent Entity**: The overarching domain (e.g., `Full-stack Web Development`, `Search Engine Optimization`).\n- **Sibling Entities**: Related frameworks and concepts (e.g., `Server-Side Rendering`, `Incremental Static Regeneration`, `Core Web Vitals`).\n- **Co-Occurring Semantic Attributes**: `meta tags`, `generateMetadata`, `sitemap.ts`, `robots.txt`, `Open Graph`, `JSON-LD`.\n\n---\n\n## 5. Reverse-Engineering SERP Features\n\nBefore drafting content, analyze the live Search Engine Results Page (SERP) for your keyword:\n\n1. **AI Overview Present**:\n - Provide a direct 2-sentence definition in the opening paragraph.\n - Use comparison tables and numbered steps.\n2. **Featured Snippet (Paragraph, List, or Table)**:\n - Paragraph: Answer in 40\u201350 words immediately following an H2 formatted with the query.\n - List: Use an ordered `<ol>` or unordered `<ul>` with bold prefixes.\n - Table: Use a markdown/HTML `<table>` comparing at least 3 items with 3+ attributes.\n3. **"People Also Ask" (PAA) Box**:\n - Extract the top 4-6 PAA questions.\n - Add them verbatim as `<h3>` subheadings with direct, concise answers in an FAQ section.',
|
|
11
|
+
"seo-links": '# Internal Linking Architecture & Link Acquisition\n\nLinks are the connective tissue of the web. Search engines use links to discover new pages, understand semantic topic relationships, and pass authority (PageRank). A disciplined internal link architecture often yields faster ranking improvements than costly external link building.\n\n---\n\n## 1. Internal Linking: The Topical Silo Architecture\n\nOrganize internal links into strict **Topical Silos** to reinforce topical authority:\n\n [Homepage (Highest PageRank)]\n \n \u25BC \u25BC\n [Pillar: Performance] [Pillar: Content Strategy]\n | \n \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC \u25BC\n [CWV Guide] [INP Fixes] [BLUF Guide] [E-E-A-T Tips]\n | | | \n \u2514\u2500\u2500\u2500\u25C4\u2500\u2500\u2500\u25BA\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u25C4\u2500\u2500\u2500\u25BA\u2500\u2500\u2500\u2518\n (Intra-Silo Lateral Links) (Intra-Silo Lateral Links)\n\n### Silo Rules:\n1. **Vertical Flow**: Main Pillar pages link down to all child cluster pages; all child cluster pages link back up to the main Pillar page.\n2. **Horizontal Lateral Flow**: Child pages within the same topic silo link laterally to one another using descriptive anchor text.\n3. **Cross-Silo Restrictions**: Child pages in Silo A should rarely link directly to child pages in Silo B. Instead, cross-silo links should connect at the Pillar level to maintain thematic purity.\n\n---\n\n## 2. Anchor Text Optimization & Prohibitions\n\nThe text inside an `<a>` tag tells crawlers what the destination page is about.\n\n| Anchor Text Type | Example | SEO Evaluation | Usage Rule |\n| :--- | :--- | :--- | :--- |\n| **Descriptive Keyword** | `review our Core Web Vitals checklist` | Excellent | Primary internal link method |\n| **Partial Match** | `tips for optimizing INP latency` | Excellent | Adds natural semantic variety |\n| **Branded** | `SEOAnything platform` | Good | For tool and homepage links |\n| **Generic** | `click here`, `read more`, `this link` | **POOR / FORBIDDEN** | Wastes link equity; tells crawlers nothing |\n\n---\n\n## 3. Orphan Page Eradication & Click-Depth Audit\n\n- **Orphan Pages**: Pages that exist in your sitemap or database but have zero internal links pointing to them. Search engines crawl them infrequently and treat them as low-priority.\n- **Click-Depth Rule**: Every important, indexable URL must be reachable within **3 clicks** of the homepage:\n - Click 1: Homepage -> Category / Pillar Hub\n - Click 2: Pillar Hub -> Specific Article / Product\n - Click 3: Article -> Related Deep Asset\n\n---\n\n## 4. High-Impact Backlink Acquisition Playbooks\n\n### Playbook 1: Digital PR & Benchmark Data\n1. Compile original, proprietary data (e.g., analyze 5,000 top websites in your niche for Core Web Vitals compliance).\n2. Create visually compelling charts and publish the results as an ungated industry report.\n3. Pitch the report to industry journalists and bloggers. Data-rich studies naturally accumulate hundreds of passive editorial backlinks.\n\n### Playbook 2: Unlinked Brand Mention Reclamation\n1. Set up alerts (Google Alerts, Mention, or Ahrefs) for your company and product names.\n2. When a website mentions your brand without a hyperlink, email the author/editor:\n > *"Hi [Name], loved your recent article on [Topic]. Noticed you mentioned [Brand Name] in section 3. Would you mind adding a hyperlink to [URL] so your readers can easily locate the project? Appreciate the coverage!"*\n Conversion rates typically exceed 30%.\n\n### Playbook 3: Broken Link Building (Dead Link Replacement)\n1. Use link inspection tools to identify broken outbound links (HTTP 404) on authoritative resource pages or educational portals in your niche.\n2. If you have (or can create) content that replaces the dead resource, contact the site owner notifying them of the broken link and proposing your active URL as a drop-in replacement.',
|
|
12
|
+
"seo-master": '# Master SEO & GEO Intelligence Engine (All-in-One Playbook)\n\nThis is the **All-in-One Master SEO Skill** for **SEOAnything**. It contains the complete, actionable execution playbooks across all search disciplines. You can execute any SEO audit, technical fix, content creation, schema generation, internal linking overhaul, or Generative Engine Optimization (GEO) task directly from this single skill **without needing to invoke individual sub-skills**.\n\n---\n\n## Quick Navigation: The 8 Disciplines Covered\n1. [The 5 Pillars of Modern Ranking & Triage](#1-the-5-pillars-of-ranking--triage)\n2. [Technical SEO & Core Web Vitals (CWV)](#2-technical-seo--core-web-vitals-cwv)\n3. [Keyword Research, Intent & Topical Clustering](#3-keyword-research-search-intent--topical-clustering)\n4. [Content Architecture, BLUF & E-E-A-T](#4-content-architecture-bluf--e-e-a-t)\n5. [Generative Engine Optimization (GEO) & AI Search](#5-generative-engine-optimization-geo--ai-search)\n6. [Structured Data, JSON-LD & Entity Schema](#6-structured-data-json-ld--entity-schema)\n7. [Internal Linking Silos & Backlink Acquisition](#7-internal-linking-silos--link-acquisition)\n8. [Programmatic SEO (pSEO) & Scaled Pages](#8-programmatic-seo-pseo--scaled-architecture)\n9. [100-Point Master SEO Audit & Health Scorecard](#9-100-point-master-seo-audit--scorecard)\n10. [Emergency Protocol: Diagnosing Traffic Drops](#10-emergency-protocol-diagnosing-traffic-drops)\n\n---\n\n## 1. The 5 Pillars of Ranking & Triage\n\nModern search demands a dual-pronged strategy: dominating traditional organic search results (Google, Bing) while securing citations and recommendations in generative AI engines (Google AI Overviews, Perplexity, ChatGPT Search, Gemini, Claude).\n\n THE 5 PILLARS OF RANKING \n1. Technical | Crawlability | Core Web Vitals, Robots, \n Foundation | & Indexability | Sitemaps, SSR/SSG, Speed \n2. Keyword & | Search Intent & | Pillar-Cluster Model, KD, \n Topic Hubs | Information Arch | Entities, Long-Tail Intent\n3. Content & | E-E-A-T & | BLUF Answering, First-Party\n Experience | Helpful Content | Insights, On-Page Anatomy \n4. Authority & | Internal Link | PageRank Sculpting, Silos,\n Link Graph | & Backlink Graph | Digital PR, Unlinked Brand\n5. AI Search | Generative Engine | Statistical Density, LLMs,\n & GEO | Optimization | Schema, llms.txt, Citations\n\n### 90-Day Execution Roadmap & Priority Triage\n\nWhen optimizing or building a site, address issues in order of impact:\n\n- **Stage 1: Critical Blockers (Days 0\u20137)**:\n 1. Verify site is crawlable and indexable (`robots.txt`, no accidental `noindex`, 0 HTTP 5xx errors).\n 2. Implement valid, self-referential canonical tags on all indexable pages.\n 3. Ensure mobile responsiveness with `<meta name="viewport" content="width=device-width, initial-scale=1">`.\n 4. Enforce HTTPS without mixed content or redirect loops.\n 5. Deploy standard `sitemap.xml` and `llms.txt` to the root domain.\n- **Stage 2: Content & On-Page Architecture (Weeks 2\u20134)**:\n 1. Map 1 primary target keyword and 3\u20135 semantic entities per page.\n 2. Apply **BLUF (Bottom Line Up Front)**: Answer the searcher\'s core query in the opening 1\u20132 sentences.\n 3. Enforce strict heading hierarchy (exactly one `<h1>`, followed by logical `<h2>` and `<h3>` tags).\n 4. Optimize title tags (< 60 chars), meta descriptions (< 160 chars), and descriptive image `alt` attributes.\n 5. Inject rich JSON-LD structured data (`Article`, `Organization`, `FAQPage`, `BreadcrumbList`).\n- **Stage 3: Topical Authority & Internal Linking Silos (Weeks 4\u20138)**:\n 1. Build **Pillar & Cluster Topic Hubs**: One comprehensive master pillar page linked bi-directionally to 5\u201310 sub-topic cluster posts.\n 2. Eradicate orphan pages; ensure every key page is reachable within 3 clicks of the homepage.\n 3. Use descriptive, keyword-rich anchor text internally (prohibit generic "click here" or "read more").\n- **Stage 4: Generative Engine Optimization (GEO) & Scale (Ongoing)**:\n 1. Increase statistical density: Add verifiable metrics, comparison tables, and benchmark data.\n 2. Format independent, self-contained sub-headers to maximize passage extraction by AI models.\n 3. If scaling landing pages, enforce the **60/40 Unique Value Formula** to prevent thin-content penalties.\n\n---\n\n## 2. Technical SEO & Core Web Vitals (CWV)\n\nTechnical SEO ensures that search crawlers and AI bots can discover, render, understand, and index your website without friction or latency.\n\n### 2.1 Core Web Vitals Benchmarks & Primary Fixes\n\nTarget the "Good" threshold for at least 75% of page visits:\n\n| Metric | Threshold (Good) | What It Measures | Primary Fixes |\n| :--- | :--- | :--- | :--- |\n| **LCP** (Largest Contentful Paint) | **\u2264 2.5 seconds** | Loading speed of the main content element | \u2022 Preload hero image: `<link rel="preload" as="image" href="..." fetchpriority="high">`<br>\u2022 Use modern formats (WebP, AVIF)<br>\u2022 Optimize TTFB (< 800ms) with edge CDN caching<br>\u2022 Inline critical CSS, defer non-critical scripts |\n| **INP** (Interaction to Next Paint) | **\u2264 200 ms** | Responsiveness to user clicks/taps | \u2022 Break long tasks (> 50ms) using `scheduler.yield()` or `requestAnimationFrame`<br>\u2022 Debounce input and scroll event listeners<br>\u2022 Avoid CPU-heavy client hydration on the main thread |\n| **CLS** (Cumulative Layout Shift) | **\u2264 0.1** | Visual stability during page load | \u2022 Always set explicit `width` and `height` (or `aspect-ratio`) on images/videos<br>\u2022 Reserve slot containers for dynamic ads or widgets<br>\u2022 Use `font-display: swap` with size-adjust fallback fonts |\n\n### 2.2 Production `robots.txt` Specification\n\nThe `robots.txt` file must reside at the root domain (`https://example.com/robots.txt`):\n\n```txt\nUser-agent: *\nAllow: /\nDisallow: /api/\nDisallow: /admin/\nDisallow: /checkout/\nDisallow: /private/\n\n# Explicitly allow AI search retrieval crawlers\nUser-agent: GPTBot\nAllow: /\n\nUser-agent: PerplexityBot\nAllow: /\n\nUser-agent: ClaudeBot\nAllow: /\n\n# Sitemap Declarations\nSitemap: https://example.com/sitemap.xml\nSitemap: https://example.com/sitemap-blog.xml\n```\n\n**Guardrails**:\n- **NEVER** disallow CSS or JavaScript directories (`/assets/`, `/_next/`, `/static/`). Googlebot and Perplexity need CSS/JS to render the DOM.\n- **NEVER** use `Disallow: /` on staging environments that share a database or when deploying to production.\n- Use `robots.txt` to control crawl budget, NOT to hide sensitive data (use HTTP authentication or `noindex` headers).\n\n### 2.3 Canonicalization Rules\n\nEvery indexable URL must have an explicit canonical link element in the `<head>`:\n\n```html\n<link rel="canonical" href="https://example.com/blog/technical-seo-guide" />\n```\n\n1. **Self-Referential Canonicals**: Every clean, canonical page must point to its exact self.\n2. **Handle URL Parameters**: Strip tracking parameters (`?utm_source=...`, `?ref=...`, `?fbclid=...`) in the canonical target.\n3. **HTTP vs HTTPS & WWW vs non-WWW**: Enforce 301 redirects to the chosen canonical protocol and subdomain.\n4. **Trailing Slashes**: Enforce either trailing slash (`/page/`) or non-trailing slash (`/page`) consistently site-wide.\n\n### 2.4 HTTP Status Codes & Redirects\n\n- **200 OK**: Normal live indexable page.\n- **301 Moved Permanently**: Passes ~99% of PageRank; search engines update their index. Use for permanent URL migrations.\n- **302 Found (Temporary)**: Does NOT transfer full link equity; index retains original URL.\n- **404 Not Found**: Dropped from index after repeated crawls.\n- **410 Gone**: Dropped from index faster than 404. Use for intentional permanent deletions.\n- **500 / 503 Server Error**: Crawler backs off; temporary 503 avoids ranking penalty during maintenance. Never leave 500s active.\n- **Zero Redirect Chains**: Avoid chaining redirects (`A -> B -> C`). Always link directly to `C`.\n\n### 2.5 Modern Framework Implementations\n\n| Framework | Metadata Pattern | LCP Hero Image Optimization | Sitemaps & Robots |\n| :--- | :--- | :--- | :--- |\n| **Next.js** (App Router) | `export const metadata: Metadata = { ... }`<br>or dynamic `generateMetadata()` | `<Image src="..." alt="..." priority />` | `app/sitemap.ts`<br>`app/robots.ts` |\n| **TanStack Start** | `createFileRoute(\'/...\')({ head: () => ({ meta: [...], links: [...] }) })` | `<img src="..." alt="..." fetchpriority="high" />` | `app/routes/sitemap.xml.ts`<br>`app/routes/robots.txt.ts` |\n| **Astro** | Frontmatter variables or `<SEO title="..." description="..." />` | `<Image src={...} alt="..." loading="eager" />` | `@astrojs/sitemap` in `astro.config.mjs` |\n| **Remix / React Router** | `export const meta: MetaFunction = () => [...]` | `<img src="..." alt="..." fetchpriority="high" />` | `app/routes/sitemap[.]xml.ts` |\n| **Nuxt 3** | `useSeoMeta({ title: \'...\', description: \'...\' })` | `<NuxtImg src="..." alt="..." priority />` | `@nuxtjs/sitemap`<br>`@nuxtjs/robots` |\n| **SvelteKit** | `<svelte:head><title>...</title></svelte:head>` | `<img src="..." alt="..." loading="eager" />` | `src/routes/sitemap.xml/+server.ts` |\n\n**Framework Guardrails**:\n- **Never ship empty initial HTML (CSR SPA Trap)**: Always use SSR or SSG for public pages.\n- **Eliminate Hydration CLS**: Server-rendered markup must match client-rendered markup exactly.\n- **Declare LCP Priorities**: Always mark the above-the-fold hero image with `priority` or `loading="eager"`.\n\n### 2.6 Internationalization (`hreflang`)\n\nWhen serving multilingual or regional audiences, implement bi-directional hreflang tags:\n\n```html\n<link rel="alternate" hreflang="en-us" href="https://example.com/us/pricing" />\n<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/pricing" />\n<link rel="alternate" hreflang="es" href="https://example.com/es/precios" />\n<link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />\n```\n\n---\n\n## 3. Keyword Research, Search Intent & Topical Clustering\n\nModern SEO has evolved from keyword stuffing into **Topical Authority** and **Entity Salience**. Search engines understand semantic relationships and reward comprehensive domain coverage.\n\n### 3.1 The 4-Tier Search Intent Taxonomy\n\n| Search Intent | Query Modifiers / Examples | Optimal Content Type |\n| :--- | :--- | :--- |\n| **Informational** | "how to", "what is", "guide", "examples", "benefits", "why" | Deep-dive blog post, tutorial, definition, FAQ, documentation |\n| **Commercial Investigation** | "best [x] for [y]", "vs", "alternatives", "review 2026" | Comparison table, review, buyer\'s guide, benchmark data |\n| **Transactional** | "buy", "pricing", "discount", "demo", "hire", "quote", "api" | Product page, pricing table, checkout, free trial signup |\n| **Navigational** | "[Brand] login", "[Brand] app", "[Brand] docs" | Dedicated portal or homepage |\n\n### 3.2 Pillar & Cluster (Hub & Spoke) Architecture\n\n | MASTER PILLAR PAGE \n | "Complete Guide to GEO"\n \n \u25BC \u25BC \u25BC\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n | Cluster Page 1 | | Cluster Page 2 | | Cluster Page 3 \n | "llms.txt Setup" | | "Perplexity Citations" | "AI Overviews BLUF"\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n | | \n (Interlinked bi-directionally)\n\n1. **Pillar Page**: Covers the broad topic at a high level (2,500\u20135,000 words). Links to each cluster page in relevant sections.\n2. **Cluster Pages**: Deep-dive into specific long-tail questions (1,200\u20132,000 words).\n3. **Cluster-to-Pillar Link**: Every cluster page **MUST** link back to the main Pillar page using the primary target keyword as anchor text.\n4. **Cluster-to-Cluster Link**: Siblings link to each other when contextually relevant.\n\n### 3.3 Keyword Prioritization Formula\n\n$$\\text{Opportunity Score} = \\frac{\\text{Search Volume} \\times \\text{Business Value (1-5)}}{\\text{Keyword Difficulty (KD)} + 1}$$\n\n- **Low-Hanging Fruit (KD 0\u201325, Volume 100\u20131,000)**: Publish precise, answer-first cluster articles. Ranks in 2\u20136 weeks to build domain momentum.\n- **Core Growth (KD 25\u201350, Volume 1,000\u201310,000)**: Commercial comparison pages, interactive calculators, templates.\n- **Trophy Targets (KD 50+, Volume 10,000+)**: Comprehensive pillar guides, definitive industry reports, proprietary research.\n\n### 3.4 Entity Mapping & Semantic Salience\n\n- **Subject Entity**: The core concept (e.g., `Next.js SEO`).\n- **Parent Entity**: Overarching domain (e.g., `Full-stack Web Development`).\n- **Sibling Entities**: Related frameworks (e.g., `Server-Side Rendering`, `Core Web Vitals`).\n- **Co-Occurring Semantic Attributes**: `meta tags`, `generateMetadata`, `sitemap.ts`, `Open Graph`, `JSON-LD`.\n\n### 3.5 Reverse-Engineering SERP Features\n\n- **AI Overview Present**: Provide a direct 2-sentence definition in the opening paragraph. Use structured comparison tables and numbered steps.\n- **Featured Snippet**: Answer in 40\u201350 words immediately following an H2 formatted with the query, or use `<ol>` / `<ul>` with bold prefixes.\n- **People Also Ask (PAA)**: Extract top 4\u20136 questions and add them verbatim as `<h3>` subheadings with concise answers in an FAQ section.\n\n---\n\n## 4. Content Architecture, BLUF & E-E-A-T\n\nGoogle\'s Helpful Content System strictly demotes content written solely for search engines without first-hand value. Content must demonstrate **E-E-A-T** (Experience, Expertise, Authoritativeness, Trustworthiness) and deliver instantaneous value through **BLUF** formatting.\n\n### 4.1 On-Page Content Anatomy Checklist\n\n| Element | Optimal Length / Format | Formula / Rule |\n| :--- | :--- | :--- |\n| **Title Tag** | 50 \u2013 60 characters (< 580px) | `[Primary Keyword] \u2013 [CTR Hook / Year]` |\n| **Meta Description** | 150 \u2013 160 characters (< 960px) | `[Core Benefit] + [Entity Terms] + CTA` |\n| **URL Slug** | 2 \u2013 5 words, lowercase | `/blog/[primary-kw]` (Never include dates) |\n| **Heading 1 (H1)** | 1 per page, 40\u201370 characters | Matches search intent with natural keyword |\n| **Heading 2 (H2)** | Logical section dividers | Uses secondary keywords & question phrasing |\n| **Heading 3 (H3)** | Sub-points & PAA questions | Specific sub-answers & definitions |\n| **Images** | WebP / AVIF format | Width/height attributes + descriptive alt text |\n\n### 4.2 The BLUF (Bottom Line Up Front) Writing Framework\n\nNever hide the answer at the end of an article. State the core conclusion in the very first 1\u20132 sentences.\n\n- **Bad (Generic AI Fluff)**:\n > *"In today\'s fast-paced digital landscape, search engine optimization is more important than ever before. Many businesses wonder how to improve their technical SEO. In this comprehensive guide, we will explore the wonderful world of Core Web Vitals..."*\n- **Good (BLUF Answer-First)**:\n > **Interaction to Next Paint (INP)** measures page responsiveness and must stay **under 200 milliseconds** to pass Google Core Web Vitals. To fix poor INP, break long JavaScript tasks (>50ms) using `scheduler.yield()`, debounce input listeners, and eliminate CPU-heavy client-side hydration.\n\n**Structure of a High-Ranking Section**:\n1. **Direct Answer (BLUF)**: First 1\u20132 sentences directly answer or define the question.\n2. **Key Takeaway Box / Bulleted Summary**: 3\u20135 concise bullets summarizing critical points.\n3. **Data / Benchmark Table**: Structured comparison or measurable criteria.\n4. **Step-by-Step Implementation**: Clear code snippets, instructions, or workflow.\n5. **Nuance & Edge Cases**: Common traps, trade-offs, and troubleshooting.\n\n### 4.3 Demonstrating E-E-A-T\n\n- **Experience**: Include original screenshots, test results, benchmarks run by your team, and lessons learned.\n- **Expertise**: Include a named author byline, biographical credentials, and `sameAs` links to LinkedIn, GitHub, or Wikipedia.\n- **Authoritativeness**: Cite primary academic studies, official documentation, or verified industry data with standard outbound links.\n- **Trustworthiness**: Maintain clear editorial guidelines, visible `datePublished` and `dateModified` timestamps, valid SSL, privacy policy, and contact info.\n\n### 4.4 Content Decay Refresh Protocol\n\n1. In Google Search Console, filter pages with a >20% decline in clicks over the past 90 days.\n2. Update outdated years, deprecated code APIs, dead links, and stale stats.\n3. Inspect top 3 ranking competitors to identify newly emerged subtopics.\n4. Add a comparison table, FAQ schema, or actionable code snippet.\n5. Update `dateModified` in the JSON-LD schema.\n\n---\n\n## 5. Generative Engine Optimization (GEO) & AI Search\n\nGenerative Engine Optimization (GEO) optimizes digital content so Large Language Models and AI search engines (**Google AI Overviews, Perplexity, ChatGPT Search, Gemini, Claude**) discover, synthesize, and cite your brand. Targeted GEO formatting increases citation rates in AI responses by **up to 40%**.\n\n### 5.1 The 6 Core Ranking Factors of GEO\n\n1. **Statistical Density & Quantitative Verification**:\n - Fluff: *"Our caching strategy significantly boosts speed."*\n - GEO-Optimized: *"Implementing stale-while-revalidate edge caching reduced p99 latency by 64.2% across 1.2M daily requests in Q1 2026."*\n - Always include verifiable metrics, percentages, dollar amounts, sample sizes, and explicit dates.\n2. **Passage-Level Semantic Independence**:\n - Every H2 and H3 section must function as an independent, standalone answer.\n - Avoid relying on pronouns or context established three paragraphs earlier (replace *"As mentioned above, this method..."* with *"In static site generation, pre-rendering HTML at build time..."*).\n3. **Answer-First Definitional Framing**:\n - Format opening sentences as a definitive noun phrase: `[Entity] is [Category] that [Primary Mechanism] to achieve [Core Outcome].`\n4. **Comparison Tables & Structured Markdown**:\n - LLMs frequently pull markdown tables directly into the response UI. Include clear column headers (`Feature`, `Method A`, `Method B`, `Best For`).\n5. **Multi-Source Web Consensus**:\n - Perplexity and ChatGPT Search verify entity validity across G2, Capterra, ProductHunt, GitHub, and Reddit (`r/webdev`, `r/SEO`).\n6. **The `llms.txt` Standard**:\n - Place an `llms.txt` file at the domain root (`https://example.com/llms.txt`) providing a markdown-first index for LLMs.\n\n### 5.2 Production `llms.txt` Specification\n\n```markdown\n# Your Brand / Site Name\n\n> Concise one-sentence summary of what your product, service, or documentation does.\n\n## Core Documentation & Guides\n\n- [Getting Started](https://example.com/docs/getting-started): Step-by-step onboarding guide.\n- [Architecture & Standards](https://example.com/docs/architecture): Technical deep-dive and performance specifications.\n- [API Reference](https://example.com/docs/api): Complete endpoints, payloads, and authentication.\n\n## Benchmarks & Research\n\n- [2026 Core Web Vitals Benchmark](https://example.com/research/cwv-study): Original study analyzing 50k domains.\n- [GEO Performance Guide](https://example.com/blog/geo-playbook): How to optimize content for generative search.\n\n## Company & Entities\n\n- Official Name: Example Inc.\n- Founded: 2024\n- Primary Entity Type: Web Infrastructure Software\n- Contact: team@example.com\n```\n\n---\n\n## 6. Structured Data, JSON-LD & Entity Schema\n\nAlways embed **JSON-LD** in a `<script type="application/ld+json">` tag within `<head>` or `<body>`.\n\n### 6.1 Organization Schema (Homepage)\n```json\n{\n "@context": "https://schema.org",\n "@type": "Organization",\n "@id": "https://example.com/#organization",\n "name": "Acme Software",\n "url": "https://example.com",\n "logo": {\n "@type": "ImageObject",\n "url": "https://example.com/logo.png",\n "width": 512,\n "height": 512\n },\n "sameAs": [\n "https://twitter.com/acmesoftware",\n "https://linkedin.com/company/acmesoftware",\n "https://github.com/acmesoftware"\n ],\n "contactPoint": {\n "@type": "ContactPoint",\n "email": "support@example.com",\n "contactType": "customer service"\n }\n}\n```\n\n### 6.2 Article / BlogPosting Schema (Every Post)\n```json\n{\n "@context": "https://schema.org",\n "@type": "BlogPosting",\n "@id": "https://example.com/blog/technical-seo-guide#article",\n "isPartOf": {\n "@type": "WebSite",\n "@id": "https://example.com/#website"\n },\n "headline": "The Complete Guide to Technical SEO in 2026",\n "description": "Master Core Web Vitals, crawlability, canonicals, and modern search indexing.",\n "image": "https://example.com/images/cover.webp",\n "datePublished": "2026-01-15T08:00:00+00:00",\n "dateModified": "2026-03-01T12:00:00+00:00",\n "author": {\n "@type": "Person",\n "name": "Jane Doe",\n "jobTitle": "Principal SEO Architect",\n "url": "https://example.com/authors/jane-doe",\n "sameAs": ["https://linkedin.com/in/janedoe"]\n },\n "publisher": {\n "@type": "Organization",\n "@id": "https://example.com/#organization"\n },\n "mainEntityOfPage": {\n "@type": "WebPage",\n "@id": "https://example.com/blog/technical-seo-guide"\n }\n}\n```\n\n### 6.3 BreadcrumbList Schema (Site-Wide)\n```json\n{\n "@context": "https://schema.org",\n "@type": "BreadcrumbList",\n "itemListElement": [\n { "@type": "ListItem", "position": 1, "name": "Home", "item": "https://example.com" },\n { "@type": "ListItem", "position": 2, "name": "Blog", "item": "https://example.com/blog" },\n { "@type": "ListItem", "position": 3, "name": "Technical SEO", "item": "https://example.com/blog/technical-seo-guide" }\n ]\n}\n```\n\n### 6.4 FAQPage Schema (Q&A Sections)\n```json\n{\n "@context": "https://schema.org",\n "@type": "FAQPage",\n "mainEntity": [\n {\n "@type": "Question",\n "name": "What is the optimal Core Web Vitals LCP threshold?",\n "acceptedAnswer": {\n "@type": "Answer",\n "text": "Google recommends a Largest Contentful Paint (LCP) of 2.5 seconds or faster for at least 75% of page visits."\n }\n }\n ]\n}\n```\n\n### 6.5 SoftwareApplication & Product Schema\n```json\n{\n "@context": "https://schema.org",\n "@type": "SoftwareApplication",\n "name": "SEOAnything",\n "operatingSystem": "All",\n "applicationCategory": "DeveloperApplication",\n "aggregateRating": {\n "@type": "AggregateRating",\n "ratingValue": "4.9",\n "reviewCount": "128"\n },\n "offers": {\n "@type": "Offer",\n "price": "0",\n "priceCurrency": "USD"\n }\n}\n```\n\n### 6.6 Framework Integration (React / Next.js)\n```tsx\nexport default function Page() {\n const jsonLd = {\n \'@context\': \'https://schema.org\',\n \'@type\': \'Article\',\n headline: \'Next.js SEO Best Practices\',\n };\n\n return (\n <section>\n <script\n type="application/ld+json"\n dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}\n />\n <h1>Next.js SEO Best Practices</h1>\n </section>\n );\n}\n```\n\n---\n\n## 7. Internal Linking Silos & Link Acquisition\n\nInternal link architecture routes PageRank equity through your site and signals topical hierarchy to crawlers.\n\n### 7.1 The Topical Silo Architecture\n\n [Homepage (Highest PageRank)]\n \n \u25BC \u25BC\n [Pillar: Performance] [Pillar: Content Strategy]\n | \n \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC \u25BC\n [CWV Guide] [INP Fixes] [BLUF Guide] [E-E-A-T Tips]\n | | | \n \u2514\u2500\u2500\u2500\u25C4\u2500\u2500\u2500\u25BA\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u25C4\u2500\u2500\u2500\u25BA\u2500\u2500\u2500\u2518\n (Intra-Silo Lateral Links) (Intra-Silo Lateral Links)\n\n1. **Vertical Flow**: Main Pillar pages link down to all child cluster pages; all child cluster pages link back up to the main Pillar page.\n2. **Horizontal Lateral Flow**: Child pages within the same topic silo link laterally to one another using descriptive anchor text.\n3. **Cross-Silo Restrictions**: Child pages in Silo A should rarely link directly to child pages in Silo B. Cross-silo links connect at the Pillar level.\n\n### 7.2 Anchor Text Rules\n\n- **Descriptive Keyword** (`review our Core Web Vitals checklist`): Excellent. Primary internal link method.\n- **Partial Match** (`tips for optimizing INP latency`): Excellent. Adds natural semantic variety.\n- **Branded** (`SEOAnything platform`): Good for tool and homepage links.\n- **Generic** (`click here`, `read more`, `this link`): **POOR / FORBIDDEN**. Wastes link equity; tells crawlers nothing.\n\n### 7.3 Orphan Page Eradication & Click-Depth \u2264 3\n\nEvery important indexable URL must be reachable within **3 clicks** of the homepage:\n- Click 1: Homepage -> Category / Pillar Hub\n- Click 2: Pillar Hub -> Specific Article / Product\n- Click 3: Article -> Related Deep Asset\n\n### 7.4 High-Impact White-Hat Link Playbooks\n\n1. **Digital PR & Proprietary Benchmark Data**: Analyze real-world data across hundreds of domains and publish an ungated industry study. Media outlets and bloggers naturally cite data points with editorial backlinks.\n2. **Unlinked Brand Mention Reclamation**: Monitor brand mentions using Google Alerts or Ahrefs. Reach out to editors requesting a hyperlink to your project.\n3. **Broken Link Building**: Locate 404 links on authoritative resource lists in your niche and offer your active, superior guide as a replacement.\n\n---\n\n## 8. Programmatic SEO (pSEO) & Scaled Architecture\n\nProgrammatic SEO generates hundreds or thousands of high-ranking landing pages using database records, API feeds, and structured templates (e.g., comparison pages, directory entries, calculators).\n\n### 8.1 The 60/40 Unique Value Formula\n\nTo avoid Google\'s **Doorway Pages** and **Scalable Thin Content** penalties:\n- **Maximum 40% Boilerplate / Structural Markup**: Global header, footer, navigation wrappers.\n- **Minimum 60% Truly Unique, Dynamic Data**:\n 1. Record-specific quantitative metrics (scores, speeds, prices, dimensions).\n 2. Dynamic comparison tables specific to the records being compared.\n 3. Dynamic user reviews, testimonials, or community insights.\n 4. Interactive calculators or filterable tables.\n\n### 8.2 Crawl Budget Management & Staged Rollout\n\n- **Pilot Phase (Batch 1: 50\u2013200 Pages)**: Submit dedicated sitemap `sitemap-pilot.xml`. Verify >80% indexation over 3\u20134 weeks.\n- **Expansion Phase (Batch 2: 1,000\u20132,500 Pages)**: Verify server TTFB remains < 500ms under crawler load.\n- **Scale Phase (Batch 3: 10,000+ Pages)**: Segment XML sitemaps into files with no more than 10,000 URLs each (`sitemap-comparisons-1.xml`, `sitemap-comparisons-2.xml`) grouped under a master `sitemap.xml` index.\n- **Parameterized URLs**: Canonicalize filter and sorting variants to the clean base category URL. Add `noindex, follow` to zero-search-volume filter combinations.\n\n---\n\n## 9. 100-Point Master SEO Audit & Scorecard\n\nRun complete automated audits using the built-in CLI:\n\n```bash\n# Audit current repository or local routes\nnpx seoanything audit .\n\n# Audit a specific Next.js page or component\nnpx seoanything audit ./app/blog/[slug]/page.tsx\n\n# Audit a live production page\nnpx seoanything audit https://example.com/blog/my-guide\n```\n\n### The 100-Point Master Audit Checklist\n\n#### 1. Crawlability & Indexability (25%)\n- [ ] `robots.txt` is valid, accessible at root domain, and does not block critical CSS/JS assets.\n- [ ] AI crawler user-agents (`GPTBot`, `PerplexityBot`, `ClaudeBot`) are explicitly permitted.\n- [ ] XML Sitemap exists at `/sitemap.xml`, contains only 200 OK canonical URLs, and is registered in Google Search Console.\n- [ ] Every indexable page features an explicit self-referential canonical tag.\n- [ ] Zero internal 404 links or broken redirects (no `301 -> 301` chains).\n- [ ] Parameterized URLs, search results, and admin routes include `noindex, follow` tags.\n\n#### 2. Performance & Core Web Vitals (20%)\n- [ ] Largest Contentful Paint (LCP) is \u2264 2.5s on mobile devices.\n- [ ] Hero image has high fetch priority: `<link rel="preload" as="image" fetchpriority="high">`.\n- [ ] Interaction to Next Paint (INP) is \u2264 200ms with zero long tasks (>50ms) blocking main thread.\n- [ ] Cumulative Layout Shift (CLS) is \u2264 0.1; all images and embeds have explicit `width` and `height`.\n- [ ] Time to First Byte (TTFB) is \u2264 800ms globally via edge CDN caching.\n- [ ] Text assets (HTML, CSS, JS, SVG) are compressed with Brotli or Gzip.\n\n#### 3. On-Page & Semantic Content (20%)\n- [ ] Title tags are 50\u201360 characters, front-loaded with target keyword, and unique per page.\n- [ ] Meta descriptions are 140\u2013160 characters, include target entity terms, and feature an actionable CTA.\n- [ ] Exactly one `<h1>` per page, accurately reflecting search intent.\n- [ ] Strict heading hierarchy (`h1` -> `h2` -> `h3`) with zero skipped levels.\n- [ ] All `<img>` tags possess contextually descriptive `alt` attributes.\n- [ ] Social Open Graph (`og:title`, `og:description`, `og:image`) and Twitter Card tags are present.\n\n#### 4. Generative Engine Optimization (GEO) & AI Search (15%)\n- [ ] `llms.txt` is deployed at domain root and listed in `robots.txt`.\n- [ ] Key informational pages employ BLUF: Direct answer defined in opening 1\u20132 sentences.\n- [ ] Passage independence: Subheaders can be extracted by LLMs without missing contextual pronouns.\n- [ ] Statistical density: At least 1 verifiable benchmark, metric, or data point per 500 words.\n- [ ] Comparative markdown/HTML tables used for commercial evaluation queries.\n\n#### 5. Structured Data & Schema.org (10%)\n- [ ] Valid JSON-LD markup implemented for `Organization`, `WebSite`, and `BreadcrumbList`.\n- [ ] Content pages include `BlogPosting` or `Article` with named author and date timestamps.\n- [ ] FAQ sections include compliant `FAQPage` schema.\n- [ ] Zero syntax errors when tested against Google Rich Results validator.\n\n#### 6. Internal Link Graph & Architecture (10%)\n- [ ] Zero orphan pages (every indexable page has at least 3 incoming internal links).\n- [ ] Maximum click depth is \u2264 3 clicks from homepage for all critical money pages.\n- [ ] Descriptive anchor text used exclusively (zero generic "click here" or "learn more" anchors).\n- [ ] Topical silo integrity: Cluster pages link upward to their parent Pillar page.\n\n### Audit Scorecard & Grading Scale\n\n| Overall Score | Health Status | Priority Action |\n| :--- | :--- | :--- |\n| **90 \u2013 100** | **Grade A (Elite)** | Maintain topical fresh updates, expand cluster breadth, execute Digital PR. |\n| **75 \u2013 89** | **Grade B (Healthy)** | Optimize Core Web Vitals (INP/LCP), expand schema coverage, refine internal anchor text. |\n| **50 \u2013 74** | **Grade C (Deficient)** | Fix canonical loops, resolve missing title/meta tags, eliminate orphan pages. |\n| **< 50** | **Grade F (Critical)** | Emergency intervention: Verify robots.txt, fix broken rendering, remove accidental noindex tags. |\n\n---\n\n## 10. Emergency Protocol: Diagnosing Traffic Drops\n\nIf a site experiences a sudden ranking or traffic drop, execute this diagnostic protocol:\n\n[Traffic Drop Detected]\n \n \u251C\u2500\u2500> 1. Technical Check: Did a recent deployment introduce a "noindex" tag, broken robots.txt, or 500 errors?\n | \u2514\u2500\u2500 Tool: Verify via `npx seoanything audit .` and Search Console URL Inspection.\n \n \u251C\u2500\u2500> 2. Tracking Check: Is Google Analytics / GTM tag firing correctly? (Check if bounce rate is 0% or tracking ID changed).\n \n \u251C\u2500\u2500> 3. Algorithmic Update: Did Google release a Core Update, Helpful Content Update, or Spam Update?\n | \u2514\u2500\u2500 Action: Compare drop date with Search Engine Land algorithm trackers.\n \n \u251C\u2500\u2500> 4. Manual Penalty: Check Google Search Console -> "Security & Manual Actions".\n \n \u2514\u2500\u2500> 5. AI Overview Shift: Did an AI Overview or Zero-Click result displace organic CTR for your primary keywords?\n \u2514\u2500\u2500 Action: Optimize passages for GEO inclusion using BLUF definitional framing.\n\n---\n\n## 11. Standalone Execution vs. Modular Sub-Skills\n\nThis master skill is 100% self-contained. You do **not** need to invoke any other skill to execute any task above. \n\nHowever, if you ever wish to use smaller, modular sub-skills for hyper-focused, token-efficient tasks, the specialized sub-skills remain available:\n- `seo-technical`: Core Web Vitals, robots.txt, sitemaps, canonicals, SSR/SSG.\n- `seo-keywords`: Search intent taxonomy, topic clusters, entity mapping.\n- `seo-content`: Blog writing, BLUF framing, E-E-A-T proof points.\n- `seo-geo`: AI search optimization for Perplexity, ChatGPT Search, and `llms.txt`.\n- `seo-schema`: JSON-LD generation and Schema.org rich snippets.\n- `seo-links`: Topical silos, PageRank sculpting, and backlink playbooks.\n- `seo-programmatic`: Scaled landing page generation and crawl budget control.\n- `seo-audit`: 100-point checklist and automated issue scanner.',
|
|
13
|
+
"seo-programmatic": '# Programmatic SEO (pSEO) & Scaled Architecture\n\nProgrammatic SEO (pSEO) is the practice of programmatically generating hundreds or thousands of high-ranking landing pages using database records, API feeds, and structured templates. When executed correctly, pSEO builds massive long-tail search traffic (examples: Zapier integrations, Nomad List city guides, Wise currency converters).\n\n---\n\n## 1. The Golden Rule of pSEO: Avoiding the Thin Content Trap\n\nGoogle\'s Spam Policies strictly penalize **Doorway Pages** and **Scalable Thin Content**. If a programmatic page simply swaps a keyword token (`"Best Coffee in [City]"`) into identical boilerplate paragraphs, Google will de-index the entire batch.\n\n### The 60/40 Unique Value Formula\nFor every programmatically generated page:\n- **Maximum 40% Boilerplate / Structural Markup**: Navigation, basic UI wrappers, global headers/footers.\n- **Minimum 60% Truly Unique, Dynamic Data**:\n 1. Proprietary quantitative metrics (scores, prices, speeds, dimensions).\n 2. Dynamic comparison tables specific to the record.\n 3. Contextual FAQs generated from entity-specific attributes.\n 4. Dynamic user reviews, testimonials, or curated community insights.\n 5. Interactive widgets (calculators, simulators, filterable tables).\n\n---\n\n## 2. Scaled Template Architecture\n\nDesign templates that dynamically bind structured database records to semantic HTML:\n\n PROGRAMMATIC TEMPLATE ANATOMY \n1. Dynamic Head / Metadata: \n Title: [Entity A] vs [Entity B]: 2026 Comparison \n Meta: Compare [Entity A] and [Entity B] on [Metric]\n Schema: SoftwareApplication / Product (JSON-LD) \n2. Hero & Quick-Answer Matrix (BLUF): \n "At a glance: [Entity A] wins on speed (+24%), \n while [Entity B] is $15/mo cheaper." \n3. Granular Comparison Table: \n [Feature] | [Entity A Spec] | [Entity B Spec] \n4. Entity-Specific Pros & Cons: \n Dynamic bullet lists pulled from record attributes \n5. Curated FAQs: \n 3-5 questions addressing long-tail search queries \n6. Cross-Linking Grid: \n Links to Related Entities in same category / region\n\n---\n\n## 3. Crawl Budget Management & Staged Rollout\n\nSearch engines allocate a finite **Crawl Budget** based on your domain authority. Introducing 50,000 new pages overnight on a young domain causes crawl starvation and indexing failures.\n\n### The Tiered Rollout Schedule:\n1. **Pilot Phase (Batch 1: 50 \u2013 200 Pages)**:\n - Select the highest-volume or highest-intent records.\n - Deploy and submit dedicated sitemap `sitemap-pilot.xml` to Google Search Console.\n - Monitor indexation rate for 3\u20134 weeks. Target: >80% indexed.\n2. **Expansion Phase (Batch 2: 1,000 \u2013 2,500 Pages)**:\n - Verify server TTFB remains < 500ms under crawler load.\n - Ensure internal linking hubs link logically to new pages.\n3. **Scale Phase (Batch 3: 10,000+ Pages)**:\n - Split XML sitemaps into segmented files containing no more than 10,000 URLs each:\n ```txt\n https://example.com/sitemaps/sitemap-comparisons-1.xml\n https://example.com/sitemaps/sitemap-comparisons-2.xml\n ```\n - Group them under a master sitemap index: `sitemap.xml`.\n\n---\n\n## 4. Parameterized URLs & Faceted Navigation Guardrails\n\nIf your programmatic system uses query strings (`?category=x&color=y&sort=price`):\n- **Canonicalize to Clean Parent**: All sorting, filter variations, and pagination must point their `rel="canonical"` tag to the clean base category URL unless that specific filter combination represents an established keyword with standalone search volume.\n- **Noindex Low-Value Combinations**: Add `<meta name="robots" content="noindex, follow" />` to filter combinations with zero search volume to prevent crawling waste.',
|
|
14
|
+
"seo-schema": '# Structured Data, JSON-LD & Entity Schema Guide\n\nStructured data (Schema.org) provides machine-readable metadata directly to search engine crawlers and LLMs. Correct schema implementation achieves two critical outcomes:\n1. **Rich Results Eligibility**: Unlocks star ratings, review snippets, FAQ dropdowns, breadcrumb navigation, and sitelink search boxes on SERPs.\n2. **Entity Disambiguation**: Connects your brand and authors directly to Google\u2019s Knowledge Graph and AI search entity databases.\n\nAlways use **JSON-LD** embedded in a `<script type="application/ld+json">` tag within the `<head>` or `<body>`. Never use microdata or RDFa in modern web projects.\n\n---\n\n## 1. Core Schema Archetypes\n\n### 1.1 Organization & Brand Schema (Include on Homepage)\nDisambiguates your company entity and links social authority:\n\n```json\n{\n "@context": "https://schema.org",\n "@type": "Organization",\n "@id": "https://example.com/#organization",\n "name": "Acme Software",\n "url": "https://example.com",\n "logo": {\n "@type": "ImageObject",\n "url": "https://example.com/logo.png",\n "width": 512,\n "height": 512\n },\n "sameAs": [\n "https://twitter.com/acmesoftware",\n "https://linkedin.com/company/acmesoftware",\n "https://github.com/acmesoftware",\n "https://www.wikidata.org/wiki/Q12345678"\n ],\n "contactPoint": {\n "@type": "ContactPoint",\n "email": "support@example.com",\n "contactType": "customer service"\n }\n}\n```\n\n---\n\n### 1.2 Article / BlogPosting Schema (Include on Every Post)\nProvides complete provenance, authorship, and publication dates for E-E-A-T:\n\n```json\n{\n "@context": "https://schema.org",\n "@type": "BlogPosting",\n "@id": "https://example.com/blog/technical-seo-guide#article",\n "isPartOf": {\n "@type": "WebSite",\n "@id": "https://example.com/#website"\n },\n "headline": "The Complete Guide to Technical SEO in 2026",\n "description": "Master Core Web Vitals, crawlability, canonicals, and modern search indexing.",\n "image": "https://example.com/images/technical-seo-cover.webp",\n "datePublished": "2026-01-15T08:00:00+00:00",\n "dateModified": "2026-03-01T12:00:00+00:00",\n "author": {\n "@type": "Person",\n "name": "Jane Doe",\n "jobTitle": "Principal SEO Architect",\n "url": "https://example.com/authors/jane-doe",\n "sameAs": [\n "https://linkedin.com/in/janedoe",\n "https://github.com/janedoe"\n ]\n },\n "publisher": {\n "@type": "Organization",\n "@id": "https://example.com/#organization"\n },\n "mainEntityOfPage": {\n "@type": "WebPage",\n "@id": "https://example.com/blog/technical-seo-guide"\n }\n}\n```\n\n---\n\n### 1.3 BreadcrumbList Schema (Include Site-Wide)\nReplaces raw URLs in Google SERPs with clean, readable hierarchical breadcrumbs:\n\n```json\n{\n "@context": "https://schema.org",\n "@type": "BreadcrumbList",\n "itemListElement": [\n {\n "@type": "ListItem",\n "position": 1,\n "name": "Home",\n "item": "https://example.com"\n },\n {\n "@type": "ListItem",\n "position": 2,\n "name": "Blog",\n "item": "https://example.com/blog"\n },\n {\n "@type": "ListItem",\n "position": 3,\n "name": "Technical SEO",\n "item": "https://example.com/blog/technical-seo-guide"\n }\n ]\n}\n```\n\n---\n\n### 1.4 FAQPage Schema (For Question-Answer Sections)\n```json\n{\n "@context": "https://schema.org",\n "@type": "FAQPage",\n "mainEntity": [\n {\n "@type": "Question",\n "name": "What is the optimal Core Web Vitals LCP threshold?",\n "acceptedAnswer": {\n "@type": "Answer",\n "text": "Google recommends a Largest Contentful Paint (LCP) of 2.5 seconds or faster for at least 75% of page visits."\n }\n },\n {\n "@type": "Question",\n "name": "Does JSON-LD need to be in the head tag?",\n "acceptedAnswer": {\n "@type": "Answer",\n "text": "While placing JSON-LD in the head tag is recommended for early parsing, Google and search crawlers parse JSON-LD anywhere in the DOM, including the body."\n }\n }\n ]\n}\n```\n\n---\n\n### 1.5 SoftwareApplication & Product Schema\n```json\n{\n "@context": "https://schema.org",\n "@type": "SoftwareApplication",\n "name": "SEOAnything",\n "operatingSystem": "All",\n "applicationCategory": "DeveloperApplication",\n "aggregateRating": {\n "@type": "AggregateRating",\n "ratingValue": "4.9",\n "reviewCount": "128"\n },\n "offers": {\n "@type": "Offer",\n "price": "0",\n "priceCurrency": "USD"\n }\n}\n```\n\n---\n\n## 2. Framework Integration Best Practices\n\n### React / Next.js (App Router)\n```tsx\nexport default function Page() {\n const jsonLd = {\n \'@context\': \'https://schema.org\',\n \'@type\': \'Article\',\n headline: \'Next.js SEO Best Practices\',\n };\n\n return (\n <section>\n <script\n type="application/ld+json"\n dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}\n />\n <h1>Next.js SEO Best Practices</h1>\n </section>\n );\n}\n```\n\n---\n\n## 3. Schema Validation Checklist\n\n- [ ] All required fields for the schema type are populated (e.g., `headline` and `image` for `Article`).\n- [ ] No syntax errors: JSON is strictly valid with no trailing commas.\n- [ ] Schema content matches user-visible page content (cloaked or hidden schema violates Google policy).\n- [ ] Tested against the [Google Rich Results Test](https://search.google.com/test/rich-results) and Schema.org Validator.',
|
|
15
|
+
"seo-technical": '# Technical SEO & Infrastructure Excellence\n\nTechnical SEO ensures that search engine crawlers and AI bots can discover, render, understand, and index your website without friction or delay. A website with flawless content will never rank if technical flaws prevent crawlers from accessing it or if slow speed destroys Core Web Vitals.\n\n---\n\n## 1. Core Web Vitals (CWV) Benchmark & Optimization\n\nGoogle enforces Core Web Vitals as a direct page experience ranking signal. Target the "Good" threshold for at least 75% of page visits:\n\n| Metric | Threshold (Good) | What It Measures | Primary Fixes |\n| :--- | :--- | :--- | :--- |\n| **LCP** (Largest Contentful Paint) | **\u2264 2.5 seconds** | Loading speed of the main content element | \u2022 Preload hero image: `<link rel="preload" as="image" href="..." fetchpriority="high">`<br>\u2022 Use modern formats (WebP, AVIF)<br>\u2022 Optimize TTFB (< 800ms) with edge CDN caching<br>\u2022 Inline critical CSS, defer non-critical scripts |\n| **INP** (Interaction to Next Paint) | **\u2264 200 ms** | Responsiveness to user clicks/taps | \u2022 Break long tasks (> 50ms) using `scheduler.yield()` or `requestAnimationFrame`<br>\u2022 Debounce input and scroll event listeners<br>\u2022 Avoid CPU-heavy client hydration on the main thread |\n| **CLS** (Cumulative Layout Shift) | **\u2264 0.1** | Visual stability during page load | \u2022 Always set explicit `width` and `height` (or `aspect-ratio`) on images/videos<br>\u2022 Reserve slot containers for dynamic ads or widgets<br>\u2022 Use `font-display: swap` with size-adjust fallback fonts |\n\n---\n\n## 2. Robots.txt Specification & Guardrails\n\nThe `robots.txt` file must reside at the root domain (`https://example.com/robots.txt`).\n\n### Standard Production `robots.txt`\n```txt\nUser-agent: *\nAllow: /\nDisallow: /api/\nDisallow: /admin/\nDisallow: /checkout/\nDisallow: /private/\n\n# Explicitly allow AI search retrieval crawlers\nUser-agent: GPTBot\nAllow: /\n\nUser-agent: PerplexityBot\nAllow: /\n\nUser-agent: ClaudeBot\nAllow: /\n\n# Sitemap Declarations\nSitemap: https://example.com/sitemap.xml\nSitemap: https://example.com/sitemap-blog.xml\n```\n\n### Critical Robots.txt Pitfalls\n- **NEVER** disallow CSS or JavaScript directories (`/assets/`, `/_next/`, `/static/`). Googlebot and Perplexity need CSS/JS to render the DOM.\n- **NEVER** use `Disallow: /` on staging environments that share a database or when deploying to production.\n- Use `robots.txt` to control crawl budget, NOT to hide sensitive data (use HTTP authentication or `noindex` headers for private pages).\n\n---\n\n## 3. Canonicalization Rules\n\nEvery indexable URL must have an explicit canonical link element in the `<head>`:\n\n```html\n<link rel="canonical" href="https://example.com/blog/technical-seo-guide" />\n```\n\n### Best Practices:\n1. **Self-Referential Canonicals**: Every clean, canonical page should point to its exact self.\n2. **Handle URL Parameters**: Strip tracking parameters (`?utm_source=...`, `?ref=...`, `?fbclid=...`) in the canonical target.\n3. **HTTP vs HTTPS & WWW vs non-WWW**: Standardize on one version and enforce 301 redirects to it. Canonical must match the canonical protocol/subdomain.\n4. **Trailing Slashes**: Enforce either trailing slash (`/page/`) or non-trailing slash (`/page`) consistently site-wide.\n\n---\n\n## 4. Redirect Strategy & Status Codes\n\n| HTTP Status | Name | SEO Treatment | When to Use |\n| :--- | :--- | :--- | :--- |\n| **200** | OK | Standard indexable response | Normal live page |\n| **301** | Moved Permanently | Passes ~99% of PageRank; search engines update their index | Permanent URL migration, domain change, slug update |\n| **302** | Found (Temporary) | Does NOT transfer full link equity; index retains original URL | Temporary maintenance or seasonal campaigns |\n| **404** | Not Found | Dropped from index after repeated crawls | Page permanently removed with no direct replacement |\n| **410** | Gone | Dropped from index faster than 404 | Intentional deletion of spam or dead sections |\n| **500 / 503**| Server Error | Crawler backs off; temporary 503 avoids ranking penalty | Maintenance window; never leave 500s active |\n\n> [!WARNING]\n> **Zero Redirect Chains**: Avoid chaining redirects (e.g., `A -> B -> C`). Always update source links to point directly to `C`.\n\n---\n\n## 5. Modern Framework Architectures: Next.js, TanStack Start, Astro, Remix, Nuxt\n\nModern web frameworks handle rendering and metadata differently:\n\n### Framework Matrix & SEO Patterns:\n\n| Framework | Metadata Pattern | LCP Hero Image Optimization | Sitemaps & Robots |\n| :--- | :--- | :--- | :--- |\n| **Next.js** (App Router) | `export const metadata: Metadata = { ... }`<br>or dynamic `generateMetadata()` | `<Image src="..." alt="..." priority />` | `app/sitemap.ts`<br>`app/robots.ts` |\n| **TanStack Start** | `createFileRoute(\'/...\')({ head: () => ({ meta: [...], links: [...] }) })` | `<img src="..." alt="..." fetchpriority="high" />` | `app/routes/sitemap.xml.ts`<br>`app/routes/robots.txt.ts` |\n| **Astro** | Frontmatter variables or `<SEO title="..." description="..." />` | `<Image src={...} alt="..." loading="eager" />` | `@astrojs/sitemap` in `astro.config.mjs` |\n| **Remix / React Router** | `export const meta: MetaFunction = () => [...]` | `<img src="..." alt="..." fetchpriority="high" />` | `app/routes/sitemap[.]xml.ts` |\n| **Nuxt 3** | `useSeoMeta({ title: \'...\', description: \'...\' })` | `<NuxtImg src="..." alt="..." priority />` | `@nuxtjs/sitemap`<br>`@nuxtjs/robots` |\n| **SvelteKit** | `<svelte:head><title>...</title></svelte:head>` | `<img src="..." alt="..." loading="eager" />` | `src/routes/sitemap.xml/+server.ts` |\n\n### Critical Framework Guardrails:\n1. **Never ship empty initial HTML (CSR SPA Trap)**: Always use SSR (Server-Side Rendering) or SSG (Static Site Generation) for public pages.\n2. **Eliminate Hydration CLS**: Server-rendered markup must match client-rendered markup exactly to avoid Cumulative Layout Shift penalties during React/Vue hydration.\n3. **Declare LCP Priorities**: Always mark the primary above-the-fold hero image with `priority` (Next.js/Nuxt) or `loading="eager"` (Astro/HTML).\n\n---\n\n## 6. Internationalization (`hreflang`)\n\nWhen serving multilingual or multi-regional audiences, implement bi-directional hreflang tags:\n\n```html\n<link rel="alternate" hreflang="en-us" href="https://example.com/us/pricing" />\n<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/pricing" />\n<link rel="alternate" hreflang="es" href="https://example.com/es/precios" />\n<link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />\n```\n\n- Each language version must point back to itself and all siblings (bi-directional requirement).\n- Use `x-default` for unmatched regions or a language selector splash page.',
|
|
16
|
+
"seo-master-digest": '# Master SEO & GEO Intelligence Engine (All-in-One Playbook)\n## Quick Navigation: The 8 Disciplines Covered\n1. [The 5 Pillars of Modern Ranking & Triage](#1-the-5-pillars-of-ranking--triage)\n2. [Technical SEO & Core Web Vitals (CWV)](#2-technical-seo--core-web-vitals-cwv)\n3. [Keyword Research, Intent & Topical Clustering](#3-keyword-research-search-intent--topical-clustering)\n4. [Content Architecture, BLUF & E-E-A-T](#4-content-architecture-bluf--e-e-a-t)\n5. [Generative Engine Optimization (GEO) & AI Search](#5-generative-engine-optimization-geo--ai-search)\n6. [Structured Data, JSON-LD & Entity Schema](#6-structured-data-json-ld--entity-schema)\n7. [Internal Linking Silos & Backlink Acquisition](#7-internal-linking-silos--link-acquisition)\n8. [Programmatic SEO (pSEO) & Scaled Pages](#8-programmatic-seo-pseo--scaled-architecture)\n9. [100-Point Master SEO Audit & Health Scorecard](#9-100-point-master-seo-audit--scorecard)\n10. [Emergency Protocol: Diagnosing Traffic Drops](#10-emergency-protocol-diagnosing-traffic-drops)\n## 1. The 5 Pillars of Ranking & Triage\n1. Technical | Crawlability | Core Web Vitals, Robots, \n2. Keyword & | Search Intent & | Pillar-Cluster Model, KD, \n3. Content & | E-E-A-T & | BLUF Answering, First-Party\n4. Authority & | Internal Link | PageRank Sculpting, Silos,\n5. AI Search | Generative Engine | Statistical Density, LLMs,\n### 90-Day Execution Roadmap & Priority Triage\n- **Stage 1: Critical Blockers (Days 0\u20137)**:\n- **Stage 2: Content & On-Page Architecture (Weeks 2\u20134)**:\n- **Stage 3: Topical Authority & Internal Linking Silos (Weeks 4\u20138)**:\n- **Stage 4: Generative Engine Optimization (GEO) & Scale (Ongoing)**:\n## 2. Technical SEO & Core Web Vitals (CWV)\n### 2.1 Core Web Vitals Benchmarks & Primary Fixes\n### 2.2 Production `robots.txt` Specification\n# Explicitly allow AI search retrieval crawlers\n# Sitemap Declarations\n- **NEVER** disallow CSS or JavaScript directories (`/assets/`, `/_next/`, `/static/`). Googlebot and Perplexity need CSS/JS to render the DOM.\n- **NEVER** use `Disallow: /` on staging environments that share a database or when deploying to production.\n- Use `robots.txt` to control crawl budget, NOT to hide sensitive data (use HTTP authentication or `noindex` headers).\n### 2.3 Canonicalization Rules\n1. **Self-Referential Canonicals**: Every clean, canonical page must point to its exact self.\n2. **Handle URL Parameters**: Strip tracking parameters (`?utm_source=...`, `?ref=...`, `?fbclid=...`) in the canonical target.\n3. **HTTP vs HTTPS & WWW vs non-WWW**: Enforce 301 redirects to the chosen canonical protocol and subdomain.\n4. **Trailing Slashes**: Enforce either trailing slash (`/page/`) or non-trailing slash (`/page`) consistently site-wide.\n### 2.4 HTTP Status Codes & Redirects\n- **200 OK**: Normal live indexable page.\n- **301 Moved Permanently**: Passes ~99% of PageRank; search engines update their index. Use for permanent URL migrations.\n- **302 Found (Temporary)**: Does NOT transfer full link equity; index retains original URL.\n- **404 Not Found**: Dropped from index after repeated crawls.\n- **410 Gone**: Dropped from index faster than 404. Use for intentional permanent deletions.\n- **500 / 503 Server Error**: Crawler backs off; temporary 503 avoids ranking penalty during maintenance. Never leave 500s active.\n- **Zero Redirect Chains**: Avoid chaining redirects (`A -> B -> C`). Always link directly to `C`.\n### 2.5 Modern Framework Implementations\n- **Never ship empty initial HTML (CSR SPA Trap)**: Always use SSR or SSG for public pages.\n- **Eliminate Hydration CLS**: Server-rendered markup must match client-rendered markup exactly.\n- **Declare LCP Priorities**: Always mark the above-the-fold hero image with `priority` or `loading="eager"`.\n### 2.6 Internationalization (`hreflang`)\n## 3. Keyword Research, Search Intent & Topical Clustering\n### 3.1 The 4-Tier Search Intent Taxonomy\n### 3.2 Pillar & Cluster (Hub & Spoke) Architecture\n1. **Pillar Page**: Covers the broad topic at a high level (2,500\u20135,000 words). Links to each cluster page in relevant sections.\n2. **Cluster Pages**: Deep-dive into specific long-tail questions (1,200\u20132,000 words).\n3. **Cluster-to-Pillar Link**: Every cluster page **MUST** link back to the main Pillar page using the primary target keyword as anchor text.\n4. **Cluster-to-Cluster Link**: Siblings link to each other when contextually relevant.\n### 3.3 Keyword Prioritization Formula\n- **Low-Hanging Fruit (KD 0\u201325, Volume 100\u20131,000)**: Publish precise, answer-first cluster articles. Ranks in 2\u20136 weeks to build domain momentum.\n- **Core Growth (KD 25\u201350, Volume 1,000\u201310,000)**: Commercial comparison pages, interactive calculators, templates.\n- **Trophy Targets (KD 50+, Volume 10,000+)**: Comprehensive pillar guides, definitive industry reports, proprietary research.\n### 3.4 Entity Mapping & Semantic Salience\n- **Subject Entity**: The core concept (e.g., `Next.js SEO`).\n- **Parent Entity**: Overarching domain (e.g., `Full-stack Web Development`).\n- **Sibling Entities**: Related frameworks (e.g., `Server-Side Rendering`, `Core Web Vitals`).\n- **Co-Occurring Semantic Attributes**: `meta tags`, `generateMetadata`, `sitemap.ts`, `Open Graph`, `JSON-LD`.\n### 3.5 Reverse-Engineering SERP Features\n- **AI Overview Present**: Provide a direct 2-sentence definition in the opening paragraph. Use structured comparison tables and numbered steps.\n- **Featured Snippet**: Answer in 40\u201350 words immediately following an H2 formatted with the query, or use `<ol>` / `<ul>` with bold prefixes.\n- **People Also Ask (PAA)**: Extract top 4\u20136 questions and add them verbatim as `<h3>` subheadings with concise answers in an FAQ section.\n## 4. Content Architecture, BLUF & E-E-A-T\n### 4.1 On-Page Content Anatomy Checklist\n### 4.2 The BLUF (Bottom Line Up Front) Writing Framework\n- **Bad (Generic AI Fluff)**:\n- **Good (BLUF Answer-First)**:\n1. **Direct Answer (BLUF)**: First 1\u20132 sentences directly answer or define the question.\n2. **Key Takeaway Box / Bulleted Summary**: 3\u20135 concise bullets summarizing critical points.\n3. **Data / Benchmark Table**: Structured comparison or measurable criteria.\n4. **Step-by-Step Implementation**: Clear code snippets, instructions, or workflow.\n5. **Nuance & Edge Cases**: Common traps, trade-offs, and troubleshooting.\n### 4.3 Demonstrating E-E-A-T\n- **Experience**: Include original screenshots, test results, benchmarks run by your team, and lessons learned.\n- **Expertise**: Include a named author byline, biographical credentials, and `sameAs` links to LinkedIn, GitHub, or Wikipedia.\n- **Authoritativeness**: Cite primary academic studies, official documentation, or verified industry data with standard outbound links.\n- **Trustworthiness**: Maintain clear editorial guidelines, visible `datePublished` and `dateModified` timestamps, valid SSL, privacy policy, and contact info.\n### 4.4 Content Decay Refresh Protocol\n1. In Google Search Console, filter pages with a >20% decline in clicks over the past 90 days.',
|
|
17
|
+
"blog-post-template": '---\ntitle: "Primary Keyword: Compelling Value-Driven CTR Hook [Year]"\ndescription: "Direct 150-character summary answering the primary search intent with secondary entity terms and a clear call to action."\nslug: "primary-keyword-slug"\ndatePublished: "2026-01-15T08:00:00Z"\ndateModified: "2026-01-15T08:00:00Z"\nauthor:\n name: "Author Full Name"\n title: "Subject Matter Expert / Title"\n url: "https://example.com/authors/author-name"\ncanonicalUrl: "https://example.com/blog/primary-keyword-slug"\nprimaryKeyword: "primary keyword"\nsecondaryKeywords:\n - "secondary keyword 1"\n - "secondary keyword 2"\n - "secondary entity term"\n---\n\n# Primary Keyword: Compelling Value-Driven CTR Hook [Year]\n\n> **Key Takeaway (BLUF)**: State the direct, definitive answer to the user\'s core query in 1-2 concise sentences. Immediately follow with the primary actionable recommendation or statistic.\n\n---\n\n## At a Glance: Key Findings & Summary\n\n| Metric / Dimension | Recommendation | Benchmark Value |\n| :--- | :--- | :--- |\n| **Primary Factor** | Specific Action | Quantifiable metric |\n| **Secondary Factor**| Secondary Action | Quantifiable metric |\n| **Time to Impact** | Expected Window | 2\u20136 Weeks |\n\n---\n\n## 1. What is [Topic] and Why Does It Matter?\n\nDefine the entity clearly in the first sentence: **[Topic]** is a [category/method] that enables [target audience] to [primary outcome].\n\n### Core Benefits:\n1. **Verifiable Metric Gain**: Realize a 20\u201340% improvement in [key KPI].\n2. **Defensive Advantage**: Protect search visibility against algorithmic updates.\n3. **AI Search Citation**: Format content so that generative models (Perplexity, ChatGPT, AI Overviews) extract and cite this asset.\n\n---\n\n## 2. Step-by-Step Implementation Framework\n\nWalk the reader through practical, reproducible steps.\n\n### Step 1: Preliminary Setup\nProvide the exact command, configuration, or checklist needed to begin.\n\n```bash\n# Example setup command\nnpm install --save-dev [package-name]\n```\n\n### Step 2: Core Execution\nExplain the mechanics clearly. Avoid hand-wavy generalities.\n\n---\n\n## 3. Real-World Benchmarks & First-Party Data\n\n*(Demonstrate E-E-A-T Experience by including original tests, benchmarks, or case studies).*\n\nIn our benchmark evaluation across [sample size] implementations:\n- **Baseline metric**: 1,240ms\n- **Optimized metric**: 310ms (75% reduction)\n- **Observed ranking impact**: Moved from position 14 to position 3 within 24 days.\n\n---\n\n## 4. Common Pitfalls & How to Avoid Them\n\n- \u274C **Pitfall 1**: Generic AI boilerplate with no unique data. \n \u{1F449} **Fix**: Include proprietary charts, code repos, or case studies.\n- \u274C **Pitfall 2**: Neglecting mobile Core Web Vitals. \n \u{1F449} **Fix**: Test mobile LCP on throttled 4G connections.\n\n---\n\n## 5. Frequently Asked Questions (PAA Section)\n\n### How long does it take for [Topic] to show ranking results?\nTypically between 2 to 8 weeks depending on domain authority, crawl frequency, and competition level.\n\n### Does [Topic] require technical coding skills?\nWhile basic implementations can be handled via templates, technical optimizations benefit from code-level control over HTML headers and schema markup.\n\n---\n\n## Conclusion & Next Steps\n\nSummarize the key takeaways and provide clear internal links to related topic clusters:\n- [Read the Complete Guide to [Related Cluster]](https://example.com/blog/related-cluster)\n- [Explore the Technical Performance Checklist](https://example.com/blog/technical-checklist)'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// ../tools/src/api.ts
|
|
21
|
+
var ApiFail = class extends Error {
|
|
22
|
+
status;
|
|
23
|
+
code;
|
|
24
|
+
extra;
|
|
25
|
+
constructor(status, code, message, extra = {}) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.status = status;
|
|
28
|
+
this.code = code;
|
|
29
|
+
this.extra = extra;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var qs = (o) => {
|
|
33
|
+
const p = new URLSearchParams();
|
|
34
|
+
for (const [k, v] of Object.entries(o)) if (v !== void 0 && v !== null) p.set(k, String(v));
|
|
35
|
+
const s = p.toString();
|
|
36
|
+
return s ? `?${s}` : "";
|
|
37
|
+
};
|
|
38
|
+
async function collectSse(res) {
|
|
39
|
+
let out = "", event = "message";
|
|
40
|
+
for (const line of (await res.text()).split("\n")) {
|
|
41
|
+
if (line.startsWith("event:")) event = line.slice(6).trim();
|
|
42
|
+
else if (line.startsWith("data:") && event === "delta") {
|
|
43
|
+
try {
|
|
44
|
+
out += JSON.parse(line.slice(5)).text ?? "";
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
} else if (line.startsWith("data:") && event === "error") {
|
|
48
|
+
const e = JSON.parse(line.slice(5));
|
|
49
|
+
throw new ApiFail(502, e.code ?? "stream_error", e.message ?? "stream failed");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
function httpApi(baseUrl, auth) {
|
|
55
|
+
const base = baseUrl.replace(/\/$/, "");
|
|
56
|
+
const authHeaders = typeof auth === "string" ? { authorization: `Bearer ${auth}` } : auth ?? {};
|
|
57
|
+
const raw = async (method, path, body) => {
|
|
58
|
+
const res = await fetch(`${base}/api/v1${path}`, { method, headers: { ...authHeaders, ...body !== void 0 ? { "content-type": "application/json" } : {}, accept: "application/json, text/event-stream" }, body: body !== void 0 ? JSON.stringify(body) : void 0 });
|
|
59
|
+
if (!res.ok) {
|
|
60
|
+
const p = await res.json().catch(() => ({}));
|
|
61
|
+
throw new ApiFail(res.status, p.code ?? `http_${res.status}`, p.detail ?? p.title ?? res.statusText, p);
|
|
62
|
+
}
|
|
63
|
+
return res;
|
|
64
|
+
};
|
|
65
|
+
const request = async (method, path, body) => {
|
|
66
|
+
const res = await raw(method, path, body);
|
|
67
|
+
return res.status === 204 ? void 0 : res.headers.get("content-type")?.includes("json") ? await res.json() : await res.text();
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
raw,
|
|
71
|
+
request,
|
|
72
|
+
trendsDaily: (a) => request("GET", `/trends/daily${qs(a)}`),
|
|
73
|
+
trendsRealtime: (a) => request("GET", `/trends/realtime${qs(a)}`),
|
|
74
|
+
trendArticles: (a) => request("POST", "/trends/articles", a),
|
|
75
|
+
keywordSuggest: (a) => request("GET", `/keywords/suggest${qs({ q: a.keyword, hl: a.hl })}`),
|
|
76
|
+
keywordInterest: (a) => request("POST", "/keywords/interest", a),
|
|
77
|
+
keywordRegions: (a) => request("POST", "/keywords/regions", a),
|
|
78
|
+
keywordCluster: (a) => request("POST", "/keywords/cluster", a),
|
|
79
|
+
topicsTrending: (a) => request("GET", `/topics${qs(a)}`),
|
|
80
|
+
reposTrending: (a) => request("GET", `/repos/trending${qs(a)}`),
|
|
81
|
+
seoAuditUrl: (a) => request("POST", "/seo/audit", a),
|
|
82
|
+
seoGenerateSchema: (a) => request("POST", "/seo/schema", a),
|
|
83
|
+
blogCreate: (a) => request("POST", "/blog/posts", a),
|
|
84
|
+
blogWriteSection: async (a) => ({ markdown: await collectSse(await raw("POST", `/blog/posts/${a.postId}/sections/${a.index}`, { instruction: a.instruction })) }),
|
|
85
|
+
blogOptimize: (a) => request("POST", `/blog/posts/${a.postId}/optimize`),
|
|
86
|
+
blogGet: (a) => a.format ? request("GET", `/blog/posts/${a.postId}/export${qs({ format: a.format })}`).then((content) => ({ content })) : request("GET", `/blog/posts/${a.postId}`),
|
|
87
|
+
blogList: (a) => request("GET", `/blog/posts${qs(a)}`),
|
|
88
|
+
chatAsk: async (a) => {
|
|
89
|
+
const conv = await request("POST", "/conversations", { mode: a.mode ?? "general" });
|
|
90
|
+
return { answer: await collectSse(await raw("POST", `/conversations/${conv.id}/messages`, { content: a.question })) };
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ../tools/src/tools.ts
|
|
96
|
+
import { z } from "zod";
|
|
97
|
+
var def = (t) => t;
|
|
98
|
+
var ro = (openWorldHint = false) => ({ readOnlyHint: true, destructiveHint: false, openWorldHint });
|
|
99
|
+
var rw = (openWorldHint = false) => ({ readOnlyHint: false, destructiveHint: false, openWorldHint });
|
|
100
|
+
var ALL = ["remote", "local", "chat"];
|
|
101
|
+
var RL = ["remote", "local"];
|
|
102
|
+
var geo = z.string().length(2).toUpperCase().default("US").describe("ISO-3166 alpha-2 country code");
|
|
103
|
+
var hl = z.string().min(2).max(5).default("en").describe("UI language, e.g. en");
|
|
104
|
+
var period = z.enum(["now 1-H", "now 4-H", "now 1-d", "now 7-d", "now 1-m", "today 3-m", "today 12-m", "today 5-y"]).default("today 12-m");
|
|
105
|
+
var local = (ctx) => {
|
|
106
|
+
if (!ctx.local) throw new Error("local tools are only available in `seoanything mcp`");
|
|
107
|
+
return ctx.local;
|
|
108
|
+
};
|
|
109
|
+
var TOOLS = [
|
|
110
|
+
def({ name: "trends_daily", title: "Daily trending searches", description: "Latest Google daily trending searches for a country, ranked with an opportunity score.", input: z.object({ geo, hl, limit: z.number().int().min(1).max(50).default(20) }), annotations: ro(true), surfaces: ALL, run: (c, a) => c.api.trendsDaily(a) }),
|
|
111
|
+
def({ name: "trends_realtime", title: "Realtime trends", description: "Google realtime trending searches for the last N hours.", input: z.object({ geo, hours: z.number().int().min(1).max(24).default(4) }), annotations: ro(true), surfaces: ALL, run: (c, a) => c.api.trendsRealtime(a) }),
|
|
112
|
+
def({ name: "trend_articles", title: "Trend articles", description: "News articles behind trending keywords (use articleKeys from trends_daily).", input: z.object({ articleKeys: z.array(z.tuple([z.number(), z.string(), z.string()])).min(1).max(20), count: z.number().int().min(1).max(10).default(5) }), annotations: ro(true), surfaces: RL, run: (c, a) => c.api.trendArticles(a) }),
|
|
113
|
+
def({ name: "keyword_suggest", title: "Keyword suggestions", description: "Autocomplete keyword ideas for a seed keyword.", input: z.object({ keyword: z.string().min(1).max(120), hl }), annotations: ro(true), surfaces: ALL, run: (c, a) => c.api.keywordSuggest(a) }),
|
|
114
|
+
def({ name: "keyword_interest", title: "Interest over time", description: "Google Trends interest-over-time series for up to 5 keywords.", input: z.object({ keywords: z.array(z.string().min(1)).min(1).max(5), geo, period }), annotations: ro(true), surfaces: ALL, run: (c, a) => c.api.keywordInterest(a) }),
|
|
115
|
+
def({ name: "keyword_regions", title: "Interest by region", description: "Where a keyword is searched most (geo map data).", input: z.object({ keyword: z.string().min(1), geo, resolution: z.enum(["COUNTRY", "REGION", "CITY", "DMA"]).default("REGION") }), annotations: ro(true), surfaces: RL, run: (c, a) => c.api.keywordRegions(a) }),
|
|
116
|
+
def({ name: "keyword_cluster", title: "Keyword clusters", description: "Cluster a seed keyword into topic groups with search intent and pillar flags (LLM, counts against keyword_cluster quota).", input: z.object({ seed: z.string().min(1).max(120), geo, hl }), annotations: ro(true), surfaces: RL, run: (c, a) => c.api.keywordCluster(a) }),
|
|
117
|
+
def({ name: "topics_trending", title: "Topic Radar", description: "Cross-source topics trending today across Google, GitHub and GitLab.", input: z.object({ day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(), limit: z.number().int().min(1).max(12).default(8) }), annotations: ro(), surfaces: ALL, run: (c, a) => c.api.topicsTrending(a) }),
|
|
118
|
+
def({ name: "repos_trending", title: "Trending repositories", description: "Trending GitHub/GitLab projects by star velocity.", input: z.object({ source: z.enum(["github", "gitlab", "all"]).default("all"), window: z.enum(["1d", "7d", "30d"]).default("7d"), language: z.string().optional(), topic: z.string().optional(), limit: z.number().int().min(1).max(50).default(25) }), annotations: ro(), surfaces: ALL, run: (c, a) => c.api.reposTrending(a) }),
|
|
119
|
+
def({ name: "seo_audit_url", title: "SEO audit", description: "Fetch a public URL and audit technical SEO, meta tags, structured data and AI-search readiness.", input: z.object({ url: z.string().url() }), annotations: ro(true), surfaces: ALL, run: (c, a) => c.api.seoAuditUrl(a) }),
|
|
120
|
+
def({ name: "seo_generate_schema", title: "Generate JSON-LD", description: "Generate a valid JSON-LD snippet (article, faq, product, organization, ...).", input: z.object({ type: z.string().min(2), params: z.record(z.string(), z.unknown()).default({}) }), annotations: ro(), surfaces: ALL, run: (c, a) => c.api.seoGenerateSchema(a) }),
|
|
121
|
+
def({ name: "blog_create", title: "Create blog post", description: "Start a Blog Studio post: runs the brief and outline. Returns the post id.", input: z.object({ topic: z.string().min(3).max(200), primaryKeyword: z.string().optional(), targetWords: z.number().int().min(300).max(5e3).optional(), tone: z.string().optional(), siteId: z.string().optional() }), annotations: rw(), surfaces: RL, run: (c, a) => c.api.blogCreate(a) }),
|
|
122
|
+
def({ name: "blog_write_section", title: "Write blog section", description: "Draft one outline section of a post as markdown.", input: z.object({ postId: z.string(), index: z.number().int().min(0), instruction: z.string().optional() }), annotations: rw(), surfaces: RL, run: (c, a) => c.api.blogWriteSection(a) }),
|
|
123
|
+
def({ name: "blog_optimize", title: "SEO pass", description: "Run the SEO pass on a post: meta options, slug, FAQ, JSON-LD and audit score.", input: z.object({ postId: z.string() }), annotations: rw(), surfaces: RL, run: (c, a) => c.api.blogOptimize(a) }),
|
|
124
|
+
def({ name: "blog_get", title: "Get blog post", description: "Read a post, optionally exported as md/html/mdx.", input: z.object({ postId: z.string(), format: z.enum(["md", "html", "mdx"]).optional() }), annotations: ro(), surfaces: RL, run: (c, a) => c.api.blogGet(a) }),
|
|
125
|
+
def({ name: "blog_list", title: "List blog posts", description: "List your Blog Studio posts.", input: z.object({ limit: z.number().int().min(1).max(100).default(20), cursor: z.string().optional() }), annotations: ro(), surfaces: RL, run: (c, a) => c.api.blogList(a) }),
|
|
126
|
+
def({ name: "chat_ask", title: "Ask SEO chat", description: "Single-turn answer from SEO Chat in a given mode (no nested tools).", input: z.object({ question: z.string().min(1).max(4e3), mode: z.enum(["general", "keywords", "blog", "technical", "schema", "geo", "links", "programmatic"]).default("general") }), annotations: ro(), surfaces: RL, run: (c, a) => c.api.chatAsk(a) }),
|
|
127
|
+
// local only — seoanything v1 running on the user's machine
|
|
128
|
+
def({ name: "local_audit", title: "Audit local files", description: "Audit HTML/JSX/MD files in a local file or folder (or a URL) with the seoanything auditor.", input: z.object({ path: z.string().default(".") }), annotations: ro(), surfaces: ["local"], run: (c, a) => local(c).runAudit(a.path) }),
|
|
129
|
+
def({ name: "local_llms_txt", title: "Generate llms.txt", description: "Generate llms.txt for a project directory. Written to disk only when write=true.", input: z.object({ dir: z.string().default("."), title: z.string().optional(), description: z.string().optional(), write: z.boolean().default(false) }), annotations: rw(), surfaces: ["local"], run: async (c, a) => {
|
|
130
|
+
const l = local(c);
|
|
131
|
+
l.chdir(a.dir);
|
|
132
|
+
const r = l.generateLlmsTxt({ title: a.title, description: a.description });
|
|
133
|
+
if (!a.write) l.rm(r.path);
|
|
134
|
+
return { path: r.path, written: a.write, content: r.content };
|
|
135
|
+
} }),
|
|
136
|
+
def({ name: "local_sitemap", title: "Generate sitemap", description: "Generate sitemap.xml from the pages in a project directory. Written to disk only when write=true.", input: z.object({ dir: z.string().default("."), baseUrl: z.string().url(), write: z.boolean().default(false) }), annotations: rw(), surfaces: ["local"], run: async (c, a) => {
|
|
137
|
+
const l = local(c);
|
|
138
|
+
l.chdir(a.dir);
|
|
139
|
+
const r = l.generateSitemap(a.baseUrl);
|
|
140
|
+
const content = l.readFile(r.path);
|
|
141
|
+
if (!a.write) l.rm(r.path);
|
|
142
|
+
return { path: r.path, written: a.write, count: r.count, content };
|
|
143
|
+
} }),
|
|
144
|
+
def({ name: "local_install_skills", title: "Install SEO skills", description: "Install the seoanything skill packs into an AI agent's config (claude, cursor, gemini, copilot, windsurf, antigravity, universal, all).", input: z.object({ agent: z.enum(["all", "antigravity", "claude", "cursor", "gemini", "copilot", "windsurf", "universal"]).default("all"), global: z.boolean().default(false) }), annotations: rw(), surfaces: ["local"], run: async (c, a) => {
|
|
145
|
+
const l = local(c);
|
|
146
|
+
await l.installSkills({ targetAgent: a.agent, isGlobal: a.global, targetDir: l.cwd });
|
|
147
|
+
return { installed: true, agent: a.agent, dir: a.global ? "~" : l.cwd };
|
|
148
|
+
} })
|
|
149
|
+
];
|
|
150
|
+
var toolByName = (name) => TOOLS.find((t) => t.name === name);
|
|
151
|
+
|
|
152
|
+
// ../tools/src/index.ts
|
|
153
|
+
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
154
|
+
var toUserMessage = (e) => e instanceof ApiFail ? `${e.code}: ${e.message}` : e instanceof Error ? e.message : String(e);
|
|
155
|
+
async function runTool(ctx, name, args) {
|
|
156
|
+
const t = toolByName(name);
|
|
157
|
+
if (!t || !t.surfaces.includes(ctx.surface)) throw new Error(`unknown tool: ${name}`);
|
|
158
|
+
const parsed = t.input.safeParse(args ?? {});
|
|
159
|
+
if (!parsed.success) throw new Error(`invalid arguments for ${name}: ${z2.prettifyError(parsed.error)}`);
|
|
160
|
+
await ctx.onCall?.(name);
|
|
161
|
+
return t.run(ctx, parsed.data);
|
|
162
|
+
}
|
|
163
|
+
function toolsAsOpenAI(surface = "chat") {
|
|
164
|
+
return TOOLS.filter((t) => t.surfaces.includes(surface)).map((t) => {
|
|
165
|
+
const { $schema: _, ...parameters } = z2.toJSONSchema(t.input, { io: "input" });
|
|
166
|
+
return { type: "function", function: { name: t.name, description: t.description, parameters } };
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
var PROMPTS = [
|
|
170
|
+
{ name: "write_seo_blog_post", title: "Write an SEO blog post", description: "Brief \u2192 outline \u2192 sections \u2192 SEO pass with Blog Studio tools.", args: { topic: z2.string(), keyword: z2.string().optional() }, text: (a) => `Write a complete, helpful blog post about "${a.topic}"${a.keyword ? ` targeting the keyword "${a.keyword}"` : ""}. Steps: call blog_create, then blog_write_section for every outline index, then blog_optimize, then blog_get with format "md". Follow the seoanything://skills/seo-content resource (BLUF, E-E-A-T, one H1, descriptive H2s) and report the final audit score.` },
|
|
171
|
+
{ name: "fix_audit_issues", title: "Fix SEO audit issues", description: "Audit a URL and turn the findings into concrete fixes.", args: { url: z2.string() }, text: (a) => `Call seo_audit_url for ${a.url}. For each failing check, explain why it matters in one line and give the exact HTML/config change to fix it, ordered by impact. Use seoanything://skills/seo-technical for thresholds.` },
|
|
172
|
+
{ name: "keyword_cluster_plan", title: "Keyword cluster content plan", description: "Cluster a seed keyword and propose a pillar + cluster plan.", args: { seed: z2.string(), geo: z2.string().optional() }, text: (a) => `Call keyword_cluster with seed "${a.seed}"${a.geo ? ` and geo ${a.geo}` : ""}, then keyword_interest for the top 5 cluster heads. Produce a pillar-and-cluster content plan: one pillar page, 5\u20138 cluster posts, the intent of each, and internal link anchors (see seoanything://skills/seo-keywords and seo-links).` },
|
|
173
|
+
{ name: "ai_search_optimize", title: "Optimize for AI search (GEO)", description: "Make a page citable by AI Overviews, Perplexity and ChatGPT Search.", args: { url: z2.string().optional() }, text: (a) => `${a.url ? `Call seo_audit_url for ${a.url} first. ` : ""}Using seoanything://skills/seo-geo, rewrite the key passages so each H2 section is a standalone, statistic-dense answer, add an FAQ with FAQPage JSON-LD (seo_generate_schema), and draft an llms.txt entry.` }
|
|
174
|
+
];
|
|
175
|
+
function registerAll(server, ctx) {
|
|
176
|
+
for (const t of TOOLS) {
|
|
177
|
+
if (!t.surfaces.includes(ctx.surface)) continue;
|
|
178
|
+
server.registerTool(t.name, { title: t.title, description: t.description, inputSchema: t.input, annotations: t.annotations }, async (args) => {
|
|
179
|
+
try {
|
|
180
|
+
await ctx.onCall?.(t.name);
|
|
181
|
+
const out = await t.run(ctx, args);
|
|
182
|
+
return { content: [{ type: "text", text: typeof out === "string" ? out : JSON.stringify(out, null, 2) }] };
|
|
183
|
+
} catch (e) {
|
|
184
|
+
return { isError: true, content: [{ type: "text", text: toUserMessage(e) }] };
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
for (const p of PROMPTS) {
|
|
189
|
+
server.registerPrompt(p.name, { title: p.title, description: p.description, argsSchema: p.args }, (args) => ({ messages: [{ role: "user", content: { type: "text", text: p.text(args) } }] }));
|
|
190
|
+
}
|
|
191
|
+
server.registerResource("skills", new ResourceTemplate("seoanything://skills/{name}", { list: async () => ({ resources: Object.keys(SKILLS).map((name) => ({ uri: `seoanything://skills/${name}`, name, title: `${name} skill pack`, mimeType: "text/markdown" })) }) }), { title: "SEO skill packs", description: "Compiled seoanything skill packs (seo-content, seo-technical, seo-geo, ...)." }, async (uri, vars) => {
|
|
192
|
+
const text = SKILLS[String(vars.name)];
|
|
193
|
+
if (!text) throw new Error(`no skill named ${String(vars.name)}`);
|
|
194
|
+
return { contents: [{ uri: uri.href, mimeType: "text/markdown", text }] };
|
|
195
|
+
});
|
|
196
|
+
server.registerResource("trends", new ResourceTemplate("seoanything://trends/{geo}/latest", { list: void 0 }), { title: "Latest daily trends", description: "Latest daily trending searches snapshot for a country (ISO-3166 alpha-2)." }, async (uri, vars) => ({ contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(await ctx.api.trendsDaily({ geo: String(vars.geo).toUpperCase() }), null, 2) }] }));
|
|
197
|
+
}
|
|
198
|
+
export {
|
|
199
|
+
ApiFail,
|
|
200
|
+
McpServer,
|
|
201
|
+
PROMPTS,
|
|
202
|
+
TOOLS,
|
|
203
|
+
WebStandardStreamableHTTPServerTransport,
|
|
204
|
+
collectSse,
|
|
205
|
+
httpApi,
|
|
206
|
+
registerAll,
|
|
207
|
+
runTool,
|
|
208
|
+
toUserMessage,
|
|
209
|
+
toolByName,
|
|
210
|
+
toolsAsOpenAI
|
|
211
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seoanything-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "SEOAnything CLI: trends, keywords, SEO chat, blog studio, audits, a local MCP server, and `connect` to run the web app on the Claude/Codex/Gemini/Antigravity CLI on your own computer. https://www.seoanything.dev",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"seoanything": "bin/seoanything.js",
|
|
9
|
+
"seoanything-cli": "bin/seoanything.js",
|
|
10
|
+
"seo-skills": "bin/seoanything.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin",
|
|
14
|
+
"src",
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"typecheck": "echo skip",
|
|
24
|
+
"build": "esbuild ../tools/src/index.ts --bundle --platform=node --format=esm --target=node18 --outfile=dist/tools.mjs --external:zod --external:@modelcontextprotocol/sdk/*",
|
|
25
|
+
"prepack": "pnpm run build"
|
|
26
|
+
},
|
|
27
|
+
"optionalDependencies": {
|
|
28
|
+
"@alkalisummer/google-trends-js": "0.3.7",
|
|
29
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
30
|
+
"zod": "^4.6.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"esbuild": "^0.28.2",
|
|
34
|
+
"vitest": "^3.2.7"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"seoanything-v1": "npm:seoanything@1.0.0"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://www.seoanything.dev",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://gitlab.com/xetu/seo-anyhting.git",
|
|
43
|
+
"directory": "packages/cli"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"seo",
|
|
47
|
+
"google-trends",
|
|
48
|
+
"blog",
|
|
49
|
+
"mcp",
|
|
50
|
+
"claude",
|
|
51
|
+
"codex",
|
|
52
|
+
"cli",
|
|
53
|
+
"cloudflare"
|
|
54
|
+
],
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/api.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Tiny /api/v1 client over fetch (zero deps). Errors carry the RFC 9457 problem and map to exit codes in cli.js.
|
|
2
|
+
export class CliError extends Error {
|
|
3
|
+
constructor(message, exitCode = 1, problem) { super(message); this.exitCode = exitCode; this.problem = problem; }
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const exitCodeFor = (status) => (status === 401 || status === 403 ? 3 : status === 429 ? 4 : status >= 502 && status <= 504 ? 5 : 1);
|
|
7
|
+
|
|
8
|
+
export function client({ server, token }) {
|
|
9
|
+
const headers = (body) => ({ ...(token ? { authorization: `Bearer ${token}` } : {}), ...(body !== undefined ? { "content-type": "application/json" } : {}), "user-agent": "seoanything-cli/2" });
|
|
10
|
+
const raw = async (method, path, body) => {
|
|
11
|
+
let res;
|
|
12
|
+
try { res = await fetch(`${server}${path.startsWith("/api/") ? "" : "/api/v1"}${path}`, { method, headers: headers(body), body: body !== undefined ? JSON.stringify(body) : undefined }); }
|
|
13
|
+
catch (e) { throw new CliError(`cannot reach ${server} (${e.cause?.code ?? e.message})`, 5); }
|
|
14
|
+
if (!res.ok) {
|
|
15
|
+
const p = await res.json().catch(() => ({}));
|
|
16
|
+
const hint = res.status === 401 ? " run `seoanything login`." : res.status === 429 && p.hint ? ` ${p.hint}` : "";
|
|
17
|
+
throw new CliError(`${p.detail ?? p.title ?? res.statusText}${hint}`, exitCodeFor(res.status), p);
|
|
18
|
+
}
|
|
19
|
+
return res;
|
|
20
|
+
};
|
|
21
|
+
const request = async (method, path, body) => {
|
|
22
|
+
const res = await raw(method, path, body);
|
|
23
|
+
if (res.status === 204) return undefined;
|
|
24
|
+
return res.headers.get("content-type")?.includes("json") ? res.json() : res.text();
|
|
25
|
+
};
|
|
26
|
+
return { raw, request, get: (p) => request("GET", p), post: (p, b) => request("POST", p, b ?? {}), del: (p) => request("DELETE", p) };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const qs = (o) => { const p = new URLSearchParams(); for (const [k, v] of Object.entries(o)) if (v !== undefined && v !== null && v !== false) p.set(k, String(v)); const s = p.toString(); return s ? `?${s}` : ""; };
|
|
30
|
+
|
|
31
|
+
/** Stream ChatStreamEvent SSE; calls onDelta(text) as chunks arrive; resolves with the full text. */
|
|
32
|
+
export async function streamSse(res, onDelta) {
|
|
33
|
+
const reader = res.body.getReader(); const dec = new TextDecoder();
|
|
34
|
+
let buf = "", full = "";
|
|
35
|
+
for (;;) {
|
|
36
|
+
const { value, done } = await reader.read();
|
|
37
|
+
if (done) return full;
|
|
38
|
+
buf += dec.decode(value, { stream: true });
|
|
39
|
+
let i;
|
|
40
|
+
while ((i = buf.indexOf("\n\n")) >= 0) {
|
|
41
|
+
const chunk = buf.slice(0, i); buf = buf.slice(i + 2);
|
|
42
|
+
let event = "message", data = "";
|
|
43
|
+
for (const line of chunk.split("\n")) { if (line.startsWith("event:")) event = line.slice(6).trim(); else if (line.startsWith("data:")) data += line.slice(5).trim(); }
|
|
44
|
+
if (!data) continue;
|
|
45
|
+
let j; try { j = JSON.parse(data); } catch { continue; }
|
|
46
|
+
if (event === "delta" && j.text) { full += j.text; onDelta?.(j.text); }
|
|
47
|
+
if (event === "error") throw new CliError(j.message ?? "stream failed", 5, j);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|