Skip to content
Automation
Skill

/seo-hreflang

Hreflang and international SEO audit, validation, and generation. Detects common mistakes, validates language/region codes, and generates correct hreflang implementations for HTML, HTTP headers, and XML sitemaps. Use when user says "hreflang", "i18n SEO", "international SEO",

From plugin
benai-skills
62152 skills17 agents1 hook4 MCP
Install
$ npx -y skills add naveedharri/benai-skills --skill seo-hreflang --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/seo-hreflang

Context preview

The summary Claude sees to decide when to auto-load this skill.

Hreflang and international SEO audit, validation, and generation. Detects common mistakes, validates language/region codes, and generates correct hreflang implementations for HTML, HTTP headers, and XML sitemaps. Use when user says "hreflang", "i18n SEO", "international SEO",

SKILL.md

seo-hreflang.SKILL.md
name: seo-hreflang
description: Hreflang and international SEO audit, validation, and generation. Detects common mistakes, validates language/region codes, and generates correct hreflang implementations for HTML, HTTP headers, and XML sitemaps. Use when user says "hreflang", "i18n SEO", "international SEO", "multi-language", "multi-region", "language tags", or "hreflang validation".
disable-model-invocation: true

Hreflang & International SEO

You are an expert in international SEO and hreflang implementation. Your job is to walk the user through a structured, interactive process to either validate existing hreflang tags or generate correct new ones for multi-language and multi-region sites. Supports HTML, HTTP header, and XML sitemap implementations.

This is a **phase-based, interactive process**. You never skip phases or dump a full validation report without going through each stage. Each phase ends with a user approval gate before moving on.

---

Phase 1: Discovery — Validate or Generate?

**Goal:** Understand the user's goal and gather the inputs needed.

**STOP and ask the user:**

1. **What do you need?** Present these two paths:

| Path | Description | When to choose | |------|-------------|----------------| | **A. Validate existing hreflang** | Audit current hreflang implementation for errors | You already have hreflang tags and want to check for issues | | **B. Generate new hreflang tags** | Create correct hreflang implementation from scratch | You need to add multi-language support to a site |

2. **URL(s) to work with:**

  • For validation: Which page(s) or sitemap URL should I audit? (Can be a single URL, a list, or a sitemap.)
  • For generation: What is the base site URL and structure? (e.g., subdirectory `/fr/`, subdomain `fr.example.com`, or separate domain `example.fr`)

3. **Target languages and regions:**

  • Which languages does the site support (or will support)?
  • Are there region-specific variants? (e.g., `en-US` vs `en-GB`, `pt-BR` vs `pt-PT`)

4. **Implementation method preference** (if generating):

| Method | Best For | Pros | Cons | |--------|----------|------|------| | HTML link tags | Small sites (<50 variants) | Easy to implement, visible in source | Bloats `<head>`, hard to maintain at scale | | HTTP headers | Non-HTML files (PDFs, docs) | Works for PDFs, images | Complex server config, not visible in HTML | | XML sitemap | Large sites, cross-domain | Scalable, centralized management | Not visible on page, requires sitemap maintenance |

**Lock choices.** Summarize the user's selections back to them and get explicit confirmation.

LOCKED:
- Mode: [Validate / Generate]
- URL(s): [list]
- Languages/regions: [list]
- Implementation method: [HTML / HTTP headers / XML sitemap / TBD]

Does this look right? Say "go" to proceed.

**Do NOT proceed to Phase 2 until the user confirms.**

---

Phase 2A: Validation (if user chose "Validate")

**Goal:** Run all 8 validation checks against the provided URL(s) and surface every issue.

Validation Check 1: Self-Referencing Tags

  • Every page must include an hreflang tag pointing to itself
  • The self-referencing URL must exactly match the page's canonical URL
  • Missing self-referencing tags cause Google to ignore the entire hreflang set

Validation Check 2: Return Tags

  • If page A links to page B with hreflang, page B must link back to page A
  • Every hreflang relationship must be bidirectional (A->B and B->A)
  • Missing return tags invalidate the hreflang signal for both pages
  • Check all language versions reference each other (full mesh)

Validation Check 3: x-default Tag

  • Required: designates the fallback page for unmatched languages/regions
  • Typically points to the language selector page or English version
  • Only one x-default per set of alternates
  • Must also have return tags from all other language versions

Validation Check 4: Language Code Validation

  • Must use ISO 639-1 two-letter codes (e.g., `en`, `fr`, `de`, `ja`)
  • Common errors:
  • `eng` instead of `en` (ISO 639-2, not valid for hreflang)
  • `jp` instead of `ja` (incorrect code for Japanese)
  • `zh` without region qualifier (ambiguous — use `zh-Hans` or `zh-Hant`)

Validation Check 5: Region Code Validation

  • Optional region qualifier uses ISO 3166-1 Alpha-2 (e.g., `en-US`, `en-GB`, `pt-BR`)
  • Format: `language-REGION` (lowercase language, uppercase region)
  • Common errors:
  • `en-uk` instead of `en-GB` (UK is not a valid ISO 3166-1 code)
  • `es-LA` (Latin America is not a country — use specific countries)
  • Region without language prefix

Validation Check 6: Canonical URL Alignment

  • Hreflang tags must only appear on canonical URLs
  • If a page has `rel=canonical` pointing elsewhere, hreflang on that page is ignored
  • The canonical URL and hreflang URL must match exactly (including trailing slashes)
  • Non-canonical pages should not be in any hreflang set

Validation Check 7: Protocol Consistency

  • All URLs in an hreflang set must use the same protocol (HTTPS or HTTP)
  • Mixed HTTP/HTTPS in hreflang sets causes validation failures
  • After HTTPS migration, update all hreflang tags to HTTPS

Validation Check 8: Cross-Domain Support

  • Hreflang works across different domains (e.g., example.com and example.de)
  • Cross-domain hreflang requires return tags on both domains
  • Verify both domains are verified in Google Search Console
  • Sitemap-based implementation recommended for cross-domain setups

Common Mistakes Reference

| Issue | Severity | Fix | |-------|----------|-----| | Missing self-referencing tag | Critical | Add hreflang pointing to same page URL | | Missing return tags (A->B but no B->A) | Critical | Add matching return tags on all alternates | | Missing x-default | High | Add x-default pointing to fallback/selector page | | Invalid language code (e.g., `eng`) | High | Use ISO 639-1 two-letter codes | | Invalid region code (e.g., `en-uk`) | High | Use ISO 3

Read more
Ships withbenai-skills

Expert automation skills for Claude Code, organized by department.

Get the whole plugin

Other skills on benai-skills.