evnict-kit 0.2.1

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 (138) hide show
  1. package/README.md +19 -0
  2. package/bin/cli.js +38 -0
  3. package/package.json +48 -0
  4. package/src/commands/add.js +129 -0
  5. package/src/commands/init-check.js +19 -0
  6. package/src/commands/init-context.js +37 -0
  7. package/src/commands/init-rules.js +42 -0
  8. package/src/commands/init-workflow.js +36 -0
  9. package/src/commands/init.js +722 -0
  10. package/src/utils/config.js +167 -0
  11. package/src/utils/file.js +53 -0
  12. package/templates/GETTING-STARTED.md +196 -0
  13. package/templates/content/context/AGENTS.md.template +462 -0
  14. package/templates/content/rules/01-evnict-kit-general-rules.md +303 -0
  15. package/templates/content/rules/02-evnict-kit-security-rules.md +423 -0
  16. package/templates/content/rules/03-evnict-kit-backend-conventions.md +383 -0
  17. package/templates/content/rules/04-evnict-kit-frontend-conventions.md +402 -0
  18. package/templates/content/rules/05-evnict-kit-project-conventions.md +228 -0
  19. package/templates/content/skills/evnict-kit-brainstorm/SKILL.md +140 -0
  20. package/templates/content/skills/evnict-kit-bug-fix/SKILL.md +108 -0
  21. package/templates/content/skills/evnict-kit-checkpoint/SKILL.md +156 -0
  22. package/templates/content/skills/evnict-kit-code-review/SKILL.md +158 -0
  23. package/templates/content/skills/evnict-kit-coordinate/SKILL.md +274 -0
  24. package/templates/content/skills/evnict-kit-create-api/SKILL.md +281 -0
  25. package/templates/content/skills/evnict-kit-create-component/SKILL.md +263 -0
  26. package/templates/content/skills/evnict-kit-create-page/SKILL.md +247 -0
  27. package/templates/content/skills/evnict-kit-database-migration/SKILL.md +164 -0
  28. package/templates/content/skills/evnict-kit-doc-postmortem/SKILL.md +93 -0
  29. package/templates/content/skills/evnict-kit-finish-branch/SKILL.md +87 -0
  30. package/templates/content/skills/evnict-kit-fix-attt/SKILL.md +129 -0
  31. package/templates/content/skills/evnict-kit-fix-business-logic/SKILL.md +89 -0
  32. package/templates/content/skills/evnict-kit-git-worktrees/SKILL.md +104 -0
  33. package/templates/content/skills/evnict-kit-merge-checklist/SKILL.md +108 -0
  34. package/templates/content/skills/evnict-kit-onboard/SKILL.md +143 -0
  35. package/templates/content/skills/evnict-kit-prompt-standard/SKILL.md +103 -0
  36. package/templates/content/skills/evnict-kit-receiving-review/SKILL.md +89 -0
  37. package/templates/content/skills/evnict-kit-security-audit/SKILL.md +190 -0
  38. package/templates/content/skills/evnict-kit-spec/SKILL.md +237 -0
  39. package/templates/content/skills/evnict-kit-tdd/SKILL.md +413 -0
  40. package/templates/content/skills/evnict-kit-wiki/SKILL.md +412 -0
  41. package/templates/content/workflows/evnict-kit-archive-wiki.md +100 -0
  42. package/templates/content/workflows/evnict-kit-attt.md +100 -0
  43. package/templates/content/workflows/evnict-kit-bug-fix.md +107 -0
  44. package/templates/content/workflows/evnict-kit-feature-large.md +393 -0
  45. package/templates/content/workflows/evnict-kit-feature-small.md +86 -0
  46. package/templates/content/workflows/evnict-kit-handoff.md +243 -0
  47. package/templates/content/workflows/evnict-kit-implement.md +247 -0
  48. package/templates/content/workflows/evnict-kit-init-check.md +76 -0
  49. package/templates/content/workflows/evnict-kit-init-context.md +58 -0
  50. package/templates/content/workflows/evnict-kit-init-rules.md +114 -0
  51. package/templates/content/workflows/evnict-kit-init-wiki.md +80 -0
  52. package/templates/content/workflows/evnict-kit-plan.md +308 -0
  53. package/templates/content/workflows/evnict-kit-review.md +53 -0
  54. package/templates/content/workflows/evnict-kit-spec-archive.md +53 -0
  55. package/templates/content/workflows/evnict-kit-wiki-archive-feature.md +164 -0
  56. package/templates/content/workflows/evnict-kit-wiki-query.md +91 -0
  57. package/templates/content/workflows/evnict-kit-wiki-scan-project.md +272 -0
  58. package/templates/context/AGENT.md.template +9 -0
  59. package/templates/context/AGENTS.md.template +462 -0
  60. package/templates/context/CLAUDE.md.template +301 -0
  61. package/templates/context/copilot-instructions.md.template +60 -0
  62. package/templates/context/cursorrules.template +114 -0
  63. package/templates/instruct/Instruct-Agent-AI.be.md +96 -0
  64. package/templates/instruct/Instruct-Agent-AI.fe.md +79 -0
  65. package/templates/rules/antigravity/01-evnict-kit-general-rules.md +303 -0
  66. package/templates/rules/antigravity/02-evnict-kit-security-rules.md +423 -0
  67. package/templates/rules/antigravity/03-evnict-kit-backend-conventions.md +383 -0
  68. package/templates/rules/antigravity/04-evnict-kit-frontend-conventions.md +402 -0
  69. package/templates/rules/antigravity/05-evnict-kit-project-conventions.md +228 -0
  70. package/templates/rules/claude/README.md +8 -0
  71. package/templates/rules/cursor/01-evnict-kit-general-rules.mdc +46 -0
  72. package/templates/rules/cursor/02-evnict-kit-security-rules.mdc +46 -0
  73. package/templates/rules/cursor/03-evnict-kit-backend-conventions.mdc +50 -0
  74. package/templates/rules/cursor/04-evnict-kit-frontend-conventions.mdc +43 -0
  75. package/templates/rules/cursor/05-evnict-kit-project-conventions.mdc +63 -0
  76. package/templates/rules/cursor/README.md +7 -0
  77. package/templates/skills/evnict-kit-brainstorm/SKILL.md +140 -0
  78. package/templates/skills/evnict-kit-bug-fix/SKILL.md +108 -0
  79. package/templates/skills/evnict-kit-checkpoint/SKILL.md +156 -0
  80. package/templates/skills/evnict-kit-code-review/SKILL.md +158 -0
  81. package/templates/skills/evnict-kit-coordinate/SKILL.md +274 -0
  82. package/templates/skills/evnict-kit-create-api/SKILL.md +281 -0
  83. package/templates/skills/evnict-kit-create-component/SKILL.md +263 -0
  84. package/templates/skills/evnict-kit-create-page/SKILL.md +247 -0
  85. package/templates/skills/evnict-kit-database-migration/SKILL.md +164 -0
  86. package/templates/skills/evnict-kit-doc-postmortem/SKILL.md +93 -0
  87. package/templates/skills/evnict-kit-finish-branch/SKILL.md +87 -0
  88. package/templates/skills/evnict-kit-fix-attt/SKILL.md +129 -0
  89. package/templates/skills/evnict-kit-fix-business-logic/SKILL.md +89 -0
  90. package/templates/skills/evnict-kit-git-worktrees/SKILL.md +104 -0
  91. package/templates/skills/evnict-kit-merge-checklist/SKILL.md +108 -0
  92. package/templates/skills/evnict-kit-onboard/SKILL.md +143 -0
  93. package/templates/skills/evnict-kit-prompt-standard/SKILL.md +103 -0
  94. package/templates/skills/evnict-kit-receiving-review/SKILL.md +89 -0
  95. package/templates/skills/evnict-kit-security-audit/SKILL.md +190 -0
  96. package/templates/skills/evnict-kit-spec/SKILL.md +237 -0
  97. package/templates/skills/evnict-kit-tdd/SKILL.md +413 -0
  98. package/templates/skills/evnict-kit-wiki/SKILL.md +412 -0
  99. package/templates/wiki/README.md +35 -0
  100. package/templates/wiki/config.example.yaml +17 -0
  101. package/templates/wiki/package.json +17 -0
  102. package/templates/wiki/raw/notes/.gitkeep +1 -0
  103. package/templates/wiki/scripts/ingest.js +66 -0
  104. package/templates/workflows/antigravity/evnict-kit-archive-wiki.md +100 -0
  105. package/templates/workflows/antigravity/evnict-kit-attt.md +100 -0
  106. package/templates/workflows/antigravity/evnict-kit-bug-fix.md +107 -0
  107. package/templates/workflows/antigravity/evnict-kit-feature-large.md +393 -0
  108. package/templates/workflows/antigravity/evnict-kit-feature-small.md +86 -0
  109. package/templates/workflows/antigravity/evnict-kit-handoff.md +243 -0
  110. package/templates/workflows/antigravity/evnict-kit-implement.md +247 -0
  111. package/templates/workflows/antigravity/evnict-kit-init-check.md +76 -0
  112. package/templates/workflows/antigravity/evnict-kit-init-context.md +58 -0
  113. package/templates/workflows/antigravity/evnict-kit-init-rules.md +114 -0
  114. package/templates/workflows/antigravity/evnict-kit-init-wiki.md +80 -0
  115. package/templates/workflows/antigravity/evnict-kit-plan.md +308 -0
  116. package/templates/workflows/antigravity/evnict-kit-review.md +53 -0
  117. package/templates/workflows/antigravity/evnict-kit-spec-archive.md +53 -0
  118. package/templates/workflows/antigravity/evnict-kit-wiki-archive-feature.md +164 -0
  119. package/templates/workflows/antigravity/evnict-kit-wiki-query.md +91 -0
  120. package/templates/workflows/antigravity/evnict-kit-wiki-scan-project.md +272 -0
  121. package/templates/workflows/claude/README.md +6 -0
  122. package/templates/workflows/claude/evnict-kit-archive-wiki.md +98 -0
  123. package/templates/workflows/claude/evnict-kit-attt.md +98 -0
  124. package/templates/workflows/claude/evnict-kit-bug-fix.md +105 -0
  125. package/templates/workflows/claude/evnict-kit-feature-large.md +391 -0
  126. package/templates/workflows/claude/evnict-kit-feature-small.md +84 -0
  127. package/templates/workflows/claude/evnict-kit-handoff.md +240 -0
  128. package/templates/workflows/claude/evnict-kit-implement.md +245 -0
  129. package/templates/workflows/claude/evnict-kit-init-check.md +74 -0
  130. package/templates/workflows/claude/evnict-kit-init-context.md +56 -0
  131. package/templates/workflows/claude/evnict-kit-init-rules.md +112 -0
  132. package/templates/workflows/claude/evnict-kit-init-wiki.md +78 -0
  133. package/templates/workflows/claude/evnict-kit-plan.md +305 -0
  134. package/templates/workflows/claude/evnict-kit-review.md +51 -0
  135. package/templates/workflows/claude/evnict-kit-spec-archive.md +51 -0
  136. package/templates/workflows/claude/evnict-kit-wiki-archive-feature.md +162 -0
  137. package/templates/workflows/claude/evnict-kit-wiki-query.md +89 -0
  138. package/templates/workflows/claude/evnict-kit-wiki-scan-project.md +270 -0
@@ -0,0 +1,98 @@
1
+ # ATTT — An Toàn Thông Tin
2
+ **Command:** `/evnict-kit:attt $ARGUMENTS`
3
+
4
+ $ARGUMENTS chứa mô tả từ user.
5
+
6
+ ## Khi nào dùng
7
+ - Kiểm tra ATTT định kỳ
8
+ - Trước khi release
9
+ - Review module mới
10
+
11
+ ## Input
12
+ - Mode 1: `/evnict-kit:attt --scan` → Scan toàn bộ project
13
+ - Mode 2: `/evnict-kit:attt {module}` → Check module cụ thể
14
+
15
+ ---
16
+
17
+ ## Mode 1: Full Scan (`--scan`)
18
+
19
+ ### Bước 1: Chạy Security Audit
20
+ Gọi skill `evnict-kit-security-audit` với scope=all:
21
+ 1. Dependency scan (CVE)
22
+ 2. Code scan ATTT01-ATTT08
23
+ 3. Configuration review
24
+ 4. Tạo report
25
+
26
+ ### Bước 2: Fix Issues
27
+ Với mỗi issue Critical/High → gọi skill `evnict-kit-fix-attt`:
28
+ 1. Classify severity
29
+ 2. Tạo hotfix branch
30
+ 3. Fix theo OWASP guide
31
+ 4. Test
32
+ 5. Commit
33
+
34
+ ### Bước 3: Re-scan
35
+ Sau khi fix → chạy lại scan → verify 0 Critical/High.
36
+
37
+ ### Bước 4: Report
38
+ Lưu report vào `docs/attt/security-audit-{date}.md`
39
+
40
+ ---
41
+
42
+ ## Mode 2: Module Check (`{module}`)
43
+
44
+ ### Bước 1: Scope to module
45
+ ```bash
46
+ # Chỉ scan files trong module
47
+ grep -rn "pattern" --include="*.java" src/main/java/com/evn/{project}/{module}/
48
+ ```
49
+
50
+ ### Bước 2: Run ATTT checks
51
+ Chạy scan commands từ `02-evnict-kit-security-rules.md` nhưng chỉ trong module path.
52
+
53
+ ### Bước 3: Quick Report
54
+ ```markdown
55
+ ## 🔒 Module ATTT Check: {module}
56
+ | ATTT | Status | Details |
57
+ |------|--------|---------|
58
+ | ATTT01 SQL Injection | ✅/❌ | {details} |
59
+ | ATTT02 XSS | ✅/❌ | |
60
+ | ATTT03 CSRF | ✅/❌ | |
61
+ | ATTT04 JWT | ✅/❌ | |
62
+ | ATTT06 Upload | ✅/❌ | |
63
+ | ATTT07 Data Exposure | ✅/❌ | |
64
+ | Secrets | ✅/❌ | |
65
+ | PII Logs | ✅/❌ | |
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Bước cuối: Wiki Integration (BẮT BUỘC cho ATTT)
71
+ ATTT fix **LUÔN** phải push vào wiki (không hỏi user):
72
+ ```
73
+ 🔒 ATTT fix → TỰ ĐỘNG push vào wiki...
74
+ ```
75
+ Gọi skill `evnict-kit-wiki` action=push:
76
+ - Security vulnerability description
77
+ - ATTT category (ATTT01-ATTT08)
78
+ - Fix approach + OWASP reference
79
+ - Files changed
80
+ - Re-scan results
81
+
82
+ Auto-ingest:
83
+ ```bash
84
+ cd {wiki_path} && node scripts/ingest.js
85
+ ```
86
+
87
+ > **Lưu ý:** Để nạp tri thức chi tiết hơn, dùng:
88
+ > - `/evnict-kit:wiki-archive-feature` — nạp đầy đủ từ spec+plan+code
89
+ > - `/evnict-kit:wiki-query "ATTT"` — truy vấn ATTT knowledge trước khi scan
90
+
91
+ ---
92
+
93
+ ## Checklist hoàn thành
94
+ - [ ] Scan completed (full hoặc module)
95
+ - [ ] Critical/High issues fixed
96
+ - [ ] Report created
97
+ - [ ] Re-scan verified (for full scan)
98
+ - [ ] Wiki pushed (BẮT BUỘC cho ATTT fix)
@@ -0,0 +1,105 @@
1
+ # Bug Fix
2
+ **Command:** `/evnict-kit:bug-fix $ARGUMENTS`
3
+
4
+ $ARGUMENTS chứa mô tả từ user.
5
+
6
+ ## Khi nào dùng
7
+ - Bug report từ tester/user/production
8
+ - Regression bug
9
+ - Lỗi phát hiện trong development
10
+
11
+ ## Input
12
+ - Mô tả bug
13
+ - VD: `/evnict-kit:bug-fix API GET /api/customers trả về 500 khi keyword chứa ký tự đặc biệt '%'`
14
+
15
+ ---
16
+
17
+ ## Bước 1: Query wiki
18
+ Kiểm tra bug đã được report/fix trước đó:
19
+ ```bash
20
+ grep -rl "{keyword}" {wiki_path}/processed/ --include="*.md"
21
+ ```
22
+
23
+ ## Bước 2: Classify severity
24
+ | Severity | Response |
25
+ |----------|----------|
26
+ | Critical (production down) | Hotfix branch ngay |
27
+ | High (feature broken) | Fix trong sprint hiện tại |
28
+ | Medium (workaround có) | Lên kế hoạch |
29
+ | Low (cosmetic) | Backlog |
30
+
31
+ ## Bước 3: Checkpoint
32
+ ```bash
33
+ git checkout -b fix/{bug-slug}
34
+ ```
35
+
36
+ ## Bước 4: Reproduce
37
+ 1. Tìm file/module liên quan
38
+ 2. Viết test case reproduce lỗi (RED — test PHẢI FAIL)
39
+ ```java
40
+ @Test
41
+ @DisplayName("BUG: {description}")
42
+ void should_reproduce_bug() {
43
+ // Arrange — setup data gây lỗi
44
+ // Act — action gây lỗi
45
+ // Assert — verify lỗi xảy ra
46
+ }
47
+ ```
48
+
49
+ ## Bước 5: Root Cause Analysis
50
+ 1. Trace logic từ input → output
51
+ 2. Xác định dòng code gây lỗi
52
+ 3. Ghi lại root cause
53
+
54
+ ## Bước 6: TDD Fix
55
+ 1. ✅ Test reproduce FAIL (RED done)
56
+ 2. Fix code → test PASS (GREEN)
57
+ 3. Refactor nếu cần
58
+ 4. Chạy ALL tests
59
+
60
+ ```bash
61
+ ./mvnw test # All tests pass
62
+ ./mvnw compile # Build OK
63
+ ```
64
+
65
+ 3-Strike Rule: fail > 3 lần → DỪNG, báo user.
66
+
67
+ ## Bước 7: Scan similar
68
+ Tìm pattern lỗi tương tự trong codebase:
69
+ ```bash
70
+ grep -rn "{error pattern}" --include="*.java" src/
71
+ ```
72
+ Fix luôn nếu tìm thấy.
73
+
74
+ ## Bước 8: Commit
75
+ ```bash
76
+ git commit -m "fix({module}): {description}"
77
+ ```
78
+
79
+ ## Bước cuối: Wiki
80
+ Gợi ý user:
81
+ ```
82
+ 💡 Bug fix hoàn thành. Thêm tri thức vào wiki?
83
+ A) Có — chạy `/evnict-kit:wiki-archive-feature` (nạp đầy đủ)
84
+ B) Nhanh — tôi tóm tắt bug + root cause + fix → push wiki → auto-ingest
85
+ C) Không — skip
86
+ ```
87
+ - Nếu A → chạy `/evnict-kit:wiki-archive-feature`
88
+ - Nếu B → gọi skill `evnict-kit-wiki` action=push → auto-ingest
89
+ - Nếu C → skip
90
+
91
+ Tạo postmortem nếu thay đổi > 20 dòng.
92
+
93
+ ---
94
+
95
+ ## Checklist hoàn thành
96
+ - [ ] Wiki queried
97
+ - [ ] Severity classified
98
+ - [ ] Checkpoint created
99
+ - [ ] Bug reproduced (test case)
100
+ - [ ] Root cause identified
101
+ - [ ] TDD fix applied
102
+ - [ ] Similar patterns scanned
103
+ - [ ] All tests pass
104
+ - [ ] Committed
105
+ - [ ] Wiki updated (bug knowledge pushed)
@@ -0,0 +1,391 @@
1
+ # Feature Large
2
+ **Command:** `/evnict-kit:feature-large $ARGUMENTS`
3
+
4
+ $ARGUMENTS chứa mô tả từ user.
5
+
6
+ ## Khi nào dùng
7
+ - Feature mới cần cả Backend + Frontend + Database
8
+ - Độ phức tạp cao, cần spec rõ ràng trước khi code
9
+ - Ước lượng > 1 ngày làm việc
10
+
11
+ ## Input
12
+ - Mô tả feature bằng ngôn ngữ tự nhiên (tiếng Việt hoặc tiếng Anh)
13
+ - VD: `/evnict-kit:feature-large Thêm chức năng ký số hàng loạt cho các hồ sơ đã duyệt`
14
+
15
+ ---
16
+
17
+ ## Phase 0: Brainstorm (Socratic)
18
+ TRƯỚC KHI sinh spec, Agent PHẢI áp dụng skill `evnict-kit-brainstorm`:
19
+ 1. Đọc mô tả thô của user.
20
+ 2. Xác định yêu cầu cần cả BE và FE không.
21
+ 3. Hỏi user tối đa 5 câu hỏi để clarify scope, alternatives, constraints.
22
+ 4. Chốt Design Brief.
23
+ 5. CHỜ user approve mới chuyển sang Phase 1.
24
+
25
+ ---
26
+
27
+ ## Phase 1: Specify + Clarify
28
+
29
+ ### Bước 0: Detect project context
30
+ 1. Kiểm tra project hiện tại là BE hay FE:
31
+ - Có pom.xml/build.gradle → Backend
32
+ - Có angular.json/package.json+react → Frontend
33
+ 2. Đọc `.evnict/config.yaml` → liệt kê TẤT CẢ repos
34
+ 3. Nếu feature cần cả BE+FE:
35
+ - Spec PHẢI bao gồm cả BE và FE sections
36
+ - Plan PHẢI sinh tasks cho CẢ BE và FE
37
+ - Tasks BE đánh prefix `be-`, tasks FE đánh prefix `fe-`
38
+ - API contract PHẢI được sinh trong plan phase
39
+ 4. Thông báo: "Feature sẽ cần handoff sang [FE/BE].
40
+ Sau implement, chạy `/evnict-kit:handoff` để chuyển tasks."
41
+
42
+ ### Bước 1: Thu thập context
43
+ 1. Đọc `.evnict/config.yaml` → lấy project name, tech stack, wiki path
44
+ 2. **Query wiki** (nếu có) → tìm context liên quan đến chức năng được mô tả:
45
+ - Đọc index từ `{wiki_path}/processed/`
46
+ - Tìm theo keyword/domain/tags từ mô tả feature
47
+ - Nếu tìm được → đưa vào context khi tạo spec
48
+ 3. Đọc rules hiện tại trong `.agent/rules/` → nắm conventions dự án
49
+
50
+ ### Bước 2: Sinh spec draft
51
+ Tạo file `.evnict/specs/{feature-slug}/spec.md` theo format:
52
+
53
+ ```markdown
54
+ # Spec: {Feature Name}
55
+ ## Generated by /evnict-kit:feature-large
56
+ ## Date: {YYYY-MM-DD}
57
+
58
+ ---
59
+
60
+ ## 1. WHAT — Chức năng gì
61
+ {Mô tả chức năng, user story format nếu phù hợp}
62
+ - As a [role], I want to [action], so that [benefit]
63
+
64
+ ## 2. WHY — Tại sao cần
65
+ {Mục đích nghiệp vụ, giá trị mang lại}
66
+
67
+ ## 3. WHO — Ai sử dụng
68
+ | Vai trò | Quyền hạn |
69
+ |---------|-----------|
70
+ | {role} | {permissions} |
71
+
72
+ ## 4. SCOPE — Phạm vi
73
+ ### Bao gồm
74
+ - {in-scope items}
75
+
76
+ ### KHÔNG bao gồm
77
+ - {out-of-scope items}
78
+
79
+ ## 5. BUSINESS RULES
80
+ | Mã | Quy tắc | Ví dụ |
81
+ |----|---------|-------|
82
+ | BR01 | {rule description} | {example} |
83
+ | BR02 | ... | ... |
84
+
85
+ ## 6. LUỒNG NGHIỆP VỤ
86
+ ### Luồng chính (Main Flow)
87
+ 1. {step 1}
88
+ 2. {step 2}
89
+ 3. ...
90
+
91
+ ### Luồng ngoại lệ (Exception Flow)
92
+ - Nếu {condition} → {behavior}
93
+
94
+ ## 7. ACCEPTANCE CRITERIA
95
+ - [ ] {criterion 1}
96
+ - [ ] {criterion 2}
97
+
98
+ ## 8. PHẠM VI KỸ THUẬT
99
+ ### Backend
100
+ - API endpoints cần tạo: ...
101
+ - Database changes: ...
102
+ - Service logic: ...
103
+
104
+ ### Frontend
105
+ - Pages/Components cần tạo: ...
106
+ - State management: ...
107
+ - API integration: ...
108
+
109
+ ### Database
110
+ - New tables/columns: ...
111
+ - Migration scripts: ...
112
+ ```
113
+
114
+ ### Bước 3: Đặt câu hỏi clarify NGAY TRONG OUTPUT
115
+ Sau khi sinh spec draft, hỏi user TỐI ĐA 3 câu:
116
+
117
+ ```markdown
118
+ ## ❓ Câu hỏi cần làm rõ
119
+
120
+ ### Q1: Scope
121
+ {Câu hỏi về phạm vi — feature này bao gồm/không bao gồm gì?}
122
+ Gợi ý: A) ... | B) ... | C) Custom
123
+
124
+ ### Q2: Edge Cases
125
+ {Câu hỏi về trường hợp ngoại lệ}
126
+
127
+ ### Q3: Constraints
128
+ {Câu hỏi về ràng buộc kỹ thuật/nghiệp vụ}
129
+ ```
130
+
131
+ **Nguyên tắc clarify (theo spec-kit):**
132
+ - Chỉ hỏi khi choice ẢNH HƯỞNG LỚN đến scope/security/UX
133
+ - Có nhiều cách hiểu hợp lý nhưng kết quả khác nhau
134
+ - Không có default hợp lý
135
+ - Giới hạn TỐI ĐA 3 câu hỏi — các vấn đề nhỏ → tự quyết định, ghi vào Assumptions
136
+
137
+ ### Bước 4: User trả lời → Update spec → Confirm
138
+
139
+ ---
140
+
141
+ ## Phase 2: Plan + Task Breakdown
142
+
143
+ **Trigger:** `/evnict-kit:plan` (chờ User xác nhận trả lời hết Câu hỏi làm rõ ở Phase 1)
144
+
145
+ ### Bước 1: Sinh plan files
146
+ Sau khi spec confirmed, tạo cấu trúc:
147
+
148
+ ```
149
+ .evnict/specs/{feature-slug}/
150
+ ├── spec.md ← Đã confirm ở Phase 1
151
+ ├── plan.md ← Tổng plan (sinh ở bước này)
152
+ ├── tasks/
153
+ │ ├── 01-db-migration.md
154
+ │ ├── 02-be-repository.md
155
+ │ ├── 03-be-service.md
156
+ │ ├── 04-be-controller.md
157
+ │ ├── 05-fe-service.md
158
+ │ ├── 06-fe-component.md
159
+ │ └── 07-fe-page.md
160
+ └── contracts/
161
+ └── api-contract.yaml
162
+ ```
163
+
164
+ ### Bước 2: Nội dung plan.md
165
+
166
+ ```markdown
167
+ # Plan: {Feature Name}
168
+ ## Tổng quan
169
+ - Estimated: {X} subtasks, ~{Y} phút
170
+ - BE tasks: {N}
171
+ - FE tasks: {M}
172
+ - DB tasks: {K}
173
+
174
+ ## Thứ tự thực hiện
175
+ 1. DB Migration (PHẢI xong trước)
176
+ 2. BE: Repository → Service → Controller (tuần tự)
177
+ 3. FE: Service → Component → Page (tuần tự, SAU KHI BE xong API)
178
+
179
+ ## Dependencies
180
+ - FE tasks PHẢI chờ BE hoàn thành API → đọc contract từ contracts/api-contract.yaml
181
+ - BE tasks PHẢI chờ DB migration xong
182
+ ```
183
+
184
+ ### Bước 3: Nội dung mỗi task file
185
+
186
+ > **CHI TIẾT:** Xem template đầy đủ trong command `/evnict-kit:plan` — Bước 4.
187
+ > Mỗi task file PHẢI ≥ 100 dòng, bao gồm 8 sections:
188
+ > Mục tiêu, Business Context, Files list, Implementation Guide (code patterns từ file mẫu thật),
189
+ > Test Cases (≥ 3), Acceptance Criteria, Dependencies, Estimated.
190
+
191
+ ```markdown
192
+ # Task 01: DB Migration — {description}
193
+ ## 1. Mục tiêu
194
+ {3-5 câu mô tả cụ thể}
195
+
196
+ ## 2. Business Context
197
+ - BR{XX}: {rule liên quan}
198
+
199
+ ## 3. Files cần tạo/sửa
200
+ | File | Action | Mô tả |
201
+ |------|--------|-------|
202
+ | database/migrations/V{date}_{seq}__{desc}.sql | CREATE | Migration UP |
203
+ | database/migrations/V{date}_{seq}__{desc}_ROLLBACK.sql | CREATE | Rollback |
204
+
205
+ ## 4. Implementation Guide
206
+ ### Conventions: Rule 03 → Migration naming convention
207
+ ### Code Pattern: (trích từ migration mẫu trong project)
208
+
209
+ ## 5. Test Cases (TDD)
210
+ | # | Test | Input | Expected | Type |
211
+ |---|------|-------|----------|------|
212
+ | 1 | Migration UP thành công | run script | Table tồn tại | Integration |
213
+ | 2 | Columns đúng type | describe table | Match schema | Integration |
214
+ | 3 | Rollback thành công | run rollback | Table xóa | Integration |
215
+
216
+ ## 6. Acceptance Criteria
217
+ - [ ] {specific criteria}
218
+
219
+ ## 7. Dependencies
220
+ - Requires: none
221
+ - Blocks: Task 02 (BE Repository)
222
+
223
+ ## 8. Estimated: 3 phút
224
+ ```
225
+
226
+ ### Bước 4: API Contract (cho FE↔BE coordination)
227
+
228
+ ```yaml
229
+ # contracts/api-contract.yaml
230
+ feature: {feature-name}
231
+ generated: {date}
232
+ endpoints:
233
+ - method: POST
234
+ path: /api/{module}/{action}
235
+ description: {mô tả}
236
+ request:
237
+ body:
238
+ fieldName: { type: string, required: true, maxLength: 100 }
239
+ response:
240
+ 200:
241
+ schema: ResponseData
242
+ data:
243
+ id: { type: number }
244
+ 400:
245
+ schema: ResponseData
246
+ error: { message: string }
247
+ ```
248
+
249
+ ### Bước 5: User review plan → Confirm trước khi implement
250
+
251
+ ---
252
+
253
+ ## Phase 3: Implement (TDD per subtask)
254
+
255
+ **Trigger:** `/evnict-kit:implement` (sau khi plan đã confirm)
256
+
257
+ ### Pre-conditions
258
+ - Plan đã được user approve
259
+ - Working tree clean (`git status`)
260
+
261
+ ### Bước 1: Tạo feature branch
262
+ ```bash
263
+ git checkout -b feature/{feature-slug}
264
+ ```
265
+
266
+ ### Bước 2: Với MỖI task file, thực hiện TDD cycle
267
+
268
+ > **MANDATORY:** Sau mỗi task → STOP-AND-ASK (xem implement workflow).
269
+ > Agent KHÔNG ĐƯỢC tự chuyển sang task tiếp mà không hỏi user.
270
+
271
+ ```
272
+ ┌─────────────────────────────────────────────┐
273
+ │ Đọc task spec (tasks/01-xxx.md) │
274
+ │ ↓ │
275
+ │ [RED] Viết test TRƯỚC → test FAIL │
276
+ │ ↓ │
277
+ │ [GREEN] Code TỐI THIỂU để test PASS │
278
+ │ ↓ │
279
+ │ Verify: lint pass + build OK │
280
+ │ ↓ │
281
+ │ [REFACTOR] Cải thiện (test vẫn PASS) │
282
+ │ ↓ │
283
+ │ Commit: feat({module}): {task} [task-{N}] │
284
+ │ ↓ │
285
+ │ Cập nhật handoff status │
286
+ │ ↓ │
287
+ │ ══ STOP-AND-ASK ══ (6 options A-F) │
288
+ │ Chờ user approve trước khi tiếp tục │
289
+ │ ↓ │
290
+ │ → Task tiếp theo (chỉ khi user chọn A/F) │
291
+ └─────────────────────────────────────────────┘
292
+ ```
293
+
294
+ ### Bước 3: 3-Strike Rule (QĐ-TTPM Mục 8.7)
295
+ Nếu test fail > 3 lần cho cùng 1 đoạn code:
296
+ 1. **DỪNG** phiên AI
297
+ 2. Báo user: "Task {N} gặp vấn đề, cần phân tích thủ công"
298
+ 3. KHÔNG tiếp tục implement
299
+
300
+ ### Bước 4: FE↔BE Coordination
301
+ Khi BE agent xong API:
302
+ 1. Ghi API contract vào `.evnict/handoff/contracts/{feature}-api.yaml`
303
+ 2. Cập nhật `.evnict/handoff/be-status.md`:
304
+ ```
305
+ status: done
306
+ completed_tasks: ["task-01", "task-02", "task-03", "task-04"]
307
+ api_contract: handoff/contracts/{feature}-api.yaml
308
+ last_updated: {timestamp}
309
+ ```
310
+ 3. FE agent đọc contract → implement FE tasks
311
+
312
+ ### Bước 5: Final verify
313
+ ```bash
314
+ # Tất cả test pass
315
+ ./mvnw test # hoặc ng test --watch=false
316
+ # Lint pass
317
+ ./mvnw spotless:check # hoặc ng lint
318
+ # Build OK
319
+ ./mvnw compile # hoặc ng build
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Phase 4: Archive + Wiki
325
+
326
+ **Trigger:** `/evnict-kit:wiki-archive-feature` (sau khi implement xong, user đã review)
327
+
328
+ ### Bước 1: Tự tóm tắt feature
329
+ Đọc:
330
+ - `.evnict/specs/{feature}/spec.md`
331
+ - `git log --oneline` trên feature branch
332
+ - Files changed (`git diff --stat main..HEAD`)
333
+
334
+ ### Bước 2: Push vào wiki
335
+ Sinh file markdown:
336
+ ```markdown
337
+ ---
338
+ title: "{feature_name}"
339
+ domain: "{module}"
340
+ type: feature
341
+ date: {YYYY-MM-DD}
342
+ tags: [{auto-detected tags}]
343
+ related_specs: [".evnict/specs/{feature}/spec.md"]
344
+ ---
345
+
346
+ ## Tóm tắt
347
+ {AI-generated summary — 3-5 câu}
348
+
349
+ ## API mới
350
+ {list endpoints added/changed}
351
+
352
+ ## Database changes
353
+ {list migrations}
354
+
355
+ ## Files thay đổi chính
356
+ {key files changed}
357
+
358
+ ## Lessons learned
359
+ {AI-detected issues và cách giải quyết}
360
+ ```
361
+
362
+ Copy vào `{wiki_path}/raw/notes/{domain}-{slug}.md`
363
+
364
+ ### Bước 3: Trigger ingest
365
+ ```bash
366
+ cd {wiki_path} && npm run ingest
367
+ ```
368
+ ⚠️ Nếu ingest chưa setup → nhắc user chạy `/evnict-kit:init-wiki`
369
+
370
+ ### Bước 4: Archive spec
371
+ Copy `.evnict/specs/{feature}/` → `docs/specs/{feature}/`
372
+
373
+ ### Bước 5: Tạo tài liệu đặc tả (QĐ-TTPM Mục 8.9)
374
+ Nếu thay đổi > 20 dòng code → tạo `docs/postmortem/{feature}-{date}.md`:
375
+ | # | Nội dung | Chi tiết |
376
+ |---|----------|----------|
377
+ | 1 | Nhiệm vụ | Task giao cho Agent |
378
+ | 2 | Công cụ | Tool + model + config |
379
+ | 3 | Prompt chính | Prompts quan trọng (đã clean sensitive) |
380
+ | 4 | Thay đổi | Files changed + tóm tắt |
381
+ | 5 | Kiểm tra | Tests, lint, security scan |
382
+ | 6 | Vấn đề | Issues + lessons learned |
383
+ | 7 | Commit ref | Hash các commit liên quan |
384
+
385
+ ### Bước 6: Confirm
386
+ ```
387
+ ✅ Wiki updated: {wiki_path}/raw/notes/{file}
388
+ ✅ Spec archived: docs/specs/{feature}/
389
+ ✅ Postmortem: docs/postmortem/{feature}-{date}.md
390
+ ✅ Ingest triggered
391
+ ```
@@ -0,0 +1,84 @@
1
+ # Feature Small
2
+ **Command:** `/evnict-kit:feature-small $ARGUMENTS`
3
+
4
+ $ARGUMENTS chứa mô tả từ user.
5
+
6
+ ## Khi nào dùng
7
+ - Feature nhỏ, đơn giản (1 API, 1 component, sửa logic)
8
+ - Không cần spec chi tiết
9
+ - Ước lượng < 1 ngày
10
+
11
+ ## Input
12
+ - Mô tả feature ngắn gọn
13
+ - VD: `/evnict-kit:feature-small Thêm API export danh sách khách hàng ra Excel`
14
+
15
+ ---
16
+
17
+ ## Bước 1: Query wiki
18
+ Tìm context liên quan trong wiki:
19
+ ```bash
20
+ grep -rl "{keyword}" {wiki_path}/processed/ --include="*.md"
21
+ ```
22
+ Đọc kết quả → áp dụng context.
23
+
24
+ ## Bước 2: Plan ngắn
25
+ Tạo plan trực tiếp (KHÔNG tạo spec file):
26
+
27
+ ```markdown
28
+ ## Quick Plan: {feature}
29
+ - Files cần tạo/sửa: {list}
30
+ - Test cases: {list}
31
+ - Dependencies: {list}
32
+ - Estimated: {X} phút
33
+ ```
34
+
35
+ Hỏi user confirm plan trước khi implement.
36
+
37
+ ## Bước 3: Checkpoint
38
+ ```bash
39
+ git checkout -b feature/{slug}
40
+ ```
41
+
42
+ ## Bước 4: TDD Implement
43
+ Với mỗi file:
44
+ 1. [RED] Viết test → FAIL
45
+ 2. [GREEN] Code tối thiểu → PASS
46
+ 3. Verify: `./mvnw test` + `./mvnw compile`
47
+ 4. Commit: `feat({module}): {description}`
48
+
49
+ 3-Strike Rule vẫn áp dụng.
50
+
51
+ ## Bước 5: Final verify
52
+ ```bash
53
+ ./mvnw test && ./mvnw spotless:check && ./mvnw compile
54
+ # hoặc
55
+ ng test --watch=false && ng lint && ng build
56
+ ```
57
+
58
+ ## Bước 6: Archive (optional)
59
+ Nếu thay đổi > 20 dòng → push wiki + tạo postmortem.
60
+ Nếu < 20 dòng → skip, chỉ commit.
61
+
62
+ ## Bước cuối: Wiki
63
+ Gợi ý user:
64
+ ```
65
+ 💡 Feature hoàn thành. Thêm tri thức vào wiki?
66
+ A) Có — chạy `/evnict-kit:wiki-archive-feature` (nạp đầy đủ)
67
+ B) Nhanh — tôi tóm tắt ngắn gọn → push wiki
68
+ C) Không — skip
69
+ ```
70
+ - Nếu A → chạy `/evnict-kit:wiki-archive-feature`
71
+ - Nếu B → gọi skill `evnict-kit-wiki` action=push → auto-ingest
72
+ - Nếu C → skip
73
+
74
+ ---
75
+
76
+ ## Checklist hoàn thành
77
+ - [ ] Wiki queried
78
+ - [ ] Plan confirmed
79
+ - [ ] Checkpoint created
80
+ - [ ] TDD implemented
81
+ - [ ] All tests pass
82
+ - [ ] Build OK
83
+ - [ ] Committed
84
+ - [ ] Wiki updated (nếu > 20 dòng)