inventory-and-multi-warehouse
Skill1 starsChanged 18 days agoMITView on GitHub
Track stock per location with on-hand, reserved, and available quantities, reserve at checkout, and allocate orders across warehouses without overselling. Use when adding warehouses or stores as stock locations, reservations, transfers, or order routing.
In this repository28 other files it gives its agents.
- b2b-pricingSkill
- catalog-import-and-migrationSkill
- checkout-ux-and-conversionSkill
- conversion-event-trackingSkill
- ecommerce-seo-structured-dataSkill
- fraud-and-risk-basicsSkill
- google-merchant-product-feedsSkill
- headless-nextjs-storefrontSkill
- iranian-payment-gatewaysSkill
- marketplace-search-and-rankingSkill
- mcp-store-toolingSkill
- multi-vendor-payoutsSkill
- order-and-webhook-reliabilitySkill
- payment-gateway-integrationSkill
- product-catalog-modelingSkill
- product-description-guardrailsSkill
- returns-and-refundsSkill
- rtl-and-persian-localizationSkill
- shopify-app-developmentSkill
- storefront-accessibilitySkill
- storefront-performanceSkill
- stripe-paymentsSkill
- subscription-billingSkill
- tax-and-shippingSkill
- vector-product-searchSkill
- woocommerce-plugin-developmentSkill
- woocommerce-rest-apiSkill
- wordpress-plugin-securitySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Keep separate quantities: on_hand (physically there), reserved (held for unpaid or unshipped orders), and available = on_hand - reserved - …
- Distinctive: line 28
Only locations that can ship to the destination and are active.
- Very specific: line 33
Run node scripts/allocate-stock.mjs order.json stock.json to test a policy on sample data.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Inventory and multi-warehouse
A single stock number per product stops working once there are two places that ship, or a checkout that holds stock while the shopper pays. Model quantities per location and per state, and change them only through movements. Platform notes are in the platform notes.
Procedure
- Key stock by purchasable unit (SKU or variation) and location. A product with sizes has one row per size per location.
- Keep separate quantities:
on_hand(physically there),reserved(held for unpaid or unshipped orders), andavailable = on_hand - reserved - safety_stock. Sell only fromavailable. - Change stock only by writing a movement row: receipt, sale reservation, release, shipment, return, adjustment, or transfer. The current quantity is the sum of movements, or a cached total updated in the same transaction.
- Reserve at order creation with a conditional update, such as
UPDATE stock SET reserved = reserved + :qty WHERE sku = :sku AND location = :loc AND on_hand - reserved - safety_stock >= :qty. Zero rows updated means not enough stock. - Give each reservation an expiry. Release it when payment fails or the hold expires. Convert it to a shipment when the order ships.
- Allocate an order to locations with an explicit policy, then reserve at those locations. Store the allocation on the order lines.
Allocation
A common policy, in order:
- Only locations that can ship to the destination and are active.
- One location that can fill every line, the closest or cheapest first.
- Otherwise split by line across the fewest locations.
- Otherwise back-order or reject the line, as the store policy says. Never reserve more than
available.
Run node scripts/allocate-stock.mjs order.json stock.json to test a policy on sample data. It returns the allocation per line and any shortfall, and never allocates more than a location has available.
Transfers
A transfer is two movements: out of the source when it ships, and into the destination when it is received. Stock in transit is in neither available figure. Record incoming at the destination if buyers need to see it.
Counts and adjustments
A stock count writes an adjustment movement for the difference, with a reason and the user. Do not overwrite on_hand directly, or the history and any reservations made during the count are lost.
Gotchas
- Reading available stock and then writing it in a second statement oversells under load. Check and reserve in one conditional update or a row lock.
- Decrementing
on_handat checkout and again at shipment counts the sale twice. Reserve at checkout, then move reserved to shipped. - A parent product's total is not a sellable quantity. Sell from the variation's row.
- Safety stock that is not subtracted from
availablelets the last units sell online while the store floor still shows them. - Returns go back into stock only after inspection. Use a separate location or state such as
quality_controluntil then.
Verification
- Two concurrent checkouts for the last unit: one reserves, the other is refused.
- An expired unpaid reservation returns its quantity to
available. - An order for two lines that one warehouse can fill is not split.
- A transfer in transit does not appear as available at either location.
- The movement log sums to the current
on_handfor every SKU and location.
Evaluation
Worked examples and the checks they must satisfy are in evals/tasks.json.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

