营销增长
需要连接 Shopify 店铺或配置 Admin API…
为 Shopify 店铺设置可用的 Shopify CLI 认证和 Admin API 访问,以便进行商品与内容管理。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 59/100 ×0.15
适用场景
需要连接 Shopify 店铺或配置 A特定
解决思路
- 运行 `shopify version` 检查 Shopify CLI 是否已安装;若未安装,运行 `npm install -g @shopify/cli` 安装。
- 运行 `shopify auth login --store mystore.myshopify.com` 登录店铺;这会打开浏览器进行 OAuth,用户必须是店铺所有者或有相应权限的员工。
- 登录后运行 `shopify store info` 验证登录状态。
- 用自定义应用获取稳定的 Admin API access token;先询问用户是否已有 custom app,若有则跳到存储 token 的步骤。
- 若没有 custom app,引导用户在浏览器中创建:访问 `https://{store}.myshopify.com/admin/settings/apps/development`。
- 点击 **Create an app**。
- 命名应用(例如 "Claude Code Integration")。
- 点击 **Configure Admin API scopes**。
- 启用 scopes:`read_products`, `write_products`, `read_content`, `write_content`, `read_product_listings`, `read_inventory`, `write_inventory`, `read_files`, `write_files`(细节见 `references/api-scopes.md`)。
- 点击 **Save** 然后 **Install app**。
- 复制 **Admin API access token**(只显示一次)。
- 若用户需要协助导航 admin,可使用浏览器自动化(Chrome MCP 或 playwright-cli)。
- 安全存储 token,绝不要提交到 git;项目内使用时创建 `.dev.vars`,内容为 `SHOPIFY_STORE=mystore.myshopify.com` 和 `SHOPIFY_ACCESS_TOKEN=shpat_xxxxxxxxxxxxxxxxxxxxx`,并确保 `.dev.vars` 在 `.gitignore` 中。
- 跨项目使用时,将 token 存到偏好的 secrets manager(环境变量、1Password CLI 等)。
- 运行 GraphQL 查询验证 API 访问:`curl -s https://{store}.myshopify.com/admin/api/2025-01/graphql.json -H "Content-Type: application/json" -H "X-Shopify-Access-Token: {token}" -d '{"query": "{ shop { name primaryDomain { url } } }"}' | jq .`;预期响应包含 shop name 和 domain。如果返回 401,则 token 无效或过期,需重新创建 app。
- 在项目根目录创建 `shopify.config.json` 供其他 skills 引用:`{"store":"mystore.myshopify.com","apiVersion":"2025-01","tokenSource":".dev.vars"}`。
- 始终指定明确的 API version(例如 `2025-01`);不要在生产环境使用 `unstable`,Shopify 每季度淘汰 API 版本。
- 选择 token 类型:Admin API access token(`shpat_*`)用于自定义应用,稳定且长期有效;CLI session token 仅用于 Shopify CLI 命令且短暂;Storefront API token(`shpca_*`)用于公开 storefront 查询。此技能配置 Admin API access token,适合产品和内容管理。
- 遵守 Shopify leaky bucket 限流:REST 每秒突发 40 请求、持续 2 请求/秒;GraphQL 每秒 1,000 cost points,单次查询最多 2,000 points。
- 批量操作时使用 `bulkOperationRunQuery` mutation,而不是循环调用。
适用边界 · 注意事项
- 不适用于非 Shopify 店铺,或不需要 Shopify Admin API 的场景。
- 不适用于只想使用 Storefront API 公开查询而无需 Admin API 的场景。
- 如果用户没有店铺所有者或相应员工权限,无法完成 OAuth 登录和创建/安装自定义应用;不在 Claude Code 环境时该技能声明不适用。