Blog Cluster (Semantic Topic Cluster Engine)
Bundled paths below use host Markdown substitution of ${CLAUDE_SKILL_DIR};
it is not an exported shell variable. Resolve them before execution, quote
paths, and refuse nonabsolute overrides. Pass blog_reference_root resolved
from ${CLAUDE_SKILL_DIR}/../blog/references, blog_template_root from
${CLAUDE_SKILL_DIR}/../blog/templates, and needed sibling roots to agents.
Read the main reference orchestration-details.md before loading project
context; pass only its helper-fenced output to downstream agents.
Plans and executes entire interlinked content ecosystems from a single seed keyword. Three layers: Semantic Clustering (the brain), Cluster Architecture (the structure), and Execution Engine (the machine).
Adapted from the semantic-cluster-engine submission by Lutfiya Miller (winner, AI Marketing Hub Pro Challenge, March 2026, 95/100 Exemplary). Original repository: no longer available as of 2026-10-12. This port keeps the Plan + Execute architecture and the cluster context innovation, removes brand-specific (ScienceExperts.ai) styling and image prompts, and routes through claude-blog's existing sub-skills.
Commands
| Command | What it does |
|---|---|
/blog cluster |
Interactive. Asks whether to plan or execute. |
/blog cluster plan <seed-keyword> |
SERP-based semantic analysis. Outputs cluster plan + map. |
/blog cluster plan --from strategy [path] |
Imports existing blog-strategy cluster build plan and validates against SERP data. |
/blog cluster execute [path-to-plan] |
Sequential blog-write calls with cluster context and auto-interlinks. |
Key references (load on demand)
${CLAUDE_SKILL_DIR}/references/semantic-clustering.md(SERP overlap analysis, intent classification, keyword universe expansion)${CLAUDE_SKILL_DIR}/references/cluster-architecture.md(hub-and-spoke specs, schema strategy, link-density rules)${CLAUDE_SKILL_DIR}/references/execution-workflow.md(execution order, context injection, scorecard, failure handling)
Cross-references & Routing
- Skill boundaries:
plan --from strategyconsumes/blog strategytables; Execute calls/blog writesequentially (which internally runsblog-chartand creates one hero viagenerate_hero.py; never call/blog imagedirectly here); run/blog seo-check,/blog cannibalization, and/blog schemaafterward. Never modify files owned by other skills; invokeblog-writeandblog-analyzeone post at a time from this orchestrator (never inside a subagent). - Routing: if bare
/blog cluster, ask whether to plan or execute; routeplan <keyword>-> Plan Phase,plan --from strategy [path]-> Strategy Import,execute [path]/build/run-> Execute Phase.
Plan Phase: /blog cluster plan <seed-keyword>
Reference: ${CLAUDE_SKILL_DIR}/references/semantic-clustering.md
Step 1-2. Expand and cluster keywords
Use WebSearch to expand <seed> to 30-50 phrases (direct search + PAA, long-tail modifiers, question mining, commercial/informational/transactional variants, <seed> <current year> from system date). Group using ${CLAUDE_SKILL_DIR}/references/semantic-clustering.md: SERP overlap (>=4 shared top-10 results = same intent), intent classification, entity mapping, and branch grouping.
Step 3-4. Cluster architecture & internal link matrix
Following ${CLAUDE_SKILL_DIR}/references/cluster-architecture.md, build 1 Pillar (pillar-page, optional estimate 2,500-4,000 words) + 5-15 Spokes across 2-5 clusters (optional estimate 1,200-1,800 words; small-cluster mode of 2-4 spokes requires warning + confirmation; unique primary keyword per post). Plan bidirectional links (Spoke <-> Pillar, 2-3 same-cluster sibling links, 0-1 adjacent-cluster links) so every spoke has >=2 incoming links.
Step 5. Generate output files
All plan and execute artifacts go into a single subdirectory of the current working directory. Canonicalize the output directory, refuse symlinks, and reject writes outside the cluster directory. Slugs must match lowercase letters, numbers, and hyphens only; reject absolute paths, .., path separators inside slugs, and hidden control characters.
<cwd>/
└── cluster-<seed-keyword-slug>/
├── cluster-plan.json
├── cluster-map.html
├── pillar-<slug>.md (Execute Phase)
├── <spoke-slug>.md (Execute Phase, one per spoke)
└── cluster-scorecard.md (Execute Phase)
cluster-plan.json schema
Emit cluster-plan.json following the JSON schema in ${CLAUDE_SKILL_DIR}/references/cluster-architecture.md (seed_keyword, generated_at, pillar, clusters[] with posts[] including links_to/links_from, total_posts, total_interlinks, estimated_total_words). Volume estimates (high|medium|low) are relative SERP indicators; consult Ahrefs, SEMrush, or DataForSEO (seo-dataforseo from claude-seo, if installed) for exact volumes.
cluster-map.html (XSS-safe)
A static, self-contained HTML file with an embedded SVG visualization. Hard rules for the writer:
- No inline
<script>blocks. Noonclick,onmouseover, or anyon*event attributes anywhere in the document. - No external script
<src>references. - Every text label drawn into the SVG (titles, keywords, cluster names) must be escaped: replace
&with&,<with<,>with>,"with", and'with'before insertion. - Hover effects use CSS
:hoveronly. No JavaScript. - Use
<title>child elements inside SVG nodes for accessible tooltips (browser native, no script).
The map shows: a central pillar node, color-coded cluster groups radiating outward, spoke nodes within each cluster, and link lines connecting related nodes.
Step 6. Present plan to user
Show a summary table of clusters and posts, total interlinks, estimated words, and the file paths. Ask for confirmation before proceeding to execution. Wait for explicit user approval. Do not auto-execute.
Strategy Import: /blog cluster plan --from strategy [path]
Bridges blog-strategy output into a cluster plan.
- Locate strategy output. Scan the current directory (or the user-specified path) for a file containing a
Cluster Build Plantable with the columns# | Spoke Topic | Template | Target Keyword | Word Count | Internal Links(the format produced by/blog strategy). - Parse the table. Extract the pillar row (marked
P), the spoke rows, template assignments, target keywords, word counts, and link relationships. - Validate and enrich. Run SERP overlap validation (Plan Phase Step 2) on each keyword. Add volume estimates and verify cluster groupings semantically.
- If SERP data contradicts the strategy table, flag the conflict; do not silently override the user's strategic intent.
- Generate
cluster-plan.jsonandcluster-map.htmlusing the same outputs as the standard Plan Phase. - Present the converted plan with any SERP-based adjustments highlighted, and wait for user confirmation.
Execute Phase: /blog cluster execute [path-to-plan]
Reference: ${CLAUDE_SKILL_DIR}/references/execution-workflow.md
Step 1. Load plan
Read cluster-plan.json from the user-specified path or the most recent cluster-*/cluster-plan.json in the working directory. Validate JSON structure. If no plan exists, return: "No cluster plan found. Run /blog cluster plan <seed-keyword> first."
Before reading a user-supplied plan path, canonicalize it relative to the current working directory. Reject absolute paths, .., symlinks, non-cluster-plan.json filenames, and any path outside the selected cluster directory. Constrain all generated post, image, map, and scorecard outputs to that cluster directory.
Step 2. Determine execution order
- Pillar page first (so spokes can link to a known filename).
- Then spokes, ordered by
(cluster priority, search_volume_estimate desc, post id alphabetical). Cluster priority is the sum of estimated volumes within the cluster (highest first). - Alternating between clusters when more than 2 clusters exist diversifies the early content spread.
Step 3. For each post: build cluster context and call blog-write
One-time cost question (before the first post). Execution is bulk and
paid. Ask once, and wait for an explicit yes: "This plan has N posts. Each
post runs a full blog-write pass, one blog-reviewer pass (more if a gate
blocks, at most 3 failed gate runs per post), and one hero image. A Gemini hero is one paid
image call per post (about N times the current per-image price on
https://ai.google.dev/gemini-api/docs/pricing). Proceed with Gemini heroes,
use free stock heroes only, or stop?" Record the answer in the cluster
context as HERO: gemini or HERO: stock-only. For stock-only, run
generate_hero.py without --allow-paid (its default), so a Gemini key is
ignored. Only HERO: gemini adds --allow-paid.
The yes covers exactly N heroes; never regenerate in a loop. Report each
fallback or skip (a stock hero, a skipped post) as one line under
"Fallbacks and skips" in the final report.
Construct the cluster context block (full schema in ${CLAUDE_SKILL_DIR}/references/execution-workflow.md) and prepend it to the topic prompt when you invoke the blog-write skill directly (not through a Task). The context tells blog-write the cluster name, the post's role (pillar or spoke), the primary and secondary keywords, the chosen template, the optional length estimate, the list of already-written posts (link to these), the list of upcoming posts (use [INTERNAL-LINK] placeholders), and the linking requirements for this post.
Evidence provenance propagation. The cluster context includes this directive for every spoke and the pillar: "Keep material claims traceable to sources that support them. Record dates, publisher/title details, retrieval notes, methodology, and limitations when they help identify or interpret the source. Use the publication's citation style. Drop unverifiable statistics and replace contradicted ones."
This cascade preserves evidence discipline across batch execution without
turning a fixed source-record format into a score or gate. See
${CLAUDE_SKILL_DIR}/../blog/references/flow-alignment.md.
The context also instructs blog-write to run autonomously: skip topic clarification, skip outline approval, do not auto-detect template, do not pause.
Each post goes through blog-write's full delivery contract (the canonical
sequence: draft, resolve visuals, render, init nonce, review, gates). Cluster
[INTERNAL-LINK: anchor -> filename.md] markers are draft-only: the
orchestrator resolves every one at the visuals step, before render. A marker
whose target is already written becomes a real link. A marker whose target is a
later post in the plan becomes a real relative link to that post's PLANNED
filename (the plan fixes every filename), which resolves once the cluster
finishes; the scorecard's link audit then confirms every target exists. A
marker with no planned target is removed. No marker may survive into a
delivered post.
Output format: standard markdown (.md) by default, matching blog-write's default. If the user explicitly requests HTML, set the platform target accordingly. Do not impose any brand-specific CSS or wordmark; that is the user's responsibility downstream.
Step 4. Hero images (no separate blog-image call)
Do not call /blog image from this skill. blog-write's delivery contract
requires a hero for every post and creates it once through generate_hero.py
into that post's draft folder, so a second call would double the spend and
produce a competing file. The hero is therefore required, not optional: if no
hero can be produced for a post, that post fails the contract and the batch
stops under Step 6. Honor the HERO: answer from Step 3 and record the source
and model (from hero-credit.txt) per post in the scorecard.
Step 5. Backward link injection
Earlier posts need links to later ones, but a post that has passed the delivery contract must not be edited in place: any change to its markdown, HTML, PDF, or hero invalidates the review nonce and the gates. Handle each case explicitly:
- Prevent most edits. Because forward markers resolve to planned
filenames (Step 3), an earlier post already links to every later post the
plan says it should. Check
links_toandlinks_fromin the plan. - Target still in draft (its contract has not run yet, for example when
it is queued behind the post just written): replace the matching
[INTERNAL-LINK: keyword -> filename.md]marker with[keyword](filename.md)in the markdown BEFORE the contract runs. No re-review is needed. - Target already delivered and a link is still missing: do not touch the
file. Append a proposed edit to
cluster-<slug>/cluster-link-patches.md(file, anchor text, the sentence to change, target filename) and show the list in the final report. If the user explicitly opts in to apply a patch, edit the markdown and then repeat the canonical sequence for that post: if the post's last full gate run passed (it was delivered, so this is a new edit pass), runblog_preflight.py --draft <post folder> --reset-iterations; never reset a post whose last run failed. Then re-render, re-init the review nonce, re-review, re-run preflight--strict(at most 3 failed gate runs). Tell the user the number of extra reviewer runs first. - Cluster metadata (
cluster:,cluster_role:,cluster_group:,cluster_position:) is written into each post's frontmatter during its own draft (Step 3), never added afterward.
Step 6. Failure handling
If blog-write returns a quality-gate failure for any post, stop the batch immediately. Save progress, mark the failed post and all remaining posts as skipped, and tell the user to inspect or retry the failed post manually before continuing. Do not keep generating 5 to 15 posts after a quality failure, because that can create scaled-content-abuse risk.
If blog-write fails before content is generated because of a timeout or runtime error, log the failure in the scorecard and stop unless the user explicitly resumes after checking the cause.
If the user cancels mid-execution, save progress and note completed posts. On the next /blog cluster execute, detect already-written files and resume from the next unwritten post.
Step 7. Generate cluster-scorecard.md
After all attempted posts complete, produce a markdown scorecard covering:
- Per-post status (written, failed, skipped) with file path and word count.
- Per-post quality score (invoke
blog-analyzeon each post, one at a time) and the cluster average. - Cluster cohesion score: a 0 to 100 composite of link reciprocity, intent diversity, template diversity, and keyword coverage (formula in
${CLAUDE_SKILL_DIR}/references/execution-workflow.md). - Internal-link audit: outgoing and incoming counts per post, orphan flags, unresolved
[INTERNAL-LINK]markers. - Cannibalization check: any two posts sharing primary keyword, or any pair with greater than 70% keyword overlap. Recommend running
/blog cannibalizationfor a deeper pass. - Hero summary: per-post hero source and model from
hero-credit.txt, and any stock fallbacks. - Link patches: the contents of
cluster-link-patches.md, if any. - Recommended next actions: schema generation (
/blog schema), per-post SEO validation (/blog seo-check), repurposing (/blog repurpose).
Step 8. Final report
Return a concise summary with totals, scorecard path (cluster-scorecard.md), any cluster-link-patches.md items, and next-action commands (/blog schema, /blog seo-check, /blog cannibalization, /blog repurpose).
Quality Gates & Error Handling
- Plan gates: block execution if any two posts share a primary keyword; warn on fewer than 2 clusters of 2+ posts, fewer than 2 distinct intents, or fewer than 2 incoming links per post; treat word-count estimates and template diversity as advisory only.
- Error handling: narrow seeds >50 variants or offer small-cluster mode (<5 variants); without WebSearch, emit draft plan only and require confirmation/imported data; validate
cluster-plan.jsonsyntax with line numbers; ifblog-writeis unavailable, tell the userclaude-blogis required; stop immediately on any post quality-gate failure or missing hero (Step 6) and preserve completed posts for resume on cancel. - Scope: unlike
blog-strategy(high-level pillars),blog-calendar(scheduling),blog-cannibalization(post-hoc overlap check), or single-postblog-write/blog-outline,blog-clusterowns SERP-validated cluster planning and coordinated multi-post execution.
