一键导入
commerce-edi
Use when tracking EDI documents (850/855/856/810), managing their status lifecycle, or coordinating with the StateSet EDI gateway.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when tracking EDI documents (850/855/856/810), managing their status lifecycle, or coordinating with the StateSet EDI gateway.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when working the general ledger, month-end close, AP/AR workflows, fixed assets, or revenue recognition.
Use when running warehouse operations — locations, receiving, waves and picking, cycle counts, transfers, or lot/serial traceability.
Manage sequencer sync, outbox, and conflict resolution. Use when running `stateset-sync` or checking sync status, push, or pull.
Set up and run the StateSet iCommerce engine locally (CLI install, DB init, demo data, sync). Use when bootstrapping an environment, running `stateset-doctor`, or starting `stateset-autonomous`.
Use when creating new storefront websites, scaffolding e-commerce projects, or building commerce applications with StateSet.
Stream real-time commerce events and manage webhooks. Use when debugging live behavior (orders/inventory/customers/products/returns) or integrating external systems via webhooks.
| name | commerce-edi |
| description | Use when tracking EDI documents (850/855/856/810), managing their status lifecycle, or coordinating with the StateSet EDI gateway. |
Domain knowledge for EDI document tracking: what the engine stores, the status lifecycle, and how it relates to the transport gateway.
This engine stores and tracks EDI documents. The separate stateset-edi
gateway handles transport (AS2/SFTP/VAN, X12 parsing/generation, 997
functional acks, trading-partner onboarding). The engine's ediDocuments
surface is the system-of-record ledger of what was exchanged, its business
reference, and where it is in its lifecycle.
Typical integration: the gateway receives an 850, then creates an inbound document record here (with the raw payload and PO reference); when the engine ships, an outbound 856 record is created and handed to the gateway to transmit, with status updated as transmission progresses.
| Type | Name | Direction (typical) | Business object |
|---|---|---|---|
850 | Purchase Order | inbound | Creates a sales order |
855 | PO Acknowledgment | outbound | Accept/reject the 850 |
856 | Advance Ship Notice (ASN) | outbound | Shipment + carton contents |
810 | Invoice | outbound | Bills the trading partner |
Other X12 types (860 changes, 940/945 warehouse, 204, etc.) can be stored —
documentType is a free string; these four are the core retail flow:
partner 850 ──► [engine order] ──► 855 ack ──► 856 ASN ──► 810 invoice
[pending] ──► [sent] ──► [acknowledged] ──► [processed]
│ │ │
└───────────┴──────────────┴──────► [error] (with errorMessage)
| Status | Meaning |
|---|---|
pending | Recorded, not yet transmitted/handled |
sent | Handed to the gateway / transmitted |
acknowledged | Partner functional ack (997) received |
processed | Business processing complete (order created, invoice booked) |
error | Failed — errorMessage carries the failure detail |
Direction is inbound or outbound (create defaults to inbound).
For inbound documents, pending → processed is the common path; the
sent/acknowledged steps mostly apply to outbound documents.
edi_documents domain)list_edi_documents — filter by documentType ("850"), direction,
status, partner, with limit/offset paginationget_edi_document — full record by ID, including payloadcreate_edi_document — record a document: documentType (required),
direction, partner, reference (PO/order number), payload
(raw EDI) — requires --applyset_edi_document_status — move through the lifecycle; pass
errorMessage (max 2000 chars) when setting error — requires --applyget_edi_summary — counts by status and type (per partner) for
operational dashboardsThe same surface is exposed as commerce.ediDocuments on the
@stateset/embedded Node binding, and the admin app has a read-only
/operations/edi page showing 850/855/856/810 summaries and status
tracking.
1. create_edi_document({ documentType: "850", direction: "inbound",
partner: "RETAILER-A", reference: "PO-88231", payload: "<raw X12>" })
2. [create the sales order from the PO data]
3. set_edi_document_status(id, "processed")
— or "error" with an errorMessage if parsing/order creation failed
1. Ship the order (shipment created, cartons packed)
2. create_edi_document({ documentType: "856", direction: "outbound",
partner, reference: shipmentNumber }) # status: pending
3. Gateway transmits ──► set_edi_document_status(id, "sent")
4. 997 received from partner ──► set_edi_document_status(id, "acknowledged")
1. list_edi_documents({ status: "error" })
2. get_edi_document(id) — read errorMessage and payload
3. Fix the root cause (bad reference, partner mapping, transport)
4. Re-create or re-transmit via the gateway; update status accordingly
1. get_edi_summary — counts by status/type per partner
2. list_edi_documents({ status: "pending", direction: "outbound" })
— anything stuck untransmitted?
3. Check /operations/edi in the admin for the same view
reference — linking to the PO/order/shipment number is
what makes documents findable during disputeserror status without
errorMessage is undiagnosable laterget_edi_summary gaps reveal missed invoicesstateset-edi gateway concerns,
not engine document records| Error | Cause | Solution |
|---|---|---|
EDI document not found | Bad ID | list_edi_documents to locate it |
Apply required | Write without --apply | Re-run with --apply |
Document stuck pending | Gateway handoff failed | Check gateway transport, retransmit |
| Partner rejects 856 | Content/mapping issue | Inspect payload; fix mapping in the gateway |