Shopify Setup

作者 jezweb64965d9d9fc7無授權條款1K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫3 天前更新

Set up Shopify CLI auth and Admin API access for a store. Install CLI, authenticate, create custom app, store access token, verify. Use whenever the user wants to connect to a Shopify store, set up Shopify API access, install Shopify CLI, or troubleshoot Shopify auth / Admin API token issues.

僅含說明DevOps & Cloud
AI 產生的概覽

引導完成 Shopify CLI 身分驗證與商店 Admin API 存取設定,最終取得已驗證的 API 連線。

功能
引導安裝 Shopify CLI、登入商店、建立含 Admin API 權限範圍的自訂應用程式、保存存取權杖,並以 GraphQL 查詢驗證連線。它也會產生供其他技能引用的 shopify.config.json 檔案,並說明 API 版本、權杖類型與速率限制。
適用情境
適用於使用者想連接 Shopify 商店、設定 Shopify API 存取、安裝 Shopify CLI,或排解 Shopify 身分驗證與 Admin API 權杖問題的情況。
執行需求
透過 npm 安裝的 Shopify CLI、Node.js/npm、具備店主或員工權限的 Shopify 商店、用於 OAuth 與管理後台應用程式建立的瀏覽器存取、網路存取,以及安全保存 Admin API 權杖的位置。僅為說明文件,不附帶指令碼。

Shopify Setup

Set up working Shopify CLI authentication and Admin API access for a store. Produces a verified API connection ready for product and content management.

Workflow

Step 1: Check Prerequisites

Verify the Shopify CLI is installed:

bash
shopify version

If not installed:

bash
npm install -g @shopify/cli

Step 2: Authenticate with the Store

bash
shopify auth login --store mystore.myshopify.com

This opens a browser for OAuth. The user must be a store owner or staff member with appropriate permissions.

After login, verify:

bash
shopify store info

Step 3: Create a Custom App for API Access

Custom apps provide stable Admin API access tokens (unlike CLI session tokens which expire).

Check if an app already exists: Ask the user if they have a custom app set up. If yes, skip to Step 4.

If no custom app exists, guide the user through creation via browser:

  1. Navigate to https://{store}.myshopify.com/admin/settings/apps/development
  2. Click Create an app
  3. Name it (e.g. "Claude Code Integration")
  4. Click Configure Admin API scopes
  5. Enable these scopes (see references/api-scopes.md for details):
    • read_products, write_products
    • read_content, write_content
    • read_product_listings
    • read_inventory, write_inventory
    • read_files, write_files
  6. Click Save then Install app
  7. Copy the Admin API access token (shown only once)

Use browser automation (Chrome MCP or playwright-cli) if the user prefers assistance navigating the admin.

Step 4: Store the Access Token

Store the token securely. Never commit it to git.

For project use — create .dev.vars:

SHOPIFY_STORE=mystore.myshopify.comSHOPIFY_ACCESS_TOKEN=shpat_xxxxxxxxxxxxxxxxxxxxx

Ensure .dev.vars is in .gitignore.

For cross-project use — store in your preferred secrets manager (environment variable, 1Password CLI, etc.).

Step 5: Verify API Access

Test the connection with a simple GraphQL query:

bash
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 .

Expected response includes the shop name and domain. If you get a 401, the token is invalid or expired — recreate the app.

Step 6: Save Store Config

Create a shopify.config.json in the project root for other skills to reference:

json
{  "store": "mystore.myshopify.com",  "apiVersion": "2025-01",  "tokenSource": ".dev.vars"}

Critical Patterns

API Version

Always specify an explicit API version (e.g. 2025-01). Using unstable in production will break without warning. Shopify retires API versions quarterly.

Token Types

TokenFormatUse
Admin API access tokenshpat_*Custom apps — stable, long-lived
CLI session tokenShort-livedShopify CLI commands only
Storefront API tokenshpca_*Public storefront queries

This skill sets up Admin API access tokens — the right choice for product and content management.

Rate Limits

Shopify uses a leaky bucket rate limiter:

  • REST: 40 requests/second burst, 2/second sustained
  • GraphQL: 1,000 cost points per second, max 2,000 points per query

For bulk operations, use the bulkOperationRunQuery mutation instead of looping.


Reference Files

  • references/api-scopes.md — Admin API scopes needed for product and content management

來源與署名

來源:jezweb/claude-skills位於plugins/shopify/skills/shopify-setup提交64965d9

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架