@longph2102/v-flow 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/AGENTS.md +265 -0
  2. package/CHANGELOG.md +318 -0
  3. package/LICENSE +21 -0
  4. package/README.md +326 -0
  5. package/agents/ba-agent.md +437 -0
  6. package/agents/ba-critic-agent.md +156 -0
  7. package/agents/ba-to-ptyc-agent.md +112 -0
  8. package/agents/bugfix-analyst-agent.md +221 -0
  9. package/agents/constitute-agent.md +155 -0
  10. package/agents/help-agent.md +168 -0
  11. package/agents/implement-agent.md +220 -0
  12. package/agents/import-ba-docs-agent.md +164 -0
  13. package/agents/master-check-agent.md +228 -0
  14. package/agents/metrics-agent.md +180 -0
  15. package/agents/operations-agent.md +123 -0
  16. package/agents/plan-agent.md +218 -0
  17. package/agents/prototype-agent.md +191 -0
  18. package/agents/retrospective-agent.md +196 -0
  19. package/agents/review-agent.md +210 -0
  20. package/agents/sprint-agent.md +191 -0
  21. package/agents/status-agent.md +186 -0
  22. package/agents/sync-agent.md +201 -0
  23. package/agents/test-agent.md +166 -0
  24. package/agents/understand-agent.md +339 -0
  25. package/cli/commands/check.js +96 -0
  26. package/cli/commands/dev-quiz.js +107 -0
  27. package/cli/commands/doctor.js +348 -0
  28. package/cli/commands/feature.js +259 -0
  29. package/cli/commands/hooks.js +163 -0
  30. package/cli/commands/init.js +189 -0
  31. package/cli/commands/log.js +199 -0
  32. package/cli/commands/plugin.js +230 -0
  33. package/cli/commands/score-card.js +203 -0
  34. package/cli/commands/status.js +269 -0
  35. package/cli/commands/sync.js +59 -0
  36. package/cli/commands/upgrade.js +150 -0
  37. package/cli/commands/validate.js +1259 -0
  38. package/cli/commands/watch.js +151 -0
  39. package/cli/index.js +46 -0
  40. package/cli/lib/ac-test-gate.js +89 -0
  41. package/cli/lib/activity-log.js +209 -0
  42. package/cli/lib/cli-error.js +183 -0
  43. package/cli/lib/constitution-lint.js +561 -0
  44. package/cli/lib/dev-quiz-grade.js +127 -0
  45. package/cli/lib/governance.js +78 -0
  46. package/cli/lib/hook-targets.js +167 -0
  47. package/cli/lib/i18n.js +375 -0
  48. package/cli/lib/knowledge-oracle.js +379 -0
  49. package/cli/lib/logger.js +203 -0
  50. package/cli/lib/module-card-lint.js +304 -0
  51. package/cli/lib/module-card-score.js +223 -0
  52. package/cli/lib/plugins.js +481 -0
  53. package/cli/lib/scanner.js +692 -0
  54. package/cli/lib/sync-core.js +232 -0
  55. package/cli/lib/sync-targets.js +84 -0
  56. package/cli/lib/templates.js +268 -0
  57. package/cli/lib/yaml-parser.js +203 -0
  58. package/commands/v.ba-critic.md +101 -0
  59. package/commands/v.ba-to-ptyc.md +71 -0
  60. package/commands/v.bugfix.md +86 -0
  61. package/commands/v.check.md +131 -0
  62. package/commands/v.constitute.md +87 -0
  63. package/commands/v.constitution.md +84 -0
  64. package/commands/v.fork.md +127 -0
  65. package/commands/v.help.md +73 -0
  66. package/commands/v.hotfix.md +200 -0
  67. package/commands/v.implement.md +92 -0
  68. package/commands/v.import-ba-docs.md +222 -0
  69. package/commands/v.metrics.md +74 -0
  70. package/commands/v.operations.md +70 -0
  71. package/commands/v.plan.md +78 -0
  72. package/commands/v.prototype.md +121 -0
  73. package/commands/v.quickfix.md +169 -0
  74. package/commands/v.retrospective.md +80 -0
  75. package/commands/v.review.md +78 -0
  76. package/commands/v.rewind.md +127 -0
  77. package/commands/v.specify.md +118 -0
  78. package/commands/v.sprint.md +75 -0
  79. package/commands/v.status.md +62 -0
  80. package/commands/v.sync.md +81 -0
  81. package/commands/v.test.md +67 -0
  82. package/commands/v.understand.md +112 -0
  83. package/package.json +65 -0
  84. package/skills/_shared/constitution-reader/SKILL.md +109 -0
  85. package/skills/_shared/constitution-reader/config.json +52 -0
  86. package/skills/_shared/constitution-reader/examples/good/b1-phase-output.md +48 -0
  87. package/skills/_shared/constitution-reader/gotchas.md +46 -0
  88. package/skills/_shared/context-reader/SKILL.md +111 -0
  89. package/skills/_shared/context-reader/config.json +54 -0
  90. package/skills/_shared/context-reader/examples/good/legacy-nodejs-output.md +35 -0
  91. package/skills/_shared/context-reader/gotchas.md +49 -0
  92. package/skills/_shared/ears-notation/SKILL.md +63 -0
  93. package/skills/_shared/ears-notation/config.json +55 -0
  94. package/skills/_shared/ears-notation/examples/good/plan-test-interpretation.md +29 -0
  95. package/skills/_shared/ears-notation/gotchas.md +43 -0
  96. package/skills/check/cross-validator/SKILL.md +206 -0
  97. package/skills/check/cross-validator/config.json +33 -0
  98. package/skills/check/cross-validator/examples/good/validation-report-pass-with-concerns.md +105 -0
  99. package/skills/check/cross-validator/gotchas.md +43 -0
  100. package/skills/implement/constitution-enforcer/SKILL.md +134 -0
  101. package/skills/implement/constitution-enforcer/config.json +16 -0
  102. package/skills/implement/constitution-enforcer/examples/bad/vague-report.md +42 -0
  103. package/skills/implement/constitution-enforcer/examples/good/compliance-report.md +57 -0
  104. package/skills/implement/constitution-enforcer/gotchas.md +26 -0
  105. package/skills/implement/constitution-enforcer/scripts/check-constitution.sh +88 -0
  106. package/skills/implement/no-go-zone-guard/SKILL.md +173 -0
  107. package/skills/implement/no-go-zone-guard/config.json +28 -0
  108. package/skills/implement/no-go-zone-guard/examples/good/adapter-workaround.md +46 -0
  109. package/skills/implement/no-go-zone-guard/gotchas.md +27 -0
  110. package/skills/implement/no-go-zone-guard/scripts/check-nogo-zones.sh +148 -0
  111. package/skills/implement/no-go-zone-guard/scripts/nogo-precommit.sh +96 -0
  112. package/skills/implement/tdd-driver/SKILL.md +159 -0
  113. package/skills/implement/tdd-driver/config.json +33 -0
  114. package/skills/implement/tdd-driver/examples/good/tdd-cycle-product-repo.md +81 -0
  115. package/skills/implement/tdd-driver/gotchas.md +34 -0
  116. package/skills/metrics/metrics-collector/SKILL.md +133 -0
  117. package/skills/metrics/metrics-collector/config.json +16 -0
  118. package/skills/metrics/metrics-collector/examples/bad/incomplete-report.md +48 -0
  119. package/skills/metrics/metrics-collector/examples/good/full-metrics-report.md +101 -0
  120. package/skills/metrics/metrics-collector/gotchas.md +26 -0
  121. package/skills/operations/incident-runbook/SKILL.md +167 -0
  122. package/skills/operations/incident-runbook/config.json +21 -0
  123. package/skills/operations/incident-runbook/examples/bad/vague-incident-report.md +48 -0
  124. package/skills/operations/incident-runbook/examples/good/p1-hotfix-response.md +119 -0
  125. package/skills/operations/incident-runbook/gotchas.md +26 -0
  126. package/skills/plan/architecture-designer/SKILL.md +228 -0
  127. package/skills/plan/architecture-designer/config.json +32 -0
  128. package/skills/plan/architecture-designer/examples/bad/vague-plan.md +62 -0
  129. package/skills/plan/architecture-designer/examples/good/expand-contract-migration.md +56 -0
  130. package/skills/plan/architecture-designer/examples/good/plan-structure.md +58 -0
  131. package/skills/plan/architecture-designer/gotchas.md +45 -0
  132. package/skills/plan/task-breakdown/SKILL.md +208 -0
  133. package/skills/plan/task-breakdown/config.json +26 -0
  134. package/skills/plan/task-breakdown/examples/bad/vague-tasks.md +77 -0
  135. package/skills/plan/task-breakdown/examples/good/spike-clarify-tasks.md +66 -0
  136. package/skills/plan/task-breakdown/examples/good/tasks-login-feature.md +111 -0
  137. package/skills/plan/task-breakdown/gotchas.md +39 -0
  138. package/skills/prototype/LOGIC.md +240 -0
  139. package/skills/prototype/SKILL.md +185 -0
  140. package/skills/prototype/UI.md +407 -0
  141. package/skills/prototype/config.json +104 -0
  142. package/skills/prototype/examples/bad/prototype-notes.md +68 -0
  143. package/skills/prototype/examples/good/prototype-notes-ui.md +109 -0
  144. package/skills/prototype/examples/good/prototype-notes.md +67 -0
  145. package/skills/prototype/gotchas.md +128 -0
  146. package/skills/prototype/scripts/check-flow-state.ps1 +112 -0
  147. package/skills/prototype/scripts/check-flow-state.sh +104 -0
  148. package/skills/prototype/scripts/check-prototype-cleanup.ps1 +124 -0
  149. package/skills/prototype/scripts/check-prototype-cleanup.sh +109 -0
  150. package/skills/prototype/scripts/check-prototype-notes.ps1 +107 -0
  151. package/skills/prototype/scripts/check-prototype-notes.sh +102 -0
  152. package/skills/review/adversarial-reviewer/SKILL.md +137 -0
  153. package/skills/review/adversarial-reviewer/config.json +32 -0
  154. package/skills/review/adversarial-reviewer/examples/good/review-report-template.md +56 -0
  155. package/skills/review/adversarial-reviewer/gotchas.md +46 -0
  156. package/skills/review/adversarial-reviewer/scripts/quick-security-scan.sh +52 -0
  157. package/skills/specify/ba-bpmn-doc-gen/SKILL.md +108 -0
  158. package/skills/specify/ba-bpmn-doc-gen/reference/reference-bpmn-generation.md +528 -0
  159. package/skills/specify/ba-bpmn-doc-gen/reference/reference-drawio-flowchart.md +466 -0
  160. package/skills/specify/ba-critic/SKILL.md +172 -0
  161. package/skills/specify/ba-critic/config.json +32 -0
  162. package/skills/specify/ba-critic/examples/good/critic-report-round1.md +51 -0
  163. package/skills/specify/ba-critic/gotchas.md +40 -0
  164. package/skills/specify/ba-critic/scripts/check-spec-quality.sh +72 -0
  165. package/skills/specify/ba-doc-generator/SKILL.md +102 -0
  166. package/skills/specify/ba-doc-generator/references/template-clevel.md +84 -0
  167. package/skills/specify/ba-doc-generator/references/template-compliance.md +83 -0
  168. package/skills/specify/ba-doc-generator/references/template-dev.md +138 -0
  169. package/skills/specify/ba-doc-generator/references/template-partner.md +167 -0
  170. package/skills/specify/ba-doc-generator/references/template-pm.md +92 -0
  171. package/skills/specify/ba-doc-generator/references/template-review.md +114 -0
  172. package/skills/specify/ba-doc-generator/references/template-tester.md +108 -0
  173. package/skills/specify/ba-doc-generator/references/template-user.md +98 -0
  174. package/skills/specify/bugfix-analyst/SKILL.md +296 -0
  175. package/skills/specify/bugfix-analyst/config.json +41 -0
  176. package/skills/specify/bugfix-analyst/examples/bad/common-mistakes.md +71 -0
  177. package/skills/specify/bugfix-analyst/examples/good/email-validation-bugfix.md +53 -0
  178. package/skills/specify/bugfix-analyst/gotchas.md +51 -0
  179. package/skills/specify/ears-writer/SKILL.md +129 -0
  180. package/skills/specify/ears-writer/config.json +20 -0
  181. package/skills/specify/ears-writer/examples/bad/common-mistakes.md +17 -0
  182. package/skills/specify/ears-writer/examples/good/login-requirements.md +41 -0
  183. package/skills/specify/ears-writer/gotchas.md +43 -0
  184. package/skills/specify/ears-writer/scripts/check-ears-compliance.sh +51 -0
  185. package/skills/test/test-case-generator/SKILL.md +161 -0
  186. package/skills/test/test-case-generator/config.json +33 -0
  187. package/skills/test/test-case-generator/examples/good/test-cases-login.md +104 -0
  188. package/skills/test/test-case-generator/gotchas.md +43 -0
  189. package/skills/understand/ba-docs-scanner/SKILL.md +239 -0
  190. package/skills/understand/ba-docs-scanner/config.json +47 -0
  191. package/skills/understand/ba-docs-scanner/examples/good/work-order-br-extract.md +28 -0
  192. package/skills/understand/ba-docs-scanner/gotchas.md +44 -0
  193. package/skills/understand/ba-docs-scanner/merge-rules.md +47 -0
  194. package/skills/understand/codebase-scanner/SKILL.md +260 -0
  195. package/skills/understand/codebase-scanner/config.json +56 -0
  196. package/skills/understand/codebase-scanner/examples/good/menu-module-output.md +44 -0
  197. package/skills/understand/codebase-scanner/gotchas.md +42 -0
  198. package/skills/understand/codebase-scanner/scripts/scan-project-structure.sh +64 -0
  199. package/templates/DESIGN.md +456 -0
  200. package/templates/agent-command-template.yaml +240 -0
  201. package/templates/agent-config-template.md +170 -0
  202. package/templates/agent-definition-template.md +145 -0
  203. package/templates/agent-metrics-template.md +150 -0
  204. package/templates/api-contract-template.md +72 -0
  205. package/templates/bugfix-report-template.md +195 -0
  206. package/templates/bugfix-spec-template.md +134 -0
  207. package/templates/code-review-report-template.md +119 -0
  208. package/templates/constitution-template.md +234 -0
  209. package/templates/context-template.md +94 -0
  210. package/templates/data-model-template.md +95 -0
  211. package/templates/decision-log-template.md +92 -0
  212. package/templates/flow-state-template.yaml +208 -0
  213. package/templates/github/workflows/v-flow-validate.yml +30 -0
  214. package/templates/knowledge/adr-template.md +70 -0
  215. package/templates/knowledge/api-contract-template.md +140 -0
  216. package/templates/knowledge/domain-glossary.md +29 -0
  217. package/templates/knowledge/golden-tests-readme.md +115 -0
  218. package/templates/knowledge/lessons-learned.md +41 -0
  219. package/templates/knowledge/patterns.md +103 -0
  220. package/templates/module-card/SKILL.md +85 -0
  221. package/templates/module-card/api-specs.md +96 -0
  222. package/templates/module-card/business-quiz.md +119 -0
  223. package/templates/module-card/cross-service.md +125 -0
  224. package/templates/module-card/db.md +85 -0
  225. package/templates/module-card/dev-quiz.md +62 -0
  226. package/templates/module-card/permissions.md +83 -0
  227. package/templates/module-card/state-diagram.md +64 -0
  228. package/templates/module-card/tech-context.md +90 -0
  229. package/templates/module-card/ui-flows.md +91 -0
  230. package/templates/module-card/use-cases.md +142 -0
  231. package/templates/module-template.yaml +161 -0
  232. package/templates/operations-report-template.md +108 -0
  233. package/templates/plan-template.md +308 -0
  234. package/templates/prototype-notes-template.md +116 -0
  235. package/templates/ptyc/PTYC.template.docx +0 -0
  236. package/templates/ptyc/ptyc.meta.example.yaml +44 -0
  237. package/templates/retrospective-report-template.md +136 -0
  238. package/templates/security-review-template.md +84 -0
  239. package/templates/session-template.md +167 -0
  240. package/templates/spec-review-log-template.md +75 -0
  241. package/templates/spec-template.md +229 -0
  242. package/templates/sprint-status-template.md +101 -0
  243. package/templates/tasks-template.md +275 -0
  244. package/templates/test-cases-template.md +124 -0
  245. package/templates/ux-checklist-template.md +79 -0
  246. package/templates/validation-report-template.md +125 -0
  247. package/templates/vflow-config-template.yaml +22 -0
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: ba-bpmn-doc-gen
3
+ description: "Skill chuyên nghiệp tạo sơ đồ quy trình nghiệp vụ, hỗ trợ hai định dạng output: BPMN Mermaid (Markdown) và Flowchart Draw.io XML."
4
+ ---
5
+
6
+ # HƯỚNG DẪN SKILL: BA BPMN DOC GEN
7
+
8
+ **Version:** 1.3.2
9
+ **Author:** M2MBA
10
+ **Last Updated:** 2026-04-10
11
+ **Description:** Skill chuyên nghiệp tạo sơ đồ quy trình nghiệp vụ, hỗ trợ hai định dạng output: BPMN Mermaid (Markdown) và Flowchart Draw.io XML. Chỉ tập trung vẽ sơ đồ trực quan, không mô tả chi tiết.
12
+
13
+ ## 🎯 Mục đích
14
+ Skill chuyên dùng để chuyển đổi các mô tả quy trình thô (văn bản hoặc hình ảnh) thành sơ đồ quy trình chuyên nghiệp. Output RẤT TẬP TRUNG vào việc sinh ra biểu diễn trực quan (Mermaid hoặc Draw.io XML), TUYỆT ĐỐI KHÔNG sinh bảng mô tả, không giải thích dài dòng.
15
+
16
+ **✨ Features:**
17
+ - ✅ **Dual Format Output**: Hỗ trợ BPMN Mermaid (Markdown) hoặc Flowchart Draw.io XML.
18
+ - ✅ **Task Numbering**: Tự động đánh số "[STT]. [Tên]" cho mọi node.
19
+ - ✅ **Confirmation Workflow**: Phân tích và xác nhận cấu trúc trước khi sinh file.
20
+ - ✅ **Tối giản hóa thông minh**: Đề xuất gộp các bước quá chi tiết để quy trình gọn gọn.
21
+ - ✅ **Multiple End Events**: Mỗi nhánh có kết thúc riêng, tránh rối luồng.
22
+ - ✅ **Swimlanes Layout**: Tự động phân tách Lane theo Actor.
23
+
24
+ ---
25
+
26
+ ## 📋 Quy trình thực hiện (4 Phases)
27
+
28
+ ### 🎛️ PHASE 0: CHỌN FORMAT OUTPUT
29
+
30
+ **DỪNG LẠI** và hỏi user ngay khi nhận yêu cầu:
31
+
32
+ > 🖼️ Bạn muốn tạo sơ đồ theo dạng nào?
33
+ > - **[A] BPMN**: Hiển thị trực tiếp trong Markdown, phù hợp với VS Code, GitHub.
34
+ > - **[B] Flowchart Draw.io**: File `.drawio` import vào draw.io, hình thang ngược cho task thủ công.
35
+
36
+ **Lưu kết quả lựa chọn** vào biến `OUTPUT_FORMAT`:
37
+ - Nếu chọn A hoặc "BPMN" → `OUTPUT_FORMAT = "BPMN"`
38
+ - Nếu chọn B hoặc "draw.io" hoặc "flowchart" → `OUTPUT_FORMAT = "DRAWIO"`
39
+
40
+ ---
41
+
42
+ ### 📝 PHASE 1: ANALYZE & CONFIRM
43
+
44
+ #### 1.1. Phân tích Input
45
+ - **Actors/Lanes**: Xác định ai thực hiện (Nhân viên, Hệ thống, Kế toán...).
46
+ - **Tasks**: Động từ + Danh từ. Bắt buộc format: `[STT]. [Tên task]`.
47
+ - **Gateways**: Điểm quyết định (Nếu/Thì).
48
+ - **Phân loại**:
49
+ - **Thủ công (Manual)** 🖐️: Không qua hệ thống (ký giấy, kiểm tra vật lý).
50
+ - **Hệ thống (System/User)** 👤: Thao tác trên phần mềm hoặc hệ thống tự động.
51
+
52
+ #### 1.2. Tạo Bảng Xác Nhận (Confirmation Table)
53
+ Show bảng này cho user review:
54
+ | Bước | Tên | Lane | Loại Notation | Ghi chú |
55
+ |------|-----|------|---------------|---------|
56
+ | 1 | 1. Kiểm tra giấy tờ | Nhân viên | Manual Task 🖐️ | ... |
57
+
58
+ #### 1.3. Quy tắc Tối Giản Hóa
59
+ - **Rule 1**: Gộp các bước tuần tự đơn giản (mở file, kiểm tra nhỏ) thành 1 task lớn.
60
+ - **Rule 2**: Gộp các bước setup/chuẩn bị.
61
+ - **Rule 3**: KHÔNG gộp các điểm quyết định, phê duyệt hoặc handoff giữa các actor.
62
+
63
+ ---
64
+
65
+ ### 👤 PHASE 2: USER INTERACTION
66
+ - **DỪNG LẠI** và chờ User xác nhận Table ở Phase 1.
67
+ - Nếu User yêu cầu sửa, cập nhật lại Table cho đến khi được duyệt ("OK", "Generate").
68
+
69
+ ---
70
+
71
+ ### 🎨 PHASE 3: GENERATE DOCUMENTATION
72
+
73
+ #### 3.1. Phân nhánh theo OUTPUT_FORMAT
74
+
75
+ **Nếu `OUTPUT_FORMAT = "BPMN"`** → Xem `reference-bpmn-generation.md`:
76
+ - Sinh `flowchart LR` Mermaid với `subgraph` cho từng Lane.
77
+ - Quy ước: `((Start/End))`, `[Task]`, `{Gateway}`.
78
+ - Xuất file `.md` chỉ chứa duy nhất code block Sơ đồ Mermaid (không có bảng mô tả).
79
+
80
+ **Nếu `OUTPUT_FORMAT = "DRAWIO"`** → Xem `reference-drawio-flowchart.md`:
81
+ - **Lane dọc (mặc định — swimlane theo cột actor):** Pool dùng `childLayout=stackLayout` + **`horizontal=1`**. Mỗi lane: `width=400`, `x = lane_index × 400`, `y=0`, **cùng `height`** = chiều cao pool. **Luồng tuần tự trong một lane đi theo trục Y** (Start → Task → … → End), **không** xếp nối tiếp các bước cùng lane theo trục X.
82
+ - **Tránh nhầm:** `horizontal=0` trên pool → các lane thành **dải ngang** (Học viên / Hệ thống / … chồng theo hàng), luồng chính đi trái–phải — **chỉ dùng khi user/stakeholder yêu cầu rõ** dạng đó.
83
+ - Task thủ công 🖐️ → hình thang ngược (`flipV=1`). Task hệ thống 👤⚙️ → rectangle bo góc.
84
+ - **BẮT BUỘC** `edges` nối đủ node; cạnh **giữa hai lane kề** dùng `exitX` / `entryX` (trái–phải) hoặc `exitY` / `entryY` (trên–dưới) như bảng trong reference §3.6.
85
+ - File `.drawio` giao cho dự án: bọc `<mxfile>` → `<diagram>` → `<mxGraphModel>` (để mở trực tiếp bằng diagrams.net).
86
+
87
+ #### 3.2. Cấu trúc file output
88
+ - Chỉ bao gồm nội dung sơ đồ (code Mermaid hoặc thẻ XML của Draw.io).
89
+ - TUYỆT ĐỐI KHÔNG xuất văn bản giới thiệu, bảng mô tả các bước hay bất kỳ text nào ngoài lề.
90
+
91
+ ---
92
+
93
+ ## 🛠 Nguyên tắc thiết kế (Best Practices)
94
+ - **Compact Layout**: Spacing vừa phải, không để diagram quá dài.
95
+ - **Multiple End Events**: Mỗi nhánh rẽ thất bại/hoàn thành nên có Node End riêng.
96
+ - **Naming**: Luôn dùng [Động từ] + [Danh từ] cho Task.
97
+
98
+ ## 📂 Danh mục Reference & Scripts
99
+ - [reference-bpmn-generation.md](file:///e:/Training%20Project/Skill%20BA%20gg%20Antigravity/.agent/skills/ba-bpmn-doc-gen/reference/reference-bpmn-generation.md): Quy tắc chi tiết về layout, mapping và cấu trúc BPMN XML/Mermaid.
100
+ - [reference-drawio-flowchart.md](file:///e:/Training%20Project/Skill%20BA%20gg%20Antigravity/.agent/skills/ba-bpmn-doc-gen/reference/reference-drawio-flowchart.md): Quy tắc sinh Draw.io XML (mxGraphModel), shapes, layout và naming convention.
101
+
102
+ ## 📂 Output File
103
+ - Thư mục: `docs-BA/Processes/` (tạo nếu chưa có).
104
+ - **BPMN format**: `ba-bpmn-doc-[tên_quy_trình].md` (chỉ chứa block code Mermaid).
105
+ - **Draw.io format**: `ba-bpmn-doc-[tên_quy_trình]-flowchart.drawio`
106
+
107
+ ---
108
+
@@ -0,0 +1,528 @@
1
+ ---
2
+ Version: 1.2.0
3
+ Author: M2MBA
4
+ Last Updated: 2026-03-06
5
+ Description: Tài liệu reference chi tiết đầy đủ về quy tắc phân tích, layout, sinh XML và Mermaid cho quy trình BPMN. Dùng kèm với ba-bpmn-doc-gen SKILL.md.
6
+ ---
7
+
8
+ # Reference: Quy tắc sinh BPMN (BPMN Generation Rules v2.4.0)
9
+
10
+ Tài liệu này tổng hợp toàn bộ quy tắc kỹ thuật và thuật toán để sinh sơ đồ BPMN từ template gốc (V2.4.0), hỗ trợ Agent trong việc phân tích, confirm cấu trúc, thiết kế layout và sinh file kết quả.
11
+
12
+ ---
13
+
14
+ ## 1. Phân tích Input (Phase 1)
15
+
16
+ ### 1.1. Xác định các thành phần
17
+
18
+ **Actors/Lanes - Ai thực hiện?**
19
+ - Tìm: "Nhân viên", "Trưởng phòng", "Hệ thống", "Kế toán"
20
+ - Mỗi actor = 1 lane
21
+
22
+ **Tasks - Làm gì?**
23
+ - Động từ + danh từ: "Lập đơn", "Phê duyệt", "Kiểm tra"
24
+ - **QUAN TRỌNG**: Task name phải có số thứ tự ở đầu
25
+ - Format: `[STT]. [Tên task]`
26
+ - Ví dụ: "1. Kiểm tra giấy tờ", "2. Nhập thông tin", "3. Gửi email"
27
+ - Phân loại:
28
+ - **Manual Task** (🖐️): User làm thủ công, không qua hệ thống
29
+ - Ví dụ: "1. Kiểm tra giấy tờ vật lý", "2. Ký tên trên giấy"
30
+ - **User Task** (👤): User làm trên hệ thống
31
+ - Ví dụ: "3. Nhập đơn vào phần mềm", "4. Phê duyệt qua app"
32
+ - **Service Task** (⚙️): Hệ thống tự động xử lý
33
+ - Ví dụ: "5. Gửi email tự động", "6. Tính toán phí"
34
+
35
+ **Gateways - Decision points**
36
+ - "Nếu... thì...", "Có... không?"
37
+ - Exclusive Gateway (XOR): Chọn 1 nhánh
38
+ - Parallel Gateway (AND): Xử lý đồng thời
39
+
40
+ **Events - Bắt đầu/Kết thúc**
41
+ - Start Event: "Bắt đầu", "Khởi tạo"
42
+ - End Event: "Hoàn tất", "Từ chối", "Hủy"
43
+
44
+ **Flows - Luồng xử lý**
45
+ - Sequence: A → B → C
46
+ - Conditional: "Nếu CÓ", "Nếu KHÔNG"
47
+ - Loop: "Quay lại bước..."
48
+
49
+ ---
50
+
51
+ ### 1.2. Tạo Bảng Xác Nhận (Confirmation Table)
52
+
53
+ Format chuẩn để show cho User review:
54
+
55
+ ```markdown
56
+ ## 📋 Xác nhận cấu trúc BPMN
57
+
58
+ Tôi đã phân tích quy trình của bạn. Đây là structure đề xuất:
59
+
60
+ | Bước | Tên | Lane | Loại Notation | Ghi chú |
61
+ |------|-----|------|---------------|---------|
62
+ | 1 | 1. Kiểm tra giấy tờ | Nhân viên | Manual Task 🖐️ | Kiểm tra vật lý |
63
+ | 2 | 2. Nhập thông tin | Nhân viên | User Task 👤 | Nhập vào hệ thống |
64
+ | 3 | 3. Gửi email | Hệ thống | Service Task ⚙️ | Tự động |
65
+
66
+ **Loại Task:**
67
+ - 🖐️ **Manual Task**: Thủ công, không qua hệ thống
68
+ - 👤 **User Task**: User thao tác trên hệ thống
69
+ - ⚙️ **Service Task**: Hệ thống tự động
70
+
71
+ **📊 Tổng quan:**
72
+ - Số lanes: X
73
+ - Số tasks: Y
74
+ - Số gateways: Z
75
+ - Độ phức tạp: [Simple/Medium/Complex]
76
+
77
+ **❓ Xác nhận:**
78
+ Bạn có đồng ý với structure này không? Hoặc cần điều chỉnh gì?
79
+ ```
80
+
81
+ ---
82
+
83
+ ### 1.3. Quy tắc Tối Giản Hóa
84
+
85
+ **Rule 1: Gộp bước tuần tự đơn giản**
86
+
87
+ ❌ Quá chi tiết:
88
+ ```
89
+ 1. Mở file Excel
90
+ 2. Kiểm tra sao kê
91
+ 3. Đối chiếu mã GD
92
+ 4. Mapping trong file
93
+ 5. Xác nhận thanh toán
94
+ ```
95
+
96
+ ✅ Tối giản:
97
+ ```
98
+ 1. Xác nhận thanh toán
99
+ Ghi chú: Bao gồm kiểm tra sao kê, đối chiếu mã GD trong Excel
100
+ ```
101
+
102
+ **Rule 2: Gộp các task setup/chuẩn bị**
103
+
104
+ ❌ Quá chi tiết:
105
+ ```
106
+ 1. Tạo Google Form
107
+ 2. Thiết kế trường input
108
+ 3. Chia sẻ link
109
+ 4. Phát tán qua email
110
+ 5. Phát tán qua Zalo
111
+ ```
112
+
113
+ ✅ Tối giản:
114
+ ```
115
+ 1. Thu thập đơn đăng ký
116
+ Ghi chú: Tạo và phát tán form qua email/Zalo
117
+ ```
118
+
119
+ **Rule 3: KHÔNG gộp các bước quan trọng**
120
+
121
+ ✅ PHẢI giữ nguyên:
122
+ - Decision points (gateways)
123
+ - Phê duyệt/chấp thuận
124
+ - Handoff giữa actors
125
+ - Các điểm có thể fail/retry
126
+ - Bước cần tracking/audit
127
+
128
+ **Rule 4: Multiple End Events - Mỗi nhánh End riêng**
129
+
130
+ ❌ SAI - Merge về 1 End chung (làm rối):
131
+ ```
132
+ Gateway → Nhánh A → ... → quay vòng về End chung
133
+ → Nhánh B → ... → quay vòng về End chung
134
+ ```
135
+
136
+ ✅ ĐÚNG - Mỗi nhánh có End riêng:
137
+ ```
138
+ Gateway → Nhánh A → End Event (Hoàn tất)
139
+ → Nhánh B → End Event (Không đủ điều kiện)
140
+ → Nhánh C → End Event (Từ chối)
141
+ ```
142
+
143
+ Lý do: Tránh sequence flow quay vòng, làm diagram rối và khó đọc.
144
+
145
+ ---
146
+
147
+ ## 2. Thuật toán Layout & Positioning (Cho BPMN XML / Mermaid)
148
+
149
+ ### 2.1. Pool & Lane Dimensions
150
+
151
+ - **Chiều cao Lane**: `Height = 200 + (số_row - 1) × 120`
152
+ - Lane có nhiều tasks: chiều cao lớn hơn
153
+ - Lane ít tasks: chiều cao nhỏ hơn
154
+ - **Chiều dài (Width) - Tự động**:
155
+ - Tìm element xa nhất theo chiều ngang (x-coordinate)
156
+ - `Pool width = maxX + padding (200px)`
157
+ - Công thức: `Width = (lastElementX + lastElementWidth + 200)`
158
+ - Ví dụ: Element cuối ở x=3000, width=120 → Pool width = 3000 + 120 + 200 = 3320
159
+
160
+ ### 2.2. Element Sizing
161
+
162
+ | Element | Width | Height |
163
+ |---------|-------|--------|
164
+ | Task | 120px | 80px |
165
+ | Gateway | 50px | 50px |
166
+ | Start Event | r=18px | r=18px |
167
+ | End Event | r=18px | r=18px |
168
+
169
+ - Horizontal spacing: **170px** giữa các elements
170
+ - Vertical spacing: **120px** giữa các rows
171
+
172
+ ### 2.3. Multiple End Events Layout
173
+
174
+ - Mỗi nhánh từ Gateway đi đến End riêng.
175
+ - KHÔNG merge nhiều nhánh về 1 End chung.
176
+ - **Tránh chồng chéo flows**:
177
+ - End Events "Không đạt" PHẢI đặt OFFSET SANG PHẢI so với Gateway
178
+ - Flow từ Gateway → phải đi ngang sang phải trước, rồi mới đi xuống End Event
179
+
180
+ ```
181
+ Gateway (x=1000)
182
+ ├─→ Flow "Đạt": đi thẳng xuống lane khác (x=1000)
183
+ └─→ Flow "Không đạt": đi ngang sang phải (x=1080), rồi xuống End Event (x=1080)
184
+ ```
185
+
186
+ **Công thức vị trí End Event:**
187
+ - `End_X = Gateway_X + 80px`
188
+ - `End_Y = Gateway_Y + 140px`
189
+ - Tên End Event phải mô tả outcome: "Hoàn tất", "Từ chối", "Không đủ điều kiện"
190
+
191
+ ---
192
+
193
+ ### 2.4. Quy tắc chống chồng chéo qua Lane (Cross-Lane Anti-Overlap Rule)
194
+
195
+ > 🚨 **Đây là quy tắc bắt buộc** — vi phạm sẽ tạo ra đường nối đi xuyên qua shape của task khác.
196
+
197
+ **Vấn đề:** Khi một flow đi qua **nhiều hơn 1 lane** (ví dụ: BQL → CuDan → BaoVe), đường thẳng đứng nối `T6 → T7` sẽ đi xuyên qua lane BQL — nếu có một task ở lane BQL tại cùng cột X, đường nối sẽ bị chồng lên trên task đó.
198
+
199
+ **Quy tắc đặt vị trí:**
200
+
201
+ | Tình huống | Hành động |
202
+ |------------|-----------|
203
+ | `A (lane 2) → B (lane 1) → C (lane 3)`: B và A cùng cột X → C **phải** ở cột X mới (lệch phải) | Tạo cột mới cho C: `C_X = B_X + col_spacing` |
204
+ | `A (lane 2) → B (lane 1) → C (lane 3)`: B và A **khác** cột X → C có thể cùng cột với B | Không cần lệch |
205
+ | Flow dọc đi qua lane trung gian có shape ở cùng cột | Thêm waypoint "hành lang" giữa 2 cột để tránh shape |
206
+
207
+ **Ví dụ thực tế (quy trình chung cư):**
208
+ ```
209
+ ❌ SAI - T5, T6, T7 cùng cột X=740:
210
+ Col X=740: T5(BQL), T6(CuDan), T7(BaoVe)
211
+ → Flow T6→T7 đi thẳng đứng qua BQL tại x=740, đè lên T5!
212
+
213
+ ✅ ĐÚNG - Tách T6, T7 sang cột riêng:
214
+ Col X=890: T5(BQL) ← cột E
215
+ Col X=975: hành lang routing ← khoảng trống giữa E và F
216
+ Col X=1060: T6(CuDan) + T7(BaoVe) ← cột F
217
+ → Flow T5→T6 dùng hành lang x=975 (không đè shape)
218
+ → Flow T6→T7 thẳng đứng tại x=1060 (không có shape nào ở cùng cột tại BQL)
219
+ ```
220
+
221
+ **Thuật toán kiểm tra:**
222
+ ```
223
+ FOR mỗi flow (source → target) cần đi qua ≥1 lane trung gian:
224
+ intermediate_lanes = get_lanes_between(source.lane, target.lane)
225
+ FOR mỗi lane_X trong intermediate_lanes:
226
+ Nếu TỒN TẠI task/gateway trong lane_X có cùng X-column với source:
227
+ → target phải được đặt ở X-column MỚI (source_col + 1)
228
+ → Dùng waypoint "hành lang" để routing edge tránh shapes
229
+ ELSE:
230
+ → target có thể dùng cùng X-column với source
231
+ ```
232
+
233
+ **Waypoint hành lang (khi cần lệch):**
234
+ ```xml
235
+ <!-- Ví dụ: T5(BQL, x=890) → T6(CuDan, x=1060) qua hành lang x=975 -->
236
+ <bpmndi:BPMNEdge bpmnElement="Flow_T5_T6">
237
+ <di:waypoint x="950" y="518" /> <!-- right edge of T5 -->
238
+ <di:waypoint x="975" y="518" /> <!-- enter hành lang (giữa 2 cột) -->
239
+ <di:waypoint x="975" y="218" /> <!-- đi lên theo hành lang -->
240
+ <di:waypoint x="1000" y="218" /> <!-- vào left edge of T6 -->
241
+ </bpmndi:BPMNEdge>
242
+ ```
243
+
244
+
245
+ **Pool Width Auto-Calculation (Pseudo-code):**
246
+ ```javascript
247
+ let maxX = 0;
248
+ elements.forEach(el => {
249
+ const elementRightEdge = el.x + el.width;
250
+ if (elementRightEdge > maxX) maxX = elementRightEdge;
251
+ });
252
+ const poolWidth = maxX - poolStartX + 200; // 200px padding
253
+ ```
254
+
255
+ ---
256
+
257
+ ## 3. Cấu trúc BPMN XML (Generate BPMN File)
258
+
259
+ ```xml
260
+ <?xml version="1.0" encoding="UTF-8"?>
261
+ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
262
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
263
+ xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
264
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
265
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
266
+ targetNamespace="http://bpmn.io/schema/bpmn"
267
+ id="Definitions_[TenQuyTrinh]">
268
+
269
+ <bpmn:collaboration id="Collaboration_1">
270
+ <bpmn:participant id="Participant_Pool"
271
+ name="[Tên quy trình]"
272
+ processRef="Process_1" />
273
+ </bpmn:collaboration>
274
+
275
+ <bpmn:process id="Process_1" isExecutable="false">
276
+ <bpmn:laneSet>
277
+ <bpmn:lane id="Lane_1" name="[Actor 1]">
278
+ <bpmn:flowNodeRef>Task_1</bpmn:flowNodeRef>
279
+ </bpmn:lane>
280
+ <bpmn:lane id="Lane_2" name="[Actor 2]">
281
+ <bpmn:flowNodeRef>Task_2</bpmn:flowNodeRef>
282
+ </bpmn:lane>
283
+ </bpmn:laneSet>
284
+
285
+ <!-- Tasks với NUMBERED names -->
286
+ <bpmn:manualTask id="Task_1" name="1. Kiểm tra giấy tờ">
287
+ <bpmn:documentation>Kiểm tra hồ sơ vật lý, xác minh chứng từ gốc</bpmn:documentation>
288
+ <bpmn:incoming>Flow_1</bpmn:incoming>
289
+ <bpmn:outgoing>Flow_2</bpmn:outgoing>
290
+ </bpmn:manualTask>
291
+
292
+ <bpmn:userTask id="Task_2" name="2. Nhập thông tin">
293
+ <bpmn:documentation>Nhập thông tin vào hệ thống quản lý</bpmn:documentation>
294
+ <bpmn:incoming>Flow_2</bpmn:incoming>
295
+ <bpmn:outgoing>Flow_3</bpmn:outgoing>
296
+ </bpmn:userTask>
297
+
298
+ <!-- Exclusive Gateway -->
299
+ <bpmn:exclusiveGateway id="Gateway_1" name="[Câu hỏi?]">
300
+ <bpmn:incoming>Flow_3</bpmn:incoming>
301
+ <bpmn:outgoing>Flow_Yes</bpmn:outgoing>
302
+ <bpmn:outgoing>Flow_No</bpmn:outgoing>
303
+ </bpmn:exclusiveGateway>
304
+
305
+ <!-- Multiple End Events -->
306
+ <bpmn:endEvent id="End_Success" name="Hoàn tất">
307
+ <bpmn:incoming>Flow_Yes</bpmn:incoming>
308
+ </bpmn:endEvent>
309
+
310
+ <bpmn:endEvent id="End_Reject" name="Từ chối">
311
+ <bpmn:incoming>Flow_No</bpmn:incoming>
312
+ </bpmn:endEvent>
313
+
314
+ <!-- Sequence Flows -->
315
+ <bpmn:sequenceFlow id="Flow_Yes" name="Có"
316
+ sourceRef="Gateway_1" targetRef="End_Success" />
317
+ <bpmn:sequenceFlow id="Flow_No" name="Không"
318
+ sourceRef="Gateway_1" targetRef="End_Reject" />
319
+ </bpmn:process>
320
+
321
+ <!-- Diagram Interchange (DI) for layout -->
322
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
323
+ <bpmndi:BPMNPlane bpmnElement="Collaboration_1">
324
+ <bpmndi:BPMNShape bpmnElement="Participant_Pool" isHorizontal="true">
325
+ <dc:Bounds x="160" y="80" width="[width]" height="[height]" />
326
+ </bpmndi:BPMNShape>
327
+ <bpmndi:BPMNShape bpmnElement="Lane_1" isHorizontal="true">
328
+ <dc:Bounds x="190" y="80" width="[width]" height="[height]" />
329
+ </bpmndi:BPMNShape>
330
+ <bpmndi:BPMNShape bpmnElement="Task_1">
331
+ <dc:Bounds x="[x]" y="[y]" width="120" height="80" />
332
+ </bpmndi:BPMNShape>
333
+ <bpmndi:BPMNShape bpmnElement="End_Success">
334
+ <dc:Bounds x="[x]" y="[y]" width="36" height="36" />
335
+ </bpmndi:BPMNShape>
336
+ <bpmndi:BPMNEdge bpmnElement="Flow_Yes">
337
+ <di:waypoint x="[x1]" y="[y1]" />
338
+ <di:waypoint x="[x2]" y="[y2]" />
339
+ </bpmndi:BPMNEdge>
340
+ </bpmndi:BPMNPlane>
341
+ </bpmndi:BPMNDiagram>
342
+ </bpmn:definitions>
343
+ ```
344
+
345
+ ---
346
+
347
+ ## 4. Quy tắc Sinh SVG & Icons
348
+
349
+ ### 4.1. Font Styling (Bắt buộc áp dụng cho TẤT CẢ text)
350
+
351
+ - **Font size**: 16px
352
+ - **Font weight**: bold (700)
353
+ - **Font family**: 'Arial', 'Segoe UI', sans-serif
354
+
355
+ Ví dụ:
356
+ ```xml
357
+ <text x="[x]" y="[y]" font-size="16" font-weight="bold"
358
+ font-family="Arial, sans-serif" text-anchor="middle" fill="#000">
359
+ 1. Kiểm tra giấy tờ
360
+ </text>
361
+ ```
362
+
363
+ ### 4.2. Icons (PHẢI là SVG path, KHÔNG dùng emoji text)
364
+
365
+ **Manual Task - Hand Icon 🖐️** (đặt tại góc trên trái task: x+5, y+5):
366
+ ```xml
367
+ <g transform="translate([taskX+5], [taskY+5])">
368
+ <rect width="20" height="20" fill="white" stroke="none" opacity="0.8"/>
369
+ <!-- Palm -->
370
+ <rect x="6" y="8" width="8" height="8" fill="none" stroke="#333" stroke-width="1.5"/>
371
+ <!-- Fingers -->
372
+ <line x1="7" y1="8" x2="7" y2="4" stroke="#333" stroke-width="1.5"/>
373
+ <line x1="10" y1="8" x2="10" y2="3" stroke="#333" stroke-width="1.5"/>
374
+ <line x1="13" y1="8" x2="13" y2="4" stroke="#333" stroke-width="1.5"/>
375
+ <!-- Thumb -->
376
+ <line x1="6" y1="10" x2="3" y2="10" stroke="#333" stroke-width="1.5"/>
377
+ </g>
378
+ ```
379
+
380
+ **User Task - Person Icon 👤** (đặt tại góc trên trái task: x+5, y+5):
381
+ ```xml
382
+ <g transform="translate([taskX+5], [taskY+5])">
383
+ <rect width="20" height="20" fill="white" stroke="none" opacity="0.8"/>
384
+ <circle cx="10" cy="6" r="3" fill="none" stroke="#333" stroke-width="1.5"/>
385
+ <path d="M 10 9 L 10 14" stroke="#333" stroke-width="1.5" stroke-linecap="round"/>
386
+ <path d="M 6 11 L 10 10 L 14 11" stroke="#333" stroke-width="1.5" stroke-linecap="round"/>
387
+ <path d="M 10 14 L 7 18 M 10 14 L 13 18" stroke="#333" stroke-width="1.5" stroke-linecap="round"/>
388
+ </g>
389
+ ```
390
+
391
+ **Service Task - Gear Icon ⚙️** (đặt tại góc trên trái task: x+5, y+5):
392
+ ```xml
393
+ <g transform="translate([taskX+5], [taskY+5])">
394
+ <rect width="20" height="20" fill="white" stroke="none" opacity="0.8"/>
395
+ <path d="M 10 3 L 11 6 L 14 6 L 13 9 L 16 11 L 13 13 L 14 16 L 11 16 L 10 19 L 9 16 L 6 16 L 7 13 L 4 11 L 7 9 L 6 6 L 9 6 Z"
396
+ fill="none" stroke="#333" stroke-width="1.5" stroke-linejoin="miter"/>
397
+ <circle cx="10" cy="11" r="3" fill="none" stroke="#333" stroke-width="1.5"/>
398
+ </g>
399
+ ```
400
+
401
+ ### 4.3. Ví dụ hoàn chỉnh - Manual Task trong SVG
402
+
403
+ ```xml
404
+ <!-- Task rectangle -->
405
+ <rect x="300" y="150" width="120" height="80"
406
+ fill="#fff" stroke="#333" stroke-width="2" rx="10" ry="10"/>
407
+
408
+ <!-- Icon hand - góc trên trái -->
409
+ <g transform="translate(305, 155)">
410
+ <rect width="20" height="20" fill="white" stroke="none" opacity="0.8"/>
411
+ <rect x="6" y="8" width="8" height="8" fill="none" stroke="#333" stroke-width="1.5"/>
412
+ <line x1="7" y1="8" x2="7" y2="4" stroke="#333" stroke-width="1.5"/>
413
+ <line x1="10" y1="8" x2="10" y2="3" stroke="#333" stroke-width="1.5"/>
414
+ <line x1="13" y1="8" x2="13" y2="4" stroke="#333" stroke-width="1.5"/>
415
+ <line x1="6" y1="10" x2="3" y2="10" stroke="#333" stroke-width="1.5"/>
416
+ </g>
417
+
418
+ <!-- Task name - centered -->
419
+ <text x="360" y="195" font-size="16" font-weight="bold"
420
+ font-family="Arial, sans-serif" text-anchor="middle" fill="#000">
421
+ 1. Kiểm tra giấy tờ
422
+ </text>
423
+ ```
424
+
425
+ ---
426
+
427
+ ## 5. Cấu trúc File HTML (Tùy chọn, nếu Agent cần sinh HTML)
428
+
429
+ ```html
430
+ <!DOCTYPE html>
431
+ <html lang="vi">
432
+ <head>
433
+ <meta charset="UTF-8">
434
+ <title>[Tên Quy Trình]</title>
435
+ <style>
436
+ * { box-sizing: border-box; margin: 0; padding: 0; }
437
+ body { font-family: 'Segoe UI', sans-serif; background: #f5f5f5; color: #333; }
438
+ .container { max-width: 1400px; margin: 0 auto; padding: 20px; background: white; }
439
+ h1 { color: #2c3e50; border-bottom: 3px solid #3498db; padding-bottom: 15px; margin-bottom: 30px; }
440
+ .diagram-container { text-align: center; margin: 30px 0; padding: 20px;
441
+ background: #fafafa; border-radius: 8px; overflow-x: auto; }
442
+ table { width: 100%; border-collapse: collapse; margin: 20px 0; }
443
+ th { background-color: #3498db; color: white; padding: 12px; text-align: left; }
444
+ td { padding: 10px; border: 1px solid #ddd; }
445
+ tr:nth-child(even) { background-color: #f9f9f9; }
446
+ tr:hover { background-color: #f0f8ff; }
447
+ .badge { display: inline-block; padding: 4px 10px; border-radius: 12px;
448
+ font-size: 12px; font-weight: 600; }
449
+ .badge-manual { background: #fff3e0; color: #e65100; }
450
+ .badge-user { background: #e3f2fd; color: #1976d2; }
451
+ .badge-service{ background: #f3e5f5; color: #7b1fa2; }
452
+ .badge-decision{ background: #fff9c4; color: #f57f17; }
453
+ </style>
454
+ </head>
455
+ <body>
456
+ <div class="container">
457
+ <h1>[Tên Quy Trình]</h1>
458
+
459
+ <h2>Quy trình dạng hình</h2>
460
+ <div class="diagram-container">
461
+ <!-- Nhúng SVG trực tiếp ở đây (sau khi user confirm OK) -->
462
+ <!-- Hoặc dùng placeholder nếu chưa có SVG -->
463
+ </div>
464
+
465
+ <h2>Bảng mô tả quy trình</h2>
466
+ <table>
467
+ <thead>
468
+ <tr>
469
+ <th>Bước</th>
470
+ <th>Tên bước</th>
471
+ <th>Mô tả</th>
472
+ <th>Thực hiện thủ công/hệ thống</th>
473
+ </tr>
474
+ </thead>
475
+ <tbody>
476
+ <!-- Rows -->
477
+ <tr>
478
+ <td>1</td>
479
+ <td>1. Kiểm tra giấy tờ</td>
480
+ <td>Kiểm tra hồ sơ vật lý, xác minh chứng từ gốc</td>
481
+ <td><span class="badge badge-manual">Thủ công 🖐️</span></td>
482
+ </tr>
483
+ </tbody>
484
+ </table>
485
+ </div>
486
+ </body>
487
+ </html>
488
+ ```
489
+
490
+ > **Ghi chú**: Badge classes:
491
+ > - `badge-manual` → Thủ công 🖐️ (Manual Task)
492
+ > - `badge-user` → Hệ thống 👤 (User Task)
493
+ > - `badge-service` → Tự động ⚙️ (Service Task)
494
+ > - `badge-decision` → Quyết định (Gateway)
495
+
496
+ ---
497
+
498
+ ## 6. Cấu trúc File Markdown Output
499
+
500
+ ```markdown
501
+ # [Tên Quy Trình]
502
+
503
+ ## 1. Quy trình dạng hình
504
+
505
+ ```mermaid
506
+ flowchart LR
507
+ subgraph Actor_1 ["Nhân viên"]
508
+ S((Bắt đầu)) --> T1[1. Kiểm tra giấy tờ]
509
+ T1 --> T2[2. Nhập thông tin]
510
+ end
511
+ subgraph Actor_2 ["Trưởng phòng"]
512
+ T2 --> G1{Duyệt?}
513
+ G1 -- Có --> E1((Hoàn tất))
514
+ G1 -- Không --> E2((Từ chối))
515
+ end
516
+ ```
517
+
518
+ ## 2. Bảng mô tả quy trình
519
+
520
+ | Bước | Tên bước | Mô tả | Thực hiện thủ công/hệ thống |
521
+ |------|----------|-------|------------------------------|
522
+ | 1 | 1. Kiểm tra giấy tờ | Kiểm tra hồ sơ vật lý | Thủ công 🖐️ |
523
+ | 2 | 2. Nhập thông tin | Nhập vào phần mềm | Hệ thống 👤 |
524
+ ```
525
+
526
+ ---
527
+ > Version: 1.2.0 | Author: M2MBA | Last Updated: 2026-03-06
528
+ > Reference cho skill: ba-bpmn-doc-gen