SuperAPI AI 工具集

shopify-admin-publication-channel-audit

办公与效率

查看项目

更新于 10-15 09:35

技能介绍

用途

该技能用于查询所有处于 active 状态的产品,以及这些产品在其上可见的销售渠道(publications)。它会标记出已激活但未出现在关键渠道上的产品,从而防止因产品存在于目录中但在销售渠道上不可见而造成的隐性收入损失。

该技能为只读操作,不执行任何变更。

前提条件

需要已认证的 Shopify CLI 会话:

shopify store auth --store <domain> --scopes read_products,read_publications

API 权限范围:read_products、read_publications。

参数

  • store(字符串,必填,无默认值):店铺域名(例如 mystore.myshopify.com)。
  • required_channels(数组,可选,默认值为 ["Online Store"]):所有 active 产品都应发布到的渠道名称。
  • format(字符串,可选,默认值为 human):输出格式,可选 human 或 json。

安全性

该技能为只读,不执行任何变更操作,可随时安全运行。

工作流步骤

  1. OPERATION: publications — 查询。输入:first: 50。预期输出:所有可用销售渠道(publications),包含 id、name。
  2. OPERATION: products — 查询。输入:query: "status:active"、first: 250、select publishedOnCurrentPublication、resourcePublications { publication { name } }、分页游标。预期输出:active 产品及其渠道发布状态。
  3. 对每个产品:检查其是否出现在每个 required_channels 中,如缺失则标记。

GraphQL 操作

publications:query(已针对 api_version 2025-01 验证):

query SalesChannels { publications(first: 50) { edges { node { id name supportsFuturePublishing app { title } } } } }

products:query(已针对 api_version 2025-01 验证):

query ProductPublications($after: String) { products(first: 250, after: $after, query: "status:active") { edges { node { id title handle status resourcePublications(first: 20) { edges { node { publication { id name } publishDate isPublished } } } } } pageInfo { hasNextPage endCursor } } }

会话跟踪

Claude 必须在每个阶段输出以下内容,此为强制要求。

开始时输出:

╔══════════════════════════════════════════════╗ ║ SKILL: Publication Channel Audit ║ ║ Store: <store domain> ║ ║ Started: <YYYY-MM-DD HH:MM UTC> ║ ╚══════════════════════════════════════════════╝

每一步之后输出:

[N/TOTAL] <QUERY|MUTATION> <OperationName> → Params: <brief summary of key inputs> → Result: <count or outcome>

完成时输出:

format 为 human(默认)时:

══════════════════════════════════════════════ PUBLICATION CHANNEL AUDIT Active products: <n> Sales channels found: <n> Products missing channels: <n>

Missing from "Online Store": "<product title>" (<handle>) Output: publication_audit_<date>.csv ══════════════════════════════════════════════

format 为 json 时,输出:

{ "skill": "publication-channel-audit", "store": "<domain>", "active_products": 0, "channels_found": 0, "missing_channel_count": 0, "output_file": "publication_audit_<date>.csv" }

输出格式

CSV 文件 publication_audit_<YYYY-MM-DD>.csv,包含以下列:product_id, title, handle, channel_name, is_published, publish_date, issue

错误处理

  • THROTTLED:API 速率限制超限。恢复方式:等待 2 秒,最多重试 3 次。
  • Channel not found:所需渠道未安装或已重命名。恢复方式:在摘要中将该渠道报告为缺失。
  • No active products:目录为空。恢复方式:以 0 结果退出。

最佳实践

  • 在批量导入产品后运行——产品默认并不总是发布到所有渠道。
  • 对于多渠道店铺,将所有关键渠道添加到 required_channels,以捕获从任一渠道缺失的产品。
  • 产品从某个渠道取消发布可能是有意为之(例如仅批发商品)——在发布之前请先审查被标记的列表。
  • 可与 product-data-completeness-score 配合使用——数据完整度得分较低的产品应先修复,再发布到其他渠道。