Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
{
"schema_version": 2,
"diagram_type": "workflow",
"meta": {
"title": "订单处理工作流",
"output": "order-reflow.html",
"locale": "zh-CN",
"quality_profile": "showcase"
},
"lanes": [
{
"id": "order",
"label": "订单与支付"
},
{
"id": "result",
"label": "库存与订单结果"
},
{
"id": "fulfil",
"label": "履约与异常处理"
}
],
"phases": [
{
"id": "submit_phase",
"label": "提交与校验",
"fromCol": 0,
"toCol": 1
},
{
"id": "payment_phase",
"label": "支付等待",
"fromCol": 2,
"toCol": 4,
"variant": "emphasis"
},
{
"id": "fulfillment_phase",
"label": "履约与收尾",
"fromCol": 5,
"toCol": 5
}
],
"mainPath": [
"submit_order",
"check_inventory",
"reserve_inventory",
"create_pending",
"wait_payment",
"payment_success",
"deduct_inventory",
"ship_order"
],
"semanticChecks": {
"allowedRoots": [
"submit_order"
],
"allowedTerminals": [
"notify_insufficient",
"release_inventory",
"ship_order",
"manual_fulfillment"
],
"requiredEdges": [
{
"from": "submit_order",
"to": "check_inventory"
},
{
"from": "check_inventory",
"to": "reserve_inventory"
},
{
"from": "reserve_inventory",
"to": "create_pending"
},
{
"from": "create_pending",
"to": "wait_payment"
},
{
"from": "wait_payment",
"to": "payment_success"
},
{
"from": "payment_success",
"to": "deduct_inventory"
},
{
"from": "deduct_inventory",
"to": "ship_order"
},
{
"from": "check_inventory",
"to": "notify_insufficient"
},
{
"from": "wait_payment",
"to": "cancel_order"
},
{
"from": "cancel_order",
"to": "release_inventory"
},
{
"from": "ship_order",
"to": "manual_fulfillment"
}
],
"requiredPaths": [
{
"from": "check_inventory",
"to": "notify_insufficient"
},
{
"from": "wait_payment",
"to": "cancel_order"
},
{
"from": "cancel_order",
"to": "release_inventory"
},
{
"from": "ship_order",
"to": "manual_fulfillment"
}
]
},
"nodes": [
{
"id": "submit_order",
"lane": "order",
"col": 0,
"type": "external",
"label": "提交订单",
"sublabel": "用户确认商品"
},
{
"id": "check_inventory",
"lane": "order",
"col": 1,
"type": "backend",
"label": "校验库存",
"sublabel": "检查可售数量"
},
{
"id": "reserve_inventory",
"lane": "order",
"col": 2,
"type": "database",
"label": "预占库存",
"sublabel": "锁定可售数量"
},
{
"id": "create_pending",
"lane": "order",
"col": 3,
"type": "backend",
"label": "创建待支付订单",
"sublabel": "订单状态:待支付",
"width": 92
},
{
"id": "wait_payment",
"lane": "order",
"col": 4,
"type": "external",
"label": "等待支付",
"sublabel": "等待支付结果"
},
{
"id": "payment_success",
"lane": "order",
"col": 5,
"type": "backend",
"label": "支付成功",
"sublabel": "确认到账"
},
{
"id": "deduct_inventory",
"lane": "result",
"col": 5,
"type": "database",
"label": "扣减库存",
"sublabel": "结算预占数量"
},
{
"id": "ship_order",
"lane": "fulfil",
"col": 5,
"type": "backend",
"label": "发货",
"sublabel": "创建配送任务"
},
{
"id": "notify_insufficient",
"lane": "result",
"col": 1,
"type": "external",
"label": "提示库存不足",
"sublabel": "订单失败"
},
{
"id": "cancel_order",
"lane": "result",
"col": 4,
"type": "backend",
"label": "取消订单",
"sublabel": "支付超时"
},
{
"id": "release_inventory",
"lane": "fulfil",
"col": 4,
"type": "database",
"label": "释放预占库存",
"sublabel": "恢复可售数量"
},
{
"id": "manual_fulfillment",
"lane": "fulfil",
"col": 3,
"type": "external",
"label": "人工处理",
"sublabel": "发货失败"
}
],
"edges": [
{
"id": "submit_to_check",
"from": "submit_order",
"to": "check_inventory",
"role": "main"
},
{
"id": "check_to_reserve",
"from": "check_inventory",
"to": "reserve_inventory",
"label": "库存充足",
"role": "main",
"variant": "emphasis"
},
{
"id": "reserve_to_pending",
"from": "reserve_inventory",
"to": "create_pending",
"label": "预占成功",
"role": "main"
},
{
"id": "pending_to_wait",
"from": "create_pending",
"to": "wait_payment",
"role": "main"
},
{
"id": "wait_to_paid",
"from": "wait_payment",
"to": "payment_success",
"label": "支付成功",
"role": "main",
"variant": "emphasis"
},
{
"id": "paid_to_deduct",
"from": "payment_success",
"to": "deduct_inventory",
"label": "结算预占",
"role": "main"
},
{
"id": "deduct_to_ship",
"from": "deduct_inventory",
"to": "ship_order",
"role": "main",
"variant": "emphasis"
},
{
"id": "check_to_insufficient",
"from": "check_inventory",
"to": "notify_insufficient",
"label": "库存不足",
"role": "error",
"variant": "security"
},
{
"id": "wait_to_timeout",
"from": "wait_payment",
"to": "cancel_order",
"label": "支付超时",
"role": "error",
"variant": "security"
},
{
"id": "cancel_to_release",
"from": "cancel_order",
"to": "release_inventory",
"label": "释放预占",
"role": "error",
"variant": "dashed"
},
{
"id": "ship_to_manual",
"from": "ship_order",
"to": "manual_fulfillment",
"label": "发货失败",
"role": "error",
"variant": "security"
}
],
"cards": [
{
"dot": "emerald",
"title": "库存语义",
"items": [
"库存充足后先预占",
"支付成功再扣减",
"支付超时释放预占"
]
},
{
"dot": "amber",
"title": "异常出口",
"items": [
"库存不足提示订单失败",
"支付超时取消订单",
"发货失败转人工处理"
]
}
]
}