用途
分析商品目录中的价格与销售速度关系,识别哪些商品对价格敏感,以及可能的最优价格点在哪里。它会比较同一类别/供应商下不同价格层的商品,并考察带 compare-at 价格(促销)的商品与全价商品的表现差异。该技能为只读,不执行任何变更。
前置条件
需要已认证的 Shopify CLI 会话:shopify store auth --store <domain> --scopes read_orders,read_products
API 权限范围:read_orders、read_products
参数
store:字符串,必填,无默认值,店铺域名。
days_back:整数,可选,默认 90,销售回溯窗口。
group_by:字符串,可选,默认 product_type,分组比较方式,可选 product_type、vendor 或 collection。
format:字符串,可选,默认 human,输出格式,可选 human 或 json。
安全性
只读技能——不执行任何变更,可随时安全运行。
工作流程
操作 products(查询):输入 first: 250、status: ACTIVE,选择 id、title、productType、vendor、variants { price, compareAtPrice, inventoryQuantity },使用分页游标。预期输出:所有活跃商品及其定价数据。
操作 orders(查询):输入 query: "created_at:>='<NOW - days_back days>'"、first: 250,选择 lineItems { variant { id, price }, quantity },使用分页游标。预期输出:用于计算销售速度的各变体销售数据。
对每个商品/变体计算:日销量(velocity)、日营收、当前价格点、是否设置 compare-at 价格(促销标识)、促销折扣百分比 = (compareAtPrice - price) / compareAtPrice × 100。
在每个分组(product_type 或 vendor)内:按价格升序排列;计算每个价格层的销售速度;识别价格—销量相关性(负相关表示价格敏感,平缓表示价格不敏感);对比促销商品销售速度与全价销售速度;标记小幅价格变动可能显著改变销量的商品。
操作 productVariants(查询,用于带 compare-at 价格变体的补充数据):输入设置了 compareAtPrice 的变体 ID,预期输出历史定价上下文。
GraphQL 操作
products:query — 已验证适用于 api_version 2025-01
query ActiveProductsWithPricing($after: String) { products(first: 250, after: $after, query: "status:active") { edges { node { id title productType vendor variants(first: 100) { edges { node { id price compareAtPrice sku inventoryQuantity } } } } } pageInfo { hasNextPage endCursor } } }
orders:query — 已验证适用于 api_version 2025-01
query SalesVelocityData($query: String!, $after: String) { orders(first: 250, after: $after, query: $query) { edges { node { createdAt lineItems(first: 50) { edges { node { variant { id price } quantity } } } } } pageInfo { hasNextPage endCursor } } }
productVariants:query — 已验证适用于 api_version 2025-01
query VariantsOnSale($query: String, $after: String) { productVariants(first: 250, after: $after, query: $query) { edges { node { id price compareAtPrice product { id title productType vendor } } } pageInfo { hasNextPage endCursor } } }
会话跟踪
Claude 必须在每个阶段输出以下内容,这是强制要求。
开始时输出:
╔══════════════════════════════════════════════╗ ║ SKILL: Price Elasticity Analyzer ║ ║ Store: <store domain> ║ ║ Started: <YYYY-MM-DD HH:MM UTC> ║ ╚══════════════════════════════════════════════╝
每步之后输出:
[N/TOTAL] <QUERY|MUTATION> <OperationName> → Params: <key inputs 简要摘要> → Result: <count or outcome>
完成时输出:
格式为 human(默认)时:
══════════════════════════════════════════════ PRICE ELASTICITY ANALYSIS (<days_back> days) Products analyzed: <n> Product groups compared: <n> ───────────────────────────── PRICE-SENSITIVE (high elasticity): "<product type>" — velocity drops <pct>% per $10 price increase Top candidate: "<product>" at $<price> — consider testing $<lower>
PRICE-INSENSITIVE (low elasticity): "<product type>" — velocity stable across price range $<low>-$<high> Top candidate: "<product>" at $<price> — room to increase
SALE EFFECTIVENESS: Products on sale: <n> Avg discount: <pct>% Sale velocity lift: +<pct>% vs. full-price peers
Output: price_elasticity_<date>.csv ══════════════════════════════════════════════
输出格式
CSV 文件 price_elasticity_<YYYY-MM-DD>.csv,包含以下列:product_id, product_title, product_type, vendor, current_price, compare_at_price, daily_velocity, revenue_per_day, group_avg_velocity, price_rank_in_group, elasticity_indicator, recommendation。
错误处理
THROTTLED:API 速率限制超出,等待 2 秒,最多重试 3 次。
小分组:某类型只有 1-2 个商品,跳过该分组——数据不足以比较。
无销售:商品在窗口内零销售,以 velocity=0 纳入以便比较。
最佳实践
要获得有意义的结果,每个分组至少需要 5 个以上商品。
价格不敏感的商品是涨价的候选对象——可用 bulk-price-adjustment 测试。
价格敏感的商品可能受益于促销定价——可用 discount-ab-analysis 测试。
促销但销售速度提升很有限的商品在消耗利润——应移除 compare-at 价格。
每季度运行一次,以跟踪价格敏感度随季节的变化。