SEO
by addyosmani / web-quality-skills
Optimize for search engine visibility and ranking.
Maps the full hreflang graph across language and region versions and validates return tags, self-references, locale codes and canonical consistency.
Listed ·Updated
AGENT ROLE: Autonomous internationalization-integrity agent. Build the hreflang cluster graph from the provided URLs (or sitemap) and report every broken edge per references/output.schema.json. Report facts, not opinions.
For a cluster of alternate-language pages, verify that hreflang annotations form a valid, fully reciprocal graph: every page references every alternate, every alternate references back, all locale codes are valid, all targets are 200/canonical.
urls (REQUIRED string[]) OR sitemap_url (REQUIRED if urls absent): entry points for the cluster.source (OPTIONAL enum html|http_header|sitemap): where to read hreflang. Default html (also parse HTTP Link headers).expected_locales (OPTIONAL string[]): if given, flag any cluster missing one of these.max_urls (OPTIONAL, default 2000).seoskills-hreflang/1.0.robots.txt; IF a URL is disallowed THEN skip with reason robots_disallow.scripts/hreflang_validate.py --urls a,b,c (or --sitemap {url}).Link: header. Parse <link rel="alternate" hreflang="xx-YY" href="..."> from <head> and headers.STEP 1 — COLLECT: for each URL capture {status, canonical, declared: [{hreflang, href}]}.
STEP 2 — BUILD GRAPH: nodes = fetched URLs; edge A→B for each declared alternate on A pointing to B.
STEP 3 — VALIDATE each node/edge, emit an issue with a code for every failure:
RETURN_TAG_MISSING: A→B exists but B→A does not (non-reciprocal).SELF_REFERENCE_MISSING: page does not include an hreflang pointing to its own URL.INVALID_LOCALE: hreflang not a valid ISO 639-1 language, optional ISO 3166-1 region, or x-default.TARGET_NOT_200: alternate href resolves to non-200 (follow ≤3 redirects; report final).NON_CANONICAL_TARGET: alternate href differs from that target's own canonical.MIXED_ABSOLUTE_RELATIVE / HTTP_TARGET_ON_HTTPS: protocol/host inconsistencies.DUPLICATE_LOCALE: two hrefs for the same hreflang value on one page.MISSING_EXPECTED_LOCALE: cluster lacks a locale from expected_locales.
STEP 4 — GROUP issues by cluster (connected component) and emit; valid=true only if a cluster has zero issues.429/503 THEN backoff 2^attempt (max 4); IF still failing THEN mark that URL fetch_status="unavailable" and downgrade dependent edges to code="TARGET_UNVERIFIABLE" (do not assert broken).NO_HREFLANG_DECLARED (info-level) unless it is genuinely single-locale.sitemap_url yields 0 URLs THEN status="empty_input", no error.RETURN_TAG_MISSING for a target that was TARGET_UNVERIFIABLE.One JSON object per references/output.schema.json. No prose.
scripts/hreflang_validate.py — crawler + graph validation.references/output.schema.json — output contract.Not using the CLI? Copy the SKILL.md and paste it straight into ChatGPT, Claude, or any agent.