Skip to content

balsm-health/website / .claude/skills/seo

Comprehensive SEO analysis for any website or business type. Full site audits, single-page analysis, technical SEO (crawlability, indexability, Core Web Vitals with INP), schema markup, content quality (E-E-A-T), image optimization, sitemap analysis, and GEO for AI Overviews/ChatGPT/Perplexity. Industry detection for SaaS, e-commerce, local, publishers, agencies. Triggers on: SEO, audit, schema, Core Web Vitals, sitemap, E-E-A-T, AI Overviews, GEO, technical SEO, content quality, page speed.

FileKindSize
LICENSE.txtmarkdown143 B
SKILL.mdskill md16.9 KB
bin/claude-seoexecutablescript1.5 KB
extensions/banana/references/cost-tracking.mdmarkdown1.2 KB
extensions/banana/references/gemini-models.mdmarkdown5.8 KB
extensions/banana/references/mcp-tools.mdmarkdown3.7 KB
extensions/banana/references/post-processing.mdmarkdown5.1 KB
extensions/banana/references/presets.mdmarkdown2.2 KB
extensions/banana/references/prompt-engineering.mdmarkdown20.9 KB
extensions/banana/references/seo-image-presets.mdmarkdown4.0 KB
extensions/banana/scripts/batch.pyexecutablescript3.3 KB
extensions/banana/scripts/cost_tracker.pyexecutablescript7.2 KB
extensions/banana/scripts/edit.pyexecutablescript5.6 KB
extensions/banana/scripts/generate.pyexecutablescript6.4 KB
extensions/banana/scripts/presets.pyexecutablescript4.9 KB
extensions/banana/scripts/setup_mcp.pyexecutablescript4.5 KB
extensions/banana/scripts/validate_setup.pyexecutablescript3.8 KB
hooks/hooks.jsonconfig416 B
hooks/run-python-hook.jsscript1.7 KB
hooks/validate-schema.pyexecutablescript5.9 KB
pdf/google-seo-reference.mdmarkdown8.0 KB
references/backlink-quality.mdmarkdown3.4 KB
references/cwv-thresholds.mdmarkdown6.9 KB
references/eeat-framework.mdmarkdown8.1 KB
references/free-backlink-sources.mdmarkdown5.6 KB
references/local-schema-types.mdmarkdown9.2 KB
references/local-seo-signals.mdmarkdown9.6 KB
references/maps-api-endpoints.mdmarkdown5.9 KB
references/maps-free-apis.mdmarkdown6.0 KB
references/maps-gbp-checklist.mdmarkdown5.9 KB
references/maps-geo-grid.mdmarkdown4.3 KB
references/quality-gates.mdmarkdown5.1 KB
references/schema-types.mdmarkdown7.8 KB
references/thinking-framework.mdmarkdown9.3 KB
requirements.txtmanifest1.5 KB
runtime-plugin.jsonconfig1.5 KB
schema/templates.jsonconfig9.4 KB
scripts/agent_ux_check.pyscript8.2 KB
scripts/analyze_visual.pyexecutablescript7.2 KB
scripts/backlinks_auth.pyscript16.1 KB
scripts/bing_webmaster.pyscript21.8 KB
scripts/capture_screenshot.pyexecutablescript6.4 KB
scripts/commoncrawl_graph.pyscript15.6 KB
scripts/consistency_check.pyscript12.5 KB
scripts/content_humanize.pyscript7.2 KB
scripts/content_quality.pyscript9.7 KB
scripts/content_verify.pyscript7.1 KB
scripts/crux_history.pyscript10.7 KB
scripts/dataforseo_costs.pyscript15.8 KB
scripts/dataforseo_merchant.pyexecutablescript16.7 KB
scripts/dataforseo_normalize.pyexecutablescript14.7 KB
scripts/domain_history.pyscript9.6 KB
scripts/drift_baseline.pyscript13.5 KB
scripts/drift_compare.pyscript22.3 KB
scripts/drift_history.pyscript3.4 KB
scripts/drift_report.pyscript11.0 KB
scripts/fetch_page.pyexecutablescript9.4 KB
scripts/ga4_report.pyscript16.8 KB
scripts/gbp_deprecation_lint.pyexecutablescript4.7 KB
scripts/google_auth.pyscript31.0 KB
scripts/google_report.pyscript97.6 KB
scripts/gsc_inspect.pyscript11.0 KB
scripts/gsc_query.pyscript18.6 KB
scripts/indexing_notify.pyscript10.3 KB
scripts/indexnow_submit.pyscript8.8 KB
scripts/iptc_ai_label.pyscript7.6 KB
scripts/keyword_planner.pyscript10.8 KB
scripts/lcp_subparts.pyscript7.2 KB
scripts/moz_api.pyscript14.7 KB
scripts/nlp_analyze.pyscript12.1 KB
scripts/pagespeed_check.pyscript22.9 KB
scripts/parasite_risk.pyexecutablescript8.6 KB
scripts/parse_html.pyexecutablescript8.8 KB
scripts/portability_check.pyscript7.8 KB
scripts/preload_check.pyscript8.1 KB
scripts/release_sign.pyscript5.6 KB
scripts/render_page.pyscript20.9 KB
scripts/runtime.pyexecutablescript15.1 KB
scripts/schema_ecommerce_validate.pyscript11.8 KB
scripts/schema_generate.pyscript12.0 KB
scripts/seo_updates.pyscript4.8 KB
scripts/sitemap_discovery.pyscript10.0 KB
scripts/sync_flow.pyscript11.9 KB
scripts/ucp_check.pyscript8.4 KB
scripts/unlighthouse_run.pyscript5.6 KB
scripts/url_safety.pyscript22.0 KB
scripts/validate_backlink_report.pyscript11.7 KB
scripts/verify_backlinks.pyscript12.9 KB
scripts/verify_release.pyscript4.8 KB
scripts/youtube_search.pyscript12.3 KB

