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,143 @@
1
+ ---
2
+ name: evnict-kit-onboard
3
+ description: Onboard thành viên mới — tóm tắt project, architecture, conventions, commands, workflow. Giúp member mới nắm bắt dự án nhanh chóng.
4
+ compatibility: All tech stacks
5
+ ---
6
+
7
+ # evnict-kit-onboard — Onboard Member Mới
8
+
9
+ ## Khi nào dùng
10
+ - Member mới tham gia dự án
11
+ - Developer chuyển sang module mới
12
+ - Cần tóm tắt toàn cảnh dự án
13
+
14
+ ## Input Parameters
15
+ - `role` (optional): backend | frontend | fullstack (default: fullstack)
16
+ - `module` (optional): Module cần focus
17
+
18
+ ---
19
+
20
+ ## Workflow Steps
21
+
22
+ ### Bước 1: Thu thập thông tin dự án
23
+ 1. Đọc `.evnict/config.yaml` → project info
24
+ 2. Đọc `AGENTS.md` hoặc context file → architecture overview
25
+ 3. Đọc rules `05-evnict-kit-project-conventions.md` → conventions
26
+ 4. Đọc wiki → domain knowledge
27
+ 5. Scan codebase → project structure
28
+
29
+ ### Bước 2: Sinh Onboarding Guide
30
+
31
+ ```markdown
32
+ # 🚀 Onboarding: {Project Name}
33
+ ## Date: {YYYY-MM-DD}
34
+ ## Role: {backend | frontend | fullstack}
35
+
36
+ ---
37
+
38
+ ## 1. Tổng quan dự án
39
+ - **Tên dự án**: {name}
40
+ - **Mô tả**: {description}
41
+ - **Tech stack**: {tech stack}
42
+ - **Database**: {database}
43
+ - **Team size**: {estimate from git log}
44
+
45
+ ## 2. Architecture
46
+ {ASCII architecture diagram from AGENTS.md}
47
+
48
+ ### Layers
49
+ - Controller → Service → Repository → Database
50
+ - Frontend: Component → Service → API
51
+
52
+ ### Key Modules
53
+ | Module | Mô tả | Owner |
54
+ |--------|--------|-------|
55
+ | {module} | {desc} | {from git blame} |
56
+
57
+ ## 3. Project Structure
58
+ {tree -L 3 output}
59
+
60
+ ## 4. Development Environment
61
+
62
+ ### Prerequisites
63
+ - JDK {version}
64
+ - Node.js {version}
65
+ - Oracle/SQL Server client
66
+ - IDE: Any (recommend Antigravity/VS Code)
67
+
68
+ ### Setup
69
+ ```bash
70
+ # Clone
71
+ git clone {repo-url}
72
+
73
+ # Backend
74
+ cd {be-folder}
75
+ ./mvnw clean install
76
+
77
+ # Frontend
78
+ cd {fe-folder}
79
+ npm install
80
+ ng serve
81
+ ```
82
+
83
+ ### Environment Variables
84
+ ```
85
+ DB_HOST=localhost
86
+ DB_PORT=1521
87
+ DB_NAME={name}
88
+ JWT_KEY_PATH=path/to/key
89
+ ```
90
+
91
+ ## 5. Coding Conventions (tóm tắt)
92
+ {Các conventions quan trọng nhất từ rules}
93
+
94
+ - Naming: {pattern}
95
+ - API: {pattern}
96
+ - Commit message: {type}({scope}): {description}
97
+
98
+ ## 6. Development Workflow
99
+ 1. Nhận task → đọc spec
100
+ 2. Tạo branch: `feature/{task-slug}`
101
+ 3. Code theo TDD: Red → Green → Refactor
102
+ 4. Commit thường xuyên
103
+ 5. Chạy test + lint trước merge
104
+ 6. Tạo merge request → review
105
+
106
+ ## 7. AI Agent Commands
107
+ | Command | Mô tả |
108
+ |---------|--------|
109
+ | `/evnict-kit:init-rules` | Khởi tạo project conventions |
110
+ | `/evnict-kit:feature-large` | Phát triển feature lớn |
111
+ | `/evnict-kit:feature-small` | Feature nhỏ nhanh |
112
+ | `/evnict-kit:bug-fix` | Quy trình sửa lỗi |
113
+ | `/evnict-kit:review` | Auto review code |
114
+
115
+ ## 8. Important Links
116
+ - Repository: {repo-url}
117
+ - CI/CD: {azure-devops-url}
118
+ - Wiki: {wiki-path}
119
+ - Specs: `.evnict/specs/`
120
+
121
+ ## 9. Security Reminders (QĐ-TTPM)
122
+ - ❌ KHÔNG hardcode secrets
123
+ - ❌ KHÔNG git push (Agent không push)
124
+ - ❌ KHÔNG log PII
125
+ - ✅ Test trước khi commit
126
+ - ✅ Checkpoint trước phiên AI
127
+ ```
128
+
129
+ ### Bước 3: Module-specific onboarding (nếu có module)
130
+ Nếu user chỉ định module:
131
+ 1. Đọc code module → list files, components, services
132
+ 2. Đọc tests → hiểu business logic
133
+ 3. Đọc specs liên quan trong `.evnict/specs/`
134
+ 4. Tạo module-specific guide
135
+
136
+ ---
137
+
138
+ ## Tiêu chí hoàn thành
139
+ - [ ] Onboarding guide tạo đầy đủ
140
+ - [ ] Architecture diagram included
141
+ - [ ] Convention summary included
142
+ - [ ] Setup instructions verified
143
+ - [ ] AI commands listed
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: evnict-kit-prompt-standard
3
+ description: Chuẩn viết prompt theo QĐ-TTPM Mục 8.5 — format, ví dụ tốt/xấu, template cho từng loại task.
4
+ compatibility: All AI tools
5
+ ---
6
+
7
+ # evnict-kit-prompt-standard — Chuẩn Viết Prompt
8
+
9
+ ## Khi nào dùng
10
+ - Viết prompt cho AI Agent
11
+ - Review chất lượng prompt
12
+ - Training member mới về prompt engineering
13
+
14
+ ---
15
+
16
+ ## Nguyên tắc chung (QĐ-TTPM Mục 8.5)
17
+
18
+ ### 1. Rõ ràng, cụ thể
19
+ ```
20
+ ❌ SAI: "Sửa lỗi login"
21
+ ✅ ĐÚNG: "Fix lỗi login API /api/auth/login trả về 500 khi password đúng nhưng account bị lock. Expected: trả 403 với message 'Tài khoản đã bị khóa'."
22
+ ```
23
+
24
+ ### 2. Một prompt = Một nhiệm vụ
25
+ ```
26
+ ❌ SAI: "Tạo API customer, thêm bảng mới, viết test, deploy"
27
+ ✅ ĐÚNG: "Tạo API GET /api/customers — danh sách khách hàng phân trang, filter theo tên và trạng thái"
28
+ ```
29
+
30
+ ### 3. Có context đầy đủ
31
+ ```
32
+ ❌ SAI: "Thêm field vào form"
33
+ ✅ ĐÚNG: "Thêm field 'Số điện thoại' vào form Customer (src/app/features/customer/pages/customer-form/). Field type: input text, validation: pattern 0[0-9]{9}, required: true. Dùng PrimeNG p-inputText."
34
+ ```
35
+
36
+ ### 4. Chỉ định output format
37
+ ```
38
+ ❌ SAI: "Viết test cho service"
39
+ ✅ ĐÚNG: "Viết unit test cho CustomerService.create() bằng JUnit5 + Mockito. Test cases: 1) Happy path - valid data, 2) Name rỗng → BusinessException, 3) Phone sai format → ValidationException."
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Templates theo loại task
45
+
46
+ ### Template: Tạo API
47
+ ```
48
+ Tạo API {METHOD} {path}
49
+ - Mô tả: {description}
50
+ - Input: {fields with types and validation}
51
+ - Output: ResponseData với {data structure}
52
+ - Auth: {required | public}
53
+ - Business rules: {rules}
54
+ - Tech: Controller → Service → Repository (JOOQ)
55
+ ```
56
+
57
+ ### Template: Fix Bug
58
+ ```
59
+ Fix bug: {description}
60
+ - Steps to reproduce: {steps}
61
+ - Expected: {expected}
62
+ - Actual: {actual}
63
+ - File(s) liên quan: {paths}
64
+ - TDD: viết test reproduce lỗi trước
65
+ ```
66
+
67
+ ### Template: Tạo Component
68
+ ```
69
+ Tạo component {name} trong module {module}
70
+ - Loại: {page | shared | feature}
71
+ - Chức năng: {description}
72
+ - Data source: {API endpoint hoặc @Input}
73
+ - UI: {PrimeNG components to use}
74
+ - States: loading, error, empty, data
75
+ ```
76
+
77
+ ### Template: Code Review
78
+ ```
79
+ Review code trên branch {branch}
80
+ - Focus: {security | logic | quality | all}
81
+ - Files changed: {list hoặc "git diff"}
82
+ - Spec reference: {path to spec}
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Anti-patterns
88
+
89
+ | ❌ Bad Prompt | ✅ Good Prompt | Lỗi |
90
+ |-------------|--------------|-----|
91
+ | "Làm cho nó chạy" | "Fix compile error ở CustomerService.java:45 — missing import for ResponseData" | Quá mơ hồ |
92
+ | "Sửa tất cả lỗi" | "Fix lỗi validation ở endpoint POST /api/customers — field 'phone' không check null" | Scope quá rộng |
93
+ | "Viết code đẹp hơn" | "Refactor CustomerRepository.search() — extract điều kiện filter thành private methods" | Không measurable |
94
+ | "Bắt chước project X" | "Implement pagination pattern giống CustomerRepository — dùng JOOQ offset/limit + fetchCount" | Thiếu context |
95
+
96
+ ---
97
+
98
+ ## Tiêu chí hoàn thành
99
+ - [ ] Prompt rõ ràng, cụ thể
100
+ - [ ] 1 prompt = 1 nhiệm vụ
101
+ - [ ] Có context (file, module, tech)
102
+ - [ ] Có expected output/format
103
+ - [ ] Không quá mơ hồ
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: evnict-kit-receiving-review
3
+ description: Hướng dẫn Agent xử lý Code Review Feedback. Phân loại feedback, lập kế hoạch fix systemwide và phản hồi reviewer một cách chuẩn xác, không tranh cãi.
4
+ ---
5
+
6
+ # evnict-kit-receiving-review
7
+
8
+ ## Khi nào dùng
9
+ - Khi Pull Request / Merge Request nhận được comments từ Reviewer.
10
+ - Khi người dùng (User) tự thực hiện Code Review và dán (paste) comments vào chat.
11
+ - Khi có một hệ thống tự động (SonarQube, GitLab CI) trả về các lỗi Quality Gate.
12
+
13
+ ## Tư duy cốt lõi (Core Mindset)
14
+ 1. **Không Phòng Thủ (No Defensiveness)**: Tuyệt đối không bao giờ trả lời bằng cách mang tính chất cãi lại hay bảo vệ code cũ trừ khi logic hoàn toàn sai lệch dẫn tới hỏng hệ thống. Phải luôn Acknowledge (ghi nhận) đóng góp.
15
+ 2. **Sửa Tận Gốc (Systematic Fix)**: Khi reviewer comment về một lỗi ở một file, hãy chủ động dùng `grep_search` quét TOÀN BỘ codebase xem có chỗ nào mắc lỗi tương tự không và sửa đồng loạt.
16
+ 3. **Phân Loại Rõ Ràng**: Không phải mọi comment đều có chung mức độ ưu tiên. Cần biết phân biệt critical và minor.
17
+ 4. **Giữ Nhịp Độ (Pacing)**: Báo cho reviewer tiến trình. Tránh sửa loạn xạ dẫn đến conflict các file không cần thiết.
18
+
19
+ ---
20
+
21
+ ## Workflow chi tiết
22
+
23
+ ### Bước 1: Tiếp nhận và Phân loại Feedback (Feedback Categorization)
24
+ Đọc toàn bộ các comment review từ user, tách bạch từng mục thành danh sách. Tạo một Tóm tắt phân loại theo 3 mức độ:
25
+
26
+ **Critical (Phải sửa ngay)**
27
+ - Lỗi Security (VD: SQL Injection, XSS, gọi API thiếu Access Control / Role check).
28
+ - Lỗi Performance nghiêm trọng (VD: N+1 Queries do JPA Hibernate, Memory leak vòng lặp).
29
+ - Lỗi Business Logic có kết quả sai lệch hoặc không khớp với Design Brief/Specs đã ký.
30
+
31
+ **Important (Sửa trước khi merge)**
32
+ - Lỗi Design Pattern (VD: Vi phạm MVC, Tight coupling, Service đan chéo Controller).
33
+ - Thiếu Unit Test trầm trọng hoặc Code Coverage rớt thê thảm đỏ lè trên CI.
34
+ - Lỗi vi phạm nghiêm trọng Conventions của dự án (VD: Đặt tên sai, quên Logging block, Hardcode tham số config).
35
+
36
+ **Minor (Optional / Tốt hơn nên làm)**
37
+ - Typo sai chính tả trong đoạn Comments hay Docstrings.
38
+ - Các tối ưu hoá nhỏ lẻ, refactoring mức siêu nhỏ cho Code ngắn gọn hơn (Nitpicks).
39
+ - Reviewer đưa "Ý kiến cá nhân" về sở thích viết code chứ không tác động Business hay System.
40
+
41
+ ### Bước 2: Lập Kế hoạch Sửa chữa (Fix Plan)
42
+ Trình bày Kế hoạch rõ ràng cho người dùng thay vì đi fix câm lặng. Trình bày dạng checklist markdown `[ ]`.
43
+ - "Dựa trên X comments phản hồi, Agent đã tổng hợp và đề xuất Fix Plan như sau:"
44
+ - Đối với Lỗi hệ thống: "Lỗi N+1, Agent sẽ rà soát TOÀN BỘ các file tương tự chứ không chỉ file bị comment."
45
+ - Đối với những Minor/Nitpick, đề xuất "Mục tiểu tiết này Agent sẽ sửa luôn do thời gian fix <1 phút" hoặc "Mục này đòi hỏi refactor rộng, đề xuất tạo Jira Task mới và skip trong PR hiện tại".
46
+
47
+ ### Bước 3: Sửa chữa theo chuẩn TDD và System-Wide Fix
48
+ - Dùng `grep_search` để lùng sục triệt để mã nguồn. Nếu reviewer kêu code gọi API quên Timeout ở 1 chỗ, lập tức tìm những chỗ gọi HTTP client khác để xử lý triệt để.
49
+ - Nếu logic Business bị lỗi và cần thay: Cần chạy lại Test Component. Sửa Test cũ (để nó RED - tức là fail đúng như cách hệ thống bị lỗi), sau đó dọn dẹp Code để test PASS (GREEN).
50
+ - Đảm bảo việc sửa không tạo thêm Bug lặp (Regression bug).
51
+
52
+ ### Bước 4: Kiểm chứng Cuối (Verification Pipeline)
53
+ Luôn kiểm tra lại toàn hệ thống sau sửa chữa:
54
+ - Pass Code Linting (`ng lint`, `./mvnw spotless:check`).
55
+ - Các bài Unit Test và Integration Test phải 100% xanh (`npm test`, `./mvnw verify`).
56
+ - Project Compile thành công không vướng Compile-Time errors.
57
+
58
+ ### Bước 5: Soạn Response Format cho Reviewer
59
+ Sau khi sửa xong, cung cấp cho User một response mẫu chuyên nghiệp để user có thể copy/paste trên GitHub/GitLab:
60
+
61
+ ```markdown
62
+ Cảm ơn review của bạn. Dưới đây là các thay đổi đã thực hiện:
63
+
64
+ ### Đã xử lý (Fixed)
65
+ - ✅ **[Trầm trọng]** Xử lý việc thiếu Role Check ở `AdminController.java`. Đã tách riêng logic phân quyền thành annotation `@PreAuthorize`.
66
+ - ✅ **[Quan trọng]** Đã tối ưu hoá câu Query N+1 ở `OrderRepository.java` bằng cách dùng vòng lặp fetch join. (Bên cạnh đó, em đã kiểm tra lại trên toàn bộ files Repository và fix luôn 2 hàm tương tự).
67
+ - ✅ Bổ sung 4 Unit Tests cho các Edge Cases bạn đã nhắc. Coverage đã được cover đạt 92%.
68
+
69
+ ### Sẽ xử lý trong tương lai (Deferred / Out-of-Scope)
70
+ - 💡 Về việc chuyển sang dùng Caching Layer (`Redis`), em xin phép tạo một thẻ Ticket riêng [TICKET-123] do tác động tới Architecture của Server quá lớn so với mục tiêu thực thi Pull Request hiện tại.
71
+
72
+ Vui lòng Review lại bản mới nhận nhé!
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Xử lý các tình huống khó khăn (Edge Cases Handling)
78
+
79
+ 1. **Reviewer yêu cầu 1 thứ đi ngược lại với `01-evnict-kit-general-rules.md`**:
80
+ - Giải pháp: Trao đổi nhẹ nhàng và nhắc đến chuẩn. VD: "Cảm ơn ý kiến của anh/chị. Tuy nhiên theo chuẩn Project (RP01), chúng ta nên dùng ResponseEntity/Wrapper classes. Anh/chị xem hướng chuẩn này có hợp lý không ạ?"
81
+ 2. **Reviewer yêu cầu tính năng lấn sang scope khác (Scope Creep)**:
82
+ - Giải pháp: Tách bạch rõ. Ghi nhận là ý tưởng hoàn toàn tốt và có tính hệ thống nhưng đề xuất bóc tách ra Feature độc lập để PR nhanh chóng đi vào production. VD: "Tụi em đồng tình chức năng Báo cáo tự động này hữu ích, tuy nhiên nó vượt ra ngoài luồng Thêm mới SP nên Agent đề nghị mở 1 nhánh feature mới".
83
+
84
+ ## Tiêu chí hoàn thành (Definition of Done)
85
+ 1. Đã phân loại rõ ràng 100% các ý kiến.
86
+ 2. Đã fix thực tế trên codebase mọi lỗi Critical và Important do reviewer nhắc đến.
87
+ 3. Code mới bổ sung đều compile, lint, test PASS 100%. Lịch sử Git sạch sẽ.
88
+ 4. Có bài Soạn thảo Response gãy gọn, không đụng chạm đến self-respect.
89
+ 5. Đã lưu lại lessons learned vào file cấu hình Dự án hoặc Wiki (nếu nhận diện đây là một Architectural Flaw thay vì bug thuần tuý).
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: evnict-kit-security-audit
3
+ description: Security audit toàn diện — dependency scan → code scan ATTT01-08 → configuration review → report. Đánh giá ATTT cho module hoặc toàn bộ dự án.
4
+ compatibility: Java Spring Boot, Angular, ASP.NET Core
5
+ ---
6
+
7
+ # evnict-kit-security-audit — Security Audit
8
+
9
+ ## Khi nào dùng
10
+ - Trước khi release version mới
11
+ - Review module mới trước khi merge
12
+ - Kiểm tra định kỳ ATTT (theo QĐ-TTPM)
13
+
14
+ ## Input Parameters
15
+ - `scope` (optional): all | module (default: all)
16
+ - `module` (optional): Tên module cụ thể nếu scope=module
17
+ - `report_path` (optional): Đường dẫn lưu report
18
+
19
+ ---
20
+
21
+ ## Workflow Steps
22
+
23
+ ### Bước 1: Dependency Scan
24
+
25
+ #### Java (Maven)
26
+ ```bash
27
+ ./mvnw org.owasp:dependency-check-maven:check
28
+ ./mvnw versions:display-dependency-updates
29
+ ```
30
+
31
+ #### Node.js (Angular/React)
32
+ ```bash
33
+ npm audit
34
+ npm audit --json > audit-report.json
35
+ ```
36
+
37
+ #### .NET
38
+ ```bash
39
+ dotnet list package --vulnerable
40
+ ```
41
+
42
+ Ghi nhận kết quả:
43
+ | Dependency | CVE | Severity | Fix Available |
44
+ |-----------|-----|----------|---------------|
45
+ | {lib} | {CVE-xxx} | {Critical/High/Medium/Low} | {Yes/No} |
46
+
47
+ ### Bước 2: Code Scan — ATTT01-ATTT08
48
+
49
+ Chạy TOÀN BỘ scan commands từ `02-evnict-kit-security-rules.md`:
50
+
51
+ ```bash
52
+ # ATTT01: SQL Injection
53
+ grep -rn "query.*+.*\"" --include="*.java" src/
54
+ grep -rn "createNativeQuery.*+\s" --include="*.java" src/
55
+ grep -rn "DSL\.field(.*+\s" --include="*.java" src/
56
+ grep -rn "DSL\.condition(.*+\s" --include="*.java" src/
57
+
58
+ # ATTT02: XSS
59
+ grep -rn "\[innerHTML\]" --include="*.html" src/
60
+ grep -rn "bypassSecurityTrust" --include="*.ts" src/
61
+ grep -rn "dangerouslySetInnerHTML" --include="*.tsx" --include="*.jsx" src/
62
+
63
+ # ATTT04: JWT
64
+ grep -rn "HS256\|alg.*none\|secret.*=\"" --include="*.java" src/
65
+ grep -rn "parse.*Unsafe\|without.*verification" --include="*.java" src/
66
+
67
+ # ATTT07: Data Exposure
68
+ grep -rn "ResponseEntity.ok(.*repository\|ResponseEntity.ok(.*entity" --include="*.java" src/
69
+ grep -rn "printStackTrace\|getStackTrace" --include="*.java" src/
70
+
71
+ # R01: Secrets
72
+ grep -rn "password\s*=\s*\"" --include="*.java" --include="*.ts" --include="*.yml" src/
73
+ grep -rn "apiKey\s*=\s*\"" --include="*.java" --include="*.ts" src/
74
+ grep -rn "secret\s*=\s*\"" --include="*.java" --include="*.ts" src/
75
+
76
+ # R04: PII in logs
77
+ grep -rn "log\.\(info\|debug\|warn\|error\).*password\|log\.\(info\|debug\|warn\|error\).*token" --include="*.java" src/
78
+ ```
79
+
80
+ ### Bước 3: Configuration Review
81
+
82
+ #### Kiểm tra Security Config
83
+ ```bash
84
+ find src -name "SecurityConfig*.java" -o -name "WebSecurityConfig*.java" | head -5
85
+ ```
86
+
87
+ Verify:
88
+ - [ ] CSRF configured (hoặc disabled với JWT justification)
89
+ - [ ] CORS configured properly (không wildcard `*` cho production)
90
+ - [ ] CSP headers set
91
+ - [ ] X-Content-Type-Options: nosniff
92
+ - [ ] X-Frame-Options: DENY
93
+ - [ ] Strict-Transport-Security set
94
+
95
+ #### Kiểm tra .gitignore
96
+ ```bash
97
+ cat .gitignore
98
+ ```
99
+ Verify chặn: `.env`, `*.key`, `*.pem`, `application-prod.yml`
100
+
101
+ #### Kiểm tra endpoints public
102
+ ```bash
103
+ grep -rn "permitAll\|anonymous" --include="*.java" src/
104
+ ```
105
+ Verify: chỉ login, refresh, health endpoint là public
106
+
107
+ ### Bước 4: Tạo Security Report
108
+
109
+ ```markdown
110
+ # 🔒 Security Audit Report
111
+ ## Project: {project-name}
112
+ ## Date: {YYYY-MM-DD}
113
+ ## Scope: {all | module: {name}}
114
+ ## Auditor: AI Agent
115
+
116
+ ---
117
+
118
+ ## Executive Summary
119
+ | Category | Issues Found | Critical | High | Medium | Low |
120
+ |----------|-------------|----------|------|--------|-----|
121
+ | Dependencies | {N} | {n} | {n} | {n} | {n} |
122
+ | Code (ATTT) | {N} | {n} | {n} | {n} | {n} |
123
+ | Configuration | {N} | {n} | {n} | {n} | {n} |
124
+ | **Total** | **{N}** | **{n}** | **{n}** | **{n}** | **{n}** |
125
+
126
+ ## Verdict: {PASS | FAIL | NEEDS ATTENTION}
127
+
128
+ ---
129
+
130
+ ## 1. Dependency Vulnerabilities
131
+ {Table of CVEs found}
132
+
133
+ ## 2. Code Vulnerabilities
134
+ ### ATTT01 — SQL Injection: {PASS/FAIL}
135
+ {Details}
136
+
137
+ ### ATTT02 — XSS: {PASS/FAIL}
138
+ {Details}
139
+
140
+ ### ATTT03 — CSRF: {PASS/FAIL}
141
+ {Details}
142
+
143
+ ### ATTT04 — JWT Security: {PASS/FAIL}
144
+ {Details}
145
+
146
+ ### ATTT05 — Dependencies: {PASS/FAIL}
147
+ {Details}
148
+
149
+ ### ATTT06 — File Upload: {PASS/FAIL}
150
+ {Details}
151
+
152
+ ### ATTT07 — Data Exposure: {PASS/FAIL}
153
+ {Details}
154
+
155
+ ### ATTT08 — OWASP Top 10: {PASS/FAIL}
156
+ {Details}
157
+
158
+ ## 3. Configuration Issues
159
+ {List of config issues}
160
+
161
+ ## 4. Recommendations
162
+ | # | Priority | Action | Effort |
163
+ |---|----------|--------|--------|
164
+ | 1 | {P} | {action} | {estimate} |
165
+
166
+ ## 5. Sign-off
167
+ - Reviewed by: AI Agent
168
+ - Date: {date}
169
+ - Next audit: {recommended date}
170
+ ```
171
+
172
+ Lưu report vào: `docs/attt/security-audit-{date}.md`
173
+
174
+ ---
175
+
176
+ ## Error Handling
177
+
178
+ ### FAIL audit khi:
179
+ - Critical CVE chưa patch → BLOCK deployment
180
+ - SQL Injection found → BLOCK + fix ngay
181
+ - Hardcoded secrets found → BLOCK + rotate secrets
182
+
183
+ ---
184
+
185
+ ## Tiêu chí hoàn thành
186
+ - [ ] Dependency scan completed
187
+ - [ ] Code scan ATTT01-08 completed
188
+ - [ ] Configuration reviewed
189
+ - [ ] Report created với verdict
190
+ - [ ] Critical/High issues escalated