shopify-sdk-patterns

Featured

Apply production-ready patterns for @shopify/shopify-api including typed GraphQL clients, session management, and retry logic. Use when implementing Shopify integrations, refactoring SDK usage, or establishing team coding standards for Shopify. Trigger with phrases like "shopify SDK patterns", "shopify best practices", "shopify code patterns", "idiomatic shopify", "shopify client wrapper".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Shopify SDK Patterns ## Overview Production-ready patterns for the `@shopify/shopify-api` library: singleton clients, typed GraphQL operations, session management, cursor-based pagination, and error handling wrappers. ## Prerequisites - `@shopify/shopify-api` v9+ installed - Familiarity with Shopify's GraphQL Admin API - Understanding of async/await and TypeScript generics ## Instructions ### Step 1: Typed GraphQL Client Wrapper ```typescript // src/shopify/client.ts import "@shopify/shopify-api/adapters/node"; import { shopifyApi, Session, GraphqlClient } from "@shopify/shopify-api"; const shopify = shopifyApi({ apiKey: process.env.SHOPIFY_API_KEY!, apiSecretKey: process.env.SHOPIFY_API_SECRET!, hostName: process.env.SHOPIFY_HOST_NAME!, apiVersion: "2024-10", isCustomStoreApp: !!process.env.SHOPIFY_ACCESS_TOKEN, adminApiAccessToken: process.env.SHOPIFY_ACCESS_TOKEN, }); // Singleton session cache per shop const sessionCache = new Map<string, Session>(); export function getSession(shop: string): Session { if (!sessionCache.has(shop)) { const session = shopify.session.customAppSession(shop); sessionCache.set(shop, session); } return sessionCache.get(shop)!; } export function getGraphqlClient(shop: string): GraphqlClient { return new shopify.clients.Graphql({ session: getSession(shop), }); } // Typed query helper export async function shopifyQuery<T = any>( shop: string, query: string, variables?: Record<string, unknown> ): ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category