scripts/preload_check.py

View on GitHub
#!/usr/bin/env python3
"""
Speculation Rules / bfcache / prerender2 / preload detector.

Per the v2 gap analysis, **LCP is the binding CWV constraint** as of
2025: 77% of mobile pages pass INP, only 62% pass LCP, and 48% pass
all three. The fastest large LCP win available without a content
rewrite is to wire up **bfcache** and **Speculation Rules** so the
next-navigation paint is effectively instant.

This script audits a page's HTML and response headers for the four
preload mechanisms Google rewards in 2025-2026:

  - ``<script type="speculationrules">`` blocks  (Chrome 121+)
  - ``Speculation-Rules`` HTTP response header   (Chrome 122+)
  - ``<link rel="preload" as="…">``               (legacy but still useful for LCP)
  - ``<link rel="prerender" href="…">``           (deprecated; flag for migration)
  - bfcache hints: ``Cache-Control: no-store`` removed, no
    ``unload`` listeners, no permission-prompting APIs.

The script does NOT measure bfcache eligibility from JS; that requires
a headless browser run with the ``NotRestoredReasons`` API. Instead,
it surfaces the easy static signals so an audit can quickly identify
high-value fixes.

Result JSON::

    {
      "url":                   "<final URL>",
      "speculation_rules": {
        "inline_blocks":       <int>,
        "header_present":      <bool>,
        "actions":             ["prefetch", "prerender", …]
      },
      "preload_hints":         <int>,
      "prerender_links":       <int>,  # deprecated rel=prerender count
      "bfcache_signals": {
        "cache_control_no_store":  <bool>,
        "unload_listener":         <bool>,
        "beforeunload_listener":   <bool>
      },
      "lcp_resource_hints": {
        "preload_lcp_candidate":   <bool>,
        "fetchpriority_high":      <int>
      },
      "score": 0..100,
      "recommendations": ["…"]
    }
"""

from __future__ import annotations

import argparse
import json
import os
import re
import sys
from typing import Optional

_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
if _SCRIPTS_DIR not in sys.path:
    sys.path.insert(0, _SCRIPTS_DIR)
from url_safety import URLSafetyError, safe_requests_get  # noqa: E402


_SPECULATION_BLOCK_RE = re.compile(
    r'<script\b[^>]*\btype\s*=\s*["\']speculationrules["\'][^>]*>(?P<body>.*?)</script>',
    re.IGNORECASE | re.DOTALL,
)
_PRELOAD_LINK_RE = re.compile(
    r'<link\b[^>]*\brel\s*=\s*["\']preload["\'][^>]*>', re.IGNORECASE,
)
_PRERENDER_LINK_RE = re.compile(
    r'<link\b[^>]*\brel\s*=\s*["\']prerender["\'][^>]*>', re.IGNORECASE,
)
_FETCHPRIORITY_HIGH_RE = re.compile(
    r'\bfetchpriority\s*=\s*["\']high["\']', re.IGNORECASE,
)
_LCP_IMG_HINT_RE = re.compile(
    r'<(?:img|video|source)\b[^>]*\bfetchpriority\s*=\s*["\']high["\']',
    re.IGNORECASE,
)
_UNLOAD_LISTENER_RE = re.compile(
    r'\b(?:addEventListener|on)\s*\(\s*["\']?unload["\']?', re.IGNORECASE,
)
_BEFOREUNLOAD_LISTENER_RE = re.compile(
    r'\b(?:addEventListener|on)\s*\(\s*["\']?beforeunload["\']?', re.IGNORECASE,
)


def _extract_speculation_actions(body: str) -> list[str]:
    """Pull the unique 'action' field values out of a speculationrules JSON."""
    actions: set[str] = set()
    try:
        payload = json.loads(body.strip())
    except json.JSONDecodeError:
        return []
    for action_kind in ("prefetch", "prerender"):
        if isinstance(payload.get(action_kind), list):
            actions.add(action_kind)
    return sorted(actions)


