Skip to content

nexscope-ai/nexscope-ecommerce-skills / ecommerce-product-ai-visibility

ecommerce.product-ai-visibility

Verified

Product AI Visibility & Ranking — evaluate how AI search engines (ChatGPT, Claude, Gemini, DeepSeek) recommend your product when shoppers ask buying questions. Triggers: AI visibility, product AI ranking, AI recommend, AI search, does AI mention my product.

FileKindSize
.nexscope-manifest.jsonconfig230 B
SKILL.mdskill md14.3 KB
assets/config.jsonconfig388 B
assets/prompts/evaluator.mdmarkdown9.1 KB
config.jsonconfig392 B
profiles/_template/product.mdmarkdown878 B
profiles/_template/queries.csvother1.5 KB
profiles/_template/query_rules.mdmarkdown1.2 KB
profiles/airscape-planetary-design-kilo-coffee-st/product.mdmarkdown1.9 KB
profiles/airscape-planetary-design-kilo-coffee-st/queries.csvother3.2 KB
profiles/airscape-planetary-design-kilo-coffee-st/query_rules.mdmarkdown525 B
profiles/aisi-hair-ombre-blonde-wig-glueless-curl/product.mdmarkdown1.2 KB
profiles/aisi-hair-ombre-blonde-wig-glueless-curl/queries.csvother2.6 KB
profiles/aisi-hair-ombre-blonde-wig-glueless-curl/query_rules.mdmarkdown428 B
profiles/apple-airpods-pro-3/product.mdmarkdown1.1 KB
profiles/apple-airpods-pro-3/queries.csvother2.2 KB
profiles/apple-airpods-pro-3/query_rules.mdmarkdown737 B
profiles/coffee-canister/product.mdmarkdown1.4 KB
profiles/coffee-canister/queries.csvother1.3 KB
profiles/coffee-canister/query_rules.mdmarkdown356 B
profiles/define-jacket-nulu/product.mdmarkdown1.1 KB
profiles/define-jacket-nulu/queries.csvother2.2 KB
profiles/define-jacket-nulu/query_rules.mdmarkdown736 B
profiles/iphone-17-pro/product.mdmarkdown1.3 KB
profiles/iphone-17-pro/queries.csvother2.2 KB
profiles/iphone-17-pro/query_rules.mdmarkdown731 B
profiles/macbook-air-m5/product.mdmarkdown1.0 KB
profiles/macbook-air-m5/queries.csvother2.1 KB
profiles/macbook-air-m5/query_rules.mdmarkdown732 B
profiles/rare-beauty/product.mdmarkdown1.5 KB
profiles/rare-beauty/queries.csvother1.6 KB
profiles/rare-beauty/query_rules.mdmarkdown1.1 KB
profiles/stanley-quencher-h2-0-flowstate-tumbler-/product.mdmarkdown1.4 KB
profiles/stanley-quencher-h2-0-flowstate-tumbler-/queries.csvother2.5 KB
profiles/stanley-quencher-h2-0-flowstate-tumbler-/query_rules.mdmarkdown763 B
scripts/__init__.pyscript0 B
scripts/_next_steps.pyscript10.1 KB
scripts/api_capture_runner.pyscript9.0 KB
scripts/api_client_base.pyscript8.2 KB
scripts/cli.pyscript10.0 KB
scripts/evaluator.pyscript6.9 KB
scripts/html_report.pyscript43.9 KB
scripts/loader.pyscript4.4 KB
scripts/normalizer.pyscript3.0 KB
scripts/preaggregate.pyscript7.0 KB
scripts/profile_builder.pyscript9.5 KB
scripts/send_report_email.pyscript4.4 KB
scripts/task_builder.pyscript2.7 KB
scripts/test_raw_api.pyscript2.6 KB
tmp-tr_4cc43ce22aaa/product_info.jsonconfig2.0 KB
tmp-tr_be2fd13607b6/product_info.jsonconfig2.1 KB

scripts/send_report_email.py

View on GitHub
"""Send AI Visibility Report notification email."""

import json
import os
import sys
import urllib.request
import urllib.error
from pathlib import Path


