shopify-admin-restock-on-return

对于已批准或已关闭的退货,通过调整每个退货行项目的现有数量,在退货指定地点将商品重新入库。

仓库最近推送
GitHub Stars
205
Forks
23
Issues / PRs
2

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "shopify-admin-restock-on-return":https://skillpi.com/zh/skills/deepskill-049fb91ab0752750425b266a4b92fab0031d4ded4eb5b3efaad25c5a1ac9f2b4。安装前核对上游来源和版本:https://github.com/40RTY-ai/shopify-admin-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

对于已批准或已关闭的退货,通过调整每个退货行项目的现有数量,在退货指定地点将商品重新入库。

0 下载

介绍来源: third_party · 40RTY-ai · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
软件、账号及付费要求
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: shopify-admin-restock-on-return
role: returns
description: "For approved/closed returns, restocks inventory at the return location by adjusting on-hand quantities for each returned line item."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
  - returns:query
  - inventoryAdjustQuantities:mutation
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLI

Purpose

Walks through recently approved or closed returns and restocks inventory for each returnLineItem whose physical item has been received and inspected. Adjusts the available quantity at the return's destination location using inventoryAdjustQuantities with reason restock and a referenceDocumentUri linking to the return record. Use when warehouse processing posts in a separate system from Shopify, or when manual restock has been deferred and needs a clean catch-up run.

Prerequisites

  • Authenticated Shopify CLI session: shopify store auth --store <domain> --scopes read_returns,write_inventory,read_locations
  • API scopes: read_returns, read_inventory, write_inventory

Parameters

Parameter Type Required Default Description
store string yes — Store domain (e.g., mystore.myshopify.com)
format string no human Output format: human or json
dry_run bool no true Preview restock plan without executing inventory mutations
days_back integer no 14 Lookback window for recently completed returns
return_status string no CLOSED Only restock returns in this status: CLOSED, OPEN, or ANY
location_id string no — If set, restock only returns whose inventory destination matches this location GID
restock_only_return_reasons array no — If set (e.g., ["UNWANTED", "SIZE_TOO_SMALL"]), restock only items returned for these reasons; DEFECTIVE is excluded by default
skip_defective bool no true Exclude returnLineItem.returnReason: DEFECTIVE items from restock

Safety

⚠️ Step 2 executes inventoryAdjustQuantities mutations that immediately add units to the available count at the destination location. Restocking damaged or unsalable inventory inflates available stock and causes oversells. The default is dry_run: true — review the preview CSV to confirm each return line item is genuinely sellable before committing. By default skip_defective: true excludes DEFECTIVE returns. Each restock posts a permanent entry in Shopify's inventory activity log with reason restock.

Workflow Steps

  1. OPERATION: returns — query Inputs: query: "status:<return_status> updated_at:>='<NOW - days_back days>'" (use updated_at:>='...' only when return_status:ANY), first: 250, select id, name, status, closedAt, order { id name }, returnLineItems(first: 50) { quantity, returnReason, fulfillmentLineItem { lineItem { variant { id sku inventoryItem { id tracked } } } } }, reverseFulfillmentOrders(first: 5) { reverseDeliveries(first: 5) { deliverable { ... on ReverseDeliveryShippingDeliverable { label { ... } } } }, location { id name } }, pagination cursor Expected output: Returns with their line items, return reasons, inventory item IDs, and destination location

  2. Build the restock plan: for each returnLineItem not previously restocked, where returnReason is allowed by params and inventoryItem.tracked: true, group by (inventoryItemId, locationId) summing quantity deltas. Skip items where the variant is missing, where tracked: false, or where the return has no destination location.

  3. OPERATION: inventoryAdjustQuantities — mutation Inputs: input.reason: "restock", input.name: "available", input.referenceDocumentUri: "shopify://returns/<return_id>", input.changes: [{ inventoryItemId, locationId, delta: +<quantity> }, ...] Expected output: inventoryAdjustmentGroup.changes with quantityAfterChange per item; userErrors

GraphQL Operations

