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(backlinks): close review gaps in the Keywords Everywhere landing

Agrici Danielf8c220525e8a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4b5c6db..70f9621 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+
+- Keywords Everywhere (Open PageRank) as an optional, free-signup backlinks
+ fallback source: a single 0-10 domain rank metric used for the Profile
+ Overview section when Moz isn't configured. Wired through
+ `backlinks_auth.py` (new `keywordseverywhere` service) and a new
+ `keywordseverywhere_api.py` client, following the existing Moz/Bing auth
+ and source patterns. The outbound call goes through the shared
+ `url_safety.safe_requests_get` DNS-pinned helper, domains are normalized
+ and SSRF-checked before use, and requests are capped at 100 domains per
+ call. `keywordseverywhere_api.py` is registered in `runtime.py`'s
+ `ALLOWED_CORE_SCRIPTS` (a script invoked from a SKILL.md but missing from
+ that allowlist is refused by `claude-seo run`; a new test in
+ `tests/test_runtime.py` guards against that class of bug for every
+ script every SKILL.md/agent invokes). The live API path is unverified:
+ landing this required no Keywords Everywhere account, and none was
+ available to exercise the real endpoint end to end (#262).
+
### Changed
- The five judgment-heavy agents (`seo-content`, `seo-geo`, `seo-sxo`, `seo-cluster`,
diff --git a/PRIVACY.md b/PRIVACY.md
index b00bdc5..17d9b25 100644
--- a/PRIVACY.md
+++ b/PRIVACY.md
@@ -34,6 +34,7 @@ When configured with backlink API credentials, these scripts transmit data to th
|--------|---------|-----------|---------------|
| `moz_api.py` | Moz Link Explorer API | Domains you analyze | [Moz Privacy](https://moz.com/privacy-policy) |
| `bing_webmaster.py` | Bing Webmaster Tools API | Domains you analyze | [Microsoft Privacy](https://privacy.microsoft.com/) |
+| `keywordseverywhere_api.py` | openpagerank.keywordseverywhere.com | Up to 100 domain names per request, with your API key in the `API-OPR` header | [Keywords Everywhere Privacy](https://keywordseverywhere.com/privacy-policy.html) |
| `indexnow_submit.py` | IndexNow endpoints (Bing / Yandex / Seznam / Naver) | URLs submitted and key-verification URL data | Endpoint provider policies |
| `commoncrawl_graph.py` | Common Crawl | Domains (public dataset query) | [Common Crawl Terms](https://commoncrawl.org/terms-of-use) |
| `verify_backlinks.py` | Target URLs directly | URLs to verify backlink existence | N/A (direct HTTP requests) |
diff --git a/scripts/keywordseverywhere_api.py b/scripts/keywordseverywhere_api.py
index c1916b6..87a7fb2 100644
--- a/scripts/keywordseverywhere_api.py
+++ b/scripts/keywordseverywhere_api.py
@@ -24,11 +24,12 @@ except ImportError:
sys.exit(1)
import os
+
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, _SCRIPTS_DIR)
try:
from backlinks_auth import get_keywordseverywhere_api_key
- from url_safety import validate_url, normalize_hostname
+ from url_safety import URLSafetyError, normalize_hostname, safe_requests_get, validate_url
except ImportError:
print("Error: backlinks_auth.py and url_safety.py required in scripts/", file=sys.stderr)
sys.exit(1)
@@ -70,7 +71,7 @@ def get_rank(domains: list, api_key: str) -> dict:
params = [("domains[]", d) for d in domains]
try:
- response = requests.get(KWE_BASE, headers=headers, params=params, timeout=30)
+ response = safe_requests_get(KWE_BASE, headers=headers, params=params, timeout=30)
if response.status_code == 401 or response.status_code == 403:
return {
@@ -130,6 +131,13 @@ def get_rank(domains: list, api_key: str) -> dict:
"error": "Request timed out after 30 seconds",
"metadata": {"source": "keywordseverywhere"},
}
+ except URLSafetyError as e:
+ return {
+ "status": "error",
+ "data": None,
+ "error": f"blocked by SSRF protection: {e}",
+ "metadata": {"source": "keywordseverywhere"},
+ }
except requests.exceptions.RequestException as e:
return {
"status": "error",
diff --git a/scripts/runtime.py b/scripts/runtime.py
index 0db15bc..2387192 100755
--- a/scripts/runtime.py
+++ b/scripts/runtime.py
@@ -39,7 +39,9 @@ ALLOWED_CORE_SCRIPTS = frozenset(
"ga4_report.py", "gbp_deprecation_lint.py", "google_auth.py",
"google_report.py", "gsc_inspect.py", "gsc_query.py", "indexing_notify.py",
"indexnow_submit.py", "iptc_ai_label.py", "keyword_planner.py",
- "lcp_subparts.py", "moz_api.py", "nlp_analyze.py", "pagespeed_check.py",
+ "keywordseverywhere_api.py",
+ "lcp_subparts.py", "metadata_template.py", "moz_api.py", "nlp_analyze.py",
+ "pagespeed_check.py",
"parasite_risk.py", "parse_html.py", "preload_check.py", "render_page.py",
"portability_check.py", "consistency_check.py",
"schema_ecommerce_validate.py", "schema_generate.py", "seo_updates.py",
diff --git a/skills/seo-backlinks/SKILL.md b/skills/seo-backlinks/SKILL.md
index 41a381e..03c7d87 100644
--- a/skills/seo-backlinks/SKILL.md
+++ b/skills/seo-backlinks/SKILL.md
@@ -7,7 +7,7 @@ license: MIT
compatibility: "Free: Common Crawl + verify always available. Optional: Moz API, Bing Webmaster, Keywords Everywhere (free signup). Premium: DataForSEO extension."
metadata:
author: AgriciDaniel
- version: "2.2.4"
+ version: "2.3.0"
category: seo
---
diff --git a/tests/test_keywordseverywhere_api.py b/tests/test_keywordseverywhere_api.py
new file mode 100644
index 0000000..41d5605
--- /dev/null
+++ b/tests/test_keywordseverywhere_api.py
@@ -0,0 +1,130 @@
+"""Keywords Everywhere (Open PageRank) API client regressions.
+
+Covers the fallback backlinks source added for #262: a successful lookup,
+an authentication error, a rate-limit response, and the 100-domain batch
+cap. The success/error/rate-limit bodies below are recorded shapes from
+the Open PageRank API docs (https://www.domcop.com/openpagerank/documentation),
+which Keywords Everywhere's endpoint is a drop-in continuation of.
+"""
+
+from __future__ import annotations
+
+import os
+import sys
+from unittest.mock import patch
+
+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)
+
+pytest.importorskip("requests")
+import keywordseverywhere_api # noqa: E402
+from url_safety import URLSafetyError # noqa: E402
+
+# Recorded success response for a single-domain rank lookup.
+RECORDED_SUCCESS_RESPONSE = {
+ "status_code": 200,
+ "last_updated": "26th August 2026",
+ "response": [
+ {
+ "status_code": 200,
+ "error": "",
+ "page_rank_decimal": 4.68,
+ "domain": "example.com",
+ "rank": "4",
+ "page_rank_integer": 5,
+ }
+ ],
+}
+
+# Recorded auth-error body: Open PageRank returns this shape for a missing
+# or invalid API-OPR header.
+RECORDED_AUTH_ERROR_RESPONSE = {
+ "status_code": 401,
+ "message": "Invalid API Key or Domain limit reached",
+}
+
+# Recorded rate-limit body.
+RECORDED_RATE_LIMIT_RESPONSE = {
+ "status_code": 429,
+ "message": "Rate limit exceeded",
+}
+
+
+class FakeResponse:
+ def __init__(self, status_code: int, body: dict):
+ self.status_code = status_code
+ self._body = body
+ self.text = str(body)
+
+ def json(self) -> dict:
+ return self._body
+
+
+def test_get_rank_success_parses_recorded_response() -> None:
+ fake = FakeResponse(200, RECORDED_SUCCESS_RESPONSE)
+ with patch.object(keywordseverywhere_api, "safe_requests_get", return_value=fake) as mock_get:
+ result = keywordseverywhere_api.get_rank(["example.com"], "opr_live_testkey")
+
+ assert result["status"] == "success"
+ assert result["error"] is None
+ assert result["data"]["domains"] == [
+ {
+ "domain": "example.com",
+ "page_rank_decimal": 4.68,
+ "page_rank_integer": 5,
+ "rank": "4",
+ }
+ ]
+ assert result["metadata"]["source"] == "keywordseverywhere"
+ # The API key must travel in the API-OPR header, never as a query param.
+ _, kwargs = mock_get.call_args
+ assert kwargs["headers"]["API-OPR"] == "opr_live_testkey"
+
+
+def test_get_rank_auth_error_maps_to_error_status() -> None:
+ fake = FakeResponse(401, RECORDED_AUTH_ERROR_RESPONSE)
+ with patch.object(keywordseverywhere_api, "safe_requests_get", return_value=fake):
+ result = keywordseverywhere_api.get_rank(["example.com"], "bad-key")
+
+ assert result["status"] == "error"
+ assert result["data"] is None
+ assert "Invalid Keywords Everywhere API key" in result["error"]
+
+
+def test_get_rank_rate_limit_maps_to_rate_limited_status() -> None:
+ fake = FakeResponse(429, RECORDED_RATE_LIMIT_RESPONSE)
+ with patch.object(keywordseverywhere_api, "safe_requests_get", return_value=fake):
+ result = keywordseverywhere_api.get_rank(["example.com"], "opr_live_testkey")
+
+ assert result["status"] == "rate_limited"
+ assert result["data"] is None
+ assert result["metadata"]["rate_limited"] is True
+
+
+def test_get_rank_ssrf_block_surfaces_as_error_not_a_crash() -> None:
+ with patch.object(
+ keywordseverywhere_api, "safe_requests_get", side_effect=URLSafetyError("blocked host")
+ ):
+ result = keywordseverywhere_api.get_rank(["example.com"], "opr_live_testkey")
+
+ assert result["status"] == "error"
+ assert "blocked by SSRF protection" in result["error"]
+
+
+def test_main_rejects_batches_over_100_domains_without_a_network_call(
+ monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
+) -> None:
+ domains = [f"d{i}.example.com" for i in range(101)]
+ monkeypatch.setattr(sys, "argv", ["keywordseverywhere_api.py", "rank", *domains, "--json"])
+ with patch.object(keywordseverywhere_api, "safe_requests_get") as mock_get:
+ with pytest.raises(SystemExit) as exc_info:
+ keywordseverywhere_api.main()
+
+ assert exc_info.value.code == 1
+ mock_get.assert_not_called()
+ err = capsys.readouterr().err
+ assert "101" in err
+ assert "max 100" in err
diff --git a/tests/test_runtime.py b/tests/test_runtime.py
index 6ba0656..8125630 100644
--- a/tests/test_runtime.py
+++ b/tests/test_runtime.py
@@ -5,6 +5,7 @@ from __future__ import annotations
import importlib.util
import json
import os
+import re
import signal
import subprocess
from pathlib import Path
@@ -223,3 +224,41 @@ def test_run_propagates_child_signal(tmp_path: Path, monkeypatch: pytest.MonkeyP
)
assert rc == 128 + signal.SIGTERM
assert delivered == [(os.getpid(), signal.SIGTERM)]
+
+
+# Scripts run without an --extension flag are dispatched straight from the
+# core scripts/ directory, so they must be listed in ALLOWED_CORE_SCRIPTS or
+# `claude-seo run` refuses them at runtime, even though the SKILL.md/agent
+# instructions look correct. This regression was caught by hand for
+# keywordseverywhere_api.py (SKILL.md wired it up, ALLOWED_CORE_SCRIPTS did
+# not list it) -- this test makes sure the next one doesn't ship silently.
+_RUN_INVOCATION = re.compile(r'run\s+([A-Za-z0-9_]+\.py)(?!["\']?\s*--extension)')
+_EXTENSION_FLAG = re.compile(r'run\s+[A-Za-z0-9_]+\.py[^\n]*--extension\b')
+
+
+def _instruction_files() -> list[Path]:
+ files: list[Path] = []
+ for pattern in ("skills/**/SKILL.md", "agents/*.md"):
+ files.extend(sorted(ROOT.glob(pattern)))
+ return files
+
+
+def test_every_skill_invoked_script_is_runtime_allowlisted() -> None:
+ missing: list[str] = []
+ for path in _instruction_files():
+ text = path.read_text(encoding="utf-8")
+ rel = path.relative_to(ROOT).as_posix()
+ for line in text.splitlines():
+ if _EXTENSION_FLAG.search(line):
+ # Extension scripts are dispatched via extensions/<name>/scripts/
+ # and are not, and should not be, in ALLOWED_CORE_SCRIPTS.
+ continue
+ for match in _RUN_INVOCATION.finditer(line):
+ script = match.group(1)
+ if script not in runtime.ALLOWED_CORE_SCRIPTS:
+ missing.append(f"{rel}: {script}")
+ assert not missing, (
+ "scripts invoked from SKILL.md/agent instructions but missing from "
+ "ALLOWED_CORE_SCRIPTS in scripts/runtime.py (claude-seo run would "
+ "refuse them): " + "; ".join(missing)
+ )