Common Shopify Admin GraphQL API patterns for product queries, metafield operations, webhooks, and bulk operations. Auto-invoked when working with Shopify API integration.
View on GitHubsarojpunde/shopify-dev-toolkit-claude-plugins
shopify-pattern-enforcer
shopify-app-development/skills/shopify-api-patterns/SKILL.md
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/sarojpunde/shopify-dev-toolkit-claude-plugins/blob/main/shopify-app-development/skills/shopify-api-patterns/SKILL.md -a claude-code --skill shopify-api-patternsInstallation paths:
.claude/skills/shopify-api-patterns/# Shopify API Patterns Skill
## Purpose
Provides reusable patterns for common Shopify Admin GraphQL API operations including product queries, metafield management, webhook handling, and bulk operations.
## When This Skill Activates
- Working with Shopify Admin GraphQL API
- Querying products, variants, customers, or orders
- Managing metafields
- Implementing webhooks
- Handling bulk operations
- Implementing rate limiting
## Core Patterns
### 1. Product Query with Pagination
```graphql
query getProducts($first: Int!, $after: String) {
products(first: $first, after: $after) {
edges {
node {
id
title
vendor
handle
productType
tags
variants(first: 10) {
edges {
node {
id
title
price
sku
}
}
}
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}
```
### 2. Metafield Query Pattern
```graphql
query getProductMetafields($productId: ID!) {
product(id: $productId) {
id
title
metafields(first: 20, namespace: "custom") {
edges {
node {
id
namespace
key
value
type
}
}
}
}
}
```
### 3. Metafield Update Mutation
```graphql
mutation updateMetafields($metafields: [MetafieldsSetInput!]!) {
metafieldsSet(metafields: $metafields) {
metafields {
id
namespace
key
value
type
}
userErrors {
field
message
}
}
}
```
**Usage Example:**
```typescript
const response = await admin.graphql(UPDATE_METAFIELDS, {
variables: {
metafields: [
{
ownerId: "gid://shopify/Product/123",
namespace: "custom",
key: "color",
value: "Red",
type: "single_line_text_field",
},
],
},
});
```
### 4. Metafield Definition Creation
```graphql
mutation createMetafieldDefinition($defin