Agent skill

Shopify Admin Return Cost Attribution

by 40RTY-ai in 40RTY-ai/shopify-admin-skills

Read-only: calculates the true cost of returns by reason and product — refund dollars, restocking impact, shipping cost lost, and COGS impact for items written off.

MITAuto-check passed

Install Shopify Admin Return Cost Attribution

skills CLI
$ npx skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-return-cost-attribution -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install 40RTY-ai/shopify-admin-skills shopify-admin-return-cost-attribution --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/40RTY-ai/shopify-admin-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/returns/shopify-admin-return-cost-attribution .claude/skills/shopify-admin-return-cost-attribution && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
shopify-admin-return-cost-attribution
GitHub stars
194
Token cost
~1.9k tokens
SKILL.md length
458 words
Files
1
Skills in repo
116
Repo updated
First seen
Licence
MIT

At a glance

Read-only: calculates the true cost of returns by reason and product — refund dollars, restocking impact, shipping cost lost, and COGS impact for items written off.

  • Works in 4 steps: OPERATION: returns — query → OPERATION: orders — query → OPERATION: inventoryItems — query —… → …
  • SKILL.md covers Purpose, Prerequisites, Parameters and Safety, plus 6 more sections
  • Calls shopify

What it does

Shopify Admin Return Cost Attribution is an agent skill from 40RTY-ai/shopify-admin-skills. Read-only: calculates the true cost of returns by reason and product — refund dollars, restocking impact, shipping cost lost, and COGS impact for items written off.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Claude Code, Cursor, Codex, Gemini CLI

It works with Shopify. The repository describes itself as: Community-maintained AI agent skills for operating Shopify stores — workflows, optimization, reports and more. The licence is MIT.

Example prompts

  • “/shopify-admin-return-cost-attribution”

Requirements

  • Compatibility (from SKILL.md): Claude Code, Cursor, Codex, Gemini CLI

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. OPERATION: returns — query
  2. OPERATION: orders — query
  3. OPERATION: inventoryItems — query — batch unique inventoryItem.id from step 1; returns unitCost per item
  4. Per line item compute: refund_amount (matched refundLineItem proportional to returned qty), shipping_loss (order shipping × line-item…

What it can do on your machine

Read from SKILL.md and the folder at commit 6765cb4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • shopify

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Claude Code, Cursor, Codex, Gemini CLI

    From compatibility in the SKILL.md frontmatter.

Context cost

Shopify Admin Return Cost Attribution loads about 1.9k tokens when it runs. Until then it costs about 51 tokens; SKILL.md has 458 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from 40RTY-ai/shopify-admin-skills at commit 6765cb4, republished under its MIT licence (© 40RTY-ai). 458 words, ~1,886 tokens.

Download SKILL.mdSave it as .claude/skills/shopify-admin-return-cost-attribution/SKILL.md (or your agent's skills folder).
name
shopify-admin-return-cost-attribution
description
Read-only: calculates the true cost of returns by reason and product — refund dollars, restocking impact, shipping cost lost, and COGS impact for items written off.
compatibility
Claude Code, Cursor, Codex, Gemini CLI
role
returns
toolkit
shopify-admin, shopify-admin-execution
api_version
2025-01
graphql_operations
returns:query, orders:query, inventoryItems:query
status
stable

Purpose

Quantifies the full cost of returns over a window — not just the refunded amount. Combines refund totals, lost shipping revenue, COGS for non-restockable items (e.g., DEFECTIVE), and restocking labor into a per-reason and per-product return P&L. Read-only. Use to prioritize which reasons or product lines deserve operational fixes — better packaging, size guides, listing accuracy.

Prerequisites

  • shopify store auth --store <domain> --scopes read_orders,read_returns,read_inventory
  • API scopes: read_orders, read_returns, read_inventory

Parameters

ParameterTypeRequiredDefaultDescription
storestringyes—Store domain (e.g., mystore.myshopify.com)
formatstringnohumanOutput format: human or json
days_backintegerno90Lookback window for returns
group_bystringnoreasonAggregation level: reason, product, sku, or reason_x_product
min_returnsintegerno3Minimum returns per group to include in summary
writeoff_reasonsarrayno["DEFECTIVE"]Return reasons whose items are treated as non-restockable (full COGS write-off)
flat_restocking_costfloatno5.00Average labor cost per return line item to model restocking workload

Safety

ℹ️ Read-only skill — no mutations are executed. Cost figures are estimates derived from unitCost, refund totals, and flat_restocking_cost — calibrate the flat-cost figure to your operation before treating outputs as accounting truth.

Workflow Steps

  1. OPERATION: returns — query Inputs: query: "created_at:>='<NOW - days_back days>'", first: 250, select returns with line item pricing, product/variant, inventoryItem.id Expected output: All returns in window with per-line-item pricing

  2. OPERATION: orders — query Inputs: For each return's order.id, fetch refunds { totalRefundedSet refundLineItems { quantity subtotalSet totalTaxSet lineItem { id } } } Expected output: Refund amounts mappable to line items

  3. OPERATION: inventoryItems — query — batch unique inventoryItem.id from step 1; returns unitCost per item

  4. Per line item compute: refund_amount (matched refundLineItem proportional to returned qty), shipping_loss (order shipping × line-item value share for full-order returns; else 0), cogs_writeoff (unitCost × qty only if returnReason in writeoff_reasons), restocking_labor (flat_restocking_cost × qty). Sum and aggregate by group_by.

Show full SKILL.md (166 more words)Show less

GraphQL Operations

graphql
# returns:query — validated against api_version 2025-01
query ReturnsForCostAttribution($query: String!, $after: String) {
  returns(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        status
        createdAt
        totalQuantity
        order {
          id
          name
          totalShippingPriceSet { shopMoney { amount currencyCode } }
          totalPriceSet { shopMoney { amount currencyCode } }
        }
        returnLineItems(first: 50) {
          edges { node {
            id
            quantity
            returnReason
            fulfillmentLineItem { lineItem {
              id
              title
              quantity
              discountedTotalSet { shopMoney { amount currencyCode } }
              originalUnitPriceSet { shopMoney { amount currencyCode } }
              variant { id sku inventoryItem { id } }
              product { id title vendor }
            } }
          } }
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}
graphql
# orders:query — validated against api_version 2025-01
query OrderRefundsForReturns($query: String!, $after: String) {
  orders(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        name
        refunds {
          id
          createdAt
          totalRefundedSet { shopMoney { amount currencyCode } }
          refundLineItems(first: 50) {
            edges { node {
              quantity
              subtotalSet { shopMoney { amount currencyCode } }
              totalTaxSet { shopMoney { amount currencyCode } }
              lineItem { id }
            } }
          }
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}
graphql
# inventoryItems:query — validated against api_version 2025-01
query InventoryUnitCosts($ids: [ID!]!) {
  nodes(ids: $ids) {
    ... on InventoryItem {
      id
      unitCost { amount currencyCode }
      tracked
    }
  }
}

Session Tracking

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

On start, emit:

╔══════════════════════════════════════════════╗
║  SKILL: Return Cost Attribution              ║
║  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):

══════════════════════════════════════════════
RETURN COST ATTRIBUTION  (<days_back> days, group: <group_by>)
  Returns analyzed:    <n>
  Total return cost:   $<amount>  (refund <pct>%, shipping <pct>%, COGS <pct>%, labor <pct>%)

  Top cost drivers:
    <group>   Returns: <n>  Total: $<n>  Avg: $<n>  Top reason: <reason>
  Output: return_cost_<date>.csv
══════════════════════════════════════════════

For format: json, emit:

json
{
  "skill": "return-cost-attribution",
  "store": "<domain>",
  "period_days": 90,
  "group_by": "reason",
  "returns_analyzed": 0,
  "totals": {
    "total_cost": 0, "refund": 0, "shipping_loss": 0,
    "cogs_writeoff": 0, "restocking_labor": 0, "currency": "USD"
  },
  "groups": [],
  "output_file": "return_cost_<date>.csv"
}

Output Format

CSV file return_cost_<YYYY-MM-DD>.csv with columns: group_key, return_count, units, refund_amount, shipping_loss, cogs_writeoff, restocking_labor, total_cost, avg_cost_per_return, top_return_reason, currency

Error Handling

ErrorCauseRecovery
THROTTLEDAPI rate limit exceededWait 2 seconds, retry up to 3 times
Missing unitCostCost not recordedTreat COGS as 0 and flag the row
Refund not yet processedCustomer not yet refundedUse line item discounted total as estimate
Multiple refunds per returnPartial refund historySum refunds tied to the return's line items
No shipping costFree shippingShipping loss = 0

Best Practices

  • Use group_by: reason_x_product to surface lethal combos like DEFECTIVE × <hero SKU> — supplier-quality issues addressable at the source.
  • Re-run after unitCost updates; stale cost most often skews COGS write-off.
  • Pair with return-reason-analysis to compare "what returns most" with "what costs most" — they often diverge.

© 40RTY-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/returns/shopify-admin-return-cost-attribution of 40RTY-ai/shopify-admin-skills.

Open the folder on GitHubat commit 6765cb4

Compare with similar skills

Shopify Admin Return Cost Attribution next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Shopify Admin Return Cost Attribution compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Shopify Admin Return Cost Attribution this skill40RTY-ai/shopify-admin-skills194—~1.9kAutomated safety check: PassMIT
ShopifyShopify/Shopify-AI-Toolkit592—~4.2kAutomated safety check: PassMIT
E-commerce Visual Copywritingfeichanggege/ecommerce-visual-copywriting-skill867—~1.3kAutomated safety check: PassMIT
Reviewing Pull RequestsShopify/shopify-app-js541—~1.9kAutomated safety check: PassMIT
Better Designmarvkr/better-design254—~1.2kAutomated safety check: PassMIT
Liquid Theme A11ybenjaminsehl/liquid-skills120—~3.2kAutomated safety check: PassNone

Similar skills

  • Shopify

    Shopify/Shopify-AI-Toolkit

    Official

    Build anything on Shopify. An agent skill from Shopify/Shopify-AI-Toolkit.

    592 GitHub stars~4.2k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • E-commerce Visual Copywriting

    feichanggege/ecommerce-visual-copywriting-skill

    Turns product details, packaging, target platform and audience into an executable e-commerce image plan with copy, storyboards, image prompts and a compliance review.

    867 GitHub stars~1.3k tokensUpdated 23 days ago
    Writing & ContentAuto-check passed
  • Reviewing Pull Requests

    Shopify/shopify-app-js

    Official

    Reviews pull requests for Shopify/shopify-app-js with comprehensive analysis including semver compliance (MAJOR/MINOR/PATCH classification), single responsibility validation, pattern consistency…

    541 GitHub stars~1.9k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Better Design

    marvkr/better-design

    Build, improve, and review production interfaces with the Better Design MCP.

    254 GitHub stars~1.2k tokensUpdated 17 days ago
    Frontend & DesignAuto-check passed
  • Liquid Theme A11y

    benjaminsehl/liquid-skills

    Implement WCAG 2.2 accessibility patterns in Shopify Liquid themes.

    120 GitHub stars~3.2k tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed
  • Analytics Tracking Automation

    jtrackingai/analytics-tracking-automation

    A skill your agent uses when you need GA4 + GTM tracking delivery from site discovery through publish, or when the right phase entry point is still unclear.

    142 GitHub stars~2.8k tokensUpdated 5 mo ago
    Data & AnalyticsAuto-check passed

More from 40RTY-ai/shopify-admin-skills

All 116 skills in this repo
  • Shopify Admin Abandoned Cart Recovery

    40RTY-ai/shopify-admin-skills

    Query checkouts abandoned in the last N days, generate unique discount codes per customer, and tag them for re-engagement.

    194 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Shopify Admin Address Correction

    40RTY-ai/shopify-admin-skills

    Update the shipping address on an unfulfilled order before it ships.

    194 GitHub stars~1.5k tokensUpdated 1 mo ago
    Auto-check passed
  • Shopify Admin Agentic Crawler Access

    40RTY-ai/shopify-admin-skills

    Edit the theme's robots.txt.liquid to explicitly allow AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, OAI-SearchBot, Amazonbot) so AI assistants are permitted to read the catalog.

    194 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Rewrite thin product descriptions into structured, fact-rich copy (materials, fit, use-cases, the words shoppers actually type) so AI agents have something concrete to quote and match.

    194 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Shopify Admin Agentic Image Alt Text

    40RTY-ai/shopify-admin-skills

    Generate and set descriptive alt text on product images so AI agents (which can't 'see' pixels) can understand and recommend what each product looks like.

    194 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Shopify Admin Agentic LLMs Txt

    40RTY-ai/shopify-admin-skills

    Generate and publish an /llms.txt guide (brand summary, flagship products, key policies, contact) via a theme template so AI assistants get a curated, machine-readable map of the store.

    194 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Shopify Admin Return Cost Attribution

What does Shopify Admin Return Cost Attribution do?

Read-only: calculates the true cost of returns by reason and product — refund dollars, restocking impact, shipping cost lost, and COGS impact for items written off. Shopify Admin Return Cost Attribution is an agent skill from 40RTY-ai/shopify-admin-skills. Read-only: calculates the true cost of returns by reason and product — refund dollars, restocking impact, shipping cost lost, and COGS impact for items written off.

How do I install Shopify Admin Return Cost Attribution in Claude Code?

Run `npx skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-return-cost-attribution -a claude-code`. Or copy the skill folder (skills/returns/shopify-admin-return-cost-attribution in 40RTY-ai/shopify-admin-skills) into .claude/skills/shopify-admin-return-cost-attribution in your project. Claude Code loads it when a task matches its description.

How do I install Shopify Admin Return Cost Attribution in Codex?

Run `npx skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-return-cost-attribution -a codex`. Or copy the skill folder (skills/returns/shopify-admin-return-cost-attribution in 40RTY-ai/shopify-admin-skills) into .agents/skills/shopify-admin-return-cost-attribution in your project. Codex loads it when a task matches its description.

Can I use Shopify Admin Return Cost Attribution in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add 40RTY-ai/shopify-admin-skills --skill shopify-admin-return-cost-attribution -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/shopify-admin-return-cost-attribution, .gemini/skills/shopify-admin-return-cost-attribution, .github/skills/shopify-admin-return-cost-attribution and .opencode/skills/shopify-admin-return-cost-attribution in your project.

What does Shopify Admin Return Cost Attribution need to run?

Going by SKILL.md and its folder, Shopify Admin Return Cost Attribution needs the command-line tools its instructions call (shopify). Compatibility (from SKILL.md): Claude Code, Cursor, Codex, Gemini CLI.

Does Shopify Admin Return Cost Attribution access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Shopify Admin Return Cost Attribution safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Shopify Admin Return Cost Attribution use?

Shopify Admin Return Cost Attribution is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Shopify Admin Return Cost Attribution use?

About 1.9k tokens (SKILL.md is roughly 7.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Shopify Admin Return Cost Attribution?

Skills that share tags, products or a category with Shopify Admin Return Cost Attribution: Shopify (Shopify/Shopify-AI-Toolkit, 592 stars), E-commerce Visual Copywriting (feichanggege/ecommerce-visual-copywriting-skill, 867 stars), Reviewing Pull Requests (Shopify/shopify-app-js, 541 stars) and Better Design (marvkr/better-design, 254 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Shopify Admin Return Cost Attribution?

40RTY-ai (a GitHub organization) maintains it in 40RTY-ai/shopify-admin-skills, which has 194 GitHub stars. The repository holds 116 skills in this directory. The repository was last updated on August 14, 2026.

Source: 40RTY-ai/shopify-admin-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.