shopify-admin-order-cancellation-analysis

Read-only: tracks cancellation rate over time and breaks down cancelled orders by cancellation reason to identify patterns related to fraud, inventory, customer, or payment declines.

Last repository push
GitHub Stars
205
Forks
23
Issues / PRs
2

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-order-cancellation-analysis" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-ea2ce3b97bf97c820259b5a1af8dd85981146c9a7dd637b70ca8fb7ed24d72d7. 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: tracks cancellation rate over time and breaks down cancelled orders by cancellation reason to identify patterns related to fraud, inventory, customer, or payment declines.

0 Downloads

Introduction source: third_party · 40RTY-ai · 0.0.1 Reference

SkillPi interpretation

Tasks
Read-only: tracks cancellation rate over time and breaks down cancelled orders by cancelReason to surface fraud, inventory, customer, and declined-payment patterns.
Inputs and outputs
CSV file `cancellation_analysis_<YYYY-MM-DD>.csv` with columns: `bucket_start`, `bucket_end`, `total_orders`, `cancelled_orders`, `rate_pct`, `reason_customer`, `reason_fraud`, `reason_inventory`, `reason_declined`, `reason_other`, `lost_revenue`, `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

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: shopify-admin-order-cancellation-analysis
role: order-intelligence
description: "Read-only: tracks cancellation rate over time and breaks down cancelled orders by cancelReason to surface fraud, inventory, customer, and declined-payment patterns."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
  - orders:query
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLI

Purpose

Computes cancellation rate (cancelled orders / total orders) over a configurable window, broken down by cancelReason (CUSTOMER, FRAUD, INVENTORY, DECLINED, OTHER, STAFF). Surfaces shifts in cancellation patterns — for example, a spike in INVENTORY cancellations suggests a stock data integrity problem, while a spike in FRAUD suggests a coordinated attack. Read-only — no mutations.

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)
days_back integer no 30 Lookback window for orders included in the analysis
bucket string no day Time bucket: day, week, or month
min_value float no 0 Only include orders above this total value
reason_filter string no — Optional filter to a single cancelReason
format string no human Output format: human or json

Safety

ℹ️ Read-only skill — no mutations are executed. Safe to run at any time. The analysis uses cancelReason as recorded by Shopify or staff at cancellation time — accuracy depends on staff selecting the correct reason.

Workflow Steps

  1. OPERATION: orders — query Inputs: query: "created_at:>='<NOW - days_back days>'", first: 250, select cancelledAt, cancelReason, displayFinancialStatus, totalPriceSet, pagination cursor Expected output: All orders created in the window (cancelled and non-cancelled) for rate calculation; paginate until hasNextPage: false

  2. Partition orders into cancelled (cancelledAt != null) and not cancelled. Compute overall rate = cancelled / total.

  3. For cancelled orders, group by cancelReason and by time bucket. Compute rate per bucket and per reason.

  4. Identify time buckets where any single reason exceeds 2x its trailing 7-bucket average — flag as anomalies.

GraphQL Operations

# orders:query — validated against api_version 2025-01
query OrdersForCancellationAnalysis($query: String!, $after: String) {
  orders(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        name
        createdAt
        cancelledAt
        cancelReason
        displayFinancialStatus
        displayFulfillmentStatus
        totalPriceSet {
          shopMoney {
            amount
            currencyCode
          }
        }
        customer {
          id
          numberOfOrders
        }
        staffMember {
          id
          name
        }
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

Session Tracking

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

On start, emit:

╔══════════════════════════════════════════════╗
║  SKILL: Order Cancellation Analysis          ║
║  Store: <store domain>                       ║
║  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):

══════════════════════════════════════════════
CANCELLATION ANALYSIS  (<days_back> days, by <bucket>)
  Total orders:        <n>
  Cancelled orders:    <n>  (<pct>%)
  Lost revenue:        $<amount>

  By reason:
    CUSTOMER     <n>  (<pct>%)
    FRAUD        <n>  (<pct>%)
    INVENTORY    <n>  (<pct>%)
    DECLINED     <n>  (<pct>%)
    OTHER        <n>  (<pct>%)

  Anomaly buckets (>2x trailing avg):
    <bucket-key>  reason=<reason>  rate=<pct>%
  Output: cancellation_analysis_<date>.csv
══════════════════════════════════════════════

For format: json, emit:

{
  "skill": "order-cancellation-analysis",
  "store": "<domain>",
  "period_days": 30,
  "bucket": "day",
  "total_orders": 0,
  "cancelled_orders": 0,
  "cancellation_rate": 0,
  "lost_revenue": 0,
  "currency": "USD",
  "by_reason": {
    "CUSTOMER": 0, "FRAUD": 0, "INVENTORY": 0, "DECLINED": 0, "OTHER": 0
  },
  "anomalies": [],
  "output_file": "cancellation_analysis_<date>.csv"
}

Output Format

CSV file cancellation_analysis_<YYYY-MM-DD>.csv with columns: bucket_start, bucket_end, total_orders, cancelled_orders, rate_pct, reason_customer, reason_fraud, reason_inventory, reason_declined, reason_other, lost_revenue, currency

Error Handling

Error Cause Recovery
THROTTLED API rate limit exceeded Wait 2 seconds, retry up to 3 times
cancelReason is null on cancelled order Older order pre-dating reason field Bucket into OTHER, log count
No orders in window Empty store or test domain Exit with summary: 0 orders, 0% rate
Cancelled order created outside window Cancellation happened in window but order older Excluded by design — analyses creation cohort

Best Practices

  • A baseline cancellation rate of 1–3% is typical; spikes above 5% warrant investigation.
  • Sustained INVENTORY cancellations indicate a sync issue between storefront stock and warehouse — pair this skill with multi-location-inventory-audit.
  • Sustained FRAUD cancellations indicate either improving fraud filters (good) or a coordinated attack (bad) — cross-reference with order-risk-report.
  • High DECLINED rates often correlate with checkout friction or expired payment methods — investigate alongside checkout abandonment data.
  • Run weekly to catch reason-mix shifts early; run after every major promotion to confirm cancellations did not spike.

Version history

  1. 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

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 解决电商核心业务痛点:订单取消率监控与原因分析
  • 提供异常检测机制,能主动发现欺诈、库存、支付等问题模式
  • 只读设计确保安全性,适合日常高频使用
Trigger Precision95/100

Highlights

  • 触发词精准覆盖核心功能关键词(cancellation rate, cancelReason, fraud等)
  • description位置正确且内容完整,边界清晰
  • 明确限定为只读分析,避免误触发
Structure and Standards98/100

Highlights

  • Workflow Steps清晰分步,含端到端Session Tracking模板
  • frontmatter完整,GraphQL操作已验证
  • Error Handling覆盖主要异常场景,Best Practices提供实用指导
Execution Reliability96/100

Highlights

  • 工具来源明确(shopify-admin toolkit),参数定义完整
  • 异常处理全面(THROTTLED、null cancelReason、空窗口等)
  • 明确声明只读无mutations,执行安全可靠
Evidence Verifiability (mean of the first four)95/100

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.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

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.