Back to list
stateset

commerce-inventory

by stateset

StateSet iCommerce

1🍴 0📅 Jan 24, 2026

SKILL.md


name: commerce-inventory description: Use when managing stock levels, inventory adjustments, or reservation workflows.

Commerce Inventory Skill

Domain knowledge for inventory management, stock tracking, and reservation systems.

Inventory Concepts

Stock Quantities

QuantityDescriptionFormula
onHandPhysical units in warehouseActual count
allocatedReserved for ordersSum of reservations
availableCan be soldonHand - allocated

Key Formula

Available = On-Hand - Allocated

Example

On-Hand:    100 units (physical inventory)
Allocated:   25 units (reserved for orders)
Available:   75 units (can be sold)

Inventory Item Structure

{
  id: "uuid",
  sku: "WIDGET-001",
  name: "Premium Widget",
  description: "High quality widget",

  // Quantities
  totalOnHand: 100,
  totalAllocated: 25,
  totalAvailable: 75,

  // Thresholds
  reorderPoint: 20,
  reorderQuantity: 50,

  // Location breakdown
  locations: [
    { locationId: "warehouse-1", onHand: 60, allocated: 15 },
    { locationId: "warehouse-2", onHand: 40, allocated: 10 }
  ],

  createdAt: "2024-01-15T10:30:00Z",
  updatedAt: "2024-01-15T12:00:00Z"
}

Inventory Operations

Adjustments

TypeQuantityUse Case
Positive+NReceived shipment, found inventory
Negative-NDamaged, lost, shrinkage

Always document reason:

  • "Received shipment PO-12345"
  • "Damaged in warehouse - 3 units"
  • "Cycle count correction"
  • "Promotional giveaway"

Reservations

Reservation lifecycle:

[Available] ──► [Reserved] ──► [Confirmed] (deducted)
                    │
                    └──────────► [Released] (returned)
ActionEffect
ReserveAvailable ↓, Allocated ↑
ConfirmAllocated ↓, OnHand ↓
ReleaseAllocated ↓, Available ↑

Reservation Structure

{
  id: "uuid",
  sku: "WIDGET-001",
  quantity: 5,

  referenceType: "order",
  referenceId: "order-uuid",

  status: "pending",  // pending, confirmed, released, expired

  expiresAt: "2024-01-15T11:00:00Z",
  createdAt: "2024-01-15T10:45:00Z"
}

Transaction Types

TypeDescription
adjustment_inManual increase
adjustment_outManual decrease
saleSold (order fulfilled)
returnReturned from customer
transfer_inReceived from location
transfer_outSent to location
reservationStock reserved
releaseReservation released

Stock Level Alerts

LevelConditionAction
okAvailable > reorderPointNormal
lowAvailable ≤ reorderPointConsider reorder
criticalAvailable ≤ reorderPoint/2Urgent reorder
outAvailable = 0Stop selling

Common Workflows

Receive Inventory

1. get_stock(sku) - Check current levels
2. adjust_inventory(sku, +quantity, "Received PO-12345")
3. Verify new levels

Order Fulfillment

1. reserve_inventory(sku, qty, "order", orderId)
2. [Process order...]
3. confirm_reservation(reservationId)
   OR
   release_reservation(reservationId) if cancelled

Cycle Count

1. get_stock(sku) - Get system count
2. Physical count
3. If different:
   adjust_inventory(sku, difference, "Cycle count correction")

Write Off Damaged

1. get_stock(sku) - Check current
2. adjust_inventory(sku, -damaged, "Damaged - [details]")
3. Document with photos (external)

Multi-Location Inventory

When using multiple warehouses:

// Total stock
totalOnHand: 100

// By location
locations: [
  { locationId: "east", onHand: 60 },
  { locationId: "west", onHand: 40 }
]

Operations can specify location:

  • Reserve from specific location
  • Adjust specific location
  • Transfer between locations

Reservation Expiration

Default: 15 minutes (900 seconds)

Expired reservations:

  • Automatically released
  • Stock returns to available
  • Associated order may need attention

Custom expiration:

reserve_inventory({
  sku: "WIDGET-001",
  quantity: 5,
  referenceType: "order",
  referenceId: "uuid",
  expiresInSeconds: 3600  // 1 hour
})

Common Errors

ErrorCauseSolution
SKU not foundInvalid SKUCreate inventory item
Insufficient stockNot enough availableCheck levels, adjust
Reservation expiredTimed outCreate new reservation
Already confirmedDuplicate confirmNo action needed
Negative stockOver-adjustmentVerify physical count

Best Practices

  1. Always check before adjust - View current levels first
  2. Document all changes - Include reason in every adjustment
  3. Use reservations - Don't directly deduct for orders
  4. Monitor reorder points - Set appropriate thresholds
  5. Regular cycle counts - Verify physical vs system
  6. Handle expiration - Clean up expired reservations

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon