用途
该技能用于审计商店中每个配送配置文件的配送配置。它会找出以下问题:(a)没有任何配送费率的区域(会导致结账失败),(b)仅配置了手动固定费率的区域(没有承运商计算费率,通常是漏掉了一步设置),以及(c)缺乏已知销售地理区域覆盖的配置文件。配置错误的区域会无声地拉低结账转化率——该技能能在顾客发现之前将其找出。只读——不执行任何变更。
前置条件
已认证的 Shopify CLI 会话:shopify store auth --store <domain> --scopes read_shipping
API 权限范围:read_shipping
参数
store(字符串,必填):商店域名(例如 mystore.myshopify.com)
profile_filter(字符串,选填):可选的配送配置文件名称,用于限定审计范围
flag_manual_only(布尔值,选填,默认 true):标记仅含手动费率的区域(无承运商计算费率)
flag_high_price(浮点数,选填):可选,标记任何高于此价格的费率(可能是输入错误或过期数据)
format(字符串,选填,默认 human):输出格式,human 或 json
安全性
只读技能——不执行任何变更。可随时安全运行。该技能只读取配送配置,不改变任何配送行为。
工作流程步骤
-
操作:deliveryProfiles——查询。输入:first: 50,选择 profileLocationGroups、profileItems、name、default、分页游标。预期输出:所有配送配置文件(包括默认配置文件),包含位置组和商品关联;分页直到 hasNextPage: false。
-
对每个配置文件,遍历所有 profileLocationGroups[].locationGroupZones。对每个区域,捕获:区域名称、国家代码、方式定义(费率)。
-
标记以下区域:零 methodDefinitions,或仅含基于手动 priceConditions 的费率(在 flag_manual_only: true 时没有承运商计算方式),或在设置了阈值时价格 price.amount 大于 flag_high_price 的方式。
-
按配置文件汇总发现的问题,然后构建全店范围内配置错误区域的全局摘要。
GraphQL 操作
deliveryProfiles:query——已针对 api_version 2025-01 验证
query DeliveryProfilesAudit($after: String) { deliveryProfiles(first: 50, after: $after) { edges { node { id name default profileItems(first: 1) { edges { node { id } } } profileLocationGroups { locationGroup { id locations(first: 50) { edges { node { id name address { countryCode } } } } } locationGroupZones(first: 50) { edges { node { zone { id name countries { code { countryCode } provinces { code } } } methodDefinitions(first: 50) { edges { node { id name active rateProvider { __typename ... on DeliveryRateDefinition { price { amount currencyCode } } ... on DeliveryParticipant { carrierService { id name } fixedFee { amount currencyCode } percentageOfRateFee } } } } } } } } } } } pageInfo { hasNextPage endCursor } } }
会话跟踪
Claude 必须在每个阶段输出以下内容。这是强制要求。
开始时输出:
╔══════════════════════════════════════════════╗ ║ SKILL: Shipping Rate 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(默认):
══════════════════════════════════════════════ SHIPPING RATE AUDIT Profiles inspected: <n> Zones inspected: <n> Zones with no rates: <n> Zones manual-only: <n> Rates above threshold: <n>
Critical issues (zero-rate zones): Profile: <name> Zone: <name> Countries: <list> Output: shipping_rate_audit_<date>.csv ══════════════════════════════════════════════
对于 format: json,输出:
{ "skill": "shipping-rate-audit", "store": "<domain>", "profiles_inspected": 0, "zones_inspected": 0, "zones_no_rates": 0, "zones_manual_only": 0, "rates_above_threshold": 0, "issues": [], "output_file": "shipping_rate_audit_<date>.csv" }
输出格式
CSV 文件 shipping_rate_audit_<YYYY-MM-DD>.csv,包含以下列:profile_name, zone_name, countries, rate_count, manual_rate_count, carrier_rate_count, min_rate, max_rate, currency, flag
错误处理
THROTTLED(API 速率超限):等待 2 秒,最多重试 3 次
Profile has no products(配置文件为空):在输出中注明,不作为严重问题标记
Zone has only DeliveryRateDefinition (no carrier)(仅有手动费率):若 flag_manual_only: true 则标记
Country list is null on a zone(区域国家列表为空,全球兜底区域):视为通配,不因缺少国家而标记
最佳实践
在任何重大配送变更(新区域上线、承运商切换)之后运行,以确认区域覆盖与上线计划一致。
零费率区域会导致无声的结账失败——该地区的顾客会看到“无可用配送”并放弃结账。将其视为 P0 问题。
仅手动费率的区域并不总是错误的——国内固定费率配送是一种有意选择。如果你的商店有意采用固定费率,请使用 flag_manual_only: false。
将标记出的国家代码与按国家过滤的 customers:query 交叉对照,以估算有风险的收入。
每季度运行一次,以发现由应用集成或员工添加的、偏离文档化配置的区域。