seoskills.sh
Catalog/Tooling Integrations/Ahrefs-GSC Backlink Reconciler

Ahrefs-GSC Backlink Reconciler

Pulls referring domains from the Ahrefs API v3, reads the Search Console "Top linking sites" CSV export (Search Console…

Updated

New

Use this skill

$ npx skills add seoskills.sh/ahrefs-gsc-backlink-reconciler
Repository
seoskills.sh
GitHub stars
License
MIT

About this skill

Ahrefs-GSC Backlink Reconciler is a Tooling Integrations skill for AI agents, published in the seoskills.sh catalog. Reach for it when your work involves ahrefs, Semrush, Screaming Frog, Moz, and Search Console workflows. 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

Ahrefs-GSC Backlink Reconciler

AGENT ROLE: Autonomous link-reconciliation agent. Fetch Ahrefs referring domains, ingest the GSC top-linking-sites export, optionally add Semrush, collapse every host to its registrable domain, and reconcile into one authoritative set with source attribution. Emit the JSON in references/output.schema.json. Stateful across runs via authoritative_domains.

OBJECTIVE

Produce a single deduped referring-domain list that is honest about where each domain was seen (Ahrefs, GSC, Semrush), quantify how much each tool uniquely contributes, and surface the domains each tool misses plus the run-over-run gains and losses — so link audits stop trusting any one vendor's index.

INPUTS

  • target (REQUIRED): root domain to reconcile (e.g. example.com).
  • gsc-links-csv (OPTIONAL but recommended): the Search Console "Top linking sites" CSV export. Absent → Ahrefs is returned without reconciliation.
  • use-semrush (OPTIONAL flag): also pull Semrush referring domains (needs SEMRUSH_API_KEY).
  • previous (OPTIONAL): prior run's output (its authoritative_domains drives gained/lost). Absent → baseline.
  • max-domains (OPTIONAL, default 5000): cost guard on rows requested per vendor.
  • verify-min-dr (OPTIONAL, default 30): Ahrefs-only domains at/above this DR are flagged for manual verification.

AUTHENTICATION (Ahrefs API v3; optional Semrush)

  1. REQUIRE env AHREFS_API_TOKEN. IF unset THEN STOP error.code="AUTH_MISSING_AHREFS_TOKEN".
    • Endpoint: GET https://api.ahrefs.com/v3/site-explorer/refdomains with header Authorization: Bearer {token}, select=domain,domain_rating,dofollow_links,linked_domains,first_seen,last_seen.
    • 401 → STOP AUTH_INVALID_AHREFS_TOKEN; 403 → STOP AHREFS_FORBIDDEN.
  2. GSC has NO links API. The "Top linking sites" report must be exported by hand and passed as --gsc-links-csv. Do NOT claim GSC data without the CSV.
  3. IF --use-semrush AND SEMRUSH_API_KEY set: GET https://api.semrush.com/analytics/v1/?type=backlinks_refdomains (returns ;-delimited CSV). Missing key → degrade with sources.semrush="skipped_no_key".

EXPECTED TOOL CALLS

  • Run scripts/backlink_reconciler.py --target example.com --gsc-links-csv top_linking_sites.csv [--use-semrush] [--previous prev.json].
  • One Ahrefs refdomains call; optionally one Semrush call; local CSV parse for GSC.

PROCEDURE (deterministic)

STEP 1 — FETCH Ahrefs referring domains (capped at max-domains), collapsing subdomains to the registrable domain and keeping the strongest DR per domain. STEP 2 — READ the GSC export; detect the host column (first column when unlabeled) and any linking-pages count; normalize hosts to registrable domains. STEP 3 — OPTIONALLY fetch Semrush referring domains and normalize. STEP 4 — UNION into an authoritative set; attribute each domain to the sources that reported it and attach the best available attributes (DR, GSC linking pages, first seen). STEP 5 — PARTITION vs GSC: both, ahrefs_only, gsc_only; compute overlap and each tool's unique share. STEP 6 — FLAG verification candidates: gsc_only (Google sees a link Ahrefs misses) and high-DR ahrefs_only (authority domain Google's export omits — possibly nofollow/disallowed/uncounted). STEP 7 — DIFF vs previous.authoritative_domainsgained_domains, lost_domains. First run → status="baseline".

RATE LIMITS & ERROR HANDLING

  • Ahrefs 429 → backoff 2^attempt (max 5) then STOP RATE_LIMITED; 5xx retry ≤3.
  • Semrush is best-effort: on 429/error the run continues with sources.semrush carrying the reason (never fabricated).
  • Registrable-domain mapping uses a curated two-level public-suffix set (heuristic, not the full PSL); it is documented, not silently exact.

MISSING / INSUFFICIENT DATA

  • No --gsc-links-csvreconciliation="skipped_no_csv"; return the Ahrefs set only, do not invent GSC coverage.
  • Empty GSC export → sources.gsc="empty_export".
  • First run (no previous) → status="baseline"; no gained/lost computed.
  • Never merge a host into a domain it does not belong to; when the suffix is unknown the last two labels are used and this is disclosed.

OUTPUT

One JSON object per references/output.schema.json. authoritative_domains MUST be persisted and passed back as the next run's --previous.

FILES

  • scripts/backlink_reconciler.py — Ahrefs + GSC + Semrush fetch, registrable-domain normalization, reconciliation and diff.
  • 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

seoskills.sh install badge

More in Tooling Integrations

Tooling Integrationsfirecrawl/cli

firecrawl-agent

Autonomous multi-page extraction into structured JSON. Use when the user wants website data matching a schema — pricing tiers, product listings — beyond a single-page scrape.

79.3K installs
Tooling Integrationsfirecrawl/firecrawl-workflows

firecrawl-seo-audit

Audit a website's SEO with Firecrawl. Use when the user asks for an SEO audit, metadata and heading review, sitemap/site-structure analysis, keyword opportunities, competitor SERP comparison, or prioritized search optimization recommendations.

31.7K installs
Tooling Integrationsagricidaniel/claude-seo

seo-google

Google SEO APIs: Search Console (Search Analytics, URL Inspection, Sitemaps), PageSpeed Insights v5, CrUX field data with 25-week history, Indexing API v3, and GA4 organic traffic. Provides real Google field data for Core Web Vitals, indexation status, search performance, and organic traffic trends. Use when user says "search console", "GSC", "PageSpeed", "CrUX", "field data", "indexing API", "GA4 organic", "URL inspection", or "real CWV data".

5K installs
Tooling Integrationsevery-app/open-seo

seo-project-setup

Populate a project's shared OpenSEO context — site scope, goals, positioning, competitors, key pages, and preferences — plus MCP checks and Search Console intake.

4.3K installs
Tooling Integrationsagricidaniel/claude-seo

seo-flow

FLOW framework integration: evidence-led SEO using the Find → Leverage → Optimize → Win loop. Surfaces stage-specific AI prompts from the FLOW knowledge base (41 prompts, CC BY 4.0). Use when user says "FLOW", "FLOW framework", "seo flow", "evidence-led SEO", "find leverage optimize win", or wants stage-specific SEO prompts.

4.1K installs
Tooling Integrationsseoskills.sh

Screaming Frog Warehouse Loader

Normalizes Screaming Frog SEO Spider CSV exports (internal_all, response_codes, directives, all_inlinks) into one stabl…

New