Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计异常

inventory-tracking库存追踪

Agent Skill

inventory-tracking 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

791

周安装

32

GitHub Stars

19

下载量

248
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:inventory-tracking(库存追踪)
来源仓库:https://github.com/finsilabs/awesome-ecommerce-skills
仓库路径:skills/inventory-tracking
安装命令:
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill inventory-tracking
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill inventory-tracking

简介

用于查找、检索和筛选相关信息。inventory-tracking 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

  • 适合根据关键词或任务场景快速定位候选结果。
  • 可在 Codex、Claude、Cursor 等宿主环境中使用。
  • 通过 GitHub 安装,具体用法请参考原始 README。
  • 安装前建议确认权限范围和维护状态,避免触发联网或文件操作。

SKILL.md

Inventory Tracking

Overview

Real-time inventory tracking prevents overselling by reserving stock when customers add items to their cart and decrementing it on order fulfillment. Every major e-commerce platform has this built in. Platform-native inventory tracking is almost always the right starting point — only build custom inventory logic if you have requirements that platforms cannot meet (complex multi-warehouse routing, custom reservation windows, or external WMS integration).

When to Use This Skill

  • When overselling is occurring and orders are being placed for out-of-stock items
  • When implementing multi-warehouse inventory with per-location stock levels
  • When building backorder or pre-order functionality for out-of-stock products
  • When a flash sale or product launch will create high-concurrency checkout attempts for limited-stock items

Core Instructions

Step 1: Determine platform and enable inventory tracking

PlatformBuilt-in InventoryRecommended Extension
ShopifyNative per-variant inventory tracking with location supportStocky (free, by Shopify) for purchase orders and demand forecasting
WooCommerceNative stock management with backorder supportATUM Inventory Management for advanced multi-warehouse and supplier POs
BigCommerceNative per-SKU inventory tracking with low-stock alertsMulti-Location Inventory app for warehouse routing
Custom / HeadlessBuild atomic reservation with optimistic lockingRequired for custom platforms without native inventory management

Step 2: Platform-specific setup


Shopify

Shopify tracks inventory per variant, per location, natively.

Enable inventory tracking:

  1. Go to Admin → Products → [Product] → [Variant]
  2. Under Inventory, check Track quantity
  3. Enter your quantity per location
  4. For "Continue selling when out of stock" — only check this if you allow backorders for this product

Set up locations:

  1. Go to Settings → Locations
  2. Add each warehouse, store, or fulfillment center as a location
  3. When editing a product variant, set the quantity at each location independently

Backorders:

  • Enable per variant: check Continue selling when out of stock on the variant
  • Or use a backorder app like Pre-Order Now or Back In Stock for more control (notify customers when available, collect pre-orders, etc.)

Oversell prevention during high traffic:

Shopify's checkout system holds inventory during the checkout process to prevent two customers from purchasing the last item simultaneously. For flash sales, use Shopify Scripts (Plus) or the Inventory Planner app to set purchase limits.

Inventory sync with physical locations:

  • Install Stocky (free, by Shopify) for purchase orders and receiving
  • Stocky automatically updates Shopify inventory when you receive a PO
  • Use the Shopify POS app to sync inventory between your online store and physical retail locations

WooCommerce

WooCommerce has built-in stock management.

Enable inventory tracking:

  1. Go to WooCommerce → Settings → Products → Inventory
  2. Check Enable stock management
  3. Set Hold stock (minutes) — this is the inventory reservation window during checkout (default: 60 minutes)

Per-product settings:

  1. Go to WooCommerce → Products → [Product] → Inventory tab
  2. Enable Manage stock?
  3. Enter Stock quantity
  4. Set Backorders: "Do not allow" / "Allow, but notify customer" / "Allow"
  5. Set a Low stock threshold for this product

Advanced inventory management with ATUM:

  1. Install ATUM Inventory Management for WooCommerce (free core, paid advanced features)
  2. ATUM provides a central inventory dashboard showing stock levels across all products
  3. Add purchase orders through ATUM → Purchase Orders → Add PO
  4. Receiving a PO in ATUM automatically increments WooCommerce stock
  5. For multi-warehouse: ATUM's Multi-Inventory add-on ($) assigns stock per location and routes fulfillment

BigCommerce

BigCommerce tracks inventory per SKU natively.

Enable inventory tracking:

  1. Go to Products → [Product] → Inventory tab
  2. Set Inventory tracking to "By product" or "By option" (for variants)
  3. Enter the current stock level
  4. Set a Low stock level for alerts

Multi-location inventory:

  • Install the Multi-Location Inventory app from the BigCommerce App Marketplace
  • Assign stock quantities per location
  • Set fulfillment routing rules (ship from closest, ship from cheapest, etc.)

Backorders:

  • BigCommerce handles this natively — set Allow backorders on products you want to continue selling when out of stock
  • The product page shows "Ships in X days" when on backorder

Custom / Headless

For custom platforms, implement atomic inventory reservation using optimistic concurrency control to prevent overselling under high load:

// lib/inventory.ts
const MAX_RETRIES = 3;

