shopify-admin-discount-cost-trend
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "shopify-admin-discount-cost-trend" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-83b6ecc028d64f5db7491bbd14143f768fd49a3f6243db4aec5c5c3aa9338e2b. Verify the upstream source and version against https://github.com/40RTY-ai/shopify-admin-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Read-only: track total discount amounts given over configurable time periods (week/month/quarter), broken down by discount type and discount code.
Introduction source: third_party · 40RTY-ai · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Read-only: tracks total discount dollars given over configurable time buckets (week/month/quarter), broken down by discount type and code.
- Inputs and outputs
- 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`
- Software, accounts and paid services
- Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders` API scopes: `read_orders`
- Testing
- Not tested
Browse files
Frontmatter
name: shopify-admin-discount-cost-trend
role: finance
description: "Read-only: tracks total discount dollars given over configurable time buckets (week/month/quarter), broken down by discount type and code."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
- orders:query
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLIPurpose
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| store | string | yes | — | Store domain (e.g., mystore.myshopify.com) |
| period | string | no | month | Bucket size: week, month, or quarter |
| periods_back | integer | no | 12 | Number of buckets to report |
| top_codes | integer | no | 10 | Top discount codes to break out individually; remainder grouped as other |
| include_shipping_discounts | bool | no | true | Whether to count shipping discounts in the totals |
| 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
-
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) -
OPERATION:
orders— query Inputs:query: "created_at:>='<window_start>' financial_status:paid",first: 250, selectcreatedAt,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 untilhasNextPage: false -
For each order, attribute discount cost:
cart_discount=currentTotalDiscountsSet.shopMoney.amountshipping_discount= sum ofshippingLines.discountAllocations.allocatedAmountSet(only ifinclude_shipping_discounts: true)total_discount= cart_discount + shipping_discount- Attribute by code: prefer first
discountApplications.codefor code discounts,titlefor automatic / manual
-
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)
-
Identify top codes by total cost across the window; aggregate the rest as
other
GraphQL Operations
# 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:
{
"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
| Error | Cause | Recovery |
|---|---|---|
THROTTLED |
API rate limit exceeded | Wait 2 seconds, retry up to 3 times |
| Stacked discount codes | Multiple codes on one order | Attribute proportionally to each code by their value share, or label as multi-code if equal |
| Manual discount with no title | Cashier-entered with empty title | Group as manual:untitled |
| Multi-currency orders | Presentment currency != shop currency | Sum on shopMoney.amount (shop currency) for consistency |
Best Practices
- Use
period: weekfor promotional businesses with frequent campaigns;period: monthfor stores with steady evergreen offers;period: quarterfor 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-calculatorto verify the cost increase is producing matching incremental revenue. - Set
include_shipping_discounts: falseif 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.
Version history
-
v1.1.0
GitHub ↗
Original release notes
## 🤖 New category: Agentic Commerce Readiness The fix-it side of the [**agentiq.report**](https://agentiq.report) audit. The audit tells operators *where* AI shopping agents (ChatGPT, Gemini, Perplexity, agentic checkout) can't find, read, or recommend their store. This release adds **10 skills that remediate those findings** via the native Shopify Admin GraphQL toolkit — closing the loop: **audit finds the gap → run the matching skill → re-audit confirms.** Every skill declares the audit **signals** it fixes (`audit_signals` frontmatter), so a finding in the report maps directly to the skill that resolves it. ### Skills - **`agentic-readiness-audit`** — flagship, read-only store-side scorecard that routes each gap to its fix skill - **`agentic-product-jsonld-backfill`** — barcode/GTIN, vendor, product type for complete Product JSON-LD - **`agentic-image-alt-text`** — descriptive alt text on product media - **`agentic-description-enrichment`** — fact-rich descriptions for AI quoting - **`agentic-metafields-setup`** — define + populate agentic metafields for filtering - **`agentic-product-taxonomy`** — Shopify Standard Product Taxonomy categories - **`agentic-crawler-access`** — allow GPTBot/ClaudeBot/PerplexityBot… in `robots.txt.liquid` - **`agentic-llms-txt`** — publish a curated `/llms.txt` for AI assistants - **`agentic-organization-schema`** — Organization JSON-LD (sameAs, contactPoint) into the theme - **`agentic-policy-readability`** — machine-readable shipping/returns policies Plus a weekly **`agentic-readiness-monitor`** routine that re-audits and alerts on regressions. ### Stats **116 skills across 11 categories** (was 106/10), **21 routines** (was 20). All GraphQL validated against the live Admin 2025-01 schema; `pnpm validate:index` passes (116 skills, 64 operations). ### Notes Theme-editing and policy skills default to `dry_run`/`audit` mode, write inside managed `# BEGIN/END` blocks, and recommend duplicating the theme first.
Current listing version
0.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 Shopify 商店折扣成本的纵向趋势分析,解决商家财务监控和营销活动效果评估的实际痛点
- 功能闭环完整,支持按时间周期、折扣类型、折扣码细分,适用于中高频财务分析场景
Highlights
- description 在顶层 frontmatter 中完整定义,语义清晰,边界明确
Highlights
- Workflow Steps 分步清晰,包含端到端输出示例
- frontmatter 完整,单文件长度合规
Areas to improve
-
Stacked discount codes 恢复策略描述略模糊 Reported severity: Minor
Error Handling 中对多折扣码订单的处理建议为'按比例分配'或标记为'multi-code',但未明确具体分配逻辑或默认行为
Recommendation: 建议明确说明当无法确定比例时的默认处理方式(如优先第一个 code 或统一标记为 multi-code),以增强执行确定性
Highlights
- GraphQL 查询已验证,API 版本明确
- 覆盖主要异常场景:限流重试、多币种处理、手动折扣异常
- 明确标注为只读技能,安全性高
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders` API scopes: `read_orders`
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.