@ngocsangairvds/vsaf 4.1.24 → 4.1.26

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 (31) hide show
  1. package/package.json +1 -1
  2. package/packages/cli/dist/commands/install.d.ts +1 -0
  3. package/packages/cli/dist/commands/install.d.ts.map +1 -1
  4. package/packages/cli/dist/commands/install.js +32 -6
  5. package/packages/cli/dist/commands/install.js.map +1 -1
  6. package/packages/core/dist/engine/node-runner.d.ts +1 -0
  7. package/packages/core/dist/engine/node-runner.d.ts.map +1 -1
  8. package/packages/core/dist/engine/node-runner.js +33 -6
  9. package/packages/core/dist/engine/node-runner.js.map +1 -1
  10. package/skills/sdlc/ba-validate-srs/SKILL.md +8 -0
  11. package/skills/sdlc/ba-validate-srs/data/domain-checklists/insurance.yaml +110 -0
  12. package/skills/sdlc/ba-validate-srs/data/grep-patterns-srs.yaml +158 -0
  13. package/skills/sdlc/ba-validate-srs/data/srs-review-glossary.md +237 -0
  14. package/skills/sdlc/ba-validate-srs/steps-v/step-v-01-discovery.md +280 -0
  15. package/skills/sdlc/ba-validate-srs/steps-v/step-v-02-business-alignment.md +351 -0
  16. package/skills/sdlc/ba-validate-srs/steps-v/step-v-03-completeness.md +353 -0
  17. package/skills/sdlc/ba-validate-srs/steps-v/step-v-04-consistency.md +352 -0
  18. package/skills/sdlc/ba-validate-srs/steps-v/step-v-05-quality.md +347 -0
  19. package/skills/sdlc/ba-validate-srs/steps-v/step-v-06-system-nfr.md +217 -0
  20. package/skills/sdlc/ba-validate-srs/steps-v/step-v-07-delivery-readiness.md +288 -0
  21. package/skills/sdlc/ba-validate-srs/steps-v/step-v-08-risk-analysis.md +283 -0
  22. package/skills/sdlc/ba-validate-srs/steps-v/step-v-09-user-impact.md +262 -0
  23. package/skills/sdlc/ba-validate-srs/steps-v/step-v-10-report.md +308 -0
  24. package/skills/sdlc/ba-validate-srs/workflow.md +269 -0
  25. package/skills/sdlc/ba-write-srs/SKILL.md +8 -0
  26. package/skills/sdlc/ba-write-srs/srs-feature-template.md +669 -0
  27. package/skills/sdlc/ba-write-srs/srs-system-template.md +430 -0
  28. package/skills/sdlc/ba-write-srs/workflow.md +139 -0
  29. package/skills/sdlc/pack.yaml +4 -0
  30. package/skills/sdlc/srs/SKILL.md +44 -55
  31. package/skills/vds-skill/install-deps.mjs +21 -3
@@ -0,0 +1,237 @@
1
+ # SRS Review — Glossary & Mô tả
2
+
3
+ ---
4
+
5
+ ## 1. REVIEW DIMENSIONS — Các chiều đánh giá
6
+
7
+ | Dimension | Mô tả | Weight |
8
+ |---|---|---|
9
+ | Completeness | Kiểm tra tính đầy đủ: có Overview, Use Cases, AC, NFRs, ERD, Business Rules, Error Codes, Dependencies, Traceability không? | 1.0 |
10
+ | Consistency | Kiểm tra tính nhất quán giữa các file: entity naming, UC ID prefix, state machine, data model, API patterns, terminology. | 1.0 |
11
+ | Quality | Kiểm tra chất lượng viết: ngôn ngữ mơ hồ (TBD, có thể), testability, AC format, duplicate requirements, scope clarity. | 1.0 |
12
+ | Readiness | Đánh giá mức độ sẵn sàng implement: API contracts, DB schema, error codes, state machines, integration specs, tech stack. | 1.0 |
13
+ | Risk | Đánh giá rủi ro kinh doanh: flow completeness (create→delete), external dependencies, integration gaps, scope creep, assumptions. | 0.8 |
14
+ | User Impact | Đánh giá tác động người dùng: persona coverage, journey completeness, error UX, onboarding, accessibility. | 0.7 |
15
+
16
+ ---
17
+
18
+ ## 2. SEVERITY LEVELS — Mức độ nghiêm trọng
19
+
20
+ | Severity | Mô tả | Hành động |
21
+ |---|---|---|
22
+ | CRITICAL | Block implementation — dev không thể implement mà không có câu trả lời hoặc spec bổ sung. | Phải sửa TRƯỚC khi bắt đầu Sprint |
23
+ | HIGH | Nên clarify sớm — có thể implement nhưng risk rework hoặc bugs. | Nên sửa trong Sprint 1 |
24
+ | MEDIUM | Nice to fix — không block nhưng improve quality, UX, maintainability. | Phân bổ vào Sprint 2 |
25
+ | LOW | Minor — pass hoặc cải thiện nhỏ. | Fix khi có thời gian |
26
+
27
+ ---
28
+
29
+ ## 3. QUESTION CATEGORIES — Phân loại câu hỏi
30
+
31
+ | Category | Mô tả | Ví dụ |
32
+ |---|---|---|
33
+ | flow-gap | Thiếu luồng xử lý đối xứng/bổ sung (có create nhưng thiếu delete/cancel/refund). | Payment có create nhưng thiếu refund. Policy có cancel nhưng thiếu reinstate. |
34
+ | ambiguity | Requirement mơ hồ, cần PO/stakeholder quyết định. | Figma cho skip CCCD, SRS yêu cầu bắt buộc — chọn cái nào? |
35
+ | cross-doc-conflict | Mâu thuẫn giữa PRD/System spec/SRS feature files. | System spec dùng UC-IP cho FR-8, SRS FR-8 dùng UC-PU. |
36
+ | domain-inference | Từ domain knowledge, thiếu flow thường gặp trong ngành bảo hiểm. | Grace period: claims allowed hay không? Endorsement reject: resubmit được không? |
37
+ | missing-spec | Flow/entity đề cập nhưng thiếu spec chi tiết để implement. | Kafka events mention xuyên suốt nhưng không có payload schema. |
38
+
39
+ ---
40
+
41
+ ## 4. ITEM IDs — Mã định danh findings
42
+
43
+ | Pattern | Mô tả | Ví dụ |
44
+ |---|---|---|
45
+ | has_* | Auto-check: kiểm tra section/content tồn tại trong document. | has_overview, has_nfrs, has_traceability, has_dependencies |
46
+ | no_ambiguous_language | Auto-check: tìm từ mơ hồ (TBD, should, có thể, etc.). | Tìm thấy 15 ambiguous terms trong prd.md |
47
+ | entity_naming | Auto-check: entity naming consistency across files. | entity_naming — kiểm tra cùng concept dùng cùng tên |
48
+ | deployment_requirements | Auto-check: có section Deployment/Infrastructure không. | Không tìm thấy section Deployment trong PRD |
49
+ | dependency_risk | Auto-check: external dependencies documented. | Không có section Dependencies/Third-party |
50
+ | acceptance_criteria_format | Auto-check: AC theo format Given/When/Then. | AC không có GWT format |
51
+ | clear_scope | Auto-check: có section phạm vi/ngoài phạm vi. | Không có section In-scope/Out-of-scope |
52
+ | no_duplicate_requirements | Auto-check: requirements trùng lặp giữa các file. | Consent spec overlap giữa FR-1 và FR-15 |
53
+ | api_contracts_defined | LLM-check: API contracts đầy đủ request/response schema. | Endpoints listed nhưng thiếu JSON schema |
54
+ | api_naming_pattern | LLM-check: API prefix nhất quán. | FR10 dùng /v1/ trong khi các FR khác dùng /api/v1/ |
55
+ | db_schema_specified | LLM-check: DB schema đầy đủ field types, PKs, FKs. | BIGINT PKs vs UUID v7 conflict |
56
+ | data_model_fields | LLM-check: entity fields nhất quán giữa các files. | Policy entity 13 fields vs 9 fields giữa FR10 và System |
57
+ | no_contradictions | LLM-check: không có mâu thuẫn nội dung giữa các files. | State machine 14 states vs 7 states |
58
+ | terminology_consistent | LLM-check: thuật ngữ dùng nhất quán. | Customer vs User vs Khách hàng cho cùng concept |
59
+ | error_handling_defined | LLM-check: error handling đầy đủ. | Không có central error code registry |
60
+ | uc-id-*-mismatch | LLM-check: UC ID prefix không khớp giữa System spec và SRS file. | uc-id-purchase-mismatch: UC-IP vs UC-PU |
61
+ | policy-* | LLM-check: Policy lifecycle/state machine issues. | policy-creation-flow-inconsistency |
62
+ | srs-completeness-* | LLM-check: SRS file completeness per module. | srs-completeness-fr9: FR-9 thiếu ERD |
63
+ | llm-* | LLM-check: semantic analysis results. | llm-missing-refund-spec, llm-testability-uw-timeout |
64
+ | risk-* | LLM-check: business risk assessment. | risk-refund-flow-missing |
65
+ | ui-* | LLM-check: user impact assessment. | ui-accessibility-missing |
66
+ | tech_stack_consistent | LLM-check: DB/broker/cache technology nhất quán giữa files. | MongoDB vs MariaDB vs PostgreSQL cho cùng entity |
67
+ | pk_fk_type_consistent | LLM-check: PK/FK type nhất quán theo canonical model. | BIGINT PKs vs UUID v7 conflict |
68
+ | canonical_model_match | LLM-check: feature SRS fields khớp System SRS canonical model. | Policy entity 13 fields (FR10) vs 9 fields (System) |
69
+ | currency_type_convention | LLM-check: currency fields thống nhất convention. | DECIMAL vs BIGINT (đơn vị nhỏ nhất) |
70
+ | cross_file_state_machine_match | LLM-check: state machine feature SRS khớp System SRS. | Claim 14 states (FR11) vs 7 states (System) |
71
+ | event_payload_schema | LLM-check: Kafka/event payload có schema đầy đủ. | Event mentioned nhưng không có payload fields/types |
72
+ | *-implementation-ready | LLM-check: module readiness to implement. | fr1-implementation-ready |
73
+ | br_assumptions_confirmed | LLM-check (V-02): BR không được viết dựa trên quyết định business chưa được confirm. Contradiction: luồng đã cứng hoá nhưng file ghi "câu hỏi cần confirm". | BR-PL-023 viết sẵn grace period behavior nhưng file ghi "cần business confirm" |
74
+ | downstream_event_consumers | LLM-check (V-03): mỗi event được publish phải có downstream consumers và side effects được mô tả. | PaymentCompletedEvent không có promotion-service consumer |
75
+ | cancellation_subflows_by_context | LLM-check (V-03): nếu có cooling-off concept, phải có nhánh huỷ riêng (trong/ngoài cooling-off) và ngày tính refund phải rõ ràng. | Chỉ có 1 luồng huỷ không phân biệt cooling-off |
76
+ | service_ownership_consistent | LLM-check (V-04): entity/resource phải được giao cho cùng service nhất quán cross-file. | Voucher validate: pricing-service (FR8) vs promotion-service (FR7, FR17) |
77
+ | api_contract_param_match | LLM-check (V-04): params trong SRS call phải match params required trong API contract. | FR7 gọi /vouchers/best?productId={id} nhưng contract yêu cầu userId+productId+premium |
78
+ | currency_unit_intra_section | LLM-check (V-04): không trộn đơn vị tiền trong cùng entity/breakdown section. | discount_amount=50000 đồng cạnh premium=5000000 cents trong cùng entity |
79
+ | state_name_uc_vs_diagram | LLM-check (V-04): state names trong UC flow steps phải khớp với nodes trong State Diagram. | UC dùng PENDING_ACTIVATION nhưng diagram chỉ có PENDING_ISSUANCE |
80
+ | referenced_fr_exists | LLM-check (V-04): FR được tham chiếu trong SRS phải tồn tại trong FR inventory. | "cross-insurer fallback (FR29)" — FR29 không tồn tại |
81
+ | upstream_artifact_alignment | LLM-check (V-02): Mọi structured artifact trong SRS (entity enums, fields, actors, phases, BR references) phải traceable về BRD/PRD. Diff: additions, removals, renames, type mismatches. Silent drops = CRITICAL, inventions = HIGH, naming divergence = HIGH. | BRD: 7 claim states (PAID); SRS: 11 states (thêm DISPUTED, tách PAID→DISBURSING+COMPLETED) — SRS refines nhưng phải documented |
82
+ | upstream_structural_consistency | LLM-check (V-04): SRS structural artifacts (state machines, transitions, field schemas, API paths, Kafka events) phải consistent với BRD state diagrams + Architecture event catalog + PRD AC state names. Transition order conflicts, field type mismatches, event coverage gaps = HIGH+. | BRD: UNDER_REVIEW→PROCESSING; SRS: PROCESSING→UNDER_REVIEW (reversed). PRD AC: DOCUMENTS_PENDING; SRS: DOCS_REQUIRED (name mismatch) |
83
+ | rules_self_explanatory | LLM-check (V-05): mỗi rule phải self-explanatory không cần PO interpret, tránh undefined terms. | "not exposed until acceptance" — acceptance không được định nghĩa |
84
+ | async_sla_defined | LLM-check (V-07): mỗi async flow phải có SLA timeout + escalation path + behavior khi quá SLA. | Endorsement treo ở INSURER_PROCESSING vô thời hạn vì không có timeout |
85
+ | auth_method_mapping | LLM-check (V-07): API spec phải có bảng mapping actor/channel → auth method. | "5 phương thức xác thực" nhưng không nói ai dùng cái nào |
86
+ | configurable_thresholds_flagged | LLM-check (V-07): threshold/config values phải đánh dấu configurable, không hardcode trong spec. | OCR threshold 0.85 hardcode thay vì configurable per insurer |
87
+ | error_code_edge_states | LLM-check (V-07): phải có error codes cho cross-state edge cases (action X trên entity ở state Y). | Không có mã lỗi cho: gia hạn HĐ đã quá grace, huỷ HĐ đang LAPSED, quote expired |
88
+ | insurer_rejection_rollback | LLM-check (V-08): mỗi flow gọi insurer phải có nhánh insurer từ chối + rollback. | Renewal assume insurer luôn accept — không có rejection path |
89
+ | platform_insurer_sync_gap_risk | LLM-check (V-08): khi platform confirm trước insurer sync, phải định nghĩa trách nhiệm trong gap. | KH nhận "kích hoạt thành công" nhưng insurer chưa ghi nhận — claim trong 15 phút đó? |
90
+ | concurrent_operation_conflict | LLM-check (V-08): nếu cho phép concurrent ops, phải có conflict resolution rule. | Nhiều endorsements đồng thời — delta premium tính thế nào? |
91
+ | dlq_alert_action_defined | LLM-check (V-08): DLQ/webhook failure phải có action plan, không chỉ "alert admin". | Webhook EXPIRED → alert admin → admin làm gì? bấm retry ở đâu? |
92
+ | pre_payment_benefit_disclosure | LLM-check (V-09): KH phải được acknowledge nếu thanh toán cho quyền lợi có waiting period / coverage gap. | Add-on waiting period: KH trả tiền hôm nay nhưng coverage từ ngày X — không có acknowledge step |
93
+ | auto_financial_action_advance_notice | LLM-check (V-09): mọi hành động tài chính tự động phải có thông báo advance cho KH. | Auto-renewal trừ tiền mà KH không nhận được thông báo trước (mâu thuẫn PRD AC39.4) |
94
+ | async_wait_ux | LLM-check (V-09): khi KH chờ async processing, phải mô tả UX: KH thấy gì, có thể huỷ không, nhận gì khi timeout. | Đang mua BH chờ UW: "đang xử lý" — KH làm gì? Có nút Huỷ không? |
95
+
96
+ ---
97
+
98
+ ## 5. SCORING — Cách tính điểm
99
+
100
+ | Metric | Mô tả | Giá trị |
101
+ |---|---|---|
102
+ | Score per finding | 1.0 = pass, 0.5 = partial, 0.0 = fail | |
103
+ | Dimension score | Trung bình weighted của tất cả findings trong dimension | OK >= 80%, WARN 60-79%, FAIL < 60% |
104
+ | Overall score | Weighted average: completeness/consistency/quality/readiness x 1.0, risk x 0.8, user-impact x 0.7 | |
105
+ | Source: auto | Kiểm tra tự động — structure, keyword, section check | |
106
+ | Source: llm | LLM agent phân tích semantic — cross-reference, testability, flow gaps, contradictions | |
107
+
108
+ ---
109
+
110
+ ## 6. AUTO-CHECK ITEMS — Kiểm tra tự động theo SRS template
111
+
112
+ ### 6.1 Completeness — Section existence checks
113
+
114
+ | Item ID | Check | Section trong template | Severity |
115
+ |---|---|---|---|
116
+ | has_overview | Section "1. Mô tả chung" tồn tại với đầy đủ fields | Section 1 | CRITICAL |
117
+ | has_use_case_summary | Bảng "1.1 Tóm tắt Use Cases" có data | Section 1.1 | CRITICAL |
118
+ | has_glossary | Section "1.2 Định nghĩa & Từ viết tắt" | Section 1.2 | MEDIUM |
119
+ | has_references | Section "1.3 Tài liệu tham chiếu" | Section 1.3 | MEDIUM |
120
+ | has_uc_screens | Mỗi UC có subsection "Màn hình" với bảng controls | Section 2.X.1 | CRITICAL |
121
+ | has_uc_sequence | Mỗi UC có Sequence Diagram (PlantUML) | Section 2.X.2 | CRITICAL |
122
+ | has_uc_flow_table | Mỗi UC có Bảng mô tả luồng nghiệp vụ | Section 2.X.2 | CRITICAL |
123
+ | has_erd | Section "3. Bảng/Thực thể liên quan" có ER diagram | Section 3 | HIGH |
124
+ | has_error_codes | Section "4. Danh sách mã lỗi" | Section 4 | HIGH |
125
+ | has_impact | Section "5. Chức năng ảnh hưởng" | Section 5 | MEDIUM |
126
+ | has_business_rules | Section "6. Business Rules tổng hợp" | Section 6 | HIGH |
127
+ | has_nfrs | Section "7. Yêu cầu phi chức năng" | Section 7 | MEDIUM |
128
+ | has_dependencies | Section "8. Ràng buộc, Giả định & Phụ thuộc" | Section 8 | HIGH |
129
+ | has_state_diagrams | Section "9. State Diagrams" hoặc ghi "Không áp dụng" | Section 9 | MEDIUM |
130
+ | has_traceability | Section "10. Ma trận truy xuất (Mini-RTM)" | Section 10 | HIGH |
131
+ | has_edge_cases | Luồng ngoại lệ/exception flows rõ ràng | Trong UC flows | MEDIUM |
132
+ | has_acceptance_criteria | Acceptance Criteria đo lường được | Per UC | HIGH |
133
+
134
+ ### 6.2 Quality — Content quality checks
135
+
136
+ | Item ID | Check | Severity |
137
+ |---|---|---|
138
+ | no_ambiguous_language | Không có "có thể", "nên", "thường", "tùy trường hợp", TBD | HIGH |
139
+ | acceptance_criteria_format | AC theo Given/When/Then hoặc checklist measurable | HIGH |
140
+ | no_duplicate_requirements | Không trùng lặp requirements giữa các UC/files | MEDIUM |
141
+ | clear_scope | Có section phạm vi + ngoài phạm vi rõ ràng | HIGH |
142
+ | no_placeholder | Không còn {{...}}, TODO, TBD chưa xử lý | HIGH |
143
+ | consistent_language | Ngôn ngữ nhất quán (toàn VN hoặc toàn EN) | LOW |
144
+ | flow_step_numbering | Bảng mô tả luồng có đánh số bước liên tục | HIGH |
145
+ | diagram_syntax_valid | PlantUML/Mermaid syntax hợp lệ | CRITICAL |
146
+
147
+ ### 6.3 Consistency — Cross-file checks (cần so sánh nhiều files)
148
+
149
+ | Item ID | Check | Severity |
150
+ |---|---|---|
151
+ | entity_naming | Entity names nhất quán giữa ER, bảng mô tả, luồng | CRITICAL |
152
+ | uc_id_pattern | UC ID tuân theo UC-FX-NN pattern | HIGH |
153
+ | screen_id_pattern | Screen ID tuân theo SCR-FX-NN pattern | HIGH |
154
+ | actor_naming | Actor names nhất quán | HIGH |
155
+ | api_naming_pattern | API endpoint prefix nhất quán (/api/v1/) | HIGH |
156
+ | state_naming | State names nhất quán giữa diagrams và bảng | HIGH |
157
+ | error_code_consistency | Error codes nhất quán giữa section 4 và flow steps | HIGH |
158
+ | br_code_consistency | Business Rule mã BR-XXX nhất quán | HIGH |
159
+ | terminology_consistent | Thuật ngữ thống nhất, không dùng lẫn lộn | MEDIUM |
160
+ | rtm_fr_match | FR IDs trong Mini-RTM khớp PRD source | HIGH |
161
+ | data_model_fields | Entity fields nhất quán giữa các files | CRITICAL |
162
+ | no_contradictions | Không mâu thuẫn nội dung giữa các files | CRITICAL |
163
+ | tech_stack_consistent | DB technology, message broker, cache nhất quán giữa các files cho cùng entity/module | CRITICAL |
164
+ | pk_fk_type_consistent | PK type (UUID v7 vs BIGINT vs SERIAL) và FK references nhất quán theo canonical model | HIGH |
165
+ | canonical_model_match | Entity fields trong feature SRS khớp System SRS canonical model (field count, field names, data types) | CRITICAL |
166
+ | currency_type_convention | Currency fields thống nhất convention: BIGINT (đơn vị nhỏ nhất) hoặc DECIMAL — không trộn lẫn | HIGH |
167
+ | cross_file_state_machine_match | State machine trong feature SRS khớp System SRS (state count, state names, transitions) | CRITICAL |
168
+
169
+ ### 6.4 Readiness — Implementation readiness checks
170
+
171
+ | Item ID | Check | Severity |
172
+ |---|---|---|
173
+ | api_contracts_defined | API contracts: method, endpoint, request/response schema | CRITICAL |
174
+ | db_schema_specified | DB schema đầy đủ: field types, PKs, FKs | HIGH |
175
+ | error_handling_defined | Error codes: mã, message, HTTP status, step trigger | HIGH |
176
+ | state_machine_complete | State machine: transitions, guards, actions | HIGH |
177
+ | integration_specs | External API: format, auth, timeout, retry | HIGH |
178
+ | event_payload_schema | Kafka/event payload schema defined: topic, fields, types, version — không chỉ mention event name | CRITICAL |
179
+ | validation_rules | Input field validation: regex, range, format | HIGH |
180
+ | navigation_flow | Screen navigation rõ ràng: A → action → B | MEDIUM |
181
+ | mockup_reference | Mockup/wireframe reference cho mỗi màn hình | MEDIUM |
182
+ | br_implementable | Business rules có thể code trực tiếp | HIGH |
183
+
184
+ ### 6.5 Risk — Risk assessment checks
185
+
186
+ | Item ID | Check | Severity |
187
+ |---|---|---|
188
+ | exception_flows_handled | Tất cả exception flows: network error, timeout, invalid data | HIGH |
189
+ | external_deps_fallback | External dependencies có fallback | HIGH |
190
+ | integration_gaps | Integration gaps giữa flows đã document | HIGH |
191
+ | scope_creep | Không có requirements vượt PRD scope | MEDIUM |
192
+ | assumptions_listed | Assumptions đã liệt kê và đánh dấu cần confirm | MEDIUM |
193
+ | concurrency_considered | Race condition scenarios đã xem xét | HIGH |
194
+ | migration_risk | Data migration risks đã xử lý (nếu thay flow cũ) | HIGH |
195
+ | security_risks | Authentication, authorization, data exposure | CRITICAL |
196
+
197
+ ### 6.6 User Impact — User experience checks
198
+
199
+ | Item ID | Check | Severity |
200
+ |---|---|---|
201
+ | persona_coverage | Tất cả personas/actors trong PRD đã cover | HIGH |
202
+ | journey_complete | User journey hoàn chỉnh entry → completion | HIGH |
203
+ | error_ux | Error messages rõ ràng, có hướng dẫn xử lý | HIGH |
204
+ | onboarding | First-time experience đã xem xét | MEDIUM |
205
+ | loading_empty_states | Loading states, empty states đã mô tả | MEDIUM |
206
+ | accessibility | Accessibility considerations (nếu yêu cầu) | LOW |
207
+ | back_cancel_undo | Navigation back/cancel/undo đã xử lý | MEDIUM |
208
+ | destructive_confirmation | Confirmation dialogs cho destructive actions | MEDIUM |
209
+
210
+ ---
211
+
212
+ ## 7. OUTPUT REPORT STRUCTURE
213
+
214
+ ### Frontmatter
215
+
216
+ ```yaml
217
+ ---
218
+ type: srs-validation-report
219
+ date: {date}
220
+ validator: BA Validate SRS Skill
221
+ scope: {single | batch | full}
222
+ files_reviewed: [list of files]
223
+ overall_score: {number}%
224
+ overall_status: {OK | WARN | FAIL}
225
+ stepsCompleted: []
226
+ ---
227
+ ```
228
+
229
+ ### Report Sections
230
+
231
+ 1. **Executive Summary** — Overall score, status, findings count by severity
232
+ 2. **Per-Dimension Scorecard** — Table: dimension, weight, score, status, findings count
233
+ 3. **Critical & High Findings** — Must-fix: #, severity, dimension, file, item_id, score, evidence, suggestion
234
+ 4. **Medium & Low Findings** — Nice-to-fix items
235
+ 5. **Unresolved Questions** — Questions needing PO/stakeholder decision: #, severity, dimension, category, question, context, related_files, impact, suggested_clarification
236
+ 6. **Recommendations** — Prioritized action plan
237
+ 7. **Appendix: Full Scoring Matrix** — All items with scores
@@ -0,0 +1,280 @@
1
+ ---
2
+ # model: haiku
3
+ # contextOutput: '{output_folder}/_validation_temp/context.yaml'
4
+ # grepPatterns: '../data/grep-patterns-srs.yaml'
5
+ ---
6
+
7
+ # Step V-01: Discovery — Xác định scope và tạo report skeleton
8
+
9
+ ---
10
+
11
+ ## 1. Xác định SRS files cần validate
12
+
13
+ Hỏi user:
14
+
15
+ ```
16
+ Bạn muốn validate SRS nào?
17
+
18
+ 1. **Single file** — Validate 1 file SRS cụ thể
19
+ 2. **Batch** — Validate nhiều files SRS (chọn danh sách)
20
+ 3. **Full** — Validate toàn bộ SRS trong folder output
21
+
22
+ Chọn (1/2/3):
23
+ ```
24
+
25
+ Chờ user chọn.
26
+
27
+ ---
28
+
29
+ ## 2. Scan files
30
+
31
+ Dựa vào lựa chọn:
32
+
33
+ ### Option 1 — Single file
34
+ - User cung cấp file path hoặc FR number
35
+ - Đọc file, xác nhận file tồn tại và có nội dung
36
+
37
+ ### Option 2 — Batch
38
+ - Liệt kê tất cả SRS files trong `{output_folder}/`
39
+ - User chọn files cần validate
40
+ - Đọc danh sách files đã chọn
41
+
42
+ ### Option 3 — Full
43
+ - Scan toàn bộ `{output_folder}/05-srs*.md`
44
+ - Liệt kê cho user confirm
45
+
46
+ ---
47
+
48
+ ## 3. Load Project Context (auto — không cần user input)
49
+
50
+ Tự động load project context từ VSAF artifacts:
51
+
52
+ 1. Read `graphify-out/graph.json` (nếu tồn tại) → extract document nodes, feature nodes, service nodes
53
+ 2. For each SRS file in scope:
54
+ - Determine feature name from file path
55
+ - Locate upstream docs trong `.vsaf/docs/features/{feature-name}/`
56
+ 3. Cross-validation sources (auto-load):
57
+ - PRD: `.vsaf/docs/features/{feature-name}/02-prd.md`
58
+ - Architecture: `.vsaf/docs/features/{feature-name}/03-adr.md`
59
+ - Epics: `.vsaf/docs/features/{feature-name}/04-epics.md` (nếu tồn tại)
60
+ - BRD: tìm trong `.vsaf/docs/` (optional — chỉ khi project có BRD)
61
+ - System SRS: tìm trong `.vsaf/docs/` (optional)
62
+
63
+ **Token efficiency rule:** PRD và ADR trong VSAF thường nhỏ (<500 lines). Đọc toàn bộ file thay vì dùng line-range optimization.
64
+
65
+ ---
66
+
67
+ ## 3b. Build SRS Section Index and UC Cache
68
+
69
+ After loading KG context, build two caches to eliminate redundant reads in parallel validation steps.
70
+
71
+ ### 3b-1. SRS Section Index
72
+
73
+ Load `../data/grep-patterns-srs.yaml` → get `srs_structure` patterns.
74
+
75
+ For each SRS file in scope:
76
+ - Run Grep `^## ` on SRS file, output_mode="content", -n=true → extract all Level-2 section headers with line numbers
77
+ - Build `section_index`: list of `{heading, start_line, end_line}` for each `##` header
78
+ - Compute `end_line` for each heading = next heading's `start_line - 1` (or file total lines for last section)
79
+
80
+ ### 3b-2. UC Cache
81
+
82
+ For each SRS file:
83
+ - Run Grep `^### .*UC-` with -n=true → extract all UC headers and line numbers
84
+ - For each UC found, record:
85
+ - `id`: UC identifier (e.g., UC-CA-01)
86
+ - `title`: UC title text
87
+ - `start_line`: line of UC header
88
+ - `end_line`: start_line of next UC (or +80 as estimate)
89
+ - `has_gherkin`: run Grep `Given.*When.*Then` within UC line range → true/false
90
+ - Build `uc_cache`: list of all UCs across all SRS files in scope
91
+
92
+ ### 3b-3. Extract Glossary Dimension Items
93
+
94
+ To avoid each parallel agent loading the full glossary:
95
+ - From the glossary already loaded in workflow initialization, extract item IDs per dimension:
96
+ - completeness_items: [has_overview, has_use_case_summary, has_glossary, ...]
97
+ - consistency_items: [uc_id_pattern, screen_id_pattern, ...]
98
+ - quality_items: [no_ambiguous_language, acceptance_criteria_format, ...]
99
+ - (etc. for each dimension)
100
+
101
+ ### 3b-4. Write context.yaml
102
+
103
+ Create directory `{output_folder}/_validation_temp/` if it does not exist.
104
+
105
+ Write `{output_folder}/_validation_temp/context.yaml`:
106
+
107
+ ```yaml
108
+ # SRS Validation session context — auto-generated by step-v-01
109
+ # DO NOT EDIT manually
110
+ validation_date: "{date}"
111
+ scope: "{single|batch|full}"
112
+ report_path: "{report_output_path}"
113
+ silent_mode: {false} # set true if --silent invocation arg
114
+
115
+ # SRS files in scope
116
+ srs_files:
117
+ - path: "{srs_file_path}"
118
+ fr_id: "{FR_ID}"
119
+ section_index: # from Grep ^## with computed end_line
120
+ - heading: "1. Mô tả chung"
121
+ start_line: 39
122
+ end_line: 134 # next heading start_line - 1
123
+ - heading: "2. Đặc tả Use Cases"
124
+ start_line: 135
125
+ end_line: 1318
126
+ # ... all ## headings with computed end_line (last section end_line = total file lines)
127
+ uc_cache: # from Grep ^### UC-
128
+ - id: "UC-CA-01"
129
+ title: "Đăng ký tài khoản chủ động"
130
+ start_line: 120
131
+ end_line: 200
132
+ has_gherkin: true
133
+ # ... etc
134
+
135
+ # Project context (VSAF convention)
136
+ upstream:
137
+ prd_path: ".vsaf/docs/features/{feature-name}/02-prd.md"
138
+ adr_path: ".vsaf/docs/features/{feature-name}/03-adr.md"
139
+ epics_path: ".vsaf/docs/features/{feature-name}/04-epics.md"
140
+ brd_path: null # set if project has BRD
141
+ graph_json: "graphify-out/graph.json" # set if graphify index exists
142
+
143
+ # Glossary item IDs per dimension (pre-extracted for agent efficiency)
144
+ dimension_items:
145
+ business_alignment: []
146
+ completeness: [has_overview, has_use_case_summary, has_glossary, has_references, has_uc_screens, has_uc_sequence, has_uc_flow_table, has_erd, has_error_codes, has_impact, has_business_rules, has_nfrs, has_dependencies, has_state_diagrams, has_traceability, has_edge_cases, has_acceptance_criteria]
147
+ consistency: []
148
+ quality: [no_ambiguous_language, acceptance_criteria_format, no_duplicate_requirements, clear_scope, flow_step_numbering, diagram_syntax_valid]
149
+ system_nfr: []
150
+ delivery_readiness: []
151
+ risk_analysis: []
152
+ user_impact: []
153
+ ```
154
+
155
+ **Token efficiency note:** context.yaml (~100-150 lines) replaces 8+ separate KG file reads across parallel agents. Each agent reads context.yaml once instead of re-loading project artifacts independently.
156
+
157
+ **Derived-from traceability rule (CRITICAL):**
158
+ SRS is a **derived document** — every requirement MUST trace back to PRD, BRD, or Architecture. If SRS contains requirements not in any upstream source, flag as:
159
+ - **CRITICAL** if SRS invents new functional requirements not in PRD/BRD
160
+ - **HIGH** if SRS adds business rules not traceable to BRD
161
+ - **MEDIUM** if SRS adds NFRs/constraints beyond Architecture specs
162
+
163
+ Upstream chain: `BRD → PRD → SRS`, `Architecture → SRS`
164
+
165
+ ---
166
+
167
+ ## 3c. Regression Check — Load Previous Reports
168
+
169
+ Scan `.vsaf/docs/features/{feature-name}/05-srs-validation-report*.md` for existing reports.
170
+
171
+ If previous reports exist:
172
+ 1. Find the most recent report (by date in filename, excluding the report being created now)
173
+ 2. Read its frontmatter to get `overall_score`, `overall_status`, `files_reviewed`
174
+ 3. Read its "Critical & High Findings" section (section 4) — extract finding IDs
175
+ 4. Write to context.yaml:
176
+
177
+ ```yaml
178
+ regression:
179
+ previous_report: "05-srs-validation-report-2026-04-06.md"
180
+ previous_score: 72.3
181
+ previous_status: WARN
182
+ previous_critical_high_ids:
183
+ - {id: C-001, dimension: consistency, summary: "service boundary violation"}
184
+ - {id: DR-002, dimension: delivery, summary: "API specs missing"}
185
+ ```
186
+
187
+ If no previous reports exist:
188
+ ```yaml
189
+ regression:
190
+ previous_report: null
191
+ note: "First validation run — no regression baseline"
192
+ ```
193
+
194
+ ---
195
+
196
+ ## 4. Tạo report skeleton
197
+
198
+ Tạo file output: `.vsaf/docs/features/{feature-name}/05-srs-validation-report.md`
199
+
200
+ Viết frontmatter:
201
+
202
+ ```yaml
203
+ ---
204
+ type: srs-validation-report
205
+ date: {date}
206
+ validator: BA Validate SRS Skill
207
+ scope: {scope}
208
+ files_reviewed:
209
+ - {list of files}
210
+ overall_score: TBD
211
+ overall_status: TBD
212
+ stepsCompleted:
213
+ - step-v-01-discovery
214
+ ---
215
+ ```
216
+
217
+ Viết section headers (chưa có nội dung):
218
+
219
+ ```markdown
220
+ ## 1. Executive Summary
221
+
222
+ _(Sẽ được điền ở Step V-10)_
223
+
224
+ ## 2. Overall Score & Confidence
225
+
226
+ _(Sẽ được điền ở Step V-10)_
227
+
228
+ ## 3. Heatmap — Score by Dimension
229
+
230
+ _(Sẽ được điền ở Step V-10)_
231
+
232
+ ## 4. Critical & High Findings
233
+
234
+ _(Sẽ được điền ở Steps V-02 → V-09)_
235
+
236
+ ## 5. Medium & Low Findings
237
+
238
+ _(Sẽ được điền ở Steps V-02 → V-09)_
239
+
240
+ ## 6. Top Missing Areas
241
+
242
+ _(Sẽ được điền ở Step V-10)_
243
+
244
+ ## 7. Unresolved Questions
245
+
246
+ _(Sẽ được điền ở Steps V-02 → V-09)_
247
+
248
+ ## 8. Action Plan
249
+
250
+ _(Sẽ được điền ở Step V-10)_
251
+
252
+ ## 9. Appendix: Full Scoring Matrix
253
+
254
+ _(Sẽ được điền ở Step V-10)_
255
+ ```
256
+
257
+ ---
258
+
259
+ ## 5. Confirm & Route
260
+
261
+ Xuất cho user:
262
+
263
+ ```
264
+ Scope: {scope}
265
+ Files: {count} file(s)
266
+ - {file list}
267
+ Cross-validate: PRD=auto, ADR=auto, Epics=auto (if exists), BRD=auto (if exists)
268
+ Report: .vsaf/docs/features/{feature-name}/05-srs-validation-report.md
269
+ Context: {output_folder}/_validation_temp/context.yaml ✓
270
+ UC Cache: {uc_count} UCs indexed ✓
271
+ Graph: {graph_json status}
272
+
273
+ [C] Continue — Bắt đầu validate Business Alignment (Step V-02)
274
+ [X] Cancel — Dừng lại
275
+ ```
276
+
277
+ **Chờ user chọn.**
278
+
279
+ Khi user chọn **C** và `{parallel_mode}` là `true`: Hiển thị "Parallel validation mode: launching Round 1..." rồi follow **PARALLEL EXECUTION ROUNDS → Round 1** trong workflow.md
280
+ Khi user chọn **C** và `{parallel_mode}` là `false`: đọc fully và follow `./step-v-02-business-alignment.md` (sequential fallback)