update skill and docs

This commit is contained in:
Canhchimlac
2026-09-22 13:46:36 +07:00
parent 343ad8bbbc
commit 51506aabc7
149 changed files with 43752 additions and 300 deletions

View File

@@ -0,0 +1,253 @@
{
"schema_version": 1,
"diagram_type": "architecture",
"meta": {
"title": "C4 Container — Hệ thống đối soát (mẫu)",
"quality_profile": "showcase",
"views": [
{
"id": "duong-chinh",
"label": "Đường chính nạp và đối soát",
"focus": [
"NV",
"WEB",
"API",
"DB"
],
"note": "Người dùng tải file POS, API ghi và đối soát trên CSDL chính."
},
{
"id": "duong-bat-dong-bo",
"label": "Nhánh bất đồng bộ",
"focus": [
"API",
"QUEUE",
"WORKER",
"POS"
],
"note": "Đối soát nặng chạy nền, gọi hệ thống POS ngoài có timeout."
}
]
},
"components": [
{
"id": "NV",
"type": "external",
"label": "Nhân viên đối soát",
"sublabel": "ROLE-01 · trình duyệt",
"pos": [
40,
300
],
"size": [
150,
60
]
},
{
"id": "IDP",
"type": "security",
"label": "IdP nội bộ",
"sublabel": "OIDC · IF-001",
"pos": [
560,
100
],
"size": [
150,
60
]
},
{
"id": "WEB",
"type": "frontend",
"label": "CMP-01 Web App",
"sublabel": "SPA · SCR-01..05",
"pos": [
300,
300
],
"size": [
150,
60
]
},
{
"id": "API",
"type": "backend",
"label": "CMP-02 Settlement API",
"sublabel": "REST/JSON · /v1",
"pos": [
560,
300
],
"size": [
150,
60
]
},
{
"id": "DB",
"type": "database",
"label": "CMP-03 CSDL chính",
"sublabel": "PostgreSQL · SoT",
"pos": [
820,
300
],
"size": [
150,
60
]
},
{
"id": "QUEUE",
"type": "messagebus",
"label": "CMP-04 Hàng đợi",
"sublabel": "SQS FIFO · IF-004",
"pos": [
560,
520
],
"size": [
150,
60
]
},
{
"id": "WORKER",
"type": "backend",
"label": "CMP-05 Worker",
"sublabel": "job đối soát nền",
"pos": [
820,
520
],
"size": [
150,
60
]
},
{
"id": "POS",
"type": "external",
"label": "Hệ thống POS",
"sublabel": "đối tác · IF-005",
"pos": [
1080,
520
],
"size": [
150,
60
]
}
],
"boundaries": [
{
"kind": "region",
"label": "Vùng hệ thống của ta · ap-southeast-1",
"wraps": [
"WEB",
"API",
"DB",
"QUEUE",
"WORKER"
]
},
{
"kind": "security-group",
"label": "sg-app · chỉ nhận từ ALB",
"wraps": [
"API",
"WORKER"
]
}
],
"connections": [
{
"id": "nv-web",
"from": "NV",
"to": "WEB",
"label": "HTTPS · sync",
"variant": "emphasis"
},
{
"id": "web-api",
"from": "WEB",
"to": "API",
"label": "REST · IF-002",
"variant": "emphasis"
},
{
"id": "idp-api",
"from": "IDP",
"to": "API",
"label": "JWT · IF-001",
"variant": "security",
"labelDy": 24
},
{
"id": "api-db",
"from": "API",
"to": "DB",
"label": "SQL · sync",
"variant": "emphasis"
},
{
"id": "api-queue",
"from": "API",
"to": "QUEUE",
"label": "publish · async",
"variant": "dashed",
"labelDy": 24
},
{
"id": "queue-worker",
"from": "QUEUE",
"to": "WORKER",
"label": "consume",
"variant": "dashed"
},
{
"id": "worker-db",
"from": "WORKER",
"to": "DB",
"label": "SQL · sync",
"labelDy": -24
},
{
"id": "worker-pos",
"from": "WORKER",
"to": "POS",
"label": "REST · 3s ·×3",
"variant": "dashed"
}
],
"cards": [
{
"dot": "emerald",
"title": "Đường chính",
"items": [
"Người dùng → Web → API → CSDL chính, toàn bộ đồng bộ",
"CSDL chính là single source of truth (DAT §1)"
]
},
{
"dot": "amber",
"title": "Nhánh bất đồng bộ",
"items": [
"Đối soát nặng đẩy qua hàng đợi FIFO, worker xử lý at-least-once",
"Gọi POS ngoài có timeout 3s, retry 3 lần theo FAIL FM-05"
]
},
{
"dot": "rose",
"title": "Bảo mật",
"items": [
"IdP nội bộ phát JWT, API kiểm ở tầng service (SEC §3)",
"API và Worker nằm trong security group chỉ nhận từ ALB"
]
}
]
}