def _read_metrics_from_run(run_dir):
    """Auto-read metrics from preaggregate.json in the run directory."""
    preag_path = Path(run_dir) / "preaggregate.json"
    if not preag_path.exists():
        return {"mention_rate": 0, "biggest_gap": "", "p0_action": "See full report"}

    preag = json.loads(preag_path.read_text(encoding="utf-8"))
    summary = preag.get("summary", {})
    mention_rate = summary.get("mention_rate", 0)

    # Find weakest LLM
    engine_stats = preag.get("engine_stats", {})
    weakest = ""
    lowest_rate = 999
    for engine, stats in engine_stats.items():
        rate = stats.get("mention_rate", 0)
        if rate < lowest_rate:
            lowest_rate = rate
            weakest = engine
    if weakest:
        biggest_gap = f"{weakest} ({int(lowest_rate*100)}% mention rate)"
    else:
        biggest_gap = "See full report"

    # Get P0 action from next_steps if available
    next_steps = preag.get("next_steps", [])
    if next_steps:
        p0_action = next_steps[0].get("title", "See full report")
    else:
        p0_action = "See full report"

    return {
        "mention_rate": mention_rate * 100 if mention_rate <= 1 else mention_rate,
        "biggest_gap": biggest_gap,
        "p0_action": p0_action
    }


def _build_subject(product_name, metrics):
    mention_rate = metrics.get("mention_rate", 0)
    return f"AI Visibility Report ready \u2014 {product_name} ({int(mention_rate)}% mention rate)"


def _build_body(product_name, metrics, report_url):
    mention_rate = int(metrics.get("mention_rate", 0))

    body = f"""Your **AI Visibility Report** for **{product_name}** is ready.

**AI Mention Rate: {mention_rate}%** \u2014 tested across ChatGPT, Claude, Gemini & DeepSeek.

Full breakdown, competitive rankings, and action steps are in your report.

**[View Report on Nexscope \u2192](https://www.nexscope.ai)**
"""
    return body


def send_report_email(product_name, run_dir, report_url):
    base_url = os.environ.get("NEXSCOPE_PROXY_BASE")
    api_key = os.environ.get("NEXSCOPE_API_KEY")

    if not base_url or not api_key:
        return {"success": False, "error": "Email service not available"}

    metrics = _read_metrics_from_run(run_dir)
    subject = _build_subject(product_name, metrics)
    markdown_body = _build_body(product_name, metrics, report_url)

    payload = {
        "subject": subject,
        "content": subject,
        "markdown": markdown_body,
        "serviceName": "AI Visibility Report",
        "status": "completed",
    }

    url = f"{base_url}/api/v1/tools/email/send"
    data = json.dumps(payload).encode("utf-8")
    req = urllib.request.Request(
        url,
        data=data,
        headers={
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json",
        },
        method="POST",
    )

    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            status = resp.status
            raw = resp.read().decode("utf-8")
            try:
                body = json.loads(raw)
            except json.JSONDecodeError:
                body = {"raw": raw[:200]}
            if status < 200 or status >= 300:
                return {"success": False, "error": "Email delivery failed", "status": status}
            if isinstance(body, dict) and "code" in body and body["code"] != 0:
                return {"success": False, "error": body.get("msg") or body.get("message", "Email delivery failed")}
            return {"success": True, "status": status, "detail": body.get("message") or body.get("msg", "accepted")}
    except urllib.error.HTTPError as e:
        err_body = ""
        try:
            err_body = e.read().decode("utf-8")[:200]
        except Exception:
            pass
        return {"success": False, "error": f"HTTP {e.code}", "detail": err_body}
    except Exception as ex:
        return {"success": False, "error": f"Email service unavailable: {type(ex).__name__}"}


if __name__ == "__main__":
    if len(sys.argv) < 4:
        print("Usage: send_report_email.py <product_name> <run_dir> <report_url>")
        sys.exit(1)

    product_name = sys.argv[1]
    run_dir = sys.argv[2]
    report_url = sys.argv[3]

    result = send_report_email(product_name, run_dir, report_url)
    print(json.dumps(result, indent=2))
    sys.exit(0 if result["success"] else 1)
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall