/databrill-core:dbl-metrics-amazon-inventoryfrom databrill-core
Report how many units of Amazon FBA stock a store holds right now — on-hand, fulfillable, inbound, reserved, unfulfillable — by ASIN, FNSKU, or seller SKU. Use when the user asks how much Amazon inventory they have, what is in stock, what is inbound, how much is unsellable or damaged, or wants an FBA stock list for one marketplace. Do not use for stock on past days or past stockouts, for The Fulfillment Lab stock, or for an ads pacing decision.
Ships in databrill-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
On a user- or organization-scoped connector, call listWorkspaces, select the
workspace, and pass its wsid explicitly to every data tool. A workspace-scoped
connector URL supplies that wsid. Never infer it from stores or from a
listWorkspaces result with one entry.
There is no dedicated MCP tool for FBA stock levels yet. Answer with the core
MCP server's executeSql against amzfact_fnsku_fbaInventory_latest, and use no
other table for a units total.
This guide is for stock now and over the last few days. For a past date or
period — "were we out of stock in December", "when did it run out" — use
dbl-metrics-amazon-inventory-history. It covers loadAmazonFbaStockouts, the
tool for when a product ran out and whether it came back, and the units on past
days that Amazon's inventory ledger records.
amzfact_fnsku_fbaInventory_latest, not the raw summary tableamzfact_fnsku_fbaInventory_latest holds one row per
(merchantId, marketplaceId, fnsku) — one row per FNSKU.
amzspapi_fbaInventory_v1__InventorySummary and the
amazon_fba_inventory_summary view are keyed by seller SKU. A commingled FNSKU
is repeated once per seller SKU pointing at it, each repetition carrying the
same quantities, so summing them counts the same physical units several times.
On a catalogue with commingled stock the per-seller-SKU total, on-hand and
fulfillable alike, runs substantially above the per-FNSKU total.
Never total the per-seller-SKU tables. Use them only when the question is
genuinely about a label (which SKU is which), and get identity from
amzfact_sku_identity instead where you can.
FNSKUs are not unique across marketplaces — the same FNSKU value appears in more than one marketplace, so a total over several marketplaces double counts.
Every query MUST carry a "marketplaceId" = ... predicate. This table cannot
answer a cross-marketplace or worldwide total: what it gives is per-marketplace
figures, and their sum is not a total of units.
(A physical total across countries comes from the inventory ledger, which is
keyed by fulfilment centre and so counts each unit once; see
dbl-metrics-amazon-inventory-history. Its newest day trails today by a few
days, so it is a total as of that day, not now.)
Summing across merchants within one marketplace is fine: different merchants own different physical units.
Common marketplace ids: US ATVPDKIKX0DER, CA A2EUQ1WTGCTBG2,
UK A1F83G8C2ARO7P, DE A1PA6795UKMFR9. Read amazon_marketplace when unsure.
Key: merchantId, marketplaceId, fnsku. Denormalised: asin, condition.
Quantities, all nullable — NULL means Amazon did not report it, not zero, so
a sum needs COALESCE(...,0), and a figure that is mostly NULL is mostly
unreported:
totalQuantity — everything Amazon holds for the FNSKU.fulfillableQuantity — sellable now. This is the number for "in stock".inboundWorkingQuantity, inboundShippedQuantity, inboundReceivingQuantity.totalReservedQuantity and its parts pendingCustomerOrderQuantity,
pendingTransshipmentQuantity, fcProcessingQuantity.totalUnfulfillableQuantity and its parts customerDamagedQuantity,
warehouseDamagedQuantity, distributorDamagedQuantity,
carrierDamagedQuantity, defectiveQuantity, expiredQuantity.totalResearchingQuantity and its short/mid/long-term parts.futureSupplyBuyableQuantity — units Amazon already lets customers buy ahead
of their arrival (future supply). Not part of totalQuantity, and an FNSKU can
be buyable through it while fulfillableQuantity is 0.
reservedFutureSupplyQuantity is the reserved part of future supply.Freshness: observedAtPoll is the instant Amazon reported the state, not our
write clock, so MAX("observedAtPoll") is the instant a total is as of.
observedAtStream is null until the stream writer exists.
An FNSKU that has gone to zero keeps its row, so filter
COALESCE("totalQuantity",0) > 0 for a "what do we hold" list.
This table is the current state only. amzfact_fnsku_fbaInventory_history has
one row per FNSKU per marketplace-local day on which its state changed, with the
lowest, highest, first and last fulfillable and buyable future-supply quantities
among the changes recorded that day. A missing day means unchanged since the
previous row. It has no rows before the workspace began recording it, so use it
for the days the ledger has not reached yet, never for a period further back.
loadAmazonFbaStockouts reads this table for its stockout episodes.
…Last is exact. …First, …Min and …Max leave out the value the FNSKU
carried into the day, so an FNSKU at 10 all morning that drops to 0 at 15:00 has
fulfillableMax 0. For the whole day, read the previous row's …Last with
LAG:
SELECT "fnsku", "date",
COALESCE("prevLast", "fulfillableFirst") AS "openingFulfillable",
GREATEST("fulfillableMax", "prevLast") AS "dayMaxFulfillable",
LEAST("fulfillableMin", "prevLast") AS "dayMinFulfillable",
"fulfillableLast" AS "closingFulfillable"
FROM (
SELECT *, LAG("fulfillableLast") OVER (
PARTITION BY "merchantId", "marketplaceId", "fnsku" ORDER BY "date") AS "prevLast"
FROM "amzfact_fnsku_fbaInventory_history"
WHERE "marketplaceId" = 'ATVPDKIKX0DER'
) h
WHERE "date" >= DATE '2026-09-01';
Filter on date outside the subquery, as above, so the first day in range still
sees the row before it.
For the declared columns and types of any Amazon table, read
${CLAUDE_PLUGIN_ROOT}/docs/schema/amazon/index.tsv and then that table's
.yaml beside it.
Store total, with freshness:
SELECT SUM(COALESCE("totalQuantity", 0)) AS "totalUnits",
SUM(COALESCE("fulfillableQuantity", 0)) AS "fulfillable",
SUM(COALESCE("inboundShippedQuantity", 0)
+ COALESCE("inboundReceivingQuantity", 0)
+ COALESCE("inboundWorkingQuantity", 0)) AS "inbound",
SUM(COALESCE("totalUnfulfillableQuantity", 0)) AS "unfulfillable",
MAX("observedAtPoll") AS "asOf"
FROM "amzfact_fnsku_fbaInventory_latest"
WHERE "marketplaceId" = 'ATVPDKIKX0DER';
By ASIN (an FNSKU has one ASIN, so this needs no dedupe):
SELECT "asin",
SUM(COALESCE("fulfillableQuantity", 0)) AS "fulfillable",
SUM(COALESCE("totalQuantity", 0)) AS "totalUnits"
FROM "amzfact_fnsku_fbaInventory_latest"
WHERE "marketplaceId" = 'ATVPDKIKX0DER' AND "asin" IS NOT NULL
GROUP BY "asin"
ORDER BY "fulfillable" DESC
LIMIT 50;
By seller SKU — join identity, and note that several SKUs can share one FNSKU, so the FNSKU's units are shown against each label and must not be totalled:
SELECT i."sku", i."asin", f."fnsku",
COALESCE(f."fulfillableQuantity", 0) AS "fnskuFulfillable"
FROM "amzfact_sku_identity" AS i
JOIN "amzfact_fnsku_fbaInventory_latest" AS f
ON f."merchantId" = i."merchantId" AND f."fnsku" = i."fnsku"
WHERE f."marketplaceId" = 'ATVPDKIKX0DER'
ORDER BY "fnskuFulfillable" DESC
LIMIT 50;
amzfact_fnsku_fbaInventory_latest is created on first write, so a workspace the
fact writer has not reached yet has no table. A missing or empty table means the
fact table is not populated in that workspace, not zero stock, and the raw
per-seller-SKU table is no substitute, since it overstates units (above).
dbl-metrics-amazon-inventory-history for stock on past days and stockouts,
including loadAmazonFbaStockouts.
dbl-ask-inventory-pacing for the ads decision; it states its own accuracy
caveat. dbl-metrics-tfl-inventory for The Fulfillment Lab stock and
dbl-metrics-shopify-inventory for Shopify. Those are three different fulfilment
networks, and Shopify's locations may BE the TFL warehouse, so a sum of their
figures can count the same units twice, and each figure has its own source and
as-of time.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub databrill/databrill-core-agent-plugin --plugin databrill-core19 skills in this plugin
/dbl-ask-inventory-pacingRecommend how advertising should respond to inventory — pause, throttle, hold, or ramp spend based on each product's runway. Use when the user asks "should we pause ads before the stockout", "we're low on stock, what about ads", "should we cut spend to stretch inventory", "we restocked — ramp back up?", "how do we sell down overstock", "long-term storage fee risk", or wants an inventory-driven ad pacing decision./dbl-ask-sales-dropDiagnose why a store's sales dropped — decompose the change into traffic, conversion, and price, and flag ad-channel and ad-efficiency causes. Use when the user asks "why did sales drop / fall / decline", "sales are down", "revenue dropped", "why did orders fall", "what happened to sales (week-over-week)", or wants a sales-decrease diagnosis for a marketplace./dbl-brand-configEdit brand configuration — product families, the ontology category and variant layer, ASIN-to-family and ASIN-to-SKU mapping, and effective-dated cost, rate and planning attributes. Use when the user asks to set up or edit product families, map ASINs to families or SKUs, seed the ontology, recategorise or relabel a family, or set a cost per unit, VAT rate or lead time for a period. Do not use for reading brand configuration — that is dbl-db./dbl-dashboardDesign or construct a dashboard, report, chart, table, or recurring analysis from Databrill MCP or database data. Use when the user asks to explore their data visually, build a dashboard or artifact, chart trends, make a management report, export a reporting dataset, or compare several accounts/workspaces./dbl-dbAnswer Databrill data questions that do not fit a dedicated metric skill by selecting the right MCP tool or a safe read-only Deno/n8n database workflow. Use for arbitrary database exploration, table or column discovery, SQL, CSV exports, orders, listings, returns, reimbursements, fees, settlements, Walmart, The Fulfillment Lab data, or questions about what data is available./dbl-metrics-adsAnalyze Amazon PPC advertising performance metrics including impressions, clicks, orders, spend, sales, CTR, CR, CPC, ACOS, and ROAS. Use when the user asks about ad performance, PPC metrics, advertising efficiency, campaign analysis, ACOS/ROAS, or spend by ad type (SP/SB/SBV/SD).Other plugins' skills for the same job