Programmatic Link Mesh Builder
Models a generated page set as a directed graph, computes PageRank by power iteration and finds orphan and unreachable…
Updated
Use this skill
$ npx skills add seoskills.sh/programmatic-link-mesh-builderAbout this skill
Programmatic Link Mesh Builder is a Programmatic SEO skill for AI agents, published in the seoskills.sh catalog. Reach for it when your work involves large-scale page generation and ecommerce SEO built for consistent quality. 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
Programmatic Link Mesh Builder
AGENT ROLE: Autonomous internal-linking agent. Build the page graph, compute PageRank and reachability, and return a capped, de-duplicated per-page link plan (hub-spoke + related-entity) that guarantees money-page reachability, emitting the JSON in references/output.schema.json.
OBJECTIVE
Convert a set of programmatic pages (with or without existing links) into an internal-link plan: which new links each page should receive and emit, so authority flows to money pages, no page is orphaned or unreachable, and no page exceeds a link-spam outlink cap.
INPUTS
- Node/edge sources (at least one REQUIRED):
--edges(JSON[[source,dest],...]),--crawl(crawler inlinks CSV with Source/Destination),--sitemap(URL; nodes only),--pages(JSON array of node URLs). money_pages(OPTIONAL via--money-pages): URLs that MUST be reachable and adequately linked.home(OPTIONAL via--home): BFS root for reachability; defaults to a root-path URL, else the highest in-degree node.damping(OPTIONAL, default 0.85),max_iter(100),eps(1e-6): PageRank power-iteration controls.min_inlinks(OPTIONAL, default 1): a page below this in-degree is an orphan.max_outlinks(OPTIONAL, default 100) andmax_new_links_per_page(OPTIONAL, default 5): link-spam caps.top_k_related(OPTIONAL, default 5): related-entity links proposed per page.embeddings(OPTIONAL flag): use semantic similarity instead of URL-token Jaccard.max_nodes(50000),max_cluster_compare(400),max_embeddings(1000): cost guards.
AUTHENTICATION (graph keyless + optional embeddings)
- The graph is built from local files or a public sitemap and needs no credentials.
- IF
--embeddingsis passed THEN REQUIRE envOPENAI_API_KEY. IF unset THEN STOPerror.code="AUTH_MISSING_EMBEDDINGS". IF the key is rejected (401) THEN STOPerror.code="AUTH_INVALID_EMBEDDINGS".
EXPECTED TOOL CALLS
- Run
scripts/link_mesh_builder.py --edges edges.json [--pages pages.json] [--money-pages money.json] [--home https://x.com/] [--max-outlinks 100]. - No paid calls in the default path; embeddings are batched (256/request) only when
--embeddingsis set.
PROCEDURE (deterministic)
STEP 1 — BUILD the node set from every provided source; build de-duplicated out-adjacency and in-degree over edges whose endpoints are both known (drop self-loops). IF node count > max_nodes THEN STOP TOO_MANY_NODES.
STEP 2 — PAGERANK by power iteration with damping; dangling-node mass is redistributed uniformly; stop when L1 delta < eps or max_iter is hit; record pagerank_iterations and pagerank_converged.
STEP 3 — REACHABILITY: BFS from home over existing edges; anything not reached is unreachable. Orphan = in-degree < min_inlinks.
STEP 4 — CLUSTER pages by first path segment; the highest-PageRank page per section is its hub.
STEP 5 — PROPOSE, in priority order, each proposal passing the caps (never exceed max_outlinks; at most max_new_links_per_page new outlinks per page; never duplicate an existing link): (a) for each under-linked/unreachable MONEY page, an inbound link from the highest-PageRank reachable hub; (b) for each orphan spoke, a hub->spoke and spoke->hub link; (c) related-entity links to the top-top_k_related most-similar pages within the section (embedding cosine if enabled and under cap, else URL-token Jaccard).
STEP 6 — EMIT per page: pagerank, current in/out links, orphan + reachability flags, proposed in/out links with reasons, and projected inlinks after the plan; plus global counts and any money page still unreachable.
RATE LIMITS & ERROR HANDLING
- Embeddings
429-> backoff2^attempt(max 5) then STOPRATE_LIMITED;5xxretry <=3 then STOPREQUEST_FAILED; requests are batched and paced (effective concurrency 1). - IF
--sitemapcannot be fetched THEN STOPerror.code="SITEMAP_UNREACHABLE". - Relatedness comparison is bounded to within-section clusters and
max_cluster_comparemembers per cluster to keep cost near-linear; embeddings are skipped (Jaccard fallback, disclosed viarelatedness_method) when node count exceedsmax_embeddings.
MISSING / INSUFFICIENT DATA
- With only a sitemap or
--pages(no edges) every page is legitimately orphan/unreachable; the plan proposes the full initial mesh and this is reflected honestly inedges=0. - A money page that cannot be linked without breaching caps is reported in
unreachable_money_pagesrather than silently force-linked past the spam cap. - PageRank is reported even when it did not converge (
pagerank_converged=false); values are never fabricated as converged. - The relatedness method actually used is always disclosed; no semantic similarity is claimed when Jaccard was used.
OUTPUT
One JSON object per references/output.schema.json.
FILES
scripts/link_mesh_builder.py— graph build, PageRank power iteration, BFS reachability, hub-spoke + related-entity proposal engine with link-spam caps.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 Programmatic SEO
programmatic-seo
When the user wants to create SEO-driven pages at scale using templates and data. Also use when the user mentions "programmatic SEO," "template pages," "pages at scale," "directory pages," "location pages," "[keyword] + [city] pages," "comparison pages," "integration pages," "building many pages for SEO," "pSEO," "generate 100 pages," "data-driven pages," or "templated landing pages." Use this whenever someone wants to create many similar pages targeting different keywords or locations. For auditing existing SEO issues, see seo-audit. For content strategy planning, see content-strategy.
seo-programmatic
Programmatic SEO planning and analysis for pages generated at scale from data sources. Covers template engines, URL patterns, internal linking automation, thin content safeguards, and index bloat prevention. Use when user says "programmatic SEO", "pages at scale", "dynamic pages", "template pages", "generated pages", or "data-driven SEO".
seo-ecommerce
E-commerce SEO analysis: Google Shopping visibility, Amazon marketplace intelligence, product schema validation, competitor pricing analysis, and marketplace keyword gaps. Combines on-page product SEO with marketplace data from DataForSEO Merchant API. Use when user says "ecommerce SEO", "product SEO", "Google Shopping", "marketplace SEO", "product schema", "Amazon SEO", "product listings", "shopping ads", or "merchant SEO".
product-page-seo
Optimize e-commerce product pages for search engine visibility. On-page SEO, structured data, page speed, mobile optimization, and content strategy for Google, Bing, and platform-specific search.
ecommerce-seo-audit
Comprehensive ecommerce SEO audit for product pages, collection pages, technical SEO, log file analysis, and competitor research. Use when the user asks for SEO audit, ecommerce SEO review, collection page optimization, product page SEO, crawl analysis, or wants to improve organic rankings.
Product Feed SEO Optimizer
Audits a Google Merchant product feed for title quality, attribute completeness, and GTIN/identifier validity using the…