def analyse(html: str, headers: Optional[dict] = None) -> dict:
    headers = headers or {}
    speculation_blocks = list(_SPECULATION_BLOCK_RE.finditer(html))
    actions: set[str] = set()
    for m in speculation_blocks:
        for a in _extract_speculation_actions(m.group("body")):
            actions.add(a)
    speculation_header = "speculation-rules" in {k.lower() for k in headers}

    preload_count = len(_PRELOAD_LINK_RE.findall(html))
    prerender_count = len(_PRERENDER_LINK_RE.findall(html))
    fetchpriority_count = len(_FETCHPRIORITY_HIGH_RE.findall(html))
    lcp_img_hint = bool(_LCP_IMG_HINT_RE.search(html))

    cc_value = ""
    for key, value in headers.items():
        if key.lower() == "cache-control":
            cc_value = value or ""
            break
    cache_control_no_store = "no-store" in cc_value.lower()

    has_unload = bool(_UNLOAD_LISTENER_RE.search(html))
    has_beforeunload = bool(_BEFOREUNLOAD_LISTENER_RE.search(html))

    # Score: 25 pts each for speculation rules, preload-with-LCP hint,
    # absence of bfcache-killers, and the absence of deprecated prerender.
    score = 0
    recs: list[str] = []
    if speculation_blocks or speculation_header:
        score += 25
    else:
        recs.append(
            "Add <script type=\"speculationrules\"> for prefetch+prerender on "
            "top user-paths. Saves entire next-navigation paint cost."
        )

    if lcp_img_hint:
        score += 25
    else:
        recs.append(
            "Mark the LCP hero image with fetchpriority=\"high\" so the "
            "browser preloads it ahead of other resources."
        )

    if not cache_control_no_store and not has_unload:
        score += 25
    else:
        if cache_control_no_store:
            recs.append(
                "Cache-Control: no-store disqualifies the page from bfcache. "
                "Remove it or scope it to authenticated routes only."
            )
        if has_unload:
            recs.append(
                "An unload listener disqualifies the page from bfcache. "
                "Switch to pagehide or visibilitychange."
            )

    if prerender_count == 0:
        score += 25
    else:
        recs.append(
            f"Found {prerender_count} <link rel=\"prerender\"> (deprecated). "
            "Migrate to speculation rules (rel=prerender was sunset in Chrome 120)."
        )

    return {
        "speculation_rules": {
            "inline_blocks": len(speculation_blocks),
            "header_present": speculation_header,
            "actions": sorted(actions),
        },
        "preload_hints": preload_count,
        "prerender_links": prerender_count,
        "bfcache_signals": {
            "cache_control_no_store": cache_control_no_store,
            "unload_listener": has_unload,
            "beforeunload_listener": has_beforeunload,
        },
        "lcp_resource_hints": {
            "preload_lcp_candidate": lcp_img_hint,
            "fetchpriority_high": fetchpriority_count,
        },
        "score": score,
        "recommendations": recs,
    }


def main() -> int:
    parser = argparse.ArgumentParser(
        description="Audit Speculation Rules, bfcache, prerender, and LCP "
                    "preload signals on a single URL."
    )
    parser.add_argument("url")
    parser.add_argument("--json", action="store_true")
    args = parser.parse_args()

    try:
        resp = safe_requests_get(args.url, timeout=20, allow_redirects=True)
    except URLSafetyError as exc:
        print(f"Error: url_safety: {exc}", file=sys.stderr)
        return 2

    result = {"url": resp.url, **analyse(resp.text, dict(resp.headers))}

    if args.json:
        json.dump(result, sys.stdout, indent=2)
        sys.stdout.write("\n")
    else:
        print(f"URL: {result['url']}")
        print(f"Score: {result['score']}/100")
        sr = result["speculation_rules"]
        print(f"  Speculation Rules:    blocks={sr['inline_blocks']} "
              f"header={sr['header_present']} actions={sr['actions']}")
        print(f"  Preload hints:        {result['preload_hints']}")
        print(f"  Deprecated prerender: {result['prerender_links']}")
        bf = result["bfcache_signals"]
        print(f"  bfcache killers:      no-store={bf['cache_control_no_store']} "
              f"unload={bf['unload_listener']} "
              f"beforeunload={bf['beforeunload_listener']}")
        lr = result["lcp_resource_hints"]
        print(f"  LCP preload:          marked={lr['preload_lcp_candidate']} "
              f"fetchpriority=high count={lr['fetchpriority_high']}")
        if result["recommendations"]:
            print("Recommendations:")
            for r in result["recommendations"]:
                print(f"  - {r}")

    return 0 if result["score"] >= 75 else 1


if __name__ == "__main__":
    sys.exit(main())
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall