Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
40rty-ai avatar

Shopify Admin Draft Order Cleanup

  • 7 installs
  • 173 repo stars
  • Updated June 26, 2026
  • 40rty-ai/shopify-admin-skills

shopify-admin-draft-order-cleanup is a Claude Code skill that finds stale Shopify draft orders older than N days and optionally deletes them to reduce admin clutter.

About

This Claude Code skill queries open Shopify draft orders older than a set number of days and optionally deletes them. A store manager runs it to clear stale drafts left over from abandoned B2B quotes, incomplete manual orders, or old integrations that clutter the admin and inflate pending revenue. It defaults to dry-run so the list can be reviewed before any permanent delete.

  • Finds open draft orders older than a configurable age
  • Optionally deletes stale drafts via the Admin API with a dry-run default
  • Reduces admin clutter and inflated pending-revenue metrics

Shopify Admin Draft Order Cleanup by the numbers

  • 7 all-time installs (skills.sh)
  • Ranked #1,587 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
  • Data as of Aug 1, 2026 (Skillselion catalog sync)
At a glance

shopify-admin-draft-order-cleanup capabilities & compatibility

Free skill; requires an authenticated Shopify store session with write_orders scope

Capabilities
draft order cleanup · admin hygiene · stale record pruning
Use cases
data analysis
Runs
Runs locally
Pricing
Free
From the docs

What shopify-admin-draft-order-cleanup says it does

Queries open draft orders older than a configurable age and optionally deletes them.
SKILL.md
Draft orders accumulate from abandoned B2B quotes, incomplete manual orders, or old integrations and clutter the admin. Stale drafts also inflate pending revenue metrics.
SKILL.md
npx skills add https://github.com/40rty-ai/shopify-admin-skills --skill shopify-admin-draft-order-cleanup

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs7
repo stars173
Last updatedJune 26, 2026
Repository40rty-ai/shopify-admin-skills

What it does

Find and delete stale Shopify draft orders to reduce admin clutter.

Who is it for?

Store managers clearing stale draft orders on a routine schedule

Skip if: Deleting drafts that represent active B2B quotes awaiting approval

When should I use this skill?

Old draft orders are cluttering the Shopify admin

What you get

Stale drafts identified and optionally deleted, with a value-cleared summary.

  • draft_cleanup_<date>.csv listing drafts and actions

By the numbers

  • older_than_days defaults to 30
  • 2 GraphQL operations (draftOrders, draftOrderDelete)

Files

SKILL.mdMarkdownGitHub ↗

Purpose

Queries open draft orders older than a configurable age and optionally deletes them. Draft orders accumulate from abandoned B2B quotes, incomplete manual orders, or old integrations and clutter the admin. Stale drafts also inflate pending revenue metrics.

Prerequisites

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

Parameters

ParameterTypeRequiredDefaultDescription
storestringyesStore domain (e.g., mystore.myshopify.com)
older_than_daysintegerno30Delete drafts older than this many days
dry_runboolnotruePreview drafts to delete without executing mutation
formatstringnohumanOutput format: human or json

Safety

⚠️ draftOrderDelete permanently deletes draft orders. Deleted drafts cannot be recovered. Run with dry_run: true to review the list before committing. Check that no stale drafts represent active B2B quotes awaiting customer approval before deleting.

Workflow Steps

1. OPERATION: draftOrders — query Inputs: query: "status:open created_at:<='<NOW - older_than_days days>'", first: 250, pagination cursor Expected output: Stale open draft orders; paginate until hasNextPage: false

2. OPERATION: draftOrderDelete — mutation Inputs: id: <draft_order_id> Expected output: deletedId, userErrors

GraphQL Operations

# draftOrders:query — validated against api_version 2025-01
query StaleDraftOrders($query: String!, $after: String) {
  draftOrders(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        name
        status
        createdAt
        updatedAt
        totalPriceSet {
          shopMoney {
            amount
            currencyCode
          }
        }
        customer {
          id
          displayName
          defaultEmailAddress {
            emailAddress
          }
        }
        tags
        note
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
# draftOrderDelete:mutation — validated against api_version 2025-01
mutation DraftOrderDelete($input: DraftOrderDeleteInput!) {
  draftOrderDelete(input: $input) {
    deletedId
    userErrors {
      field
      message
    }
  }
}

Session Tracking

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

On start, emit:

╔══════════════════════════════════════════════╗
║  SKILL: Draft Order Cleanup                  ║
║  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>

If dry_run: true, prefix every mutation step with [DRY RUN] and do not execute it.

On completion, emit:

For format: human (default):

══════════════════════════════════════════════
OUTCOME SUMMARY
  Stale drafts found:   <n>
  Drafts deleted:       <n>
  Total value cleared:  $<amount>
  Errors:               <n>
  Output:               draft_cleanup_<date>.csv
══════════════════════════════════════════════

For format: json, emit:

{
  "skill": "draft-order-cleanup",
  "store": "<domain>",
  "started_at": "<ISO8601>",
  "older_than_days": 30,
  "dry_run": true,
  "outcome": {
    "drafts_found": 0,
    "drafts_deleted": 0,
    "value_cleared": 0,
    "currency": "USD",
    "errors": 0,
    "output_file": "draft_cleanup_<date>.csv"
  }
}

Output Format

CSV file draft_cleanup_<YYYY-MM-DD>.csv with columns: draft_id, draft_name, customer_name, customer_email, created_at, total_value, currency, action

Error Handling

ErrorCauseRecovery
THROTTLEDAPI rate limit exceededWait 2 seconds, retry up to 3 times
userErrors on deleteDraft already completed or cancelledLog as skipped, continue
No stale draftsAll drafts are recent or none existExit with 0 results

Best Practices

  • Set older_than_days: 60 or higher for B2B stores where quotes may have longer sales cycles.
  • Review the dry-run list for drafts with notes or high value before deleting — these may be legitimate pending quotes.
  • For B2B scenarios, consider filtering out drafts tagged with b2b-quote or similar before running the delete step.
  • Run monthly as a routine admin hygiene task.

Related skills

FAQ

Can deleted drafts be recovered?

No. draftOrderDelete permanently deletes drafts, so the skill defaults to dry_run:true to review the list first.

What counts as stale?

Open drafts older than older_than_days, which defaults to 30 days.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.