View File

@@ -0,0 +1,45 @@
{
"schema_version": 1,
"diagram_type": "sequence",
"meta": {
"title": "Luồng chính — Lưu cửa hàng có kiểm tra POS (mẫu)",
"quality_profile": "showcase",
"viewBox": [1080, 600],
"column_fit": "spread",
"views": [
{ "id": "thanh-cong", "label": "Nhánh thành công", "focus": ["U", "FE", "BE", "POS"], "note": "POS phản hồi trong 3s, hệ thống lưu và báo đã lưu." },
{ "id": "timeout", "label": "Nhánh POS timeout", "focus": ["BE", "POS", "FE", "U"], "note": "Hết 3s không có phản hồi: trả 503 E-STR-0503, giữ nguyên dữ liệu đã nhập." }
]
},
"participants": [
{ "id": "U", "type": "external", "label": "Nhân viên", "sublabel": "ROLE-01" },
{ "id": "FE", "type": "frontend", "label": "Giao diện", "sublabel": "SCR-02 Chi tiết" },
{ "id": "BE", "type": "backend", "label": "Settlement API", "sublabel": "POST /stores" },
{ "id": "POS", "type": "external", "label": "Hệ thống POS", "sublabel": "IF-005 · timeout 3s" }
],
"segments": [
{ "from": 160, "to": 300, "label": "Gửi và kiểm tra" },
{ "from": 310, "to": 400, "label": "Nhánh thành công" },
{ "from": 410, "to": 520, "label": "Nhánh POS timeout" }
],
"messages": [
{ "id": "m1", "from": "U", "to": "FE", "y": 175, "label": "Bấm Lưu", "variant": "default" },
{ "id": "m2", "from": "FE", "to": "BE", "y": 210, "label": "POST /stores", "variant": "emphasis" },
{ "id": "m3", "from": "BE", "to": "POS", "y": 250, "label": "GET /verify (timeout 3s)", "variant": "emphasis" },
{ "id": "m4", "from": "POS", "to": "BE", "y": 320, "label": "200 OK", "variant": "return" },
{ "id": "m5", "from": "BE", "to": "FE", "y": 350, "label": "200 + id", "variant": "return" },
{ "id": "m6", "from": "FE", "to": "U", "y": 380, "label": "Toast \"Đã lưu\"", "variant": "return" },
{ "id": "m7", "from": "POS", "to": "BE", "y": 430, "label": "timeout sau 3s", "variant": "dashed", "note": "FAIL FM-05" },
{ "id": "m8", "from": "BE", "to": "FE", "y": 465, "label": "503 · E-STR-0503", "variant": "return" },
{ "id": "m9", "from": "FE", "to": "U", "y": 500, "label": "Báo lỗi, GIỮ dữ liệu đã nhập", "variant": "return" }
],
"activations": [
{ "participant": "FE", "from": 170, "to": 505, "type": "frontend" },
{ "participant": "BE", "from": 205, "to": 470, "type": "backend" },
{ "participant": "POS", "from": 245, "to": 435, "type": "external" }
],
"cards": [
{ "dot": "emerald", "title": "Thành công", "items": ["POS trả 200 trong 3s, API lưu và trả id", "Giao diện hiện toast theo UICONV §7"] },
{ "dot": "rose", "title": "Lỗi", "items": ["Timeout 3s là ngân sách theo FAIL §2, không tự đặt", "503 E-STR-0503 cho thử lại, dữ liệu đã nhập không mất (W4)"] }
]
}