shopify-cost-tuning

Optimize Shopify app costs through plan selection, API usage monitoring, and Shopify Plus upgrade analysis. Trigger with phrases like "shopify cost", "shopify billing", "shopify pricing", "shopify Plus worth it", "shopify API usage", "reduce shopify costs".

1,868 stars

Best use case

shopify-cost-tuning is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Optimize Shopify app costs through plan selection, API usage monitoring, and Shopify Plus upgrade analysis. Trigger with phrases like "shopify cost", "shopify billing", "shopify pricing", "shopify Plus worth it", "shopify API usage", "reduce shopify costs".

Teams using shopify-cost-tuning should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/shopify-cost-tuning/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/saas-packs/shopify-pack/skills/shopify-cost-tuning/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/shopify-cost-tuning/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How shopify-cost-tuning Compares

Feature / Agentshopify-cost-tuningStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Optimize Shopify app costs through plan selection, API usage monitoring, and Shopify Plus upgrade analysis. Trigger with phrases like "shopify cost", "shopify billing", "shopify pricing", "shopify Plus worth it", "shopify API usage", "reduce shopify costs".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Shopify Cost Tuning

## Overview

Optimize Shopify app and API costs through plan analysis, API usage monitoring, and strategies to minimize billable API calls. Covers Shopify store plans, Partner app billing, and API efficiency.

## Prerequisites

- Access to Shopify Partner Dashboard for app billing
- Understanding of current API usage patterns
- Knowledge of merchant's Shopify plan

## Instructions

### Step 1: Understand Shopify Plan Rate Limits

API rate limits are determined by the **merchant's** plan, not your app:

| Merchant Plan | REST Bucket | REST Leak Rate | GraphQL Points | GraphQL Restore |
|--------------|-------------|----------------|----------------|-----------------|
| Basic Shopify | 40 requests | 2/second | 1,000 points | 50/second |
| Shopify | 40 requests | 2/second | 1,000 points | 50/second |
| Advanced | 40 requests | 2/second | 1,000 points | 50/second |
| Shopify Plus | 80 requests | 4/second | 2,000 points | 100/second |

**Key insight:** Upgrading from Basic to Advanced doesn't help rate limits. Only Plus doubles them.

### Step 2: App Billing API

If your app charges merchants, use the GraphQL App Billing API:

```typescript
// Create a recurring charge
const CREATE_SUBSCRIPTION = `
  mutation appSubscriptionCreate(
    $name: String!,
    $lineItems: [AppSubscriptionLineItemInput!]!,
    $returnUrl: URL!,
    $test: Boolean
  ) {
    appSubscriptionCreate(
      name: $name,
      lineItems: $lineItems,
      returnUrl: $returnUrl,
      test: $test
    ) {
      appSubscription {
        id
        status
      }
      confirmationUrl
      userErrors { field message }
    }
  }
`;

const response = await client.request(CREATE_SUBSCRIPTION, {
  variables: {
    name: "Pro Plan",
    returnUrl: "https://your-app.com/billing/callback",
    test: process.env.NODE_ENV !== "production", // test charges in dev
    lineItems: [
      {
        plan: {
          appRecurringPricingDetails: {
            price: { amount: 9.99, currencyCode: "USD" },
            interval: "EVERY_30_DAYS",
          },
        },
      },
    ],
  },
});

// Redirect merchant to confirmationUrl to approve the charge
```

### Step 3: Monitor API Usage

```typescript
class ShopifyUsageTracker {
  private graphqlCosts: number[] = [];
  private restCalls: number = 0;
  private startOfPeriod: Date = new Date();

  trackGraphqlCost(extensions: any): void {
    if (extensions?.cost?.actualQueryCost) {
      this.graphqlCosts.push(extensions.cost.actualQueryCost);
    }
  }

  trackRestCall(): void {
    this.restCalls++;
  }

  getReport(): UsageReport {
    const totalGraphqlCost = this.graphqlCosts.reduce((a, b) => a + b, 0);
    const avgCost = totalGraphqlCost / (this.graphqlCosts.length || 1);

    return {
      period: {
        start: this.startOfPeriod,
        end: new Date(),
      },
      graphql: {
        totalQueries: this.graphqlCosts.length,
        totalCost: totalGraphqlCost,
        averageCost: Math.round(avgCost),
        maxSingleCost: Math.max(...this.graphqlCosts, 0),
      },
      rest: {
        totalCalls: this.restCalls,
      },
      recommendation: avgCost > 500
        ? "High average query cost — optimize field selection"
        : avgCost > 100
        ? "Moderate cost — consider bulk operations for large queries"
        : "Efficient usage",
    };
  }
}
```

### Step 4: Cost Reduction Strategies

**Strategy 1: Replace REST with GraphQL** (get only what you need)

```typescript
// REST returns ALL fields — 5KB+ per product
// GET /admin/api/2024-10/products/123.json
// Returns: title, body_html, vendor, product_type, handle, template_suffix,
//          published_scope, tags, admin_graphql_api_id, variants[], images[],
//          options[], ... (everything)

// GraphQL returns ONLY requested fields — 200 bytes
const response = await client.request(`{
  product(id: "gid://shopify/Product/123") {
    title
    status
    totalInventory
  }
}`);
```

**Strategy 2: Use Bulk Operations for exports**

```typescript
// Instead of 200 paginated queries (200 * ~100 cost = 20,000 points):
// Use 1 bulk operation (minimal cost, runs in background)
await client.request(`
  mutation { bulkOperationRunQuery(query: """
    { products { edges { node { id title } } } }
  """) { bulkOperation { id status } userErrors { message } } }
`);
```

**Strategy 3: Cache and invalidate via webhooks**

```typescript
// Instead of re-querying products every request:
// Cache products, invalidate only when products/update webhook fires
// Saves: hundreds of queries per hour for read-heavy apps
```

**Strategy 4: Use Storefront API for public data**

```typescript
// Storefront API has separate rate limits
// Use it for: product listings, collections, search
// Keep Admin API for: order management, customer data, fulfillments
```

## Output

- API usage monitored with cost tracking
- Rate limit-efficient query patterns
- App billing configured (if charging merchants)
- Cost reduction strategies applied

## Error Handling

| Issue | Cause | Solution |
|-------|-------|----------|
| Frequent throttling | High query cost | Reduce fields, use bulk ops |
| High hosting costs | Too many API calls | Cache responses, use webhooks |
| App billing rejection | Test mode not set | Use `test: true` in development |
| Merchant cancels | Unexpected charges | Clear billing in app onboarding |

## Examples

### Quick Usage Check

```typescript
// After every GraphQL call, log the cost
const response = await client.request(query);
const cost = response.extensions?.cost;
if (cost) {
  console.log(
    `Query cost: ${cost.actualQueryCost}/${cost.throttleStatus.maximumAvailable} ` +
    `(${cost.throttleStatus.currentlyAvailable} available)`
  );
}
```

## Resources

- [Shopify API Rate Limits](https://shopify.dev/docs/api/usage/rate-limits)
- [App Billing API](https://shopify.dev/docs/apps/build/billing)
- [Shopify Pricing](https://www.shopify.com/pricing)
- [Shopify Plus Rate Limits](https://shopify.dev/changelog/increased-admin-api-rate-limits-for-shopify-plus)

## Next Steps

For architecture patterns, see `shopify-reference-architecture`.

Related Skills

workhuman-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman performance tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman performance tuning".

workhuman-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman cost tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman cost tuning".

wispr-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow performance tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr performance tuning".

wispr-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow cost tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr cost tuning".

windsurf-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Windsurf IDE performance: indexing speed, Cascade responsiveness, and memory usage. Use when Windsurf is slow, indexing takes too long, Cascade times out, or the IDE uses too much memory. Trigger with phrases like "windsurf slow", "windsurf performance", "optimize windsurf", "windsurf memory", "cascade slow", "indexing slow".

windsurf-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Windsurf licensing costs through seat management, tier selection, and credit monitoring. Use when analyzing Windsurf billing, reducing per-seat costs, or implementing usage monitoring and budget controls. Trigger with phrases like "windsurf cost", "windsurf billing", "reduce windsurf costs", "windsurf pricing", "windsurf budget".

webflow-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Webflow API performance with response caching, bulk endpoint batching, CDN-cached live item reads, pagination optimization, and connection pooling. Use when experiencing slow API responses or optimizing request throughput. Trigger with phrases like "webflow performance", "optimize webflow", "webflow latency", "webflow caching", "webflow slow", "webflow batch".

webflow-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Webflow costs through plan selection, CDN read optimization, bulk endpoint usage, and API usage monitoring with budget alerts. Use when analyzing Webflow billing, reducing API costs, or implementing usage monitoring for Webflow integrations. Trigger with phrases like "webflow cost", "webflow billing", "reduce webflow costs", "webflow pricing", "webflow budget".

vercel-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Vercel deployment performance with caching, bundle optimization, and cold start reduction. Use when experiencing slow page loads, optimizing Core Web Vitals, or reducing serverless function cold start times. Trigger with phrases like "vercel performance", "optimize vercel", "vercel latency", "vercel caching", "vercel slow", "vercel cold start".

vercel-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Optimize Vercel costs through plan selection, function efficiency, and usage monitoring. Use when analyzing Vercel billing, reducing function execution costs, or implementing spend management and budget alerts. Trigger with phrases like "vercel cost", "vercel billing", "reduce vercel costs", "vercel pricing", "vercel expensive", "vercel budget".

veeva-performance-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault performance tuning for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva performance tuning".

veeva-cost-tuning

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault cost tuning for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva cost tuning".