# returns:query — validated against api_version 2025-01
query ReturnsForRestock($query: String!, $after: String) {
  returns(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        name
        status
        closedAt
        order { id name }
        returnLineItems(first: 50) {
          edges {
            node {
              id
              quantity
              returnReason
              returnReasonNote
              fulfillmentLineItem {
                lineItem {
                  id
                  title
                  variant {
                    id
                    sku
                    inventoryItem { id tracked }
                  }
                }
              }
            }
          }
        }
        reverseFulfillmentOrders(first: 5) {
          edges {
            node {
              id
              reverseDeliveries(first: 5) { edges { node { id } } }
            }
          }
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}
# inventoryAdjustQuantities:mutation — validated against api_version 2025-01
mutation RestockOnReturn($input: InventoryAdjustQuantitiesInput!) {
  inventoryAdjustQuantities(input: $input) {
    inventoryAdjustmentGroup {
      id
      reason
      referenceDocumentUri
      changes {
        name
        delta
        quantityAfterChange
        item { id sku }
        location { id name }
      }
    }
    userErrors { field message }
  }
}

Session Tracking

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

On start, emit:

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

══════════════════════════════════════════════
RESTOCK ON RETURN
  Returns scanned:        <n>
  Line items eligible:    <n>
  Skipped (defective):    <n>
  Skipped (untracked):    <n>
  Units restocked:        <n>  (or "skipped — dry_run")
  Adjustment groups:      <n>
  Errors:                 <n>
  Output:                 restock_on_return_<date>.csv
══════════════════════════════════════════════

For format: json, emit:

{
  "skill": "restock-on-return",
  "store": "<domain>",
  "started_at": "<ISO8601>",
  "completed_at": "<ISO8601>",
  "dry_run": true,
  "outcome": {
    "returns_scanned": 0,
    "line_items_eligible": 0,
    "skipped_defective": 0,
    "skipped_untracked": 0,
    "units_restocked": 0,
    "adjustment_groups": 0,
    "errors": 0,
    "output_file": "restock_on_return_<date>.csv"
  }
}

Output Format

CSV file restock_on_return_<YYYY-MM-DD>.csv with columns: return_id, return_name, order_name, sku, product_title, quantity_restocked, return_reason, location_name, quantity_after, inventory_item_id, status

Error Handling

Error Cause Recovery
THROTTLED API rate limit exceeded Wait 2 seconds, retry up to 3 times
inventoryItem.tracked: false Tracking disabled on variant Log and skip; require manual enable
userErrors from inventoryAdjustQuantities Invalid location or item Verify GIDs match the return's destination
Return has no destination location No reverse delivery confirmed yet Skip the return; rerun after delivery is confirmed
Variant deleted Product removed after sale Skip line item; log for review

Best Practices

  • Always run with dry_run: true first and audit the preview CSV — restocking damaged units inflates inventory and causes oversells downstream.
  • Keep skip_defective: true for normal operations. Set it to false only after explicitly inspecting defective units and confirming they're refurbishable.
  • Use restock_only_return_reasons: ["UNWANTED", "SIZE_TOO_SMALL", "SIZE_TOO_LARGE", "STYLE", "COLOR"] to focus on reasons that almost always yield resalable inventory.
  • Set location_id when running per-warehouse — it constrains the run to one site's reverse logistics workflow.
  • Cross-reference the post-run output with multi-location-inventory-audit to confirm restocked SKUs reconcile cleanly.
  • For active returns where physical inspection has not occurred, defer restock until status: CLOSED (default) — never restock on OPEN returns based solely on customer claim.

版本历史

  1. v1.1.0 GitHub ↗
    原版更新说明

    ## 🤖 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.

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 解决Shopify商家退货库存管理的核心业务痛点
  • 支持多种退货状态和原因过滤,适用场景广泛
  • 提供dry_run预览机制确保操作安全
触发精准95/100

亮点

  • description清晰界定功能范围:已批准/关闭退货的重新入库
  • 参数定义完整,覆盖各种使用场景
  • 触发条件边界清晰,不易误触
结构规范90/100

亮点

  • workflow步骤清晰,包含查询和执行两个阶段
  • 提供完整的GraphQL操作示例和API版本信息
  • 包含安全提醒、错误处理和最佳实践指导
执行可靠88/100

亮点

  • 使用官方Shopify Admin API,工具来源可靠
  • 参数验证完整,包含必填项和默认值
  • 异常处理覆盖主要错误场景,有重试机制
  • 提供dry_run模式确保操作安全
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

翻译待完成,请参阅来源文档。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。