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

View on GitHub
"""Aggregate eval results into ecommerce GEO statistics."""
import json
from pathlib import Path
from collections import Counter, defaultdict


def build_preaggregate(run_dir):
    """Build preaggregate statistics from eval results."""
    eval_dir = Path(run_dir) / "eval"
    normalized_dir = Path(run_dir) / "normalized"

    evals = []
    for f in sorted(eval_dir.glob("*.json")):
        try:
            evals.append(json.loads(f.read_text(encoding="utf-8")))
        except (json.JSONDecodeError, IOError):
            continue

    if not evals:
        return {"error": "No eval files found"}

    # Basic counts
    total = len(evals)
    engines = list(set(e.get("engine", "") for e in evals))
    queries = list(set(e.get("query_id", "") for e in evals))

    # Target product visibility
    mentioned_count = sum(1 for e in evals if e.get("mentioned"))
    mention_rate = mentioned_count / total if total else 0

    # Mention forms
    mention_forms = Counter(e.get("mention_form", "not_mentioned") for e in evals)

    # Recommendation strength
    rec_strengths = Counter(e.get("recommendation_strength", "not_mentioned") for e in evals)

    # Position stats (when mentioned)
    positions = [e.get("position") for e in evals if e.get("position") and isinstance(e.get("position"), int)]
    avg_position = sum(positions) / len(positions) if positions else None

    # Sentiment
    sentiments = Counter(e.get("sentiment", "n/a") for e in evals)

    # Per-engine breakdown
    engine_stats = {}
    for engine in engines:
        engine_evals = [e for e in evals if e.get("engine") == engine]
        engine_mentioned = sum(1 for e in engine_evals if e.get("mentioned"))
        engine_stats[engine] = {
            "total": len(engine_evals),
            "mentioned": engine_mentioned,
            "mention_rate": engine_mentioned / len(engine_evals) if engine_evals else 0,
            "avg_position": None,
            "mention_forms": dict(Counter(e.get("mention_form", "not_mentioned") for e in engine_evals)),
            "rec_strengths": dict(Counter(e.get("recommendation_strength", "not_mentioned") for e in engine_evals)),
        }
        ep = [e.get("position") for e in engine_evals if e.get("position") and isinstance(e.get("position"), int)]
        if ep:
            engine_stats[engine]["avg_position"] = sum(ep) / len(ep)

    # Competitor analysis
    competitor_counts = Counter()
    competitor_positions = defaultdict(list)
    competitor_strengths = defaultdict(list)
    for e in evals:
        for comp in e.get("competitors_mentioned", []):
            name = comp.get("name", "")
            if name:
                competitor_counts[name] += 1
                if comp.get("position"):
                    competitor_positions[name].append(comp["position"])
                competitor_strengths[name].append(comp.get("recommendation_strength", "mention_only"))

    top_competitors = []
    for name, count in competitor_counts.most_common(10):
        positions_list = competitor_positions.get(name, [])
        top_competitors.append({
            "name": name,
            "mention_count": count,
            "mention_rate": count / total,
            "avg_position": sum(positions_list) / len(positions_list) if positions_list else None,
            "primary_rate": competitor_strengths[name].count("primary") / len(competitor_strengths[name]) if competitor_strengths[name] else 0,
        })

    # Product recommendations aggregation
    all_products = []
    for e in evals:
        for pr in e.get("product_recommendations", []):
            all_products.append(pr)

    product_counts = Counter(p.get("product_name", "") for p in all_products if p.get("product_name"))
    brand_counts = Counter(p.get("brand", "") for p in all_products if p.get("brand"))
    merchant_counts = Counter(p.get("merchant_source", "") for p in all_products if p.get("merchant_source"))

    # Shopping signals
    signal_stats = {
        "has_price_info": sum(1 for e in evals if e.get("shopping_signals", {}).get("has_price_info")),
        "has_purchase_links": sum(1 for e in evals if e.get("shopping_signals", {}).get("has_purchase_links")),
        "has_comparison_table": sum(1 for e in evals if e.get("shopping_signals", {}).get("has_product_comparison_table")),
        "has_pros_cons": sum(1 for e in evals if e.get("shopping_signals", {}).get("has_pros_cons")),
    }

    buy_signals = Counter(e.get("shopping_signals", {}).get("buy_signal_strength", "none") for e in evals)

    all_merchants = []
    for e in evals:
        all_merchants.extend(e.get("shopping_signals", {}).get("merchants_mentioned", []))
    merchant_coverage = dict(Counter(all_merchants).most_common(10))

    # Citation/source analysis
    all_sources = {}
    for e in evals:
        sa = e.get("source_analysis", {})
        if isinstance(sa, dict):
            all_sources.update(sa)

    source_types = Counter(v.get("content_type", "other") for v in all_sources.values() if isinstance(v, dict))
    source_platforms = Counter(v.get("platform", "other") for v in all_sources.values() if isinstance(v, dict))
    official_sources = sum(1 for v in all_sources.values() if isinstance(v, dict) and v.get("is_official"))

    # Missed opportunities
    missed = [e.get("missed_opportunity") for e in evals if e.get("missed_opportunity")]

    return {
        "schema_version": "preaggregate.v1",
        "summary": {
            "total_evaluations": total,
            "engines": engines,
            "queries": queries,
            "mention_rate": round(mention_rate, 3),
            "mentioned_count": mentioned_count,
            "avg_position": round(avg_position, 1) if avg_position else None,
        },
        "mention_forms": dict(mention_forms),
        "recommendation_strengths": dict(rec_strengths),
        "sentiments": dict(sentiments),
        "engine_stats": engine_stats,
        "top_competitors": top_competitors,
        "product_recommendations": {
            "total_products_recommended": len(all_products),
            "unique_products": len(product_counts),
            "top_products": [{"name": n, "count": c} for n, c in product_counts.most_common(10)],
            "top_brands": [{"name": n, "count": c} for n, c in brand_counts.most_common(10)],
            "merchant_distribution": [{"name": n, "count": c} for n, c in merchant_counts.most_common(10)],
        },
        "shopping_signals": {
            "signal_rates": {k: v / total for k, v in signal_stats.items()},
            "buy_signal_distribution": dict(buy_signals),
            "merchant_coverage": merchant_coverage,
        },
        "source_analysis": {
            "total_sources": len(all_sources),
            "content_types": dict(source_types),
            "platforms": dict(source_platforms),
            "official_source_count": official_sources,
        },
        "missed_opportunities": missed[:10],
    }


def save_preaggregate(run_dir, preaggregate):
    """Save preaggregate to run directory."""
    path = Path(run_dir) / "preaggregate.json"
    path.write_text(json.dumps(preaggregate, ensure_ascii=False, indent=2), encoding="utf-8")
    return path
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