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.

fix(content): only 'per' needs a proper noun to count as a citation

Agrici Daniele5cdbb54a7be
diff --git a/scripts/content_verify.py b/scripts/content_verify.py
index 99a8a6c..99ad1b2 100644
--- a/scripts/content_verify.py
+++ b/scripts/content_verify.py
@@ -97,10 +97,12 @@ _CITATION_PATTERNS: tuple[re.Pattern, ...] = (
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+(?-i:[A-Z])",
+ # "Source:", "Via:", "See also:", "Cited in", "Cited by" or
+ # "According to" followed by any word, or "Per" followed by a
+ # Proper Noun. Only "per" needs the case-sensitive capital: it is
+ # the one prefix that is also a common word ("per week").
+ r"\b(?:(?:source\s*:|via\s*:|see\s+also\s*:|cited\s+(?:in|by)|"
+ r"according\s+to)\s+\S|per\s+(?-i:[A-Z]))",
re.IGNORECASE,
),
)
diff --git a/tests/test_content_quality.py b/tests/test_content_quality.py
index 47c0411..b04e188 100644
--- a/tests/test_content_quality.py
+++ b/tests/test_content_quality.py
@@ -345,11 +345,13 @@ def test_verify_bare_percentage_does_not_double_count_percent_of() -> None:
# "% of ..." match wins over the bare-"%" match on the same span).
result = content_verify.verify("47% of marketers report gains.")
assert result["claim_count"] == 1
+
+
def test_verify_standalone_per_followed_by_a_common_word_is_not_a_citation() -> None:
- # The citation pattern requires "per"/"according to" + a Proper Noun, but
- # re.IGNORECASE made the [A-Z] anchor match lowercase too, so "per week",
- # "per page", "according to the ..." were counted as citations. A claim
- # near such a phrase was then wrongly reported as cited.
+ # The citation pattern requires "per" + a Proper Noun, but re.IGNORECASE
+ # made the [A-Z] anchor match lowercase too, so "per week" and "per page"
+ # were counted as citations. A claim near such a phrase was then wrongly
+ # reported as cited.
result = content_verify.verify("Fully 80% of users churned, measured per week.")
assert result["claim_count"] == 1
claim = result["claims"][0]
@@ -362,6 +364,35 @@ def test_verify_per_followed_by_a_proper_noun_is_still_a_citation() -> None:
assert result["claims"][0]["has_citation"] is True
+ "attribution",
+ [
+ "according to a Stanford study",
+ "according to the CDC",
+ "Source: https://example.org/x",
+ "(source: internal survey)",
+ "cited by the World Bank",
+ "via: nielsen.com",
+ ],
+)
+def test_verify_attribution_prefixes_count_without_a_capitalised_next_word(
+ attribution: str,
+) -> None:
+ # Only "per" needs a capitalised next word. The other attribution forms
+ # are citations whatever follows them: an article, a URL, a lowercase
+ # domain or a bracketed lowercase "source:".
+ result = content_verify.verify(f"Fully 80% of users churned, {attribution}.")
+ assert result["claims"][0]["kind"] == "statistic"
+ assert result["claims"][0]["has_citation"] is True, attribution
+
+
+def test_verify_per_is_case_insensitive_but_its_proper_noun_is_not() -> None:
+ cited = content_verify.verify("Fully 80% of users churned. Per Gartner.")
+ assert cited["claims"][0]["has_citation"] is True
+ uncited = content_verify.verify("Fully 80% of users churned. Per week.")
+ assert uncited["claims"][0]["has_citation"] is False
+
+
# ---------------------------------------------------------------------------
# seo_updates
# ---------------------------------------------------------------------------