agentleFS
sadrmaneshsadrmanesh/commerce-agent-skills/skills/shopify-app-development/SKILL.md

shopify-app-development

Skill1 starsChanged 18 days agoMITView on GitHub

Build a Shopify app with the configured Admin API version, session-token auth for embedded admin requests, and HMAC-verified webhooks. Use when creating or changing a Shopify app, Admin GraphQL call, app proxy, or Shopify webhook handler.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for a Shopify app.

    line 12
  2. Very specific:

    Keep app configuration in shopify.app.toml, including the API version and app-specific webhook subscriptions.

    line 18
  3. Distinctive:

    Call the GraphQL Admin API for new admin work.

    line 20
  4. Distinctive:

    Ask for the narrowest access scopes the mutation needs.

    line 21
  5. Very specific:

    Verify HTTPS webhooks with the app client secret over the raw body, then dedupe on X-Shopify-Webhook-Id.

    line 22
  6. Distinctive:

    After the app client secret rotates, Shopify can keep signing with the previous secret for up to an hour.

    line 46
  7. Very specific:

    Treat Admin GraphQL user errors and top-level errors as separate.

    line 53
  8. Distinctive:

    Write webhooks and billing changes so a second delivery does not create a second subscription or a second charge.

    line 54
  9. Distinctive:

    Do not log the access token, the client secret, or the raw HMAC.

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Shopify app development

Use this skill for a Shopify app. Payment capture inside a shop you own is the payment skill. Webhook durability is the order and webhook skill. Storefront browsing without an admin token is the headless storefront skill.

Shopify's developer docs are the source for request authentication and webhook delivery. Re-check them when an API version or header name is load-bearing. This skill records the contracts those docs describe.

Procedure

  1. Keep app configuration in shopify.app.toml, including the API version and app-specific webhook subscriptions. Do not hard-code an API version in a handler. The X-Shopify-API-Version header says which version serialized that delivery, and the app configuration selects it.
  2. Authenticate every request before using a shop domain from the query, body, or header.
  3. Call the GraphQL Admin API for new admin work. Do not start a new REST Admin API client.
  4. Ask for the narrowest access scopes the mutation needs.
  5. Verify HTTPS webhooks with the app client secret over the raw body, then dedupe on X-Shopify-Webhook-Id.

Header and auth details are in the webhook and auth notes. Worked examples and checks are in evals/tasks.json.

Which credential

RequestProof
Embedded app in the Shopify adminSession token (ID token) validated for signature, expiry, audience, and destination.
HTTPS webhookHMAC-SHA256 of the raw body, Base64, in X-Shopify-Hmac-Sha256, keyed with the app client secret. Compare header names case-insensitively.
App proxy from a storefrontApp proxy signature. It proves the shop, not the person. Do not change shop settings from an app proxy route.
Checkout or customer-account UI extensionThat extension's session token.
Browser call that skips the app proxyAnonymous. It may read public data. It must not mutate the shop.

Reject a request that fails its check. Do not fall back to a shop parameter.

Webhooks

Compute Base64 HMAC-SHA256 over the raw body with the client secret. If a JSON parser runs first, the signature will not match. Return 401 when the signature does not match.

X-Shopify-Webhook-Id identifies one delivery. Store it and skip a repeat. X-Shopify-Event-Id is shared by deliveries from the same merchant action and is not a substitute for the delivery id when you are deduping retries of one POST.

Topic and shop-domain headers are untrusted until the HMAC matches. App-specific subscriptions in shopify.app.toml are kept in sync by Shopify. Use webhookSubscriptionCreate when the subscription has to be shop-specific. You cannot set the webhook API version on that mutation; it follows the app's webhook API version.

After the app client secret rotates, Shopify can keep signing with the previous secret for up to an hour. Accept that window only if you still have the previous secret stored for verification.

Google Cloud Pub/Sub and Amazon EventBridge deliveries do not use this HMAC header. Do not pretend an HTTPS verifier applies to those transports.

Admin writes

  • Send the shop domain you got from the verified token, not from a form field.
  • Treat Admin GraphQL user errors and top-level errors as separate. A 200 response can still contain userErrors.
  • Write webhooks and billing changes so a second delivery does not create a second subscription or a second charge.
  • Do not log the access token, the client secret, or the raw HMAC.

Gotchas

  • express.json() before verification replaces the raw body. Capture the bytes first.
  • A shop domain check must be anchored. example.myshopify.com.attacker.example is not a shop domain.
  • OAuth state has to be bound to the browser that started the install and checked on return.
  • Scopes are not implied by installation. A missing scope is a failed call, not a reason to use a broader token you stored earlier.

Verification

  • A webhook with a changed byte returns 401 and writes nothing.
  • The same X-Shopify-Webhook-Id applied twice creates one record.
  • An embedded request with no valid session token does not run a mutation.
  • An app proxy request cannot change shop settings.

Evaluation

Worked examples and the checks they must satisfy are in evals/tasks.json.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.