@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.
- package/AGENTS.md +265 -0
- package/CHANGELOG.md +318 -0
- package/LICENSE +21 -0
- package/README.md +326 -0
- package/agents/ba-agent.md +437 -0
- package/agents/ba-critic-agent.md +156 -0
- package/agents/ba-to-ptyc-agent.md +112 -0
- package/agents/bugfix-analyst-agent.md +221 -0
- package/agents/constitute-agent.md +155 -0
- package/agents/help-agent.md +168 -0
- package/agents/implement-agent.md +220 -0
- package/agents/import-ba-docs-agent.md +164 -0
- package/agents/master-check-agent.md +228 -0
- package/agents/metrics-agent.md +180 -0
- package/agents/operations-agent.md +123 -0
- package/agents/plan-agent.md +218 -0
- package/agents/prototype-agent.md +191 -0
- package/agents/retrospective-agent.md +196 -0
- package/agents/review-agent.md +210 -0
- package/agents/sprint-agent.md +191 -0
- package/agents/status-agent.md +186 -0
- package/agents/sync-agent.md +201 -0
- package/agents/test-agent.md +166 -0
- package/agents/understand-agent.md +339 -0
- package/cli/commands/check.js +96 -0
- package/cli/commands/dev-quiz.js +107 -0
- package/cli/commands/doctor.js +348 -0
- package/cli/commands/feature.js +259 -0
- package/cli/commands/hooks.js +163 -0
- package/cli/commands/init.js +189 -0
- package/cli/commands/log.js +199 -0
- package/cli/commands/plugin.js +230 -0
- package/cli/commands/score-card.js +203 -0
- package/cli/commands/status.js +269 -0
- package/cli/commands/sync.js +59 -0
- package/cli/commands/upgrade.js +150 -0
- package/cli/commands/validate.js +1259 -0
- package/cli/commands/watch.js +151 -0
- package/cli/index.js +46 -0
- package/cli/lib/ac-test-gate.js +89 -0
- package/cli/lib/activity-log.js +209 -0
- package/cli/lib/cli-error.js +183 -0
- package/cli/lib/constitution-lint.js +561 -0
- package/cli/lib/dev-quiz-grade.js +127 -0
- package/cli/lib/governance.js +78 -0
- package/cli/lib/hook-targets.js +167 -0
- package/cli/lib/i18n.js +375 -0
- package/cli/lib/knowledge-oracle.js +379 -0
- package/cli/lib/logger.js +203 -0
- package/cli/lib/module-card-lint.js +304 -0
- package/cli/lib/module-card-score.js +223 -0
- package/cli/lib/plugins.js +481 -0
- package/cli/lib/scanner.js +692 -0
- package/cli/lib/sync-core.js +232 -0
- package/cli/lib/sync-targets.js +84 -0
- package/cli/lib/templates.js +268 -0
- package/cli/lib/yaml-parser.js +203 -0
- package/commands/v.ba-critic.md +101 -0
- package/commands/v.ba-to-ptyc.md +71 -0
- package/commands/v.bugfix.md +86 -0
- package/commands/v.check.md +131 -0
- package/commands/v.constitute.md +87 -0
- package/commands/v.constitution.md +84 -0
- package/commands/v.fork.md +127 -0
- package/commands/v.help.md +73 -0
- package/commands/v.hotfix.md +200 -0
- package/commands/v.implement.md +92 -0
- package/commands/v.import-ba-docs.md +222 -0
- package/commands/v.metrics.md +74 -0
- package/commands/v.operations.md +70 -0
- package/commands/v.plan.md +78 -0
- package/commands/v.prototype.md +121 -0
- package/commands/v.quickfix.md +169 -0
- package/commands/v.retrospective.md +80 -0
- package/commands/v.review.md +78 -0
- package/commands/v.rewind.md +127 -0
- package/commands/v.specify.md +118 -0
- package/commands/v.sprint.md +75 -0
- package/commands/v.status.md +62 -0
- package/commands/v.sync.md +81 -0
- package/commands/v.test.md +67 -0
- package/commands/v.understand.md +112 -0
- package/package.json +65 -0
- package/skills/_shared/constitution-reader/SKILL.md +109 -0
- package/skills/_shared/constitution-reader/config.json +52 -0
- package/skills/_shared/constitution-reader/examples/good/b1-phase-output.md +48 -0
- package/skills/_shared/constitution-reader/gotchas.md +46 -0
- package/skills/_shared/context-reader/SKILL.md +111 -0
- package/skills/_shared/context-reader/config.json +54 -0
- package/skills/_shared/context-reader/examples/good/legacy-nodejs-output.md +35 -0
- package/skills/_shared/context-reader/gotchas.md +49 -0
- package/skills/_shared/ears-notation/SKILL.md +63 -0
- package/skills/_shared/ears-notation/config.json +55 -0
- package/skills/_shared/ears-notation/examples/good/plan-test-interpretation.md +29 -0
- package/skills/_shared/ears-notation/gotchas.md +43 -0
- package/skills/check/cross-validator/SKILL.md +206 -0
- package/skills/check/cross-validator/config.json +33 -0
- package/skills/check/cross-validator/examples/good/validation-report-pass-with-concerns.md +105 -0
- package/skills/check/cross-validator/gotchas.md +43 -0
- package/skills/implement/constitution-enforcer/SKILL.md +134 -0
- package/skills/implement/constitution-enforcer/config.json +16 -0
- package/skills/implement/constitution-enforcer/examples/bad/vague-report.md +42 -0
- package/skills/implement/constitution-enforcer/examples/good/compliance-report.md +57 -0
- package/skills/implement/constitution-enforcer/gotchas.md +26 -0
- package/skills/implement/constitution-enforcer/scripts/check-constitution.sh +88 -0
- package/skills/implement/no-go-zone-guard/SKILL.md +173 -0
- package/skills/implement/no-go-zone-guard/config.json +28 -0
- package/skills/implement/no-go-zone-guard/examples/good/adapter-workaround.md +46 -0
- package/skills/implement/no-go-zone-guard/gotchas.md +27 -0
- package/skills/implement/no-go-zone-guard/scripts/check-nogo-zones.sh +148 -0
- package/skills/implement/no-go-zone-guard/scripts/nogo-precommit.sh +96 -0
- package/skills/implement/tdd-driver/SKILL.md +159 -0
- package/skills/implement/tdd-driver/config.json +33 -0
- package/skills/implement/tdd-driver/examples/good/tdd-cycle-product-repo.md +81 -0
- package/skills/implement/tdd-driver/gotchas.md +34 -0
- package/skills/metrics/metrics-collector/SKILL.md +133 -0
- package/skills/metrics/metrics-collector/config.json +16 -0
- package/skills/metrics/metrics-collector/examples/bad/incomplete-report.md +48 -0
- package/skills/metrics/metrics-collector/examples/good/full-metrics-report.md +101 -0
- package/skills/metrics/metrics-collector/gotchas.md +26 -0
- package/skills/operations/incident-runbook/SKILL.md +167 -0
- package/skills/operations/incident-runbook/config.json +21 -0
- package/skills/operations/incident-runbook/examples/bad/vague-incident-report.md +48 -0
- package/skills/operations/incident-runbook/examples/good/p1-hotfix-response.md +119 -0
- package/skills/operations/incident-runbook/gotchas.md +26 -0
- package/skills/plan/architecture-designer/SKILL.md +228 -0
- package/skills/plan/architecture-designer/config.json +32 -0
- package/skills/plan/architecture-designer/examples/bad/vague-plan.md +62 -0
- package/skills/plan/architecture-designer/examples/good/expand-contract-migration.md +56 -0
- package/skills/plan/architecture-designer/examples/good/plan-structure.md +58 -0
- package/skills/plan/architecture-designer/gotchas.md +45 -0
- package/skills/plan/task-breakdown/SKILL.md +208 -0
- package/skills/plan/task-breakdown/config.json +26 -0
- package/skills/plan/task-breakdown/examples/bad/vague-tasks.md +77 -0
- package/skills/plan/task-breakdown/examples/good/spike-clarify-tasks.md +66 -0
- package/skills/plan/task-breakdown/examples/good/tasks-login-feature.md +111 -0
- package/skills/plan/task-breakdown/gotchas.md +39 -0
- package/skills/prototype/LOGIC.md +240 -0
- package/skills/prototype/SKILL.md +185 -0
- package/skills/prototype/UI.md +407 -0
- package/skills/prototype/config.json +104 -0
- package/skills/prototype/examples/bad/prototype-notes.md +68 -0
- package/skills/prototype/examples/good/prototype-notes-ui.md +109 -0
- package/skills/prototype/examples/good/prototype-notes.md +67 -0
- package/skills/prototype/gotchas.md +128 -0
- package/skills/prototype/scripts/check-flow-state.ps1 +112 -0
- package/skills/prototype/scripts/check-flow-state.sh +104 -0
- package/skills/prototype/scripts/check-prototype-cleanup.ps1 +124 -0
- package/skills/prototype/scripts/check-prototype-cleanup.sh +109 -0
- package/skills/prototype/scripts/check-prototype-notes.ps1 +107 -0
- package/skills/prototype/scripts/check-prototype-notes.sh +102 -0
- package/skills/review/adversarial-reviewer/SKILL.md +137 -0
- package/skills/review/adversarial-reviewer/config.json +32 -0
- package/skills/review/adversarial-reviewer/examples/good/review-report-template.md +56 -0
- package/skills/review/adversarial-reviewer/gotchas.md +46 -0
- package/skills/review/adversarial-reviewer/scripts/quick-security-scan.sh +52 -0
- package/skills/specify/ba-bpmn-doc-gen/SKILL.md +108 -0
- package/skills/specify/ba-bpmn-doc-gen/reference/reference-bpmn-generation.md +528 -0
- package/skills/specify/ba-bpmn-doc-gen/reference/reference-drawio-flowchart.md +466 -0
- package/skills/specify/ba-critic/SKILL.md +172 -0
- package/skills/specify/ba-critic/config.json +32 -0
- package/skills/specify/ba-critic/examples/good/critic-report-round1.md +51 -0
- package/skills/specify/ba-critic/gotchas.md +40 -0
- package/skills/specify/ba-critic/scripts/check-spec-quality.sh +72 -0
- package/skills/specify/ba-doc-generator/SKILL.md +102 -0
- package/skills/specify/ba-doc-generator/references/template-clevel.md +84 -0
- package/skills/specify/ba-doc-generator/references/template-compliance.md +83 -0
- package/skills/specify/ba-doc-generator/references/template-dev.md +138 -0
- package/skills/specify/ba-doc-generator/references/template-partner.md +167 -0
- package/skills/specify/ba-doc-generator/references/template-pm.md +92 -0
- package/skills/specify/ba-doc-generator/references/template-review.md +114 -0
- package/skills/specify/ba-doc-generator/references/template-tester.md +108 -0
- package/skills/specify/ba-doc-generator/references/template-user.md +98 -0
- package/skills/specify/bugfix-analyst/SKILL.md +296 -0
- package/skills/specify/bugfix-analyst/config.json +41 -0
- package/skills/specify/bugfix-analyst/examples/bad/common-mistakes.md +71 -0
- package/skills/specify/bugfix-analyst/examples/good/email-validation-bugfix.md +53 -0
- package/skills/specify/bugfix-analyst/gotchas.md +51 -0
- package/skills/specify/ears-writer/SKILL.md +129 -0
- package/skills/specify/ears-writer/config.json +20 -0
- package/skills/specify/ears-writer/examples/bad/common-mistakes.md +17 -0
- package/skills/specify/ears-writer/examples/good/login-requirements.md +41 -0
- package/skills/specify/ears-writer/gotchas.md +43 -0
- package/skills/specify/ears-writer/scripts/check-ears-compliance.sh +51 -0
- package/skills/test/test-case-generator/SKILL.md +161 -0
- package/skills/test/test-case-generator/config.json +33 -0
- package/skills/test/test-case-generator/examples/good/test-cases-login.md +104 -0
- package/skills/test/test-case-generator/gotchas.md +43 -0
- package/skills/understand/ba-docs-scanner/SKILL.md +239 -0
- package/skills/understand/ba-docs-scanner/config.json +47 -0
- package/skills/understand/ba-docs-scanner/examples/good/work-order-br-extract.md +28 -0
- package/skills/understand/ba-docs-scanner/gotchas.md +44 -0
- package/skills/understand/ba-docs-scanner/merge-rules.md +47 -0
- package/skills/understand/codebase-scanner/SKILL.md +260 -0
- package/skills/understand/codebase-scanner/config.json +56 -0
- package/skills/understand/codebase-scanner/examples/good/menu-module-output.md +44 -0
- package/skills/understand/codebase-scanner/gotchas.md +42 -0
- package/skills/understand/codebase-scanner/scripts/scan-project-structure.sh +64 -0
- package/templates/DESIGN.md +456 -0
- package/templates/agent-command-template.yaml +240 -0
- package/templates/agent-config-template.md +170 -0
- package/templates/agent-definition-template.md +145 -0
- package/templates/agent-metrics-template.md +150 -0
- package/templates/api-contract-template.md +72 -0
- package/templates/bugfix-report-template.md +195 -0
- package/templates/bugfix-spec-template.md +134 -0
- package/templates/code-review-report-template.md +119 -0
- package/templates/constitution-template.md +234 -0
- package/templates/context-template.md +94 -0
- package/templates/data-model-template.md +95 -0
- package/templates/decision-log-template.md +92 -0
- package/templates/flow-state-template.yaml +208 -0
- package/templates/github/workflows/v-flow-validate.yml +30 -0
- package/templates/knowledge/adr-template.md +70 -0
- package/templates/knowledge/api-contract-template.md +140 -0
- package/templates/knowledge/domain-glossary.md +29 -0
- package/templates/knowledge/golden-tests-readme.md +115 -0
- package/templates/knowledge/lessons-learned.md +41 -0
- package/templates/knowledge/patterns.md +103 -0
- package/templates/module-card/SKILL.md +85 -0
- package/templates/module-card/api-specs.md +96 -0
- package/templates/module-card/business-quiz.md +119 -0
- package/templates/module-card/cross-service.md +125 -0
- package/templates/module-card/db.md +85 -0
- package/templates/module-card/dev-quiz.md +62 -0
- package/templates/module-card/permissions.md +83 -0
- package/templates/module-card/state-diagram.md +64 -0
- package/templates/module-card/tech-context.md +90 -0
- package/templates/module-card/ui-flows.md +91 -0
- package/templates/module-card/use-cases.md +142 -0
- package/templates/module-template.yaml +161 -0
- package/templates/operations-report-template.md +108 -0
- package/templates/plan-template.md +308 -0
- package/templates/prototype-notes-template.md +116 -0
- package/templates/ptyc/PTYC.template.docx +0 -0
- package/templates/ptyc/ptyc.meta.example.yaml +44 -0
- package/templates/retrospective-report-template.md +136 -0
- package/templates/security-review-template.md +84 -0
- package/templates/session-template.md +167 -0
- package/templates/spec-review-log-template.md +75 -0
- package/templates/spec-template.md +229 -0
- package/templates/sprint-status-template.md +101 -0
- package/templates/tasks-template.md +275 -0
- package/templates/test-cases-template.md +124 -0
- package/templates/ux-checklist-template.md +79 -0
- package/templates/validation-report-template.md +125 -0
- package/templates/vflow-config-template.yaml +22 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
---
|
|
2
|
+
Version: 1.1.0
|
|
3
|
+
Author: M2MBA
|
|
4
|
+
Last Updated: 2026-04-10
|
|
5
|
+
Description: Quy tắc sinh file Draw.io XML (mxGraphModel format) cho quy trình nghiệp vụ dạng Flowchart. Dùng kèm với ba-bpmn-doc-gen SKILL.md khi user chọn output format là Flowchart.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Reference: Sinh Draw.io Flowchart XML (Flowchart Generation Rules v1.1.0)
|
|
9
|
+
|
|
10
|
+
Tài liệu này mô tả toàn bộ quy tắc kỹ thuật để sinh file Draw.io XML (`.drawio`) từ quy trình nghiệp vụ. Output có thể import trực tiếp vào draw.io web/app.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Điểm khác biệt so với BPMN
|
|
15
|
+
|
|
16
|
+
| Tiêu chí | BPMN (XML) | Flowchart (Draw.io) |
|
|
17
|
+
|----------|------------|---------------------|
|
|
18
|
+
| Task thủ công | Icon 🖐️ trong box | Hình thang ngược (inverted trapezoid) |
|
|
19
|
+
| Task hệ thống | Icon 👤 trong box | Rectangle bo góc |
|
|
20
|
+
| Format | BPMN 2.0 XML | mxGraphModel XML |
|
|
21
|
+
| Tool xem | bpmn.io, Camunda, VS Code | draw.io web/app |
|
|
22
|
+
| Output file | `.bpmn` | `.drawio` hoặc `.xml` |
|
|
23
|
+
| Edges | Có trong XML | **CÓ generate edges** — sinh đầy đủ đường nối |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2. Cấu trúc XML Draw.io
|
|
28
|
+
|
|
29
|
+
### 2.1. Root Structure
|
|
30
|
+
|
|
31
|
+
```xml
|
|
32
|
+
<mxGraphModel dx="786" dy="417" grid="1" gridSize="10" guides="1"
|
|
33
|
+
tooltips="1" connect="1" arrows="1" fold="1" page="1"
|
|
34
|
+
pageScale="1" pageWidth="[width]" pageHeight="[height]"
|
|
35
|
+
math="0" shadow="0">
|
|
36
|
+
<root>
|
|
37
|
+
<mxCell id="0" />
|
|
38
|
+
<mxCell id="1" parent="0" />
|
|
39
|
+
<!-- Pool, Lanes, Tasks, Gateways, Events -->
|
|
40
|
+
</root>
|
|
41
|
+
</mxGraphModel>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> **File giao cho dự án (`.drawio`):** Bọc `<mxfile …>` → `<diagram id="…" name="…">` → `<mxGraphModel>…</mxGraphModel>` → `</diagram></mxfile>` để **File → Open** trên [diagrams.net](https://app.diagrams.net/) hoạt động ổn định. Fragment chỉ có `mxGraphModel` chỉ dùng khi embed nội bộ.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### 2.2. Pool — lane dọc theo actor (**MẶC ĐỊNH**)
|
|
49
|
+
|
|
50
|
+
Mỗi actor một **cột** (vertical swimlane); luồng nghiệp vụ trong lane đi **từ trên xuống** (tăng `y`).
|
|
51
|
+
|
|
52
|
+
```xml
|
|
53
|
+
<mxCell id="pool-1" parent="1"
|
|
54
|
+
style="swimlane;html=1;childLayout=stackLayout;horizontal=1;resizeParent=1;resizeParentMax=0;startSize=30;whiteSpace=wrap;"
|
|
55
|
+
value="[Tên Quy trình]" vertex="1">
|
|
56
|
+
<mxGeometry width="[số_lane × 400]" height="[chiều_cao_pool]" as="geometry" />
|
|
57
|
+
</mxCell>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- **`horizontal=1`**: các lane con xếp **theo trục X** (cột 0, 400, 800, …) — đây là layout chuẩn skill **ba-bpmn-doc-gen**.
|
|
61
|
+
- `width` = `số_lane × 400` (px). `height` = đủ chứa chuỗi task theo **Y** trong lane cao nhất + `startSize` pool + padding (~50px).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### 2.3. Lane (cột actor — cùng `height`, tăng `x`)
|
|
66
|
+
|
|
67
|
+
```xml
|
|
68
|
+
<mxCell id="lane-pool-1-1" parent="pool-1"
|
|
69
|
+
style="swimlane;html=1;startSize=25;whiteSpace=wrap;"
|
|
70
|
+
value="[Tên Actor]" vertex="1">
|
|
71
|
+
<mxGeometry x="[lane_index × 400]" y="0" width="400" height="[cùng_height_với_pool_trừ_header]" as="geometry" />
|
|
72
|
+
</mxCell>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Tọa độ X tăng dần 400px (lane 1 trái → lane N phải):**
|
|
76
|
+
```
|
|
77
|
+
Lane 1: x=0, width=400
|
|
78
|
+
Lane 2: x=400, width=400
|
|
79
|
+
Lane 3: x=800, width=400
|
|
80
|
+
Lane 4: x=1200, width=400
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**KHÔNG** đặt nhiều bước tuần tự cùng lane bằng cách tăng `x` (trái–phải). Trong **một** lane, bước nối tiếp dùng **cùng `x` gần giữa lane (~120–150)** và **tăng `y`** (khoảng cách gợi ý xem §3.2).
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### 2.3b. Pool — lane ngang (**chỉ khi user yêu cầu**)
|
|
88
|
+
|
|
89
|
+
Nếu stakeholder muốn mỗi actor một **dải ngang** (luồng chính trái–phải trong từng hàng):
|
|
90
|
+
|
|
91
|
+
- Pool: `horizontal=0` (và thường `width` lớn theo chiều ngang, mỗi lane một **hàng** `height` cố định ~180–220px).
|
|
92
|
+
- Lane: `y = lane_index × height_row`, `width` = gần full pool width.
|
|
93
|
+
|
|
94
|
+
**Mặc định skill không dùng** biến thể này — tránh nhầm với layout lane dọc §2.2.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### 2.4. Start Event
|
|
99
|
+
|
|
100
|
+
```xml
|
|
101
|
+
<mxCell id="start-1" parent="lane-pool-1-1"
|
|
102
|
+
style="strokeWidth=2;html=1;shape=mxgraph.flowchart.start_1;whiteSpace=wrap;"
|
|
103
|
+
value="Start" vertex="1">
|
|
104
|
+
<mxGeometry height="60" width="100" x="150" y="60" as="geometry" />
|
|
105
|
+
</mxCell>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- **Label**: Chỉ hiển thị `"Start"` — KHÔNG có số thứ tự, KHÔNG có tên bước.
|
|
109
|
+
- **Vị trí**: `y = 50–80px` (sát đầu lane), `x = ~150px` (căn giữa lane 400px).
|
|
110
|
+
- Nối tới **Task 1** (bước đầu tiên trong quy trình).
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 2.5. Task — Thủ công (Inverted Trapezoid)
|
|
115
|
+
|
|
116
|
+
Dùng cho các bước **không qua hệ thống** (ký giấy, kiểm tra vật lý, gặp mặt...).
|
|
117
|
+
|
|
118
|
+
```xml
|
|
119
|
+
<mxCell id="task-1" parent="lane-pool-1-1"
|
|
120
|
+
style="verticalLabelPosition=middle;verticalAlign=middle;html=1;shape=trapezoid;
|
|
121
|
+
perimeter=trapezoidPerimeter;whiteSpace=wrap;size=0.23;arcSize=10;
|
|
122
|
+
flipV=1;labelPosition=center;align=center;fontStyle=1;fontSize=14;"
|
|
123
|
+
value="1. [Tên task]" vertex="1">
|
|
124
|
+
<mxGeometry x="120" y="[y]" width="160" height="110" as="geometry" />
|
|
125
|
+
</mxCell>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Key styles:**
|
|
129
|
+
- `shape=trapezoid` + `flipV=1` → Hình thang ngược ▽
|
|
130
|
+
- `fontStyle=1;fontSize=14` → Chữ đậm, cỡ 14
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### 2.6. Task — Hệ thống (Rectangle)
|
|
135
|
+
|
|
136
|
+
Dùng cho **User Task** (user thao tác trên hệ thống) và **Service Task** (hệ thống tự động).
|
|
137
|
+
|
|
138
|
+
```xml
|
|
139
|
+
<mxCell id="task-2" parent="lane-pool-1-1"
|
|
140
|
+
style="rounded=1;whiteSpace=wrap;html=1;fontStyle=1;fontSize=14;"
|
|
141
|
+
value="2. [Tên task]" vertex="1">
|
|
142
|
+
<mxGeometry x="120" y="[y]" width="160" height="110" as="geometry" />
|
|
143
|
+
</mxCell>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Key styles:**
|
|
147
|
+
- `rounded=1` → Rectangle bo góc
|
|
148
|
+
- `fontStyle=1;fontSize=14` → Chữ đậm, cỡ 14
|
|
149
|
+
- Nền mặc định trắng — KHÔNG thêm `fillColor`.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### 2.7. Gateway (Decision Node)
|
|
154
|
+
|
|
155
|
+
```xml
|
|
156
|
+
<mxCell id="gateway-1" parent="lane-pool-1-1"
|
|
157
|
+
style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;"
|
|
158
|
+
value="[Câu hỏi quyết định?]" vertex="1">
|
|
159
|
+
<mxGeometry x="[x]" y="[y]" width="100" height="100" as="geometry" />
|
|
160
|
+
</mxCell>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Khi nào cần Gateway:**
|
|
164
|
+
- ✅ Cần: Điều kiện phức tạp, người đọc cần được làm rõ (phê duyệt, kiểm tra điều kiện, v.v.)
|
|
165
|
+
- ❌ Không cần: Luồng hiển nhiên, người đọc tự hiểu
|
|
166
|
+
|
|
167
|
+
**Bắt buộc**: Generate đủ TẤT CẢ các nhánh từ Gateway (Yes/No, Đồng ý/Từ chối...).
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### 2.8. End Event
|
|
172
|
+
|
|
173
|
+
```xml
|
|
174
|
+
<mxCell id="end-1" parent="lane-pool-1-1"
|
|
175
|
+
style="strokeWidth=2;html=1;shape=mxgraph.flowchart.start_1;whiteSpace=wrap;"
|
|
176
|
+
value="End" vertex="1">
|
|
177
|
+
<mxGeometry height="60" width="100" x="150" y="[task_cuoi_y + 200]" as="geometry" />
|
|
178
|
+
</mxCell>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- **Label**: Chỉ hiển thị `"End"` — KHÔNG có số thứ tự.
|
|
182
|
+
- **Vị trí**: `y = task cuối + 200px`.
|
|
183
|
+
- Nhận kết nối từ Task cuối cùng.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### 2.9. Edges (Sequence Flow)
|
|
188
|
+
|
|
189
|
+
> ⚠️ **BẮT BUỘC generate edges trong XML.**
|
|
190
|
+
> Cần nối đầy đủ các node với nhau bằng Sequence Flows. Sử dụng `edgeStyle=orthogonalEdgeStyle` để đường đi vuông góc và gọn gàng, hạn chế đè lên elements khác.
|
|
191
|
+
|
|
192
|
+
Cấu trúc edge cơ bản:
|
|
193
|
+
```xml
|
|
194
|
+
<!-- Nối thông thường -->
|
|
195
|
+
<mxCell id="edge-task1-task2" edge="1" parent="pool-1"
|
|
196
|
+
source="task-1" target="task-2"
|
|
197
|
+
style="edgeStyle=orthogonalEdgeStyle;rounded=1;endArrow=block;html=1;">
|
|
198
|
+
<mxGeometry relative="1" as="geometry" />
|
|
199
|
+
</mxCell>
|
|
200
|
+
|
|
201
|
+
<!-- Nối rẽ nhánh từ Gateway (có label & bẻ góc) -->
|
|
202
|
+
<mxCell id="edge-gateway1-task3" edge="1" parent="pool-1"
|
|
203
|
+
source="gateway-1" target="task-3"
|
|
204
|
+
style="edgeStyle=orthogonalEdgeStyle;rounded=1;endArrow=block;html=1;exitX=1;exitY=0.5;entryX=0;entryY=0.5;"
|
|
205
|
+
value="Có">
|
|
206
|
+
<mxGeometry relative="1" as="geometry">
|
|
207
|
+
<Array as="points">
|
|
208
|
+
<mxPoint x="750" y="650" />
|
|
209
|
+
<mxPoint x="750" y="1255" />
|
|
210
|
+
</Array>
|
|
211
|
+
</mxGeometry>
|
|
212
|
+
</mxCell>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 3. Quy tắc Layout & Positioning
|
|
218
|
+
|
|
219
|
+
### 3.1. Sizing tổng quan
|
|
220
|
+
|
|
221
|
+
| Element | Width | Height |
|
|
222
|
+
|---------|-------|--------|
|
|
223
|
+
| Pool | N lanes × 400px | lane cao nhất + ~50px |
|
|
224
|
+
| Lane | 400px (cố định) | đủ chứa tasks + padding |
|
|
225
|
+
| Task (thủ công / hệ thống) | 160px | 110px |
|
|
226
|
+
| Gateway | 100px | 100px |
|
|
227
|
+
| Start / End Event | 100px | 60px |
|
|
228
|
+
|
|
229
|
+
### 3.2. Spacing theo trục Y — **luồng mặc định trong lane dọc**
|
|
230
|
+
|
|
231
|
+
Khi pool dùng **`horizontal=1`** (§2.2), **mọi bước tuần tự trong cùng một lane** xếp theo **Y tăng dần**, `x` gần cố định (căn giữa cột 400px). Không xếp chuỗi bước cùng actor bằng cách dịch `x` sang phải.
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
y ≈ 50 → Start Event
|
|
235
|
+
y ≈ 150 → Task 1
|
|
236
|
+
y ≈ 300 → Task 2 (+ ~150px)
|
|
237
|
+
y ≈ 450 → Task 3
|
|
238
|
+
…
|
|
239
|
+
y cuối → End Event (sau task cuối + khoảng trống ~140–200px)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Công thức linh hoạt:**
|
|
243
|
+
- `Task_Y(k) ≈ Task_Y(k-1) + 140–170` (task cao 110px + khe).
|
|
244
|
+
- `Lane_Height` / `pool height` ≥ `y_task_cuối + 110 + 140 + 60 (End) + padding`.
|
|
245
|
+
|
|
246
|
+
**Ngoại lệ:** layout lane **ngang** (`horizontal=0`, §2.3b) thì trong mỗi **hàng** lane có thể tăng `x` trái–phải; không áp dụng quy tắc “chỉ tăng Y” cho cả sơ đồ.
|
|
247
|
+
|
|
248
|
+
### 3.3. Spacing theo trục X (vị trí cột lane)
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
Lane 1: x=0
|
|
252
|
+
Lane 2: x=400
|
|
253
|
+
Lane 3: x=800
|
|
254
|
+
Lane N: x=(N-1)×400
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### 3.4. Positioning X trong lane (cột 400px)
|
|
258
|
+
|
|
259
|
+
- Task 160px rộng: `x ≈ 120` (căn giữa). Task rộng hơn (vd. 180px): `x ≈ 110`.
|
|
260
|
+
- Start/End 100px: `x ≈ 150`.
|
|
261
|
+
- Gateway 100px: `x ≈ 150`.
|
|
262
|
+
|
|
263
|
+
### 3.5. Thuật toán chống chồng chéo Cross-Lane (Anti-Overlap Rule)
|
|
264
|
+
|
|
265
|
+
> 🚨 **Bắt buộc áp dụng** khi một flow đi từ một lane, **bỏ qua** lane trung gian, và kết nối đến lane khác.
|
|
266
|
+
|
|
267
|
+
#### Vấn đề
|
|
268
|
+
Với **lane dọc** (cột actor, §2.2), khi edge nối `Lane A → Lane C` (bỏ qua **lane B ở giữa** theo trục X), đường nối đi **ngang** qua vùng lane B. Nếu lane B có task **cùng khoảng Y** với đoạn nối, cạnh dễ **đè** lên shape.
|
|
269
|
+
|
|
270
|
+
#### Quy tắc đặt Y-position
|
|
271
|
+
|
|
272
|
+
| Tình huống | Hành động |
|
|
273
|
+
|------------|-----------|
|
|
274
|
+
| Task nguồn ở Lane A, task đích ở Lane C, edge đi qua Lane B | Kiểm tra xem Lane B có task ở Y-range tương tự không |
|
|
275
|
+
| Lane B **CÓ task** ở cùng Y-row với task nguồn/đích | Task đích **PHẢI** được đặt ở Y-row MỚI (Y + 200px) |
|
|
276
|
+
| Lane B **KHÔNG có task** ở cùng Y-row | Task đích có thể giữ nguyên Y-row |
|
|
277
|
+
| Edge thẳng đứng xuyên qua nhiều lane có tasks | Dùng waypoint "hành lang" offset ±20–30px so với center-x |
|
|
278
|
+
|
|
279
|
+
#### Ví dụ thực tế
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
❌ SAI – Task 5 (Lane BQL, y=200), Task 6 (Lane CuDan, y=200), Task 7 (Lane BaoVe, y=200)
|
|
283
|
+
→ Edge T5→T6 đi thẳng đứng tại center-x của Lane BQL
|
|
284
|
+
→ Edge T6→T7 đi thẳng đứng xuyên qua Lane BQL tại y=200, ĐÈ lên Task 5!
|
|
285
|
+
|
|
286
|
+
✅ ĐÚNG – Tách Task 7 sang Y-row mới:
|
|
287
|
+
Task 5 (Lane BQL): y=200 ← Y-row A
|
|
288
|
+
Task 6 (Lane CuDan): y=200 ← cùng Y-row A (T5→T6 edge đi ngang, OK)
|
|
289
|
+
Task 7 (Lane BaoVe): y=400 ← Y-row B (KHÁC Y-row A → edge T6→T7 né Task 5)
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### Thuật toán kiểm tra trước khi sinh XML
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
FOR mỗi task_đích cần cross 2+ lanes:
|
|
296
|
+
intermediate_lanes = get_lanes_between(task_nguon.lane, task_dich.lane)
|
|
297
|
+
FOR mỗi lane_giua trong intermediate_lanes:
|
|
298
|
+
Nếu TỒN TẠI task trong lane_giua ở cùng Y-row:
|
|
299
|
+
→ task_đích.Y = task_nguon.Y + 200 // lùi xuống 1 row
|
|
300
|
+
→ Dùng waypoint offset (x ± 20px) để routing né shapes
|
|
301
|
+
ELSE:
|
|
302
|
+
→ task_đích có thể giữ nguyên Y-row với task_nguon
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### Waypoint routing khi cần lệch
|
|
306
|
+
|
|
307
|
+
```xml
|
|
308
|
+
<!-- Edge từ Lane CuDan (x_col=0) → Lane BaoVe (x_col=800), qua Lane BQL (x_col=400) -->
|
|
309
|
+
<!-- Dùng waypoint đi lệch x+20px so với center lane BQL để tránh shape ở center -->
|
|
310
|
+
<mxCell id="edge-t6-t7" edge="1" parent="pool-1"
|
|
311
|
+
source="task-6" target="task-7"
|
|
312
|
+
style="edgeStyle=orthogonalEdgeStyle;rounded=1;endArrow=block;html=1;">
|
|
313
|
+
<mxGeometry relative="1" as="geometry">
|
|
314
|
+
<Array as="points">
|
|
315
|
+
<mxPoint x="220" y="315" /> <!-- routing qua hành lang x=220 (offset +20 khỏi center=200) -->
|
|
316
|
+
<mxPoint x="220" y="455" />
|
|
317
|
+
</Array>
|
|
318
|
+
</mxGeometry>
|
|
319
|
+
</mxCell>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
### 3.6. Edges giữa các lane (layout lane dọc — mặc định)
|
|
325
|
+
|
|
326
|
+
`parent` của edge = `pool-1`. Dùng `edgeStyle=orthogonalEdgeStyle;rounded=1;endArrow=block;html=1;`.
|
|
327
|
+
|
|
328
|
+
| Tình huống | Gợi ý `exit` / `entry` |
|
|
329
|
+
|------------|-------------------------|
|
|
330
|
+
| Bước sau **cùng lane**, ở **phía dưới** | `exitX=0.5;exitY=1` → `entryX=0.5;entryY=0` |
|
|
331
|
+
| Từ lane trái sang lane **kế bên phải** (cùng mức Y) | `exitX=1;exitY=0.5` → `entryX=0;entryY=0.5` |
|
|
332
|
+
| Từ lane phải **quay về** lane trái | `exitX=0;exitY=0.5` → `entryX=1;entryY=0.5` |
|
|
333
|
+
| Gateway xuống End **cùng lane** | `exitX=0.5;exitY=1` → `entryX=0.5;entryY=0` |
|
|
334
|
+
| Gateway sang task **lane bên phải** | `exitX=1;exitY=0.5` → `entryX=0;entryY=0.5` |
|
|
335
|
+
|
|
336
|
+
Nếu orthogonal tự routing xấu, thêm `<Array as="points">` với `mxPoint` (xem §3.5 waypoint).
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## 4. ID Naming Convention
|
|
341
|
+
|
|
342
|
+
| Element | Format | Ví dụ |
|
|
343
|
+
|---------|--------|-------|
|
|
344
|
+
| Pool | `pool-[index]` | `pool-1` |
|
|
345
|
+
| Lane | `lane-pool-[pool-id]-[lane-index]` | `lane-pool-1-1` |
|
|
346
|
+
| Start Event | `start-[index]` | `start-1` |
|
|
347
|
+
| Task | `task-[step-number]` | `task-1`, `task-2` |
|
|
348
|
+
| Gateway | `gateway-[index]` | `gateway-1` |
|
|
349
|
+
| End Event | `end-[index]` | `end-1`, `end-2` |
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## 5. Quy tắc Đặt tên Task
|
|
354
|
+
|
|
355
|
+
- ✅ **BẮT BUỘC** có số thứ tự: `"1. [Tên]"`, `"2. [Tên]"`, ...
|
|
356
|
+
- ✅ Số thứ tự **khớp** với số thứ tự trong Bảng Xác Nhận (Phase 1).
|
|
357
|
+
- ✅ **KHÔNG** lặp tên lane trong tên task:
|
|
358
|
+
- ❌ `"2. Kế toán kiểm tra hoá đơn"` (lane đã là "Kế toán")
|
|
359
|
+
- ✅ `"2. Kiểm tra hoá đơn"`
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## 6. Escape XML trong Value
|
|
364
|
+
|
|
365
|
+
| Ký tự | Escape |
|
|
366
|
+
|-------|--------|
|
|
367
|
+
| `&` | `&` |
|
|
368
|
+
| `<` | `<` |
|
|
369
|
+
| `>` | `>` |
|
|
370
|
+
| `"` | `"` |
|
|
371
|
+
| `'` | `'` |
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## 7. Page Dimensions
|
|
376
|
+
|
|
377
|
+
```python
|
|
378
|
+
pageWidth = pool_width + 200 # padding mỗi bên
|
|
379
|
+
pageHeight = pool_height + 200
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## 8. Output File
|
|
385
|
+
|
|
386
|
+
- **Tên file**: `ba-bpmn-doc-[tên_quy_trình]-flowchart.drawio`
|
|
387
|
+
- **Thư mục**: `Processes/`
|
|
388
|
+
- **Lưu ý**: Mở bằng [draw.io](https://app.diagrams.net/) — File > Import từ device, chọn file `.drawio`.
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## 9. Ví dụ Output hoàn chỉnh (Mini)
|
|
393
|
+
|
|
394
|
+
> Hai lane **cột** (`x=0` và `x=400`), task trong lane 1 xếp **theo Y** (200 → 400). File thật cần **đủ edges** (§2.9) + bọc `mxfile` (§2.1).
|
|
395
|
+
|
|
396
|
+
```xml
|
|
397
|
+
<mxGraphModel dx="786" dy="417" grid="1" gridSize="10" guides="1"
|
|
398
|
+
tooltips="1" connect="1" arrows="1" fold="1" page="1"
|
|
399
|
+
pageScale="1" pageWidth="1800" pageHeight="1100" math="0" shadow="0">
|
|
400
|
+
<root>
|
|
401
|
+
<mxCell id="0" />
|
|
402
|
+
<mxCell id="1" parent="0" />
|
|
403
|
+
|
|
404
|
+
<!-- Pool -->
|
|
405
|
+
<mxCell id="pool-1" parent="1"
|
|
406
|
+
style="swimlane;html=1;childLayout=stackLayout;horizontal=1;resizeParent=1;resizeParentMax=0;startSize=30;whiteSpace=wrap;"
|
|
407
|
+
value="Quy trình Mua hàng" vertex="1">
|
|
408
|
+
<mxGeometry width="1600" height="930" as="geometry" />
|
|
409
|
+
</mxCell>
|
|
410
|
+
|
|
411
|
+
<!-- Lane 1: Nhân viên Thu mua -->
|
|
412
|
+
<mxCell id="lane-pool-1-1" parent="pool-1"
|
|
413
|
+
style="swimlane;html=1;startSize=25;whiteSpace=wrap;"
|
|
414
|
+
value="Nhân viên Thu mua" vertex="1">
|
|
415
|
+
<mxGeometry x="0" y="0" width="400" height="930" as="geometry" />
|
|
416
|
+
</mxCell>
|
|
417
|
+
|
|
418
|
+
<!-- Start Event -->
|
|
419
|
+
<mxCell id="start-1" parent="lane-pool-1-1"
|
|
420
|
+
style="strokeWidth=2;html=1;shape=mxgraph.flowchart.start_1;whiteSpace=wrap;"
|
|
421
|
+
value="Start" vertex="1">
|
|
422
|
+
<mxGeometry height="60" width="100" x="150" y="60" as="geometry" />
|
|
423
|
+
</mxCell>
|
|
424
|
+
|
|
425
|
+
<!-- Task 1: Thủ công → Trapezoid -->
|
|
426
|
+
<mxCell id="task-1" parent="lane-pool-1-1"
|
|
427
|
+
style="verticalLabelPosition=middle;verticalAlign=middle;html=1;shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;size=0.23;arcSize=10;flipV=1;labelPosition=center;align=center;fontStyle=1;fontSize=14;"
|
|
428
|
+
value="1. Xác định nhu cầu mua hàng" vertex="1">
|
|
429
|
+
<mxGeometry x="120" y="200" width="160" height="110" as="geometry" />
|
|
430
|
+
</mxCell>
|
|
431
|
+
|
|
432
|
+
<!-- Task 2: Hệ thống → Rectangle -->
|
|
433
|
+
<mxCell id="task-2" parent="lane-pool-1-1"
|
|
434
|
+
style="rounded=1;whiteSpace=wrap;html=1;fontStyle=1;fontSize=14;"
|
|
435
|
+
value="2. Lập Phiếu Yêu cầu mua hàng" vertex="1">
|
|
436
|
+
<mxGeometry x="120" y="400" width="160" height="110" as="geometry" />
|
|
437
|
+
</mxCell>
|
|
438
|
+
|
|
439
|
+
<!-- Lane 2: Trưởng phòng -->
|
|
440
|
+
<mxCell id="lane-pool-1-2" parent="pool-1"
|
|
441
|
+
style="swimlane;html=1;startSize=25;whiteSpace=wrap;"
|
|
442
|
+
value="Trưởng phòng" vertex="1">
|
|
443
|
+
<mxGeometry x="400" y="0" width="400" height="930" as="geometry" />
|
|
444
|
+
</mxCell>
|
|
445
|
+
|
|
446
|
+
<!-- Gateway -->
|
|
447
|
+
<mxCell id="gateway-1" parent="lane-pool-1-2"
|
|
448
|
+
style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;"
|
|
449
|
+
value="Phê duyệt yêu cầu?" vertex="1">
|
|
450
|
+
<mxGeometry x="150" y="200" width="100" height="100" as="geometry" />
|
|
451
|
+
</mxCell>
|
|
452
|
+
|
|
453
|
+
<!-- End Event: Từ chối -->
|
|
454
|
+
<mxCell id="end-1" parent="lane-pool-1-2"
|
|
455
|
+
style="strokeWidth=2;html=1;shape=mxgraph.flowchart.start_1;whiteSpace=wrap;"
|
|
456
|
+
value="End" vertex="1">
|
|
457
|
+
<mxGeometry height="60" width="100" x="150" y="400" as="geometry" />
|
|
458
|
+
</mxCell>
|
|
459
|
+
</root>
|
|
460
|
+
</mxGraphModel>
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
> Version: 1.1.0 | Author: M2MBA | Last Updated: 2026-04-10
|
|
466
|
+
> Reference cho skill: ba-bpmn-doc-gen (dùng khi output = Flowchart Draw.io)
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ba-critic
|
|
3
|
+
description: "Hướng dẫn BA Critic Agent phản biện spec adversarial. Agent PHẢI đọc skill này khi /v.ba-critic hoặc /v.specify --dual được gọi. Bắt buộc tìm ≥3 issues — KHÔNG có LGTM."
|
|
4
|
+
trigger: "Khi /v.ba-critic hoặc /v.specify --dual được gọi"
|
|
5
|
+
phase: "S.1"
|
|
6
|
+
used_by:
|
|
7
|
+
- /v.ba-critic
|
|
8
|
+
- /v.specify --dual
|
|
9
|
+
hooks:
|
|
10
|
+
pre_review: "Load spec.md + constitution.md + context.md (nếu legacy)"
|
|
11
|
+
post_review: "Verify ≥3 issues tìm được, mỗi issue có REQ reference"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# BA Critic — Adversarial Spec Review
|
|
15
|
+
|
|
16
|
+
> ⚠️ Đây là **Skill bắt buộc** cho BA Critic Agent.
|
|
17
|
+
> QUAN TRỌNG: Bắt buộc tìm **≥3 issues** mỗi round. "LGTM" và "Spec tốt rồi" BỊ CẤM.
|
|
18
|
+
>
|
|
19
|
+
> → Xem `gotchas.md` cho bias phổ biến khi review spec.
|
|
20
|
+
> → Xem `examples/good/` cho mẫu critic report chuẩn.
|
|
21
|
+
> → Xem `config.json` để customize (min_issues, focus_areas).
|
|
22
|
+
> → Chạy `.v-flow/skills/specify/ba-critic/scripts/check-spec-quality.sh <spec.md>` để pre-scan trước khi critic.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Khi nào review KHÁC
|
|
27
|
+
|
|
28
|
+
- **Single BA mode** (`/v.specify`): Skill này KHÔNG được gọi. Chỉ ears-writer.
|
|
29
|
+
- **Quick Fix** (`/v.quickfix`): Critic round rút gọn — focus completeness + feasibility only.
|
|
30
|
+
- **Round 2+**: Fresh context — KHÔNG bị ảnh hưởng bởi round trước. Đọc spec MỚI.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Chiều Phản Biện — Pattern Detection (toolkit tín hiệu)
|
|
35
|
+
|
|
36
|
+
> 💡 Phần này cung cấp **signals để tìm issues**, không phải checklist tuần tự.
|
|
37
|
+
> Agent tự quyết thứ tự và depth dựa trên loại feature.
|
|
38
|
+
> **Quan hệ với agent**: BA Critic Agent review theo **9 chiều** (xem `agents/ba-critic-agent.md` Bước 3 — gồm UC Detail, Flow Correctness, Exception Coverage, UI/Screen, EARS, Constitution). 5 nhóm tín hiệu dưới đây là công cụ phát hiện cho các chiều đó, KHÔNG phải danh sách chiều cố định.
|
|
39
|
+
|
|
40
|
+
### 1. 🎯 Ambiguity — Từ ngữ mơ hồ
|
|
41
|
+
|
|
42
|
+
**Grep patterns trong spec.md:**
|
|
43
|
+
```
|
|
44
|
+
Mơ hồ: "nên", "hợp lý", "dễ dùng", "user-friendly", "nhanh", "tối ưu"
|
|
45
|
+
Thiếu số: "hiệu suất tốt", "phản hồi nhanh" (không có ms/s)
|
|
46
|
+
Thiếu scope: "tất cả", "mọi", "luôn luôn" (thực sự TẤT CẢ?)
|
|
47
|
+
Passive: "sẽ được xử lý", "data được lưu" (ai xử lý? lưu ở đâu?)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Câu hỏi tự hỏi:**
|
|
51
|
+
- Nếu 2 developer đọc REQ này, họ có implement KHÁC nhau không?
|
|
52
|
+
- Acceptance criteria có verifiable bằng test tự động không?
|
|
53
|
+
|
|
54
|
+
### 2. 🕳️ Completeness — Lỗ hổng logic
|
|
55
|
+
|
|
56
|
+
**Signals cần tìm:**
|
|
57
|
+
- Có happy path nhưng thiếu error path? (POST valid → 201, nhưng POST invalid → ?)
|
|
58
|
+
- Có create nhưng thiếu delete/update?
|
|
59
|
+
- Có auth nhưng thiếu authorization level?
|
|
60
|
+
- Có input nhưng thiếu validation rules?
|
|
61
|
+
- Thiếu edge cases: empty state, maximum limits, concurrent access, timeout
|
|
62
|
+
|
|
63
|
+
**Checklist completeness chuyên sâu:**
|
|
64
|
+
```
|
|
65
|
+
[ ] Empty state defined? (0 items, first-time user)
|
|
66
|
+
[ ] Max limits defined? (max items, max size, max concurrent)
|
|
67
|
+
[ ] Error messages specified? (400, 401, 403, 404, 409, 500)
|
|
68
|
+
[ ] Timeout behavior? (network, processing, session)
|
|
69
|
+
[ ] Concurrency? (2 users edit same resource)
|
|
70
|
+
[ ] Pagination? (nếu list > N items)
|
|
71
|
+
[ ] Audit trail? (ai làm gì, khi nào)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 3. ⚔️ Consistency — Mâu thuẫn nội bộ
|
|
75
|
+
|
|
76
|
+
**Signals cần tìm:**
|
|
77
|
+
- REQ-A nói "email unique" nhưng REQ-B cho phép merge accounts?
|
|
78
|
+
- REQ-A nói "phải delete" nhưng REQ-B nói "phải giữ audit trail"?
|
|
79
|
+
- REQ-A nói "real-time" nhưng tech context là REST (polling)?
|
|
80
|
+
- Constitution nói pattern X nhưng spec imply pattern Y?
|
|
81
|
+
- Context.md No-Go Zone conflict với REQ scope?
|
|
82
|
+
|
|
83
|
+
### 4. 🔧 Feasibility — Khả thi kỹ thuật
|
|
84
|
+
|
|
85
|
+
**Signals cần tìm:**
|
|
86
|
+
- REQ yêu cầu modify No-Go Zone code?
|
|
87
|
+
- REQ yêu cầu technology không có trong tech stack?
|
|
88
|
+
- REQ yêu cầu real-time nhưng architecture là batch?
|
|
89
|
+
- Performance requirement (< 100ms) với current DB/infra có khả thi?
|
|
90
|
+
- External API dependency không ổn định?
|
|
91
|
+
|
|
92
|
+
### 5. 🧪 Testability — Có test được không
|
|
93
|
+
|
|
94
|
+
**Signals cần tìm:**
|
|
95
|
+
- AC chỉ nói "hệ thống hoạt động đúng" → đúng LÀ GÌ?
|
|
96
|
+
- AC không có expected output cụ thể
|
|
97
|
+
- REQ phụ thuộc vào external system không mock được
|
|
98
|
+
- REQ yêu cầu human judgment ("đẹp", "tốt")
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Issue Severity Reference
|
|
103
|
+
|
|
104
|
+
| Severity | Criteria | Action Required |
|
|
105
|
+
|:--------:|---------|----------------|
|
|
106
|
+
| 🔴 **Critical** (`R[N]-C00x`) | Ambiguity gây implement sai, missing security REQ, infeasible | **MUST fix** — block spec ký duyệt |
|
|
107
|
+
| 🟠 **Major** (`R[N]-M00x`) | Missing error path, incomplete edge cases, consistency conflict | **SHOULD fix** — spec chưa ready |
|
|
108
|
+
| 🟡 **Minor** (`R[N]-m00x`) | Wording tweak, better AC, suggestion optimization | **CAN fix** — tùy BA Agent |
|
|
109
|
+
|
|
110
|
+
**Rule**: ≥3 issues tổng mỗi round. Ít nhất 1 phải Major hoặc Critical (nếu spec thực sự có vấn đề).
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Fresh Context Protocol
|
|
115
|
+
|
|
116
|
+
> 💡 Đây là quy tắc QUAN TRỌNG NHẤT để tránh bias.
|
|
117
|
+
|
|
118
|
+
Mỗi round review:
|
|
119
|
+
1. **ĐỌC SPEC MỚI NHẤT** — BA Agent có thể đã sửa từ round trước
|
|
120
|
+
2. **KHÔNG nhớ issues round trước** — review từ zero, không confirm fix
|
|
121
|
+
3. **TÌM issues MỚI** — nếu issues round trước đã fix, tìm issues KHÁC
|
|
122
|
+
4. **Fresh perspective** — giả vờ chưa bao giờ đọc spec này
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Round N: Tìm issues A, B, C
|
|
126
|
+
BA Agent fix → Spec v2
|
|
127
|
+
Round N+1: ĐỌC Spec v2 fresh → Tìm issues D, E, F (KHÔNG check A, B, C)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## V-Flow Integration Points
|
|
133
|
+
|
|
134
|
+
- **spec.md** (S.1) → Input chính cần phản biện
|
|
135
|
+
- **constitution.md** → Cross-check spec vs project rules
|
|
136
|
+
- **context.md** → Cross-check spec vs No-Go Zones và tech constraints
|
|
137
|
+
- **ears-notation skill** → Validate EARS compliance
|
|
138
|
+
- **spec-review-log.md** → Append critic report mỗi round
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Output Format
|
|
143
|
+
|
|
144
|
+
Minimum required sections trong critic report:
|
|
145
|
+
|
|
146
|
+
```markdown
|
|
147
|
+
## 📋 BA Critic Report — Round {N}
|
|
148
|
+
|
|
149
|
+
**Spec version reviewed**: {hash hoặc timestamp}
|
|
150
|
+
**Issues found**: {N} (≥3 required)
|
|
151
|
+
**Verdict**: ✅ CONVERGED | ⚠️ ITERATE | 🛑 ESCALATE
|
|
152
|
+
|
|
153
|
+
### Issues
|
|
154
|
+
|
|
155
|
+
#### R[N]-C001: {Tên issue}
|
|
156
|
+
- **Severity**: 🔴 Critical / 🟠 Major / 🟡 Minor (khớp ký hiệu ID: C/M/m, N = round)
|
|
157
|
+
- **REQ affected**: REQ-xxx
|
|
158
|
+
- **Chiều phản biện**: [1 trong 9 chiều — xem `agents/ba-critic-agent.md` Bước 3]
|
|
159
|
+
- **Mô tả**: ...
|
|
160
|
+
- **Đề xuất fix**: ...
|
|
161
|
+
|
|
162
|
+
### Summary
|
|
163
|
+
- Critical: {N}
|
|
164
|
+
- Major: {N}
|
|
165
|
+
- Minor: {N}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Gotchas
|
|
171
|
+
|
|
172
|
+
→ Xem `gotchas.md` cho bias phổ biến khi review spec — cập nhật liên tục.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"setup_questions": [
|
|
3
|
+
{
|
|
4
|
+
"id": "min_issues",
|
|
5
|
+
"question": "Số issues tối thiểu phải tìm mỗi round?",
|
|
6
|
+
"type": "number",
|
|
7
|
+
"default": 3
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "focus_areas",
|
|
11
|
+
"question": "Focus areas ưu tiên?",
|
|
12
|
+
"options": ["all", "security-first", "performance-first", "ux-first"],
|
|
13
|
+
"default": "all",
|
|
14
|
+
"description": "all = các chiều review đều nhau. security-first/performance-first/ux-first = ưu tiên chiều đó."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "max_rounds",
|
|
18
|
+
"question": "Số round tối đa trước khi escalate cho human?",
|
|
19
|
+
"type": "number",
|
|
20
|
+
"default": 4
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"hooks": {
|
|
24
|
+
"pre_review": "Load spec.md mới nhất + constitution.md + context.md (nếu legacy)",
|
|
25
|
+
"post_review": "Verify ≥min_issues issues, append vào spec-review-log.md"
|
|
26
|
+
},
|
|
27
|
+
"memory": {
|
|
28
|
+
"file": "critic-history.log",
|
|
29
|
+
"format": "[date] | [feature] | [round] | [issues_found] | [critical] | [major] | [minor] | [verdict]",
|
|
30
|
+
"purpose": "Track critic quality — dùng cho /v.metrics để đánh giá spec quality"
|
|
31
|
+
}
|
|
32
|
+
}
|