shopify-graphql-cost-optimizer
Installation
SKILL.md
Shopify GraphQL Cost Optimizer
Overview
Every Shopify GraphQL query has a calculated cost. The API uses a token bucket (1,000 points max, refills at 50/second for standard plans) and throttles once depleted. The key insight: requestedQueryCost is the worst-case estimate, while actualQueryCost is what you really paid. Understanding the gap between them is how you avoid throttling.
Prerequisites
- Shopify app with GraphQL Admin API access
@shopify/shopify-apipackage installed- Understanding of GraphQL connections (edges/node pattern)
Instructions
Step 1: Read Cost Headers
Every GraphQL response includes cost data in extensions.cost: