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/domain_history.py

View on GitHub
#!/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 current 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,
            encoding="utf-8",
            errors="replace",
            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 (current 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())
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