// Reserve inventory atomically — handles concurrent requests safely
export async function reserveInventory({
  variantId, locationId, quantity, referenceId
}: { variantId: string; locationId: string; quantity: number; referenceId: string }) {
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
    const level = await db.inventoryLevels.findUnique({
      where: { variantId_locationId: { variantId, locationId } },
    });

    if (!level) throw new Error(`Inventory not found: ${variantId}`);

    const available = level.onHand - level.reserved;
    if (available < quantity && !level.backorderAllowed) {
      throw new Error(`Insufficient stock: ${available} available, ${quantity} requested`);
    }

    // Optimistic update — only succeeds if version hasn't changed (no concurrent modifications)
    const updated = await db.inventoryLevels.updateMany({
      where: { variantId_locationId: { variantId, locationId }, version: level.version },
      data: { reserved: level.reserved + quantity, version: level.version + 1 },
    });

    if (updated.count === 0) {
      // Another process modified inventory concurrently; retry
      await new Promise(r => setTimeout(r, 50 * (attempt + 1)));
      continue;
    }

    // Log the transaction for audit trail
    await db.inventoryTransactions.create({
      data: { variantId, locationId, type: 'reserve', quantity: -quantity, referenceId },
    });

    return { success: true, remaining: available - quantity };
  }
  throw new Error(`Failed to reserve inventory after ${MAX_RETRIES} retries`);
}

// Release reservation when cart expires or order is cancelled
export async function releaseReservation({
  variantId, locationId, quantity, referenceId
}: { variantId: string; locationId: string; quantity: number; referenceId: string }) {
  // Idempotency check — don't release twice
  const existing = await db.inventoryTransactions.findFirst({
    where: { type: 'release', referenceId, variantId },
  });
  if (existing) return;

  await db.$transaction([
    db.inventoryLevels.update({
      where: { variantId_locationId: { variantId, locationId } },
      data: { reserved: { decrement: quantity } },
    }),
    db.inventoryTransactions.create({
      data: { variantId, locationId, type: 'release', quantity: +quantity, referenceId },
    }),
  ]);
}

// Expire stale cart reservations — run every 5-10 minutes via cron
export async function expireStaleCartReservations() {
  const TTL_MINUTES = 30;
  const cutoff = new Date(Date.now() - TTL_MINUTES * 60 * 1000);

  const staleCarts = await db.carts.findMany({
    where: { status: 'active', updatedAt: { lt: cutoff }, reservedAt: { not: null } },
    include: { items: true },
  });

  for (const cart of staleCarts) {
    for (const item of cart.items) {
      await releaseReservation({ variantId: item.variantId, locationId: item.locationId, quantity: item.quantity, referenceId: cart.id });
    }
  }
}

Step 3: Configure backorder behavior

Backorders allow customers to purchase even when stock is at zero, with a clear expectation of a delayed delivery.

When to allow backorders:

  • Products with reliable supplier lead times (7–14 days)
  • Made-to-order products
  • Pre-order campaigns for upcoming products

When to block backorders:

  • Products with unreliable supply
  • Third-party fulfilled items where you don't control restock

Communication best practices:

  • Show "Ships in 7–10 days" on the product page when stock is 0 and backorders are enabled
  • Include expected ship date in the order confirmation email
  • Notify customers proactively if the expected date changes

Step 4: Set up inventory alerts

Pair inventory tracking with low-stock alerts — see the @low-stock-alerts skill for full setup. Quick summary:

  • Shopify: Go to Admin → Products — Shopify shows a low stock indicator; use Stocky for email alerts
  • WooCommerce: Go to WooCommerce → Settings → Products → Inventory → Low stock threshold — WooCommerce emails the store admin when stock crosses this threshold
  • BigCommerce: Go to Products → [Product] → Inventory → Low stock level — BigCommerce sends email notifications automatically

Best Practices

  • Enable inventory tracking on every SKU — products without tracking can be oversold silently; only disable tracking for digital products or items with unlimited supply
  • Set a reservation window for in-progress checkouts — WooCommerce's "Hold stock" setting (default 60 min) prevents inventory from being held indefinitely by abandoned carts
  • Test your oversell protection — during a flash sale setup, manually verify that the last unit cannot be purchased twice by simulating two simultaneous checkouts
  • Log every inventory change — platforms log this natively; for custom builds, an immutable inventory_transactions table is essential for diagnosing discrepancies
  • Use the platform's built-in multi-location inventory before buying a third-party app — Shopify, WooCommerce, and BigCommerce all handle multiple locations natively

Common Pitfalls

ProblemSolution
Overselling during flash sales on ShopifyShopify's checkout holds inventory during the checkout flow; for very high-concurrency launches, set purchase limits using Shopify Scripts (Plus) or use a waitlist app
WooCommerce inventory not decremented after orderCheck that stock management is enabled on the product AND globally in WooCommerce settings; both must be on
Inventory released immediately when order is cancelled before fulfillmentThis is correct behavior for physical goods — released inventory becomes available for other customers; only delay release for backordered items
Negative inventory after manual adjustmentAdd validation in WooCommerce (ATUM) or set a DB check constraint on custom builds; reserved >= 0 and on_hand >= 0
Shopify location not receiving inventory updates from POSEnsure POS is connected to the correct Shopify location in Settings → Locations → POS channel

Related Skills

  • @multi-warehouse
  • @low-stock-alerts
  • @variant-matrix

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37%
按下载量换算92

Claude

26.28%
按下载量换算65

Cursor

20.05%
按下载量换算50

Gemini CLI

9.98%
按下载量换算25

安全审计

Gen Agent Trust Hub

通过

Socket

未通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills