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

View on GitHub
#!/usr/bin/env python3
"""Repository consistency checker: dead references, orphans, routing, lock integrity.

Complements tests/test_manifest_consistency.py (counts and version triangulation) with
reference-graph checks that no other tool covers:

1. ``references/X`` mentions in SKILL.md and agent files resolve via the fallback chain
   own dir -> shared ``skills/seo/references/`` -> any skill's references dir (cross-skill
   resolutions are reported as info, dead ones as errors).
2. ``research/X.md`` path mentions exist.
3. ``scripts/X.py`` mentions resolve PATH-AWARE: repo-root ``scripts/`` first, then the
   enclosing extension's ``scripts/`` dir for files under ``extensions/<name>/``. A bare
   basename existing somewhere else in the tree does NOT count (this exact bug hid dead
   ``scripts/presets.py`` invocations before the 2026-07 full review).
4. Routing tables in ``skills/seo/SKILL.md`` and ``docs/COMMANDS.md`` agree with each
   other and with the skill directories on disk.
5. ``agents/<name>.md`` path mentions exist (``seo-newagent`` doc example whitelisted).
6. ``skills/seo-flow/references/flow-prompts.lock`` SHA-256 integrity.
7. Orphan-file candidates (tracked files whose basename is mentioned nowhere else);
   reported as warnings, never errors.

Usage:
    python3 scripts/consistency_check.py [--json] [--strict]

Exit codes: 0 = no errors (warnings allowed unless --strict), 1 = errors found.
"""
import argparse
import glob
import hashlib
import json
import os
import re
import subprocess
import sys

REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

ORPHAN_SCRIPT_WHITELIST = {
    "portability_check.py", "agent_ux_check.py", "gbp_deprecation_lint.py",
    "release_sign.py", "verify_release.py", "consistency_check.py",
}
GENERIC_BASENAMES = {"README.md", "SKILL.md", "__init__.py", "LICENSE", "LICENSE.txt",
                     "plugin.json", "marketplace.json", "hooks.json"}
DOC_EXAMPLE_AGENTS = {"seo-newagent"}
LOCK_PATH = "skills/seo-flow/references/flow-prompts.lock"
RUNTIME_UTILITY_COMMANDS = {"setup", "doctor"}


def tracked_files():
    out = subprocess.run(["git", "-C", REPO, "ls-files"],
                         capture_output=True, text=True, check=True).stdout
    return [l for l in out.splitlines() if l.strip()]


def read(rel, _cache={}):
    if rel not in _cache:
        try:
            with open(os.path.join(REPO, rel), encoding="utf-8", errors="replace") as fh:
                _cache[rel] = fh.read()
        except OSError:
            _cache[rel] = ""
    return _cache[rel]


def extension_root(rel):
    m = re.match(r"(extensions/[^/]+)/", rel)
    return m.group(1) if m else None


def check_references(files, md):
    ref_pat = re.compile(r'references/([A-Za-z0-9_\-./]+\.(?:md|html|json|txt|ya?ml))')
    errors, infos = [], []
    carriers = [f for f in md if (f.startswith(("skills/", "extensions/")) and f.endswith("SKILL.md"))
                or f.startswith("agents/")]
    for f in carriers:
        base = os.path.dirname(f)
        for m in sorted(set(ref_pat.findall(read(f)))):
            candidates = [os.path.join(base, "references", m),
                          os.path.join("skills/seo/references", m)]
            if any(os.path.exists(os.path.join(REPO, c)) for c in candidates):
                continue
            hits = (glob.glob(os.path.join(REPO, "skills", "*", "references", m))
                    + glob.glob(os.path.join(REPO, "extensions", "*", "skills", "*", "references", m)))
            if hits:
                infos.append(f"{f}: references/{m} resolves cross-skill to "
                             f"{os.path.relpath(hits[0], REPO)}")
            else:
                errors.append(f"{f}: dead reference references/{m}")
    return errors, infos


SELF_DOC = {"scripts/consistency_check.py", "tests/test_consistency_check.py"}


def check_research_refs(files, texts):
    pat = re.compile(r'research/([A-Za-z0-9_\-]+\.md)')
    errors = []
    for f in texts:
        if f in SELF_DOC:
            continue
        for m in sorted(set(pat.findall(read(f)))):
            if not os.path.exists(os.path.join(REPO, "research", m)):
                errors.append(f"{f}: dead research ref research/{m}")
    return errors


def check_script_refs(files, texts):
    """Path-aware: scripts/X.py must exist at repo scripts/ or the enclosing extension's.

    The lookbehind skips path-qualified mentions such as
    ``extensions/banana/scripts/edit.py`` (checked via their own full path elsewhere).
    ``research/`` notes, ``CHANGELOG.md``, and ``.github/`` templates are
    historical/example carriers.
    """
    pat = re.compile(r'(?<![\w/])scripts/([A-Za-z0-9_]+\.py)\b')
    errors = []
    mentioned = set()
    for f in texts:
        if f.startswith(("research/", ".github/")) or f == "CHANGELOG.md" or f in SELF_DOC:
            continue
        ext_root = extension_root(f)
        for m in sorted(set(pat.findall(read(f)))):
            mentioned.add(m)
            candidates = [f"scripts/{m}"]
            if ext_root:
                candidates.insert(0, f"{ext_root}/scripts/{m}")
            if not any(c in files or os.path.isfile(os.path.join(REPO, c)) for c in candidates):
                errors.append(f"{f}: dead script ref scripts/{m} "
                              f"(checked: {', '.join(candidates)})")
    orphans = []
    all_text = "\n".join(read(f) for f in texts)
    for s in sorted(os.path.basename(f) for f in files
                    if f.startswith("scripts/") and f.endswith(".py")):
        if s in ORPHAN_SCRIPT_WHITELIST:
            continue
        others = all_text.count(s) - read(f"scripts/{s}").count(s)
        if others <= 0:
            orphans.append(f"scripts/{s}: referenced nowhere outside itself")
    return errors, orphans


def check_skill_dir_script_refs(files, texts):
    """Validate scripts invoked through Claude's portable skill-root variable.

    Extension installers place their scripts beside the installed skill. In the
    source tree those scripts live at ``extensions/<name>/scripts``. Core skills
    must carry scripts inside their own skill directory before using this form.
    """
    pat = re.compile(r'\$\{CLAUDE_SKILL_DIR\}/scripts/([A-Za-z0-9_]+\.py)\b')
    errors = []
    for f in texts:
        for script in sorted(set(pat.findall(read(f)))):
            ext_root = extension_root(f)
            if ext_root:
                candidate = f"{ext_root}/scripts/{script}"
            elif f.startswith("skills/"):
                skill_root = "/".join(f.split("/")[:2])
                candidate = f"{skill_root}/scripts/{script}"
            else:
                errors.append(f"{f}: CLAUDE_SKILL_DIR script used outside a skill layout")
                continue
            if candidate not in files and not os.path.isfile(os.path.join(REPO, candidate)):
                errors.append(
                    f"{f}: dead skill-root script {script} (checked: {candidate})"
                )
    return errors


def check_runtime_invocations(texts):
    """Reject cwd-dependent or interpreter-dependent bundled script commands."""
    errors = []
    carriers = [
        f for f in texts
        if f.startswith(("skills/", "agents/", "extensions/")) and f.endswith(".md")
    ]
    bare = re.compile(
        r"\b(?:python3|python|py\s+-3)\s+[^\n`]*?scripts/[A-Za-z0-9_./-]+\.py"
    )
    runtime = re.compile(r"\bclaude-seo\s+run(?:\s+--extension\s+[a-z0-9-]+)?\s+([A-Za-z0-9_-]+\.py)")
    for f in carriers:
        content = read(f)
        for match in bare.finditer(content):
            errors.append(f"{f}: bare bundled-script invocation: {match.group(0)}")
        for script in sorted(set(runtime.findall(content))):
            if not os.path.isfile(os.path.join(REPO, "scripts", script)) and not any(
                os.path.isfile(path)
                for path in glob.glob(os.path.join(REPO, "extensions", "*", "scripts", script))
            ):
                errors.append(f"{f}: runtime invocation references missing script {script}")
    return errors


def check_routing(files):
    cmd_pat = re.compile(r'`/seo(?:\s+([a-z][a-z0-9-]*))?')
    tables = {src: {m for m in cmd_pat.findall(read(src)) if m}
              for src in ("skills/seo/SKILL.md", "docs/COMMANDS.md")}
    skill_tokens = {d.split("/")[1][4:] for d in files
                    if d.startswith("skills/seo-") and d.endswith("SKILL.md")}
    ext_tokens = {p.split("/")[3][4:] for p in files
                  if re.match(r'extensions/[^/]+/skills/seo-[^/]+/SKILL\.md$', p)}
    known = skill_tokens | ext_tokens
    a, b = tables["skills/seo/SKILL.md"], tables["docs/COMMANDS.md"]
    errors = []
    for c in sorted(a - b):
        errors.append(f"routing: `/seo {c}` in orchestrator but not docs/COMMANDS.md")
    for c in sorted(b - a):
        errors.append(f"routing: `/seo {c}` in docs/COMMANDS.md but not orchestrator")
    for c in sorted((a | b) - known - RUNTIME_UTILITY_COMMANDS):
        errors.append(f"routing: `/seo {c}` has no matching skill directory")
    return errors


def check_agent_refs(files, texts):
    agents = {os.path.basename(f)[:-3] for f in files
              if f.startswith("agents/") and f.endswith(".md")}
    pat = re.compile(r'agents/([a-z0-9-]+)\.md')
    errors = []
    for f in texts:
        if f.startswith("agents/"):
            continue
        for m in sorted(set(pat.findall(read(f)))):
            if m not in agents and m not in DOC_EXAMPLE_AGENTS:
                errors.append(f"{f}: dead agent ref agents/{m}.md")
    return errors


def check_flow_lock(files):
    errors = []
    locked = {}
    for line in read(LOCK_PATH).splitlines():
        line = line.strip()
        if not line or line.startswith("#"):
            continue
        parts = line.split()
        if len(parts) == 2:
            locked[parts[1]] = parts[0]
    for rel, want in locked.items():
        full = os.path.join(REPO, rel)
        if not os.path.exists(full):
            errors.append(f"flow lock: missing {rel}")
            continue
        with open(full, "rb") as fh:
            got = hashlib.sha256(fh.read()).hexdigest()
        if got != want:
            errors.append(f"flow lock: hash mismatch {rel}")
    extra = {f for f in files
             if f.startswith("skills/seo-flow/references/prompts/") and f.endswith(".md")} - set(locked)
    for rel in sorted(extra):
        errors.append(f"flow lock: unlocked prompt file {rel}")
    return errors


def check_orphan_files(files, texts):
    warnings = []
    prefixes = ("skills/", "docs/", "research/", "data/", "schema/")
    corpus = {f: read(f) for f in texts}
    for f in files:
        if not f.startswith(prefixes):
            continue
        base = os.path.basename(f)
        if base in GENERIC_BASENAMES or f.startswith("skills/seo-flow/references/prompts/"):
            continue
        if not any(base in c for other, c in corpus.items() if other != f):
            warnings.append(f"orphan candidate: {f}")
    return warnings


def main():
    ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
    ap.add_argument("--json", action="store_true", help="JSON output")
    ap.add_argument("--strict", action="store_true", help="exit 1 on warnings too")
    args = ap.parse_args()

    files = tracked_files()
    fileset = set(files)
    md = [f for f in files if f.endswith(".md")]
    texts = [f for f in files if f.endswith((".md", ".json", ".yaml", ".yml", ".toml",
                                             ".py", ".sh", ".ps1", ".cff", ".txt", ".html"))]

    ref_errors, ref_infos = check_references(fileset, md)
    script_errors, script_orphans = check_script_refs(fileset, texts)
    errors = (ref_errors + check_research_refs(fileset, texts) + script_errors
              + check_skill_dir_script_refs(fileset, texts)
              + check_runtime_invocations(texts)
              + check_routing(fileset) + check_agent_refs(fileset, texts)
              + check_flow_lock(fileset))
    warnings = script_orphans + check_orphan_files(fileset, texts)
    result = {"errors": errors, "warnings": warnings, "info": ref_infos,
              "files_checked": len(files),
              "status": "FAIL" if errors or (args.strict and warnings) else "PASS"}

    if args.json:
        print(json.dumps(result, indent=2))
    else:
        for e in errors:
            print(f"ERROR: {e}")
        for w in warnings:
            print(f"WARN:  {w}")
        print(f"{result['status']}: {len(errors)} errors, {len(warnings)} warnings, "
              f"{len(ref_infos)} cross-skill infos, {len(files)} files")
    return 1 if result["status"] == "FAIL" else 0


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