AgentStack
SKILL verified MIT Self-run

Shopify Admin Demand Forecast Reorder

skill-40rty-ai-shopify-admin-skills-shopify-admin-demand-forecast-reorder · by 40RTY-ai

Read-only: forecasts demand per SKU using sales velocity and seasonality, then calculates reorder points and suggested purchase order quantities.

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-40rty-ai-shopify-admin-skills-shopify-admin-demand-forecast-reorder

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures
Are you the author of Shopify Admin Demand Forecast Reorder? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.

About

Purpose

Forecasts future demand for each SKU based on historical sales velocity, trend analysis, and optional seasonality adjustments. Calculates reorder points (when to order) and suggested reorder quantities (how much to order) factoring in vendor lead times and safety stock. Read-only — no mutations.

Prerequisites

  • Authenticated Shopify CLI session: shopify store auth --store --scopes read_orders,read_products,read_inventory
  • API scopes: read_orders, read_products, read_inventory

Parameters

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | store | string | yes | — | Store domain | | daysback | integer | no | 90 | Historical sales window for velocity calculation | | forecastdays | integer | no | 30 | Days into the future to forecast demand | | leadtimedays | integer | no | 14 | Default vendor lead time in days | | safetystockdays | integer | no | 7 | Extra days of safety stock buffer | | vendorfilter | string | no | — | Scope to specific vendor | | onlylow_stock | boolean | no | false | Only show items projected to stock out within forecast window | | format | string | no | human | Output format: human or json |

Safety

> ℹ️ Read-only skill — no mutations are executed. Safe to run at any time.

Workflow Steps

  1. OPERATION: orders — query

Inputs: query: "created_at:>=''", first: 250, select createdAt, lineItems { variant { id }, quantity }, pagination cursor Expected output: All orders with line items for sales velocity calculation

  1. Calculate per-variant sales velocity:
  • Daily sales rate = total units sold / days_back
  • Weekly trend: compare last 30 days vs prior 30 days for trend direction
  • Forecasted demand = dailyrate × forecastdays × trend_multiplier
  1. OPERATION: productVariants — query

Inputs: All variant IDs with sales history, first: 250, pagination cursor Expected output: Variant details (SKU, title, product title, vendor)

  1. OPERATION: inventoryLevels — query

Inputs: Inventory item IDs for stocked variants Expected output: Current available quantities per location

  1. Calculate reorder metrics:
  • Days of Stock = currentinventory / dailysales_rate
  • Reorder Point = (leadtimedays + safetystockdays) × dailysalesrate
  • Reorder Quantity = forecastdays × dailysalesrate + safetystock - current_inventory
  • Stockout Date = today + (currentinventory / dailysales_rate) days
  • Order-By Date = stockoutdate - leadtime_days
  1. Sort by urgency: items closest to stockout first

GraphQL Operations

# orders:query — validated against api_version 2025-01
query SalesHistory($query: String!, $after: String) {
  orders(first: 250, after: $after, query: $query) {
    edges {
      node {
        createdAt
        lineItems(first: 50) {
          edges {
            node {
              quantity
              variant { id }
            }
          }
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}
# productVariants:query — validated against api_version 2025-01
query VariantInfo($ids: [ID!]!) {
  nodes(ids: $ids) {
    ... on ProductVariant {
      id
      sku
      title
      product { id title vendor }
      inventoryQuantity
      inventoryItem { id }
    }
  }
}
# inventoryItems:query — validated against api_version 2025-01
query InventoryItemDetails($ids: [ID!]!) {
  nodes(ids: $ids) {
    ... on InventoryItem {
      id
      unitCost { amount currencyCode }
      tracked
      inventoryLevels(first: 10) {
        edges {
          node {
            quantities(names: ["available"]) {
              name
              quantity
            }
            location { id name }
          }
        }
      }
    }
  }
}
# inventoryLevels:query — validated against api_version 2025-01
query LocationInventory($locationId: ID!, $after: String) {
  location(id: $locationId) {
    inventoryLevels(first: 250, after: $after) {
      edges {
        node {
          quantities(names: ["available"]) { name quantity }
          item { id variant { id sku product { title } } }
        }
      }
      pageInfo { hasNextPage endCursor }
    }
  }
}

Session Tracking

Claude MUST emit the following output at each stage. This is mandatory.

On start, emit:

╔══════════════════════════════════════════════╗
║  SKILL: Demand Forecast & Reorder Planner    ║
║  Store:                        ║
║  Started:              ║
╚══════════════════════════════════════════════╝

After each step, emit:

[N/TOTAL]   
          → Params: 
          → Result: 

On completion, emit:

For format: human (default):

══════════════════════════════════════════════
DEMAND FORECAST & REORDER PLAN  (d history → d forecast)
  SKUs analyzed:       
  Avg daily velocity:   units/day
  ─────────────────────────────
  ⚠️  URGENT (stockout " SKU:  Stock:  Days left:  ORDER BY: 
    Reorder qty:  units  Est. cost: $

  ⏰ PLAN AHEAD (stockout 7-30 days):
    "" SKU:  Stock:  Days left:  ORDER BY: 

  ✅ HEALTHY (>30 days stock):
     SKUs with adequate stock

  Output: reorder_plan_.csv
══════════════════════════════════════════════

For format: json, emit:

{
  "skill": "demand-forecast-reorder",
  "store": "",
  "history_days": 90,
  "forecast_days": 30,
  "lead_time_days": 14,
  "skus_analyzed": 0,
  "urgent_reorders": [],
  "planned_reorders": [],
  "healthy_skus": 0,
  "output_file": "reorder_plan_.csv"
}

Output Format

CSV file reorder_plan_.csv with columns: variant_id, sku, product_title, vendor, current_stock, daily_velocity, trend, days_of_stock, stockout_date, reorder_point, reorder_qty, order_by_date, est_cost

Error Handling

| Error | Cause | Recovery | |-------|-------|----------| | THROTTLED | API rate limit exceeded | Wait 2 seconds, retry up to 3 times | | Zero sales velocity | Product never sold in window | Skip from reorder calc — flag as "no demand data" | | No inventory tracking | Variant not tracked | Skip — cannot forecast untracked items |

Best Practices

  • Set lead_time_days per vendor if possible; default 14 is conservative.
  • Use safety_stock_days: 14 for high-value or slow-ship items.
  • Run weekly and pipe output into a purchase order workflow.
  • Cross-reference with stock-velocity-report for velocity validation.
  • Use with dead-stock-identifier to avoid reordering items that aren't selling.
  • For seasonal products, use a longer days_back (180-365) to capture seasonal patterns.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.