N-gram SERP Intent Clusterer
Clusters a keyword list by the overlap of their live SERP results and fuses n-gram intent signals, then labels each clu…
Updated
About this skill
N-gram SERP Intent Clusterer is a Keyword Research skill for AI agents, published in the seoskills.sh catalog. Reach for it when your work involves keyword discovery, search intent mapping, and topical strategy. Install it with one command and it runs inside your own agent, so the work happens in your workflow, not a separate SEO tool.
SKILL.md
N-gram SERP Intent Clusterer
AGENT ROLE: Autonomous keyword-clustering agent. Group keywords by SERP-result overlap (the only ground-truth signal for "same intent"), label intent, and emit the JSON in references/output.schema.json. Cluster by evidence, not by string similarity alone.
OBJECTIVE
Partition a keyword set into clusters where Google returns substantially the same URLs (⇒ one page can rank for all), assign each cluster a dominant intent, and name the canonical target URL.
INPUTS
keywords(REQUIRED string[]).overlap_threshold(OPTIONAL, default 3): min shared top-10 URLs for two keywords to be linked.top_n(OPTIONAL, default 10): SERP depth to compare.location/hl(OPTIONAL): default "United States"/"en".
AUTHENTICATION (SERP API)
- REQUIRE env
SERP_API_KEY. IF unset THEN STOPerror.code="AUTH_MISSING_API_KEY". - Endpoint (SerpApi shape):
GET https://serpapi.com/search.json?engine=google&q={kw}&num={top_n}&api_key={key}. - Record
serp_providerin output; the fetch layer is swappable for DataForSEO.
EXPECTED TOOL CALLS
- Run
scripts/cluster_intent.py --keywords keywords.json --overlap 3. - One SERP fetch per keyword; extract the ordered
organic_results[].linkset.
PROCEDURE (deterministic)
STEP 1 — FETCH the top-top_n organic URLs for every keyword (normalize to registrable-domain + path).
STEP 2 — BUILD an undirected graph: node = keyword; edge (a,b) IF |urls(a) ∩ urls(b)| >= overlap_threshold.
STEP 3 — CLUSTER = connected components (single-linkage on SERP overlap).
STEP 4 — INTENT per cluster: compute n-grams over the cluster's keywords + SERP titles; map modifier n-grams to intent via references-free rules — buy|price|cheap|deal|coupon|for sale→transactional; best|top|review|vs|alternative→commercial; how|what|why|guide|tutorial|ideas→informational; brand/domain tokens→navigational. Dominant = highest-weighted.
STEP 5 — CANONICAL TARGET: the URL appearing in the most keywords' SERPs within the cluster (modal URL); IF the user's own domain ranks, prefer it and note owns_target=true.
STEP 6 — EMIT clusters sorted by size desc; singletons returned as size-1 clusters.
RATE LIMITS & ERROR HANDLING
- SERP APIs bill per search. On
429/quota THEN backoff2^attempt(max 5); after that STOPerror.code="RATE_LIMITED"withpartial= keywords fetched. Never silently drop. - On
5xx/timeout retry ≤3 then mark that keywordstatus="serp_error"and exclude it from clustering (report inskipped). - Concurrency ≤ 3.
MISSING / INSUFFICIENT DATA
- IF a keyword returns < 3 organic URLs THEN it cannot be reliably clustered → return as singleton with
low_confidence=true. - Never merge two keywords below
overlap_thresholdeven if strings look similar (string similarity ≠ intent).
OUTPUT
One JSON object per references/output.schema.json. No prose.
FILES
scripts/cluster_intent.py— SERP fetch, overlap graph, connected-component clustering, intent labeling.references/output.schema.json— output contract.
Not using the CLI? Copy the SKILL.md and paste it straight into ChatGPT, Claude, or any agent.
Embed a badge
Install into your agent
More in Keyword Research
find-keywords
Build a prioritized keyword list for a website, topic, or campaign. Use when the user asks about keyword research, finding keywords to target, building a keyword list, search demand, keyword difficulty, intent mapping, or which keywords to prioritize. For writing content around keywords, see brief. For grouping keywords into clusters, see build-clusters.
seo-plan
Strategic SEO planning for new or existing websites. Industry-specific templates, competitive analysis, content strategy, and implementation roadmap. Use when user says "SEO plan", "SEO strategy", "SEO planning", "content strategy", "keyword strategy", "content calendar", "site architecture", or "SEO roadmap".
seo-cluster
SERP-based semantic topic clustering for content architecture planning. Groups keywords by actual Google SERP overlap (not text similarity), designs hub-and-spoke content clusters with internal link matrices, and generates interactive visualizations. Optionally executes content creation if claude-blog is installed. Use when user says "topic cluster", "content cluster", "semantic clustering", "pillar page", "hub and spoke", "content architecture", "keyword grouping", or "cluster plan".
seo-sxo
Search Experience Optimization: reads Google SERPs backwards to detect page-type mismatches, derives user stories from search intent signals, and scores pages from multiple persona perspectives. Identifies why well-optimized pages fail to rank by analyzing what Google rewards for each keyword. Use when user says "SXO", "search experience", "page type mismatch", "SERP analysis", "user story", "persona scoring", "why isn't my page ranking", "intent mismatch", or "wireframe".
target-serp
Identify and capture SERP features for target keywords — featured snippets, People Also Ask boxes, knowledge panels, and rich results. Use when the user asks about featured snippets, position zero, PAA optimization, rich results, schema markup for SERP features, or how to get more SERP real estate.
amazon-keyword-research
Amazon keyword research and market opportunity analysis for sellers. Retrieve autocomplete suggestions (long-tail keywords), analyze competitor landscape, and assess market opportunity for any keyword on 12 Amazon marketplaces (US/UK/DE/FR/IT/ES/JP/CA/AU/IN/MX/BR). No API key required. Make sure to use this skill whenever the user mentions Amazon product research, finding products to sell on Amazon, Amazon keyword ideas, niche analysis, competition analysis for Amazon, market opportunity on Amazon, comparing Amazon keywords, evaluating whether a product is worth selling, Amazon autocomplete da