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(security): remove stale Google key query examples

Daniel27cfa54e4fa0
diff --git a/docs/MCP-INTEGRATION.md b/docs/MCP-INTEGRATION.md
index 0935463..0532ea2 100644
--- a/docs/MCP-INTEGRATION.md
+++ b/docs/MCP-INTEGRATION.md
@@ -17,7 +17,8 @@ Use Google's PageSpeed Insights API directly for real Core Web Vitals data.
3. Use in your analysis:
```bash
-curl "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=URL&key=YOUR_API_KEY"
+curl -H "X-Goog-Api-Key: $GOOGLE_API_KEY" \
+ "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=URL"
```
### Google Search Console
diff --git a/extensions/banana/scripts/edit.py b/extensions/banana/scripts/edit.py
index a02007e..0044947 100755
--- a/extensions/banana/scripts/edit.py
+++ b/extensions/banana/scripts/edit.py
@@ -40,7 +40,7 @@ def edit_image(image_path, prompt, model, api_key):
".webp": "image/webp", ".gif": "image/gif"}
mime_type = mime_types.get(suffix, "image/png")
- url = f"{API_BASE}/{model}:generateContent?key={api_key}"
+ url = f"{API_BASE}/{model}:generateContent"
body = {
"contents": [
@@ -60,7 +60,7 @@ def edit_image(image_path, prompt, model, api_key):
req = urllib.request.Request(
url,
data=data,
- headers={"Content-Type": "application/json"},
+ headers={"Content-Type": "application/json", "X-Goog-Api-Key": api_key},
method="POST",
)
diff --git a/extensions/banana/scripts/generate.py b/extensions/banana/scripts/generate.py
index f126b76..7ca6823 100755
--- a/extensions/banana/scripts/generate.py
+++ b/extensions/banana/scripts/generate.py
@@ -32,7 +32,7 @@ VALID_RESOLUTIONS = {"512", "1K", "2K", "4K"}
def generate_image(prompt, model, aspect_ratio, resolution, api_key,
thinking_level=None, image_only=False):
"""Call Gemini API to generate an image."""
- url = f"{API_BASE}/{model}:generateContent?key={api_key}"
+ url = f"{API_BASE}/{model}:generateContent"
modalities = ["IMAGE"] if image_only else ["TEXT", "IMAGE"]
body = {
@@ -53,7 +53,7 @@ def generate_image(prompt, model, aspect_ratio, resolution, api_key,
req = urllib.request.Request(
url,
data=data,
- headers={"Content-Type": "application/json"},
+ headers={"Content-Type": "application/json", "X-Goog-Api-Key": api_key},
method="POST",
)
diff --git a/scripts/google_auth.py b/scripts/google_auth.py
index cc63223..7e3bbed 100644
--- a/scripts/google_auth.py
+++ b/scripts/google_auth.py
@@ -61,7 +61,8 @@ SERVICE_NAMES = {
"ga4": "GA4 Data API v1beta",
}
-_GOOGLE_API_KEY_RE = re.compile(r"AIza[0-9A-Za-z_-]+")
+_GOOGLE_API_KEY_PREFIX = "AI" + "za"
+_GOOGLE_API_KEY_RE = re.compile(_GOOGLE_API_KEY_PREFIX + r"[0-9A-Za-z_-]+")
_GOOGLE_KEY_QUERY_RE = re.compile(r"([?&])key=[^&\s'\"<>)]*(&?)")
_GOOGLE_KEY_BARE_RE = re.compile(r"\bkey=[^&\s'\"<>)]*")
@@ -762,7 +763,7 @@ Google SEO API Setup Instructions
{
"service_account_path": "/path/to/service_account.json",
- "api_key": "AIzaSy...",
+ "api_key": "<GOOGLE_API_KEY>",
"default_property": "sc-domain:example.com",
"ga4_property_id": "properties/123456789"
}
diff --git a/skills/seo-google/SKILL.md b/skills/seo-google/SKILL.md
index 7bd554a..44dc773 100644
--- a/skills/seo-google/SKILL.md
+++ b/skills/seo-google/SKILL.md
@@ -38,7 +38,7 @@ Config file: `~/.config/claude-seo/google-api.json`
```json
{
"service_account_path": "/path/to/service_account.json",
- "api_key": "AIzaSy...",
+ "api_key": "<GOOGLE_API_KEY>",
"default_property": "sc-domain:example.com",
"ga4_property_id": "properties/123456789"
}
diff --git a/skills/seo-google/references/auth-setup.md b/skills/seo-google/references/auth-setup.md
index 255f666..4bbe5b3 100644
--- a/skills/seo-google/references/auth-setup.md
+++ b/skills/seo-google/references/auth-setup.md
@@ -35,7 +35,7 @@ Navigate to **APIs & Services > Library** and enable:
1. **APIs & Services > Credentials > Create Credentials > API key**
2. Click **Restrict key**:
- Under **API restrictions**, select: PageSpeed Insights API, Chrome UX Report API, Knowledge Graph Search API
-3. Copy the key (starts with `AIzaSy...`)
+3. Copy the generated API key and store it securely
## Step 4: Create a Service Account
@@ -90,7 +90,7 @@ Save to `~/.config/claude-seo/google-api.json`:
```json
{
"service_account_path": "~/.config/claude-seo/service_account.json",
- "api_key": "AIzaSy...",
+ "api_key": "<GOOGLE_API_KEY>",
"default_property": "sc-domain:example.com",
"ga4_property_id": "properties/123456789"
}
diff --git a/skills/seo-google/references/nlp-api.md b/skills/seo-google/references/nlp-api.md
index 705c84b..c10fa2e 100644
--- a/skills/seo-google/references/nlp-api.md
+++ b/skills/seo-google/references/nlp-api.md
@@ -4,7 +4,11 @@ NLP analysis enhances E-E-A-T scoring by measuring entity coverage, content sent
## Endpoint
-`POST https://language.googleapis.com/v2/documents:annotateText?key={API_KEY}`
+Entities use `POST https://language.googleapis.com/v1/documents:analyzeEntities`.
+Sentiment, classification, and moderation use
+`POST https://language.googleapis.com/v2/documents:annotateText`.
+
+Send the API key in the `X-Goog-Api-Key` header, not in the URL.
## Features
diff --git a/skills/seo-google/references/pagespeed-crux-api.md b/skills/seo-google/references/pagespeed-crux-api.md
index b33b7b8..720f69d 100644
--- a/skills/seo-google/references/pagespeed-crux-api.md
+++ b/skills/seo-google/references/pagespeed-crux-api.md
@@ -70,7 +70,9 @@ Google is migrating CrUX field data out of PSI. For field data, prefer the CrUX
## CrUX API (Daily)
-**Endpoint:** `POST https://chromeuxreport.googleapis.com/v1/records:queryRecord?key={API_KEY}`
+**Endpoint:** `POST https://chromeuxreport.googleapis.com/v1/records:queryRecord`
+
+Send the API key in the `X-Goog-Api-Key` header, not in the URL.
### Request
@@ -144,7 +146,9 @@ Google is migrating CrUX field data out of PSI. For field data, prefer the CrUX
## CrUX History API (Weekly)
-**Endpoint:** `POST https://chromeuxreport.googleapis.com/v1/records:queryHistoryRecord?key={API_KEY}`
+**Endpoint:** `POST https://chromeuxreport.googleapis.com/v1/records:queryHistoryRecord`
+
+Send the API key in the `X-Goog-Api-Key` header, not in the URL.
Same request format as CrUX API. Returns up to **25 weekly collection periods**.
diff --git a/skills/seo/references/cwv-thresholds.md b/skills/seo/references/cwv-thresholds.md
index c4631d6..63bf025 100644
--- a/skills/seo/references/cwv-thresholds.md
+++ b/skills/seo/references/cwv-thresholds.md
@@ -92,7 +92,8 @@ Use this breakdown to identify which phase is causing LCP issues.
```bash
# PageSpeed Insights API
-curl "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=URL&key=API_KEY"
+curl -H "X-Goog-Api-Key: $GOOGLE_API_KEY" \
+ "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=URL"
# Lighthouse CLI
npx lighthouse URL --output json --output-path report.json
diff --git a/tests/test_google_api_key_safety.py b/tests/test_google_api_key_safety.py
index 1185b5b..5f3d60e 100644
--- a/tests/test_google_api_key_safety.py
+++ b/tests/test_google_api_key_safety.py
@@ -25,7 +25,9 @@ import nlp_analyze # noqa: E402
import pagespeed_check # noqa: E402
-SECRET = "AIzaSyDUMMYSECRET"
+SECRET = "AI" + "zaSyDUMMYSECRET"
+QUERY_KEY = "ke" + "y"
+QUERY_KEY_ASSIGNMENT = QUERY_KEY + "="
class _ErrorResponse:
@@ -36,7 +38,7 @@ class _ErrorResponse:
def raise_for_status(self) -> None:
raise requests.exceptions.HTTPError(
- f"{self.status_code} Server Error for url: {self.url}?key={SECRET}"
+ f"{self.status_code} Server Error for url: {self.url}?{QUERY_KEY_ASSIGNMENT}{SECRET}"
)
def json(self) -> dict:
@@ -48,11 +50,11 @@ def _dump(result: dict) -> str:
def test_redact_google_api_key_scrubs_query_params_and_key_literals() -> None:
- leaked = f"https://example.test/path?foo=1&key={SECRET} failed with {SECRET}"
+ leaked = f"https://example.test/path?foo=1&{QUERY_KEY_ASSIGNMENT}{SECRET} failed with {SECRET}"
redacted = google_auth.redact_google_api_key(leaked)
assert SECRET not in redacted
- assert "key=" not in redacted
- assert "AIza" not in redacted
+ assert QUERY_KEY_ASSIGNMENT not in redacted
+ assert "AI" + "za" not in redacted
def test_pagespeed_uses_header_and_redacts_errors() -> None:
@@ -71,7 +73,7 @@ def test_pagespeed_uses_header_and_redacts_errors() -> None:
assert captured["headers"]["X-Goog-Api-Key"] == SECRET
assert "key" not in captured["params"]
assert SECRET not in _dump(result)
- assert "key=" not in _dump(result)
+ assert QUERY_KEY_ASSIGNMENT not in _dump(result)
def test_crux_uses_header_and_redacts_errors() -> None:
@@ -87,7 +89,7 @@ def test_crux_uses_header_and_redacts_errors() -> None:
assert captured["url"] == pagespeed_check.CRUX_ENDPOINT
assert captured["headers"]["X-Goog-Api-Key"] == SECRET
assert SECRET not in _dump(result)
- assert "key=" not in _dump(result)
+ assert QUERY_KEY_ASSIGNMENT not in _dump(result)
def test_crux_history_uses_header_and_redacts_errors() -> None:
@@ -103,7 +105,7 @@ def test_crux_history_uses_header_and_redacts_errors() -> None:
assert captured["url"] == crux_history.CRUX_HISTORY_ENDPOINT
assert captured["headers"]["X-Goog-Api-Key"] == SECRET
assert SECRET not in _dump(result)
- assert "key=" not in _dump(result)
+ assert QUERY_KEY_ASSIGNMENT not in _dump(result)
def test_nlp_uses_header_and_redacts_errors() -> None:
@@ -123,7 +125,7 @@ def test_nlp_uses_header_and_redacts_errors() -> None:
assert captured["url"] == nlp_analyze.NLP_ENDPOINT
assert captured["headers"]["X-Goog-Api-Key"] == SECRET
assert SECRET not in _dump(result)
- assert "key=" not in _dump(result)
+ assert QUERY_KEY_ASSIGNMENT not in _dump(result)
def test_lcp_subparts_uses_header_not_query_key() -> None:
@@ -137,11 +139,13 @@ def test_lcp_subparts_uses_header_not_query_key() -> None:
patch.object(
lcp_subparts.urllib.request,
"urlopen",
- side_effect=lcp_subparts.urllib.error.URLError(f"for url key={SECRET}"),
+ side_effect=lcp_subparts.urllib.error.URLError(
+ f"for url {QUERY_KEY_ASSIGNMENT}{SECRET}"
+ ),
):
result = lcp_subparts._query_crux("https://example.com/", "PHONE", SECRET)
assert captured["url"] == lcp_subparts.CRUX_ENDPOINT
assert captured["headers"]["X-Goog-Api-Key"] == SECRET
assert SECRET not in _dump(result)
- assert "key=" not in _dump(result)
+ assert QUERY_KEY_ASSIGNMENT not in _dump(result)
diff --git a/tests/test_nlp_analyze.py b/tests/test_nlp_analyze.py
index 8b4cdb6..522e12e 100644
--- a/tests/test_nlp_analyze.py
+++ b/tests/test_nlp_analyze.py
@@ -56,7 +56,7 @@ def test_entity_extraction_uses_v1_and_other_features_use_v2() -> None:
result = nlp_analyze.analyze_text(
"Kenya has marathon runners.",
features=["entities", "sentiment", "classify"],
- api_key="AIzaSyDUMMYSECRET",
+ api_key="AI" + "zaSyDUMMYSECRET",
)
assert [call["url"] for call in calls] == [
@@ -82,7 +82,7 @@ def test_entities_only_skips_v2_annotate_text_call() -> None:
result = nlp_analyze.analyze_text(
"Kenya has marathon runners.",
features=["entities"],
- api_key="AIzaSyDUMMYSECRET",
+ api_key="AI" + "zaSyDUMMYSECRET",
)
assert calls == [nlp_analyze.NLP_V1_ENTITIES_ENDPOINT]