/major-ai-skills:shopify-appfrom major-ai-skills
Ship Shopify apps with session-token auth, HMAC-verified webhooks, cost-aware Admin GraphQL, least-privilege scopes, and uninstall-safe token lifecycle—patterns agents routinely get wrong.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Shopify apps extend merchant admin and storefronts. Embedded apps authenticate with session tokens (App Bridge); backends call Admin GraphQL with shop-scoped offline access tokens (X-Shopify-Access-Token). Shopify pushes events over webhooks that must be HMAC-verified on the raw body. Agents treat shop query params as untrusted until token/HMAC validation succeeds, pin Admin API versions, budget GraphQL query cost, and purge tokens on app/uninstalled.
┌─────────────────────────────────────────────────────────────┐
│ Shopify app request paths │
│ │
│ Merchant Admin (embedded) │
│ ├── App Bridge → session token (JWT) │
│ └── Your backend validates token → shop session record │
│ │
│ Admin GraphQL │
│ ├── Header: X-Shopify-Access-Token (offline/online) │
│ ├── Cost leaky bucket (extensions.cost.throttleStatus) │
│ └── Pin API version; least-privilege scopes │
│ │
│ Webhooks (HTTPS / PubSub / EventBridge) │
│ ├── Verify X-Shopify-Hmac-SHA256 on raw body │
│ ├── Dedupe X-Shopify-Webhook-Id; 200 fast → async work │
│ └── app/uninstalled → delete tokens + scheduled jobs │
└─────────────────────────────────────────────────────────────┘
Use when
shopify.app.toml).Do not use when
@zapier (or Shopify Flow).@graphql-client.?shop= without session/HMAC validation, bake API secrets into the storefront, or invent Partner Dashboard credentials → refuse.@shopify/shopify-app-* libraries for OAuth, session tokens, and webhook validation—hand-rolled auth is the usual breach path.shop alone. Anchor shop-domain regex at both ends (block shop.myshopify.com.attacker.net).crypto.timingSafeEqual on decoded digests. Admin-created webhook subscriptions often fail HMAC—subscribe via app config / Admin API with the app secret.X-Shopify-Webhook-Id; respond 200 quickly; heavy work async. Treat topic/shop headers as untrusted until HMAC verifies.extensions.cost.throttleStatus; backoff when currentlyAvailable is low; use bulk operations for large exports. Single query max ~1000 cost points.app/uninstalled—delete access/refresh tokens, cancel jobs, stop webhook side effects.SHOPIFY_API_KEY, SHOPIFY_API_SECRET, session storage).Webhook route (raw body first):
import crypto from "node:crypto";
import express from "express";
const app = express();
const secret = process.env.SHOPIFY_API_SECRET; // from env — never hardcode
// Capture raw body only for webhooks; do not use express.json() before this route
app.post(
"/webhooks",
express.raw({ type: "application/json" }),
async (req, res) => {
const hmacHeader = req.get("x-shopify-hmac-sha256") || "";
const digest = crypto
.createHmac("sha256", secret)
.update(req.body)
.digest("base64");
const a = Buffer.from(digest, "base64");
const b = Buffer.from(hmacHeader, "base64");
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
return res.status(401).send("invalid hmac");
}
const deliveryId = req.get("x-shopify-webhook-id");
const topic = req.get("x-shopify-topic");
const shop = req.get("x-shopify-shop-domain");
// await dedupeInsert(deliveryId); if duplicate → 200 and return
// enqueueAsync({ shop, topic, body: JSON.parse(req.body.toString("utf8")) })
res.status(200).send("ok");
}
);
Admin GraphQL call (token from server-side session store):
async function adminGraphql(shop, accessToken, query, variables = {}) {
const version = process.env.SHOPIFY_API_VERSION || "2025-10";
const res = await fetch(
`https://${shop}/admin/api/${version}/graphql.json`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": accessToken,
},
body: JSON.stringify({ query, variables }),
}
);
const json = await res.json();
const throttle = json?.extensions?.cost?.throttleStatus;
if (throttle && throttle.currentlyAvailable < 50) {
// backoff / queue before next expensive query
}
if (json.errors) throw new Error(JSON.stringify(json.errors));
return json.data;
}
const ORDERS = `
query Orders($cursor: String) {
orders(first: 50, after: $cursor) {
edges { cursor node { id name displayFulfillmentStatus } }
pageInfo { hasNextPage endCursor }
}
}
`;
Validation loop:
shopify app info
shopify app deploy --help # review before releasing toml/webhooks
# Trigger test webhook via CLI or admin event; confirm 401 without secret, 200 with
| Signature | Likely cause | Fix path |
|---|---|---|
| Webhook HMAC always fails | Body parsed (express.json) before verify; wrong secret; admin-UI subscription | Use express.raw; app secret from Partners; subscribe via shopify.app.toml / API |
401 / invalid session token | Clock skew, wrong audience, trusting shop param | Validate full JWT claims; sync NTP; use official auth helpers |
GraphQL THROTTLED / low currentlyAvailable | Query too costly or bursty | Smaller first, fewer nested connections; respect restore rate; bulk ops |
| Field access denied despite scope | Protected customer data / staff online-token limits | Complete PCD approval; use offline token for background jobs |
| Works in tunnel, fails in prod | Callback / redirect URL mismatch | Exact redirect allowlist; no wildcards or prefix matching |
| Data after uninstall | Missing app/uninstalled cleanup | Delete tokens, cancel billing/jobs, stop processing |
| Billing charge declined | Test vs live charge flow | Handle declined/pending; use test stores for billing QA |
| Theme/checkout extension blocked | Plan / surface limits | Check Plus/checkout extensibility constraints before promising UX |
shopify.app.toml.shop + topic + delivery id—not full PII payloads.app dev tunneling for local embedded testing; keep prod URLs in Partner config in sync.@graphql-client — generic GraphQL client patterns for Admin/Storefront@nodejs — webhook HTTP servers and raw-body middleware order@zapier — lightweight merchant automations without a full app@github-actions — CI for app build/test before Partner deployMANDATORY: Never trust
shopquery params or webhook headers until session-token or HMAC verification succeeds on the raw body. Use least-privilege scopes, pin API versions, handle GraphQL cost throttling, and delete tokens on uninstall. Never hardcode or inventSHOPIFY_API_SECRET/ access tokens.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job