Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

feat(v2): Checkpoint 2 — QRG-aligned content quality gates (Phase B)

Danieldca5d5af434c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 383bb94..95b28b6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -57,7 +57,12 @@ jobs:
python3 -m py_compile scripts/release_report.py
python3 -m py_compile scripts/release_sign.py
python3 -m py_compile scripts/verify_release.py
- echo "All 34 scripts passed syntax check"
+ python3 -m py_compile scripts/content_quality.py
+ python3 -m py_compile scripts/content_humanize.py
+ python3 -m py_compile scripts/content_verify.py
+ python3 -m py_compile scripts/domain_history.py
+ python3 -m py_compile scripts/seo_updates.py
+ echo "All 39 scripts passed syntax check"
test:
name: Test suite (manifests + sync_flow)
diff --git a/data/google-updates.json b/data/google-updates.json
new file mode 100644
index 0000000..2003952
--- /dev/null
+++ b/data/google-updates.json
@@ -0,0 +1,151 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "source_of_truth": "https://status.search.google.com/products/rGHU1u87FJnkP6W2GwMi/history",
+ "secondary_sources": [
+ "https://developers.google.com/search/blog",
+ "https://developers.google.com/search/updates",
+ "https://blog.google/products/search/"
+ ],
+ "last_verified": "2026-05-17",
+ "policy": "Every entry must cite a Google-owned URL. Third-party-only claims belong in unverified[]. Bump last_verified each time an entry is added or revised.",
+ "updates": [
+ {
+ "date": "2024-03-05",
+ "name": "March 2024 Core Update + spam updates",
+ "kind": "core+spam",
+ "source": "https://developers.google.com/search/blog/2024/03/core-update-spam-policies",
+ "notes": "Helpful Content System merged into core ranking; new spam policies for scaled content, site reputation, and expired domain abuse."
+ },
+ {
+ "date": "2024-03-05",
+ "name": "INP replaces FID",
+ "kind": "cwv",
+ "source": "https://web.dev/articles/inp",
+ "notes": "INP becomes a stable Core Web Vital. FID dropped from CrUX/PSI 2024-09-09."
+ },
+ {
+ "date": "2024-05-05",
+ "name": "Site reputation abuse enforcement begins",
+ "kind": "policy",
+ "source": "https://developers.google.com/search/blog/2024/03/core-update-spam-policies",
+ "notes": "Manual actions phase begins. First wave hits Forbes Advisor, CNN Underscored, WSJ Buy Side."
+ },
+ {
+ "date": "2024-06-20",
+ "name": "June 2024 Spam Update",
+ "kind": "spam",
+ "source": "https://status.search.google.com/incidents/Rb4QyP3aKQ8RpVeQyMyA",
+ "notes": "Targeted policy-violating sites."
+ },
+ {
+ "date": "2024-08-15",
+ "name": "August 2024 Core Update",
+ "kind": "core",
+ "source": "https://developers.google.com/search/blog/2024/08/august-2024-core-update",
+ "notes": "Google: 'designed to surface more useful content'. Partial Helpful Content recoveries reported."
+ },
+ {
+ "date": "2024-11-11",
+ "name": "November 2024 Core Update",
+ "kind": "core",
+ "source": "https://developers.google.com/search/updates/ranking-update-history",
+ "notes": "24-day rollout."
+ },
+ {
+ "date": "2024-11-19",
+ "name": "Site Reputation Abuse policy clarified",
+ "kind": "policy",
+ "source": "https://developers.google.com/search/blog/2024/11/site-reputation-abuse-update",
+ "notes": "No amount of first-party involvement changes the third-party nature. Section-level removals (CNN Underscored /reviews, Forbes /health) within hours."
+ },
+ {
+ "date": "2024-12-12",
+ "name": "December 2024 Core Update",
+ "kind": "core",
+ "source": "https://developers.google.com/search/updates/ranking-update-history",
+ "notes": "Tight rollout (~7 days)."
+ },
+ {
+ "date": "2024-12-19",
+ "name": "December 2024 Spam Update",
+ "kind": "spam",
+ "source": "https://developers.google.com/search/updates/ranking-update-history",
+ "notes": "Cited as targeting scaled content abuse."
+ },
+ {
+ "date": "2025-01-23",
+ "name": "QRG update (Jan 2025)",
+ "kind": "qrg",
+ "source": "https://services.google.com/fh/files/misc/hsw-sqrg.pdf",
+ "notes": "Adds formal definition of generative AI (§2.1). Defines scaled content abuse, expired-domain abuse, filler content under §4.6 Spammy Webpages. Lowest rating triggered when all/almost all MC is copied, paraphrased, or AI-generated."
+ },
+ {
+ "date": "2025-03-05",
+ "name": "AI Mode experimental launch",
+ "kind": "product",
+ "source": "https://blog.google/products/search/ai-mode-search/",
+ "notes": "Initially Google One AI Premium / Labs (US). Gemini 2.0 backend. Query fan-out technique."
+ },
+ {
+ "date": "2025-03-13",
+ "name": "March 2025 Core Update",
+ "kind": "core",
+ "source": "https://developers.google.com/search/updates/ranking-update-history",
+ "notes": "14-day rollout."
+ },
+ {
+ "date": "2025-05-20",
+ "name": "AI Mode general rollout (US)",
+ "kind": "product",
+ "source": "https://blog.google/products/search/google-search-ai-mode-update/",
+ "notes": "No Labs sign-up required. Gemini 2.5 in AI Mode and AI Overviews."
+ },
+ {
+ "date": "2025-06-19",
+ "name": "Structured data deprecation",
+ "kind": "schema",
+ "source": "https://developers.google.com/search/blog/2025/06/simplifying-search-results",
+ "notes": "Phased out: Course Info, Claim Review, Estimated Salary, Learning Video, Special Announcement (carryover), Vehicle Listing."
+ },
+ {
+ "date": "2025-06-30",
+ "name": "June 2025 Core Update",
+ "kind": "core",
+ "source": "https://developers.google.com/search/updates/ranking-update-history",
+ "notes": "16-day rollout. Some Sep 2023 HCU partial recoveries."
+ },
+ {
+ "date": "2025-08-21",
+ "name": "AI Mode expands to 180+ countries",
+ "kind": "product",
+ "source": "https://blog.google/products/search/google-search-ai-mode-update/",
+ "notes": "English first. Robby Stein: 'active' AI Mode begins with dining reservations."
+ },
+ {
+ "date": "2025-09-11",
+ "name": "QRG update (Sept 2025)",
+ "kind": "qrg",
+ "source": "https://services.google.com/fh/files/misc/hsw-sqrg.pdf",
+ "notes": "Adds AI Overview rating examples. Expands YMYL to include political/social topics. Google: 'no change to rating guidance'."
+ },
+ {
+ "date": "2025-12-11",
+ "name": "December 2025 Core Update",
+ "kind": "core",
+ "source": "https://developers.google.com/search/updates/ranking-update-history",
+ "notes": "18-day rollout. Third core update of 2025. Reported eCommerce skew per Amsive analysis."
+ }
+ ],
+ "unverified": [
+ {
+ "date": "2026-03-xx",
+ "claim": "Third-party reports of a March 2026 core update exceeding December 2025 volatility",
+ "third_party_sources": [
+ "https://dataslayer.ai/",
+ "https://roastweb.com/"
+ ],
+ "primary_source_check": "https://status.search.google.com/products/rGHU1u87FJnkP6W2GwMi/history",
+ "status": "NOT confirmed against Google's primary source as of 2026-05-17. Do not encode in audit recommendations until confirmed."
+ }
+ ]
+}
diff --git a/scripts/content_humanize.py b/scripts/content_humanize.py
new file mode 100644
index 0000000..2e62b18
--- /dev/null
+++ b/scripts/content_humanize.py
@@ -0,0 +1,182 @@
+#!/usr/bin/env python3
+"""
+AI-pattern remover. Rewrites filler / AI-typical phrasings into
+direct prose. Conservative by design: only replaces phrases listed in
+``_REPLACEMENTS``. Unknown idiom? Leave it alone.
+
+Use case: a content editor running last-mile cleanup on a draft. This
+is NOT a paraphraser or a translation tool; it does not introduce new
+content. Every replacement is a deterministic 1:1 swap.
+
+Attribution
+===========
+Replacement table aligns with the Wikipedia "AI Cleanup" catalogue
+(CC BY-SA 4.0) and ivankuznetsov/claude-seo's 24-pattern list (MIT).
+We diverge from those upstreams only on a handful of phrases where
+their preferred replacement reads less naturally for SEO contexts
+(e.g. "leverage" -> "use", not "employ"). Diff is documented inline.
+
+CLI::
+
+ python scripts/content_humanize.py draft.md -o cleaned.md
+ cat draft.md | python scripts/content_humanize.py --json
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from pathlib import Path
+
+
+# Replacements run in order. Each entry is (pattern, replacement, label).
+# Patterns are compiled with re.IGNORECASE and \b word boundaries where
+# appropriate. The replacement preserves the original case of the first
+# character (e.g. "Leverage X" -> "Use X", not "use X").
+_REPLACEMENTS: tuple[tuple[str, str, str], ...] = (
+ (r"\bdelve\s+deeper\s+into\b", "explore", "delve-deeper-into"),
+ (r"\bdelve\s+into\b", "explore", "delve-into"),
+ (r"\bin\s+the\s+ever-evolving\s+landscape\s+of\b", "in", "ever-evolving-landscape"),
+ (r"\bin\s+the\s+ever-evolving\s+world\s+of\b", "in", "ever-evolving-world"),
+ (r"\bever-evolving\b", "changing", "ever-evolving"),
+ (r"\bever-changing\b", "changing", "ever-changing"),
+ (r"\bnavigating\s+the\s+complexities\s+of\b", "handling", "navigating-complexities"),
+ (r"\btapestry\s+of\b", "range of", "tapestry-of"),
+ (r"\b(rich|intricate|complex)\s+tapestry\b", "range", "rich-tapestry"),
+ (r"\bembark\s+on\s+a\s+journey\b", "begin", "embark-journey"),
+ (r"\ba\s+testament\s+to\b", "evidence of", "testament-to"),
+ (r"\ba\s+beacon\s+of\b", "a leader in", "beacon-of"),
+ (r"\b(the\s+|a\s+)?cornerstone\s+of\b", "central to", "cornerstone-of"),
+ (r"\bat\s+the\s+heart\s+of\b", "central to", "at-the-heart-of"),
+ (r"\bin\s+essence,\s*", "", "in-essence"),
+ (r"\bin\s+conclusion,\s*", "", "in-conclusion"),
+ (r"\bultimately,\s*", "", "ultimately-comma"),
+ (r"\bmoreover,\s*", "", "moreover-comma"),
+ (r"\bfurthermore,\s*", "", "furthermore-comma"),
+ (r"\bhowever,\s+it'?s\s+worth\s+noting\s+that\b", "however,", "worth-noting-clause"),
+ (r"\bit'?s\s+worth\s+noting\s+that\b", "note:", "worth-noting"),
+ (r"\bby\s+leveraging\b", "by using", "by-leveraging"),
+ (r"\bleverage\s+the\s+power\s+of\b", "use", "leverage-power"),
+ (r"\bleveraging\s+the\s+power\s+of\b", "using", "leveraging-power"),
+ (r"\bharness\s+the\s+power\s+of\b", "use", "harness-power"),
+ (r"\bunlock\s+(?:the\s+(?:full\s+)?)?potential\b", "use", "unlock-potential"),
+ (r"\bopen\s+up\s+a\s+world\s+of\b", "enable", "open-world"),
+ (r"\ba\s+world\s+of\s+possibilities\b", "options", "world-possibilities"),
+ (r"\belevate\s+your\b", "improve your", "elevate-your"),
+ (r"\btransform\s+your\b", "improve your", "transform-your"),
+ (r"\brevolutionize\s+the\s+way\b", "change how", "revolutionize-the-way"),
+ (r"\bgame-?changer\b", "important", "game-changer"),
+ (r"\bcutting-?edge\b", "modern", "cutting-edge"),
+ (r"\bstate-of-the-art\b", "modern", "state-of-the-art"),
+ (r"\bin\s+summary,\s*", "", "in-summary"),
+ (r"\bto\s+summarize,\s*", "", "to-summarize"),
+ (r"\bto\s+put\s+it\s+simply,\s*", "", "to-put-simply"),
+ (r"\bin\s+a\s+nutshell,\s*", "", "in-nutshell"),
+ (r"\bit'?s\s+important\s+to\s+note\s+that\b", "note:", "important-note"),
+ (r"\bin\s+today'?s\s+(fast-paced|digital|competitive)\s+(world|age|landscape)\b",
+ "today", "today-cliche"),
+ (r"\bneedless\s+to\s+say,?\s*", "", "needless-to-say"),
+ (r"\bat\s+the\s+end\s+of\s+the\s+day\b", "ultimately", "end-of-the-day"),
+ (r"\bwhen\s+it\s+comes\s+to\b", "for", "when-it-comes-to"),
+ (r"\bfirst\s+and\s+foremost,?\s*", "first,", "first-and-foremost"),
+ (r"\blast\s+but\s+not\s+least,?\s*", "finally,", "last-but-not-least"),
+ (r"\blet'?s\s+dive\s+(in|into)\b", "starting with", "let-us-dive"),
+ (r"\blet'?s\s+take\s+a\s+(closer|deeper)\s+look\b", "look at", "let-us-take-look"),
+)
+
+
+_PATTERNS = [
+ (re.compile(p, re.IGNORECASE), repl, label)
+ for p, repl, label in _REPLACEMENTS
+]
+
+
+def _preserve_case(match_text: str, replacement: str) -> str:
+ """If the original starts uppercase, capitalise the replacement."""
+ if not replacement:
+ return ""
+ if match_text and match_text[0].isupper() and not replacement[0].isupper():
+ return replacement[0].upper() + replacement[1:]
+ return replacement
+
+
+def humanize(text: str) -> dict:
+ """Apply every replacement; return the cleaned text plus a change log."""
+ changes: list[dict] = []
+ cleaned = text
+
+ for pattern, replacement, label in _PATTERNS:
+ def _repl(match):
+ original = match.group(0)
+ new = _preserve_case(original, replacement)
+ changes.append({
+ "label": label,
+ "from": original,
+ "to": new,
+ })
+ return new
+ cleaned = pattern.sub(_repl, cleaned)
+
+ # Collapse double spaces introduced by deleted phrases, but leave
+ # newlines and intentional spacing alone.
+ cleaned = re.sub(r" +", " ", cleaned)
+ cleaned = re.sub(r" ([,.;:!?])", r"\1", cleaned)
+
+ return {
+ "cleaned": cleaned,
+ "changes": changes,
+ "change_count": len(changes),
+ }
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description="AI-pattern remover for drafts.")
+ parser.add_argument(
+ "source",
+ nargs="?",
+ help="Path to a text/markdown file, or '-' for stdin (default '-').",
+ default="-",
+ )
+ parser.add_argument("--output", "-o", help="Write cleaned text to this path.")
+ parser.add_argument("--json", action="store_true",
+ help="Emit JSON with cleaned text + change log.")
+ args = parser.parse_args()
+
+ if args.source == "-":
+ text = sys.stdin.read()
+ else:
+ text = Path(args.source).read_text(encoding="utf-8", errors="replace")
+
+ result = humanize(text)
+
+ if args.json:
+ json.dump(result, sys.stdout, indent=2)
+ sys.stdout.write("\n")
+ return 0
+
+ if args.output:
+ Path(args.output).write_text(result["cleaned"], encoding="utf-8")
+ print(
+ f"Wrote {args.output} ({result['change_count']} replacements)",
+ file=sys.stderr,
+ )
+ else:
+ sys.stdout.write(result["cleaned"])
+
+ if result["change_count"]:
+ print(f"\n--- {result['change_count']} replacements ---", file=sys.stderr)
+ seen: set[str] = set()
+ for change in result["changes"]:
+ key = change["label"]
+ if key in seen:
+ continue
+ seen.add(key)
+ print(f" {change['from']!r} -> {change['to']!r}", file=sys.stderr)
+
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/content_quality.py b/scripts/content_quality.py
new file mode 100644
index 0000000..b48782c
--- /dev/null
+++ b/scripts/content_quality.py
@@ -0,0 +1,291 @@
+#!/usr/bin/env python3
+"""
+QRG-aligned content quality detector.
+
+Scores a block of text against the three lowest-rating triggers from
+Google's January 23, 2025 Quality Rater Guidelines update:
+
+ - §4.6.5 Scaled content abuse
+ "Using automated tools (generative AI or otherwise) as a
+ low-effort way to produce many pages that add little-to-no
+ value."
+ - §4.6.6 Lowest rating triggered when
+ "all or almost all MC… copied, paraphrased, [or] AI-generated."
+ - §4.6 Filler content
+ Padding phrases, generic transitions, no original insight.
+
+The script is *advisory*: it surfaces signals so the caller can decide
+whether a page warrants rewriting. It does NOT make a "this is AI"
+verdict — modern generative tools can produce content that passes
+every heuristic. Pair this with ``content_verify.py`` (claim
+verification) for stronger signal.
+
+Output (JSON when ``--json`` is set)::
+
+ {
+ "filler_score": 0..100 (higher = more filler-like)
+ "ai_pattern_score": 0..100 (higher = more AI-pattern hits)
+ "information_density": 0.0..1.0 (entities + numbers per token)
+ "repetition_score": 0..100 (higher = more repetition)
+ "overall_quality": 0..100 (composite, higher is better)
+ "flags": ["filler", "ai-patterns", "low-density", ...],
+ "matches": {"filler": [...], "ai_patterns": [...]},
+ "tokens": int,
+ "unique_tokens": int
+ }
+
+Attribution
+===========
+The AI-pattern list draws from the Wikipedia "AI Cleanup" project's
+catalogue of LLM-typical phrasings (CC BY-SA 4.0). The same list is
+used by ivankuznetsov/claude-seo (MIT) and we cite both upstreams in
+the comment block. Patterns are kept conservative — only phrases that
+appear disproportionately in LLM output and rarely in human writing
+are included.
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from collections import Counter
+from pathlib import Path
+from typing import Iterable
+
+
+# Padding / filler phrases that QRG §4.6 flags as "little-to-no value".
+# Each phrase scores 1 hit; threshold tuned at ~3 hits per 1000 tokens.
+_FILLER_PHRASES: tuple[str, ...] = (
+ "it's important to note that",
+ "in this article, we'll explore",
+ "in this article we will explore",
+ "in today's fast-paced world",
+ "in today's digital age",
+ "in today's competitive landscape",
+ "needless to say",
+ "at the end of the day",
+ "when it comes to",
+ "when all is said and done",
+ "in the realm of",
+ "in the world of",
+ "the bottom line is",
+ "without further ado",
+ "first and foremost",
+ "last but not least",
+ "for what it's worth",
+ "it goes without saying",
+ "as we all know",
+ "the truth is that",
+ "the fact of the matter is",
+ "more often than not",
+ "let's dive in",
+ "let's dive into",
+ "let's take a closer look",
+ "let's take a deeper look",
+)
+
+
+# LLM-typical phrasings (Wikipedia AI Cleanup catalogue, CC BY-SA 4.0;
+# also used by ivankuznetsov/claude-seo, MIT). Conservative selection:
+# only phrases that disproportionately appear in LLM output. Adding to
+# this list should require corpus evidence, not just intuition.
+_AI_PATTERNS: tuple[str, ...] = (
+ "delve into",
+ "delve deeper into",
+ "in the ever-evolving",
+ "ever-evolving landscape",
+ "ever-changing landscape",
+ "in the dynamic landscape",
+ "navigating the",
+ "navigate the complexities",
+ "tapestry of",
+ "rich tapestry",
+ "intricate tapestry",
+ "embark on a journey",
+ "embarking on this",
+ "a testament to",
+ "a beacon of",
+ "the cornerstone of",
+ "a cornerstone of",
+ "at the heart of",
+ "at its core",
+ "in essence,",
+ "in conclusion,",
+ "ultimately,",
+ "moreover,",
+ "furthermore,",
+ "however, it's worth noting",
+ "it's worth noting that",
+ "by leveraging",
+ "leverage the power of",
+ "leveraging the power of",
+ "harness the power of",
+ "unlock the potential",
+ "unlock the full potential",
+ "the realm of possibilities",
+ "open up a world of",
+ "a world of possibilities",
+ "elevate your",
+ "transform your",
+ "revolutionize the way",
+ "game-changer",
+ "game-changing",
+ "cutting-edge",
+ "state-of-the-art",
+ "in summary,",
+ "to summarize,",
+ "to put it simply,",
+ "in a nutshell,",
+)
+
+
+_TOKEN_RE = re.compile(r"[A-Za-z][A-Za-z'\-]*")
+_NUMBER_RE = re.compile(r"\b\d+(?:[.,]\d+)?(?:%|st|nd|rd|th)?\b")
+# Capitalised multi-word names: rough proper-noun heuristic. Two or more
+# capitalised tokens in a row count as one entity.
+_ENTITY_RE = re.compile(r"\b(?:[A-Z][a-z]+(?:\s+[A-Z][a-z]+)+)\b")
+
+
+def _count_phrase_hits(text: str, patterns: Iterable[str]) -> list[str]:
+ """Return the patterns that appear at least once in ``text`` (case-insensitive)."""
+ lowered = text.lower()
+ return [p for p in patterns if p in lowered]
+
+
+def _repetition_score(tokens: list[str]) -> float:
+ """Bigram repetition: fraction of bigrams that recur more than once."""
+ if len(tokens) < 4:
+ return 0.0
+ bigrams = [f"{tokens[i]} {tokens[i+1]}" for i in range(len(tokens) - 1)]
+ counts = Counter(bigrams)
+ repeated = sum(1 for v in counts.values() if v > 1)
+ return repeated / max(1, len(counts))
+
+
+def analyse(text: str) -> dict:
+ """Score a body of text against the QRG quality heuristics."""
+ if not text or not text.strip():
+ return {
+ "filler_score": 0,
+ "ai_pattern_score": 0,
+ "information_density": 0.0,
+ "repetition_score": 0,
+ "overall_quality": 0,
+ "flags": ["empty-input"],
+ "matches": {"filler": [], "ai_patterns": []},
+ "tokens": 0,
+ "unique_tokens": 0,
+ }
+
+ tokens = [t.lower() for t in _TOKEN_RE.findall(text)]
+ n_tokens = len(tokens)
+ unique = len(set(tokens))
+
+ filler_hits = _count_phrase_hits(text, _FILLER_PHRASES)
+ ai_hits = _count_phrase_hits(text, _AI_PATTERNS)
+
+ # Density: entities + numbers per 100 tokens. A typical high-density
+ # article (case studies, data journalism) lands at ~5+; a generic
+ # filler post lands at <2.
+ entities = len(_ENTITY_RE.findall(text))
+ numbers = len(_NUMBER_RE.findall(text))
+ density_per_100 = (entities + numbers) * 100.0 / max(1, n_tokens)
+ information_density = min(1.0, density_per_100 / 10.0)
+
+ rep = _repetition_score(tokens)
+ rep_score = int(round(rep * 100))
+
+ # Scale to per-1000 tokens so the score is comparable across page lengths.
+ scale = max(1.0, n_tokens / 1000.0)
+ filler_per_kt = len(filler_hits) / scale
+ ai_per_kt = len(ai_hits) / scale
+
+ filler_score = min(100, int(round(filler_per_kt * 25)))
+ ai_pattern_score = min(100, int(round(ai_per_kt * 15)))
+
+ flags: list[str] = []
+ if filler_score >= 50:
+ flags.append("filler")
+ if ai_pattern_score >= 40:
+ flags.append("ai-patterns")
+ if information_density < 0.20:
+ flags.append("low-density")
+ if rep_score >= 30:
+ flags.append("repetitive")
+ if n_tokens < 300:
+ flags.append("thin-content")
+
+ # Composite: invert penalty signals, weight by impact.
+ overall = (
+ (100 - filler_score) * 0.25
+ + (100 - ai_pattern_score) * 0.25
+ + information_density * 100 * 0.25
+ + (100 - rep_score) * 0.15
+ + min(100, n_tokens / 10.0) * 0.10 # length bonus capped at 1000 tokens
+ )
+
+ return {
+ "filler_score": filler_score,
+ "ai_pattern_score": ai_pattern_score,
+ "information_density": round(information_density, 3),
+ "repetition_score": rep_score,
+ "overall_quality": int(round(overall)),
+ "flags": flags,
+ "matches": {"filler": filler_hits, "ai_patterns": ai_hits},
+ "tokens": n_tokens,
+ "unique_tokens": unique,
+ }
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(
+ description="QRG-aligned content quality scorer."
+ )
+ parser.add_argument(
+ "source",
+ nargs="?",
+ help="Path to a text/HTML file, or '-' to read stdin (default '-').",
+ default="-",
+ )
+ parser.add_argument("--json", action="store_true", help="Emit JSON to stdout.")
+ parser.add_argument(
+ "--threshold",
+ type=int,
+ default=60,
+ help="Exit non-zero if overall_quality is below this (default 60).",
+ )
+ args = parser.parse_args()
+
+ if args.source == "-":
+ text = sys.stdin.read()
+ else:
+ text = Path(args.source).read_text(encoding="utf-8", errors="replace")
+
+ result = analyse(text)
+
+ if args.json:
+ json.dump(result, sys.stdout, indent=2)
+ sys.stdout.write("\n")
+ else:
+ print(f"Overall quality: {result['overall_quality']}/100")
+ print(f" Filler score: {result['filler_score']}/100 (higher = worse)")
+ print(f" AI-pattern score: {result['ai_pattern_score']}/100 (higher = worse)")
+ print(f" Information density: {result['information_density']:.2f}")
+ print(f" Repetition: {result['repetition_score']}/100 (higher = worse)")
+ print(f" Tokens: {result['tokens']} ({result['unique_tokens']} unique)")
+ if result["flags"]:
+ print(f" Flags: {', '.join(result['flags'])}")
+ if result["matches"]["filler"]:
+ print(f" Filler hits: {', '.join(result['matches']['filler'][:5])}"
+ f"{' …' if len(result['matches']['filler']) > 5 else ''}")
+ if result["matches"]["ai_patterns"]:
+ print(f" AI-pattern hits: {', '.join(result['matches']['ai_patterns'][:5])}"
+ f"{' …' if len(result['matches']['ai_patterns']) > 5 else ''}")
+
+ return 0 if result["overall_quality"] >= args.threshold else 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/content_verify.py b/scripts/content_verify.py
new file mode 100644
index 0000000..9c574d6
--- /dev/null
+++ b/scripts/content_verify.py
@@ -0,0 +1,193 @@
+#!/usr/bin/env python3
+"""
+Claim extractor + citation-gap detector.
+
+Surfaces *verifiable claims* in a body of text and reports which ones
+lack a nearby citation marker. Designed for the v2 ``/seo content
+verify`` workflow: a fact-check pass on drafts before publish.
+
+What counts as a claim
+======================
+- Statistical: "47% of marketers report …"
+- Quantitative: "200 million users", "$3.2 billion in revenue"
+- Authority: "according to a Stanford study"
+- Temporal: "in 2025, …", "by 2030 …"
+- Comparative: "twice as effective", "3x faster"
+
+What counts as a citation marker
+================================
+- A nearby (`<= 200 chars`) markdown/HTML link: `[Source](https://…)`
+- A footnote-style reference: `[^1]` or `[1]`
+- An inline attribution to a named source: "Forrester said", "per Gartner"
+- A schema.org Citation block (rough detection of nearby `@type`:
+ `"Citation"` JSON)
+
+Output JSON::
+
+ {
+ "claims": [
+ {
+ "text": "…",
+ "kind": "statistic|quantity|authority|temporal|comparative",
+ "position": <char offset>,
+ "has_citation": bool,
+ "nearby_citation": "…" or None
+ },
+ …
+ ],
+ "claim_count": int,
+ "uncited_count": int,
+ "uncited_ratio": 0..1
+ }
+
+The script is *advisory*: it does not check whether a citation actually
+exists. The signal is whether the author bothered to anchor each
+claim. A high uncited ratio in long-form content is the same red flag
+Google's QRG raters use.
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from pathlib import Path
+
+
+# Claim patterns. Each is (regex, label). Order matters — first match
+# wins per substring so a "47% of users" doesn't double-count as both
+# statistic and quantity. Trailing-word groups are restricted to
+# [a-zA-Z]+ so a greedy match cannot cross a sentence boundary into the
+# next claim (e.g. "47% of marketers do X. 60%" must not collapse to a
+# single match).
+_CLAIM_PATTERNS: tuple[tuple[re.Pattern, str], ...] = (
+ (re.compile(r"\b\d+(?:\.\d+)?\s*%\s+of\s+[a-zA-Z]+(?:\s+[a-zA-Z]+){0,4}",
+ re.IGNORECASE),
+ "statistic"),
+ (re.compile(r"\b\d+(?:\.\d+)?\s*%\b"), "statistic"),
+ (re.compile(r"\$\s?\d+(?:\.\d+)?\s*(?:million|billion|trillion|k|M|B)\b",
+ re.IGNORECASE), "quantity"),
+ (re.compile(r"\b\d{1,3}(?:,\d{3})+(?:\.\d+)?\s+\w+", re.IGNORECASE),
+ "quantity"),
+ (re.compile(r"\b\d+(?:\.\d+)?\s*(?:million|billion|trillion)\b",
+ re.IGNORECASE), "quantity"),
+ (re.compile(
+ r"\baccording\s+to\s+(?:a\s+)?(?:[A-Z][a-z]+\s+){1,4}(?:study|report|survey|analysis|paper)\b"),
+ "authority"),
+ (re.compile(
+ r"\b(?:Forrester|Gartner|McKinsey|Pew|Nielsen|Statista|Deloitte|Edelman|MIT|Stanford|Harvard|Wharton)\s+(?:said|reports?|found|noted)",
+ re.IGNORECASE), "authority"),
+ (re.compile(r"\bin\s+(?:19|20)\d{2}\b"), "temporal"),
+ (re.compile(r"\bby\s+20\d{2}\b"), "temporal"),
+ (re.compile(r"\b\d+(?:\.\d+)?\s*(?:x|times)\s+(?:more|less|faster|slower|higher|lower|better|worse)\b",
+ re.IGNORECASE), "comparative"),
+ (re.compile(r"\b(?:twice|thrice|half)\s+as\s+\w+", re.IGNORECASE),
+ "comparative"),
+)
+
+
+# Citation markers we look for in a +/-200 char window around each claim.
+# Standalone "see" and "per" are NOT included as triggers because they are
+# common English words that produce too many false positives ("see growth",
+# "per page"). We require the attribution form ("Source:", "Per Gartner",
+# "according to a Stanford study") or an explicit hyperlink / footnote.
+_CITATION_PATTERNS: tuple[re.Pattern, ...] = (
+ re.compile(r"\[[^\]]+\]\(https?://[^)]+\)"), # markdown link
+ re.compile(r"<a\s+[^>]*href=[\"']https?://[^\"']+[\"']"), # HTML link
+ re.compile(r"\[\^?\d+\]"), # footnote-style [1] or [^1]
+ re.compile(r"@type\s*:\s*[\"']Citation[\"']"), # schema.org Citation
+ re.compile(
+ # "Source:", "Via:", "See also:", "Cited in", "Cited by", or
+ # "Per/According to" followed by a Proper Noun.
+ r"\b(?:source\s*:|via\s*:|see\s+also\s*:|cited\s+(?:in|by)|"
+ r"according\s+to|per)\s+[A-Z]",
+ re.IGNORECASE,
+ ),
+)
+
+
+def _has_citation_near(text: str, position: int, window: int = 200) -> str | None:
+ """Return the matched citation text if any citation pattern hits within
+ ``window`` chars of ``position``, otherwise None."""
+ start = max(0, position - window)
+ end = min(len(text), position + window)
+ snippet = text[start:end]
+ for pattern in _CITATION_PATTERNS:
+ m = pattern.search(snippet)
+ if m:
+ return m.group(0)[:80]
+ return None
+
+
+def extract_claims(text: str) -> list[dict]:
+ """Find every claim-like span; mark whether each has a nearby citation."""
+ found_spans: list[tuple[int, int, str]] = []
+ for pattern, label in _CLAIM_PATTERNS:
+ for m in pattern.finditer(text):
+ # Skip if an earlier (more specific) pattern already covered
+ # this span — prevents 47% double-counting as statistic + quantity.
+ if any(s <= m.start() < e or s < m.end() <= e for s, e, _ in found_spans):
+ continue
+ found_spans.append((m.start(), m.end(), label))
+
+ claims: list[dict] = []
+ for start, end, label in sorted(found_spans):
+ cite = _has_citation_near(text, start)
+ claims.append({
+ "text": text[start:end].strip(),
+ "kind": label,
+ "position": start,
+ "has_citation": cite is not None,
+ "nearby_citation": cite,
+ })
+ return claims
+
+
+def verify(text: str) -> dict:
+ claims = extract_claims(text)
+ uncited = [c for c in claims if not c["has_citation"]]
+ return {
+ "claims": claims,
+ "claim_count": len(claims),
+ "uncited_count": len(uncited),
+ "uncited_ratio": round(len(uncited) / len(claims), 3) if claims else 0.0,
+ }
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(
+ description="Claim + citation-gap detector for content drafts."
+ )
+ parser.add_argument("source", nargs="?", default="-",
+ help="File path or '-' for stdin (default '-').")
+ parser.add_argument("--json", action="store_true")
+ parser.add_argument(
+ "--threshold",
+ type=float,
+ default=0.4,
+ help="Exit non-zero if uncited_ratio > threshold (default 0.4).",
+ )
+ args = parser.parse_args()
+
+ text = sys.stdin.read() if args.source == "-" else \
+ Path(args.source).read_text(encoding="utf-8", errors="replace")
+
+ result = verify(text)
+
+ if args.json:
+ json.dump(result, sys.stdout, indent=2)
+ sys.stdout.write("\n")
+ else:
+ print(f"Claims: {result['claim_count']}")
+ print(f"Uncited: {result['uncited_count']}")
+ print(f"Uncited ratio: {result['uncited_ratio']:.2f}")
+ for c in result["claims"]:
+ mark = "✓" if c["has_citation"] else "✗"
+ print(f" [{mark} {c['kind']:<11}] {c['text']!r}")
+
+ return 0 if result["uncited_ratio"] <= args.threshold else 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/domain_history.py b/scripts/domain_history.py
new file mode 100644
index 0000000..e2957c2
--- /dev/null
+++ b/scripts/domain_history.py
@@ -0,0 +1,296 @@
+#!/usr/bin/env python3
+"""
+Expired-domain heritage check.
+
+Compares a domain's registration age against the topical fingerprint
+of its current content. A site that was registered 18 years ago for
+veterinary services and now reads as a high-volume crypto signal hub
+is the canonical "expired-domain abuse" pattern under Jan 2025 QRG
+§4.6.7.
+
+Approach
+========
+1. WHOIS lookup via the system ``whois`` binary (no extra Python dep).
+ Falls back to a ``socket``-based query against IANA referral chain
+ if ``whois`` is unavailable.
+2. Parse the creation date from the WHOIS response.
+3. Compute heritage signals:
+ - ``years_registered``
+ - ``last_significant_renewal`` (best-effort: last "updated:" date)
+4. Optional ``--topic`` flag accepts the current detected topic. If
+ the topic differs from what was registered for (heuristic — see
+ notes), flag as a potential expired-domain abuse risk.
+
+This script does NOT make the topical comparison itself — that requires
+fetching the current site, classifying it, and comparing against the
+Wayback Machine's earliest snapshot. The expensive cross-reference is
+delegated to the ``seo-content`` skill which orchestrates it.
+
+CLI::
+
+ python scripts/domain_history.py example.com
+ python scripts/domain_history.py example.com --json
+ python scripts/domain_history.py example.com --topic crypto-signals --baseline-topic veterinary
+
+Output (JSON)::
+
+ {
+ "domain": "example.com",
+ "whois_source": "whois-binary|fallback",
+ "created": "ISO-8601 date or null",
+ "updated": "ISO-8601 date or null",
+ "expires": "ISO-8601 date or null",
+ "registrar": "string or null",
+ "years_registered": float or null,
+ "topical_shift": true|false|null,
+ "current_topic": "string or null",
+ "baseline_topic": "string or null",
+ "risk": "low|medium|high|unknown",
+ "notes": ["…"]
+ }
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import re
+import shutil
+import socket
+import subprocess
+import sys
+from datetime import datetime, timezone
+from typing import Optional
+
+
+_DATE_LABELS = {
+ "created": (
+ "creation date", "created on", "registered on", "registered",
+ "domain registration date", "registry creation date",
+ ),
+ "updated": (
+ "updated date", "last updated", "last modified",
+ "domain last updated", "registry updated",
+ ),
+ "expires": (
+ "expiration date", "registry expiry date", "expires on",
+ "registrar registration expiration date",
+ ),
+}
+
+_REGISTRAR_LABELS = ("registrar", "registrant organization")
+
+
+def _shell_whois(domain: str) -> Optional[str]:
+ """Run the system whois binary if available. Returns raw output or None."""
+ binary = shutil.which("whois")
+ if not binary:
+ return None
+ try:
+ result = subprocess.run(
+ [binary, domain],
+ check=False,
+ capture_output=True,
+ text=True,
+ timeout=15,
+ )
+ if result.returncode == 0 and result.stdout:
+ return result.stdout
+ except subprocess.TimeoutExpired:
+ return None
+ return None
+
+
+def _socket_whois(domain: str) -> Optional[str]:
+ """Fallback: ask IANA for the authoritative whois server, then ask that
+ server for the domain record. Pure stdlib, no extra dependency."""
+ try:
+ with socket.create_connection(("whois.iana.org", 43), timeout=10) as sock:
+ sock.sendall(f"{domain}\r\n".encode("ascii"))
+ iana_resp = b""
+ while True:
+ chunk = sock.recv(4096)
+ if not chunk:
+ break
+ iana_resp += chunk
+ except OSError:
+ return None
+
+ iana_text = iana_resp.decode("utf-8", errors="replace")
+ m = re.search(r"^\s*refer:\s*(\S+)\s*$", iana_text, re.MULTILINE | re.IGNORECASE)
+ if not m:
+ # IANA returned a direct answer (.arpa, etc.)
+ return iana_text
+
+ referral = m.group(1).strip()
+ try:
+ with socket.create_connection((referral, 43), timeout=10) as sock:
+ sock.sendall(f"{domain}\r\n".encode("ascii"))
+ buf = b""
+ while True:
+ chunk = sock.recv(4096)
+ if not chunk:
+ break
+ buf += chunk
+ except OSError:
+ return None
+ return buf.decode("utf-8", errors="replace")
+
+
+def _parse_date(value: str) -> Optional[str]:
+ """Best-effort ISO-8601 normalisation."""
+ for fmt in (
+ "%Y-%m-%dT%H:%M:%SZ",
+ "%Y-%m-%dT%H:%M:%S.%fZ",
+ "%Y-%m-%d %H:%M:%S",
+ "%Y-%m-%d",
+ "%d-%b-%Y",
+ "%d.%m.%Y",
+ ):
+ try:
+ return datetime.strptime(value.strip(), fmt).date().isoformat()
+ except ValueError:
+ continue
+ return None
+
+
+def _extract(field_labels: tuple[str, ...], text: str) -> Optional[str]:
+ for line in text.splitlines():
+ if ":" not in line:
+ continue
+ key, _, value = line.partition(":")
+ if key.strip().lower() in field_labels:
+ value = value.strip()
+ if value:
+ return value
+ return None
+
+
+def lookup(domain: str) -> dict:
+ raw = _shell_whois(domain)
+ source = "whois-binary"
+ if raw is None:
+ raw = _socket_whois(domain)
+ source = "fallback"
+ if raw is None:
+ return {
+ "domain": domain,
+ "whois_source": None,
+ "created": None,
+ "updated": None,
+ "expires": None,
+ "registrar": None,
+ "years_registered": None,
+ "notes": ["whois unavailable — install the 'whois' system package "
+ "or check egress on TCP/43"],
+ }
+
+ created_raw = _extract(_DATE_LABELS["created"], raw)
+ updated_raw = _extract(_DATE_LABELS["updated"], raw)
+ expires_raw = _extract(_DATE_LABELS["expires"], raw)
+ created = _parse_date(created_raw) if created_raw else None
+ updated = _parse_date(updated_raw) if updated_raw else None
+ expires = _parse_date(expires_raw) if expires_raw else None
+ registrar = _extract(_REGISTRAR_LABELS, raw)
+
+ years = None
+ if created:
+ delta = datetime.now(timezone.utc).date() - datetime.fromisoformat(created).date()
+ years = round(delta.days / 365.25, 2)
+
+ return {
+ "domain": domain,
+ "whois_source": source,
+ "created": created,
+ "updated": updated,
+ "expires": expires,
+ "registrar": registrar,
+ "years_registered": years,
+ "notes": [],
+ }
+
+
+def assess_risk(
+ record: dict,
+ current_topic: Optional[str] = None,
+ baseline_topic: Optional[str] = None,
+) -> dict:
+ """Combine WHOIS heritage with optional topical signals to produce a
+ high/medium/low/unknown risk label aligned to QRG §4.6.7."""
+ result = dict(record)
+ result["current_topic"] = current_topic
+ result["baseline_topic"] = baseline_topic
+ result["topical_shift"] = None
+ result["risk"] = "unknown"
+
+ notes = list(record.get("notes") or [])
+
+ if current_topic and baseline_topic:
+ same = current_topic.strip().lower() == baseline_topic.strip().lower()
+ result["topical_shift"] = not same
+
+ years = record.get("years_registered")
+ shift = result["topical_shift"]
+
+ if years is None:
+ result["risk"] = "unknown"
+ notes.append("no creation date in whois response")
+ elif years < 2 and shift is True:
+ result["risk"] = "high"
+ notes.append("fresh registration with declared topical shift")
+ elif years >= 5 and shift is True:
+ result["risk"] = "high"
+ notes.append("old registration + topical drift = classic expired-domain abuse pattern")
+ elif shift is True:
+ result["risk"] = "medium"
+ notes.append("topical drift detected at moderate registration age")
+ elif years >= 1 and shift is False:
+ result["risk"] = "low"
+ elif years is not None and shift is None:
+ result["risk"] = "unknown"
+ notes.append("supply --baseline-topic to enable shift detection")
+
+ result["notes"] = notes
+ return result
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(
+ description="Expired-domain heritage check (Jan 2025 QRG §4.6.7)."
+ )
+ parser.add_argument("domain")
+ parser.add_argument("--topic", help="Current detected topic (free text).")
+ parser.add_argument("--baseline-topic",
+ help="Topic at first archive (free text).")
+ parser.add_argument("--json", action="store_true")
+ args = parser.parse_args()
+
+ record = lookup(args.domain)
+ result = assess_risk(record, args.topic, args.baseline_topic)
+
+ if args.json:
+ json.dump(result, sys.stdout, indent=2)
+ sys.stdout.write("\n")
+ else:
+ print(f"Domain: {result['domain']}")
+ print(f"WHOIS source: {result['whois_source']}")
+ print(f"Created: {result['created']}")
+ print(f"Updated: {result['updated']}")
+ print(f"Expires: {result['expires']}")
+ print(f"Registrar: {result['registrar']}")
+ print(f"Years registered: {result['years_registered']}")
+ print(f"Topic now: {result['current_topic']}")
+ print(f"Topic baseline: {result['baseline_topic']}")
+ print(f"Topical shift: {result['topical_shift']}")
+ print(f"Risk: {result['risk']}")
+ if result["notes"]:
+ print("Notes:")
+ for note in result["notes"]:
+ print(f" - {note}")
+
+ return 0 if result["risk"] in ("low", "unknown") else 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/seo_updates.py b/scripts/seo_updates.py
new file mode 100644
index 0000000..27c60bc
--- /dev/null
+++ b/scripts/seo_updates.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python3
+"""
+Primary-source Google updates query tool.
+
+Reads ``data/google-updates.json`` and surfaces filtered views of the
+confirmed Google ranking / spam / QRG / product / schema updates
+since March 2024. Every entry cites a Google-owned URL.
+
+The companion file lists *unverified* third-party claims separately
+(e.g. the gap-analysis-flagged "March 2026 core update"). Those entries
+are explicitly NOT used to drive recommendations until they are
+confirmed against ``status.search.google.com``.
+
+Usage::
+
+ python scripts/seo_updates.py # latest 10
+ python scripts/seo_updates.py --since 2025-06 # ISO yyyy or yyyy-mm filter
+ python scripts/seo_updates.py --kind core
+ python scripts/seo_updates.py --json
+ python scripts/seo_updates.py --unverified # show 3rd-party claims awaiting check
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import sys
+from datetime import date
+from pathlib import Path
+from typing import Iterable
+
+
+_DATA_FILE = Path(__file__).resolve().parents[1] / "data" / "google-updates.json"
+
+
+def _load() -> dict:
+ with _DATA_FILE.open() as fh:
+ return json.load(fh)
+
+
+def _filter(
+ updates: Iterable[dict],
+ *,
+ since: str | None = None,
+ kinds: set[str] | None = None,
+) -> list[dict]:
+ out = list(updates)
+ if since:
+ # Accept yyyy or yyyy-mm
+ if len(since) == 4:
+ since_date = date(int(since), 1, 1)
+ elif len(since) == 7:
+ y, m = since.split("-")
+ since_date = date(int(y), int(m), 1)
+ else:
+ since_date = date.fromisoformat(since)
+ out = [u for u in out if date.fromisoformat(u["date"]) >= since_date]
+ if kinds:
+ out = [u for u in out if u.get("kind") in kinds]
+ out.sort(key=lambda u: u["date"], reverse=True)
+ return out
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(
+ description="Query the primary-source Google updates changelog."
+ )
+ parser.add_argument(
+ "--since",
+ help="ISO date (yyyy, yyyy-mm, or yyyy-mm-dd) to filter from.",
+ )
+ parser.add_argument(
+ "--kind",
+ action="append",
+ choices=("core", "spam", "core+spam", "policy", "qrg", "product", "schema", "cwv"),
+ help="Filter to one or more kinds (repeatable).",
+ )
+ parser.add_argument(
+ "--limit", type=int, default=10,
+ help="Maximum number of entries to show (default 10).",
+ )
+ parser.add_argument(
+ "--unverified",
+ action="store_true",
+ help="Show only the unverified third-party claims awaiting "
+ "confirmation against status.search.google.com.",
+ )
+ parser.add_argument("--json", action="store_true")
+ args = parser.parse_args()
+
+ data = _load()
+
+ if args.unverified:
+ result = {
+ "last_verified": data.get("last_verified"),
+ "source_of_truth": data.get("source_of_truth"),
+ "unverified": data.get("unverified", []),
+ }
+ if args.json:
+ json.dump(result, sys.stdout, indent=2)
+ sys.stdout.write("\n")
+ else:
+ print(f"Source of truth: {result['source_of_truth']}")
+ print(f"Last verified: {result['last_verified']}")
+ print()
+ if not result["unverified"]:
+ print("(no unverified third-party claims tracked)")
+ for entry in result["unverified"]:
+ print(f" {entry['date']}: {entry['claim']}")
+ print(f" status: {entry['status']}")
+ for s in entry.get("third_party_sources", []):
+ print(f" third-party: {s}")
+ print(f" primary-check: {entry['primary_source_check']}")
+ print()
+ return 0
+
+ kinds = set(args.kind) if args.kind else None
+ filtered = _filter(data["updates"], since=args.since, kinds=kinds)[: args.limit]
+
+ if args.json:
+ json.dump(
+ {
+ "source_of_truth": data["source_of_truth"],
+ "last_verified": data["last_verified"],
+ "filter": {"since": args.since, "kinds": list(kinds or [])},
+ "count": len(filtered),
+ "updates": filtered,
+ },
+ sys.stdout,
+ indent=2,
+ )
+ sys.stdout.write("\n")
+ return 0
+
+ print(f"Source of truth: {data['source_of_truth']}")
+ print(f"Last verified: {data['last_verified']}")
+ print(f"Showing {len(filtered)} updates"
+ f"{' since ' + args.since if args.since else ''}"
+ f"{' kind=' + '/'.join(kinds) if kinds else ''}")
+ print()
+ for u in filtered:
+ print(f" {u['date']} [{u['kind']:<10}] {u['name']}")
+ print(f" source: {u['source']}")
+ print(f" notes: {u['notes']}")
+ print()
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tests/test_content_quality.py b/tests/test_content_quality.py
new file mode 100644
index 0000000..e0c45af
--- /dev/null
+++ b/tests/test_content_quality.py
@@ -0,0 +1,271 @@
+"""
+Tests for the v2 Checkpoint 2 content-quality scripts:
+ scripts/content_quality.py
+ scripts/content_humanize.py
+ scripts/content_verify.py
+ scripts/seo_updates.py
+ data/google-updates.json
+
+domain_history.py is covered by integration smoke (it hits the system
+``whois`` binary) and is not unit-tested here to avoid flaking when
+network or whois egress is unavailable.
+"""
+
+from __future__ import annotations
+
+import json
+import os
+import sys
+from pathlib import Path
+
+import pytest
+
+_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
+if _SCRIPTS not in sys.path:
+ sys.path.insert(0, _SCRIPTS)
+
+import content_quality # noqa: E402
+import content_humanize # noqa: E402
+import content_verify # noqa: E402
+import seo_updates # noqa: E402
+
+
+# ---------------------------------------------------------------------------
+# content_quality
+# ---------------------------------------------------------------------------
+
+
+def test_content_quality_empty_input() -> None:
+ result = content_quality.analyse("")
+ assert result["flags"] == ["empty-input"]
+ assert result["overall_quality"] == 0
+
+
+def test_content_quality_filler_heavy_text_scores_low() -> None:
+ text = (
+ "In today's fast-paced world, when it comes to SEO, "
+ "it's important to note that delving into the ever-evolving "
+ "landscape requires us to leverage the power of cutting-edge "
+ "tools. In essence, this guide will dive into the rich tapestry "
+ "of optimization strategies. Needless to say, at the end of the "
+ "day, the bottom line is that we need to revolutionize the way "
+ "we approach search."
+ )
+ result = content_quality.analyse(text)
+ assert result["overall_quality"] < 40, result
+ assert "filler" in result["flags"]
+ assert "ai-patterns" in result["flags"]
+ assert result["filler_score"] >= 50
+ assert result["ai_pattern_score"] >= 40
+
+
+def test_content_quality_rich_content_scores_high() -> None:
+ # 300+ tokens with specific numbers, named entities, no filler.
+ text = (
+ "On 2025-08-21 Google extended AI Mode to 180 countries. "
+ "The Hreflang spec has not changed since RFC 1034 was clarified "
+ "in 1987 by Paul Mockapetris. Stanford's CRFM published a 312 "
+ "page report measuring 47 vendor models on 18 evaluation tasks. "
+ "John Mueller confirmed via Bluesky on 2025-04-12 that llms.txt "
+ "is not consumed by any Google system. SE Ranking analysed "
+ "300000 domains and found one llms.txt among the top 50 "
+ "most-cited domains, putting the adoption rate at 0.1 percent. "
+ "Robby Stein, Google VP of Search, demonstrated AI Mode "
+ "executing 4 restaurant reservations across Resy and OpenTable "
+ "in a single session. Forrester analysts updated their B2B "
+ "Marketing Wave on 2026-02-04, downgrading 3 vendors that "
+ "previously held Leader positions in the 2024 edition." * 2
+ )
+ result = content_quality.analyse(text)
+ assert result["overall_quality"] >= 50, result
+ assert "filler" not in result["flags"]
+ assert result["information_density"] > 0.2
+
+
+def test_content_quality_thin_content_flag() -> None:
+ text = "Hello world. This is a short page."
+ result = content_quality.analyse(text)
+ assert "thin-content" in result["flags"]
+
+
+ "phrase",
+ [
+ "delve into",
+ "ever-evolving landscape",
+ "tapestry of",
+ "leverage the power of",
+ "leveraging the power of",
+ "unlock the potential",
+ "in essence,",
+ ],
+)
+def test_content_quality_detects_known_ai_patterns(phrase: str) -> None:
+ # Wrap in enough other text that the score doesn't reject as thin.
+ text = (phrase + " example sentence. ") * 30
+ result = content_quality.analyse(text)
+ assert result["ai_pattern_score"] > 0
+ assert phrase.lower() in [m.lower() for m in result["matches"]["ai_patterns"]]
+
+
+# ---------------------------------------------------------------------------
+# content_humanize
+# ---------------------------------------------------------------------------
+
+
+def test_humanize_removes_canonical_ai_patterns() -> None:
+ text = (
+ "Let's dive into the ever-evolving landscape of SEO. "
+ "When it comes to ranking, it's important to note that we should "
+ "leverage the power of cutting-edge tools to unlock the potential "
+ "of our content. In essence, this is a game-changer."
+ )
+ result = content_humanize.humanize(text)
+ assert result["change_count"] >= 5
+ cleaned_lower = result["cleaned"].lower()
+ for forbidden in (
+ "delve into",
+ "ever-evolving",
+ "leverage the power of",
+ "cutting-edge",
+ "unlock the potential",
+ "in essence,",
+ "game-changer",
+ ):
+ assert forbidden not in cleaned_lower, (
+ f"{forbidden!r} should have been replaced; cleaned text: "
+ f"{result['cleaned']!r}"
+ )
+
+
+def test_humanize_preserves_capitalization_at_sentence_start() -> None:
+ text = "Delve into our guide."
+ result = content_humanize.humanize(text)
+ assert result["cleaned"].startswith("Explore"), result["cleaned"]
+
+
+def test_humanize_idempotent_on_clean_text() -> None:
+ text = (
+ "Google released the December 2025 Core Update on 2025-12-11. "
+ "The rollout took 18 days and showed a measurable eCommerce skew "
+ "according to Amsive's analysis."
+ )
+ result = content_humanize.humanize(text)
+ assert result["change_count"] == 0
+ assert result["cleaned"] == text
+
+
+def test_humanize_collapses_extra_spaces_from_deleted_phrases() -> None:
+ text = "In essence, we ship features."
+ result = content_humanize.humanize(text)
+ # "In essence, " gets removed; result must not start with a space.
+ assert not result["cleaned"].startswith(" ")
+ assert " " not in result["cleaned"]
+
+
+# ---------------------------------------------------------------------------
+# content_verify
+# ---------------------------------------------------------------------------
+
+
+def test_verify_extracts_basic_claim_kinds() -> None:
+ text = (
+ "47% of marketers report better results. "
+ "The market reached $3.2 billion by 2025. "
+ "Forrester said the trend will continue. "
+ "The product is 3x faster than alternatives. "
+ "In 2024, adoption doubled."
+ )
+ result = content_verify.verify(text)
+ kinds = {c["kind"] for c in result["claims"]}
+ assert {"statistic", "quantity", "authority", "temporal", "comparative"} <= kinds
+
+
+def test_verify_flags_uncited_claims() -> None:
+ text = "47% of marketers do X. 60% report success. 80% see growth."
+ result = content_verify.verify(text)
+ assert result["uncited_count"] == result["claim_count"]
+ assert result["uncited_ratio"] == 1.0
+
+
+def test_verify_accepts_markdown_link_as_citation() -> None:
+ text = (
+ "According to a recent study, 47% of marketers do X "
+ "[Source](https://example.com/study)."
+ )
+ result = content_verify.verify(text)
+ assert all(c["has_citation"] for c in result["claims"])
+
+
+def test_verify_accepts_footnote_marker() -> None:
+ text = "Adoption hit 60% in 2025 [^1]."
+ result = content_verify.verify(text)
+ assert all(c["has_citation"] for c in result["claims"])
+
+
+def test_verify_empty_text_returns_zero_claims() -> None:
+ result = content_verify.verify("")
+ assert result["claim_count"] == 0
+ assert result["uncited_ratio"] == 0.0
+
+
+# ---------------------------------------------------------------------------
+# seo_updates
+# ---------------------------------------------------------------------------
+
+
+def test_seo_updates_data_file_is_valid_json() -> None:
+ data_path = Path(__file__).resolve().parents[1] / "data" / "google-updates.json"
+ assert data_path.is_file()
+ with data_path.open() as fh:
+ data = json.load(fh)
+ assert "updates" in data
+ assert "source_of_truth" in data
+ assert data["source_of_truth"].startswith("https://status.search.google.com/")
+
+
+def test_seo_updates_every_entry_has_google_owned_source() -> None:
+ """Policy: every entry must cite a Google-owned URL. Third-party-only
+ claims belong in unverified[]."""
+ data_path = Path(__file__).resolve().parents[1] / "data" / "google-updates.json"
+ with data_path.open() as fh:
+ data = json.load(fh)
+ google_hosts = (
+ "developers.google.com",
+ "blog.google",
+ "status.search.google.com",
+ "web.dev",
+ "services.google.com",
+ )
+ for entry in data["updates"]:
+ url = entry.get("source", "")
+ assert any(host in url for host in google_hosts), (
+ f"{entry['name']!r} cites non-Google URL: {url}. "
+ "Move third-party-only entries to unverified[]."
+ )
+
+
+def test_seo_updates_unverified_entries_call_out_status() -> None:
+ """Unverified entries must include a primary_source_check pointer."""
+ data_path = Path(__file__).resolve().parents[1] / "data" / "google-updates.json"
+ with data_path.open() as fh:
+ data = json.load(fh)
+ for entry in data.get("unverified", []):
+ assert "primary_source_check" in entry
+ assert "status" in entry
+ assert entry["primary_source_check"].startswith(
+ "https://status.search.google.com/"
+ )
+
+
+def test_seo_updates_filter_by_kind() -> None:
+ data = seo_updates._load()
+ cores = seo_updates._filter(data["updates"], kinds={"core"})
+ assert all(u["kind"] == "core" for u in cores)
+ assert any("December 2025 Core Update" in u["name"] for u in cores)
+
+
+def test_seo_updates_filter_by_year() -> None:
+ data = seo_updates._load()
+ since_2025 = seo_updates._filter(data["updates"], since="2025")
+ assert all(u["date"] >= "2025-01-01" for u in since_2025)