Shopify Admin Discount Cost Trend logo

Shopify Admin Discount Cost Trend

Organization
40RTY-ai
shopify-admin-discount-cost-trend

Read-only: tracks total discount dollars given over configurable time buckets (week/month/quarter), broken down by discount type and code.

Overview

Publisher40RTY-ai
Repositoryshopify-admin-skills
Skill nameshopify-admin-discount-cost-trend
Stars
200
Forks
22
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by 40RTY-ai on GitHub. Read the source before you install it.

Installation

Install the Shopify Admin Discount Cost Trend AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/40RTY-ai/shopify-admin-skills/tree/main/skills/finance/shopify-admin-discount-cost-trend
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/40RTY-ai/shopify-admin-skills.git /tmp/shopify-admin-skills
mkdir -p .claude/skills
cp -r /tmp/shopify-admin-skills/skills/finance/shopify-admin-discount-cost-trend .claude/skills/shopify-admin-discount-cost-trend
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Shopify Admin Discount Cost Trend in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Shopify Admin Discount Cost Trend on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Shopify Admin Discount Cost Trend is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Purpose

Tracks how much money the store gave away in discounts over time, bucketed by week, month, or quarter, and broken down by discount code and discount type (percentage / fixed amount / free shipping / automatic). Answers: "is our discount spend trending up or down, and which campaigns are driving it?" Read-only — no mutations. Complements discount-roi-calculator (per-discount return) with a longitudinal view of total cost.

Prerequisites

  • Authenticated Shopify CLI session: shopify store auth --store <domain> --scopes read_orders
  • API scopes: read_orders

Parameters

ParameterTypeRequiredDefaultDescription
storestringyes—Store domain (e.g., mystore.myshopify.com)
periodstringnomonthBucket size: week, month, or quarter
periods_backintegerno12Number of buckets to report
top_codesintegerno10Top discount codes to break out individually; remainder grouped as other
include_shipping_discountsboolnotrueWhether to count shipping discounts in the totals
formatstringnohumanOutput format: human or json

Safety

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

Workflow Steps

  1. Compute window from period × periods_back (e.g., month × 12 → last 12 calendar months starting from the first day of the bucket 11 months ago)

  2. OPERATION: orders — query Inputs: query: "created_at:>='<window_start>' financial_status:paid", first: 250, select createdAt, discountCodes, currentTotalDiscountsSet, totalDiscountsSet, cartDiscountAmountSet, discountApplications { allocationMethod, targetType, value, ... on DiscountCodeApplication { code }, ... on AutomaticDiscountApplication { title }, ... on ManualDiscountApplication { title } }, shippingLines { discountAllocations { allocatedAmountSet } }, pagination cursor Expected output: All paid orders in the window with discount data; paginate until hasNextPage: false

  3. For each order, attribute discount cost:

    • cart_discount = currentTotalDiscountsSet.shopMoney.amount
    • shipping_discount = sum of shippingLines.discountAllocations.allocatedAmountSet (only if include_shipping_discounts: true)
    • total_discount = cart_discount + shipping_discount
    • Attribute by code: prefer first discountApplications.code for code discounts, title for automatic / manual
  4. Bucket each order into its period (week-of-year, year-month, or year-quarter) and aggregate:

    • Total discount cost per bucket
    • Per discount code per bucket
    • Per discount type per bucket (percentage, fixed_amount, shipping, automatic)
  5. Identify top codes by total cost across the window; aggregate the rest as other

GraphQL Operations

graphql
# orders:query — validated against api_version 2025-01
query DiscountCostTrend($query: String!, $after: String) {
  orders(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        name
        createdAt
        discountCodes
        currentTotalDiscountsSet { shopMoney { amount currencyCode } }
        totalDiscountsSet { shopMoney { amount currencyCode } }
        cartDiscountAmountSet { shopMoney { amount currencyCode } }
        discountApplications(first: 10) {
          edges {
            node {
              allocationMethod
              targetType
              targetSelection
              value {
                ... on PricingPercentageValue { percentage }
                ... on MoneyV2 { amount currencyCode }
              }
              ... on DiscountCodeApplication { code }
              ... on AutomaticDiscountApplication { title }
              ... on ManualDiscountApplication { title description }
            }
          }
        }
        shippingLines(first: 5) {
          edges {
            node {
              title
              discountAllocations {
                allocatedAmountSet { shopMoney { amount currencyCode } }
              }
            }
          }
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}

Session Tracking

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

On start, emit:

╔══════════════════════════════════════════════╗
║  SKILL: Discount Cost Trend                  ║
║  Store: <store domain>                       ║
║  Period: <period> × <periods_back>           ║
║  Started: <YYYY-MM-DD HH:MM UTC>             ║
╚══════════════════════════════════════════════╝

After each step, emit:

[N/TOTAL] <QUERY|MUTATION>  <OperationName>
          → Params: <brief summary of key inputs>
          → Result: <count or outcome>

On completion, emit:

For format: human (default):

══════════════════════════════════════════════
DISCOUNT COST TREND  (last <periods_back> <period>s)
  Total discount cost:    $<amount>
  Avg per <period>:        $<amount>
  Latest <period>:         $<amount>   (<delta_vs_prev_pct>% vs prior)

  By bucket:
    2025-Q1  $<n>   (cart $<n> / shipping $<n>)
    2025-Q2  $<n>   (cart $<n> / shipping $<n>)

  By discount type:
    code            $<n>   (<pct>%)
    automatic       $<n>   (<pct>%)
    manual          $<n>   (<pct>%)
    shipping        $<n>   (<pct>%)

  Top codes (by total cost):
    "<code>"        $<n>   (<pct>%)
    "<code>"        $<n>   (<pct>%)
    other           $<n>   (<pct>%)

  Output: discount_cost_trend_<date>.csv
══════════════════════════════════════════════

For format: json, emit:

json
{
  "skill": "discount-cost-trend",
  "store": "<domain>",
  "period": "month",
  "periods_back": 12,
  "total_discount_cost": 0,
  "by_bucket": [],
  "by_type": { "code": 0, "automatic": 0, "manual": 0, "shipping": 0 },
  "top_codes": [],
  "currency": "USD",
  "output_file": "discount_cost_trend_<date>.csv"
}

Output Format

CSV file discount_cost_trend_<YYYY-MM-DD>.csv with columns: bucket, discount_code_or_title, discount_type, orders_count, cart_discount, shipping_discount, total_discount, currency

Error Handling

ErrorCauseRecovery
THROTTLEDAPI rate limit exceededWait 2 seconds, retry up to 3 times
Stacked discount codesMultiple codes on one orderAttribute proportionally to each code by their value share, or label as multi-code if equal
Manual discount with no titleCashier-entered with empty titleGroup as manual:untitled
Multi-currency ordersPresentment currency != shop currencySum on shopMoney.amount (shop currency) for consistency

Best Practices

  • Use period: week for promotional businesses with frequent campaigns; period: month for stores with steady evergreen offers; period: quarter for board reporting.
  • A flat or rising trend with no campaign activity often points to automatic discount creep — review automatic discounts that have no end date.
  • Cross-reference the latest bucket against discount-roi-calculator to verify the cost increase is producing matching incremental revenue.
  • Set include_shipping_discounts: false if your accounting books shipping subsidy separately from product discounts.
  • Set up monthly automation: discount spend that drifts above budget should trigger a finance review before it shows up in margin reports.

Frequently asked questions

What does the Shopify Admin Discount Cost Trend AI skill do?

Read-only: tracks total discount dollars given over configurable time buckets (week/month/quarter), broken down by discount type and code.

Why use Shopify Admin Discount Cost Trend on TypingMind?

Because you install it once and use it with any model. Shopify Admin Discount Cost Trend is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Shopify Admin Discount Cost Trend in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/40RTY-ai/shopify-admin-skills/tree/main/skills/finance/shopify-admin-discount-cost-trend. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Shopify Admin Discount Cost Trend?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Shopify Admin Discount Cost Trend?

As many as you like. As long as a model supports skills, you can use Shopify Admin Discount Cost Trend with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Shopify Admin Discount Cost Trend AI skill free?

Yes. It is published on GitHub by 40RTY-ai under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