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,301 @@
1
+ # {{PROJECT_NAME}} — Claude Code Context
2
+ > Generated by evnict-kit v0.2.1 | {{DATE}}
3
+ > Đây là file context CHỦ ĐẠO — Claude Code đọc file này ở MỌI request.
4
+
5
+ ---
6
+
7
+ ## 1. PROJECT OVERVIEW
8
+
9
+ | Property | Value |
10
+ |----------|-------|
11
+ | Project Name | {{PROJECT_NAME}} |
12
+ | Tech Stack | {{TECH_STACK}} |
13
+ | Database | {{DATABASE}} |
14
+ | evnict-kit | v0.2.1 |
15
+
16
+ ### Mô tả
17
+ <!-- CHƯA KHỞI TẠO — chạy /evnict-kit:init-context -->
18
+ {Mô tả ngắn gọn về dự án — 2-3 câu}
19
+
20
+ ### Mục tiêu nghiệp vụ
21
+ <!-- CHƯA KHỞI TẠO -->
22
+ {Mục tiêu chính của hệ thống}
23
+
24
+ ---
25
+
26
+ ## 2. ARCHITECTURE
27
+
28
+ ### Layer Structure
29
+ ```
30
+ Controller Layer → HTTP handling, input validation (@Valid)
31
+
32
+ Service Layer → Business logic, @Transactional
33
+
34
+ Repository Layer → Data access (JOOQ type-safe queries)
35
+
36
+ Database → Oracle/SQL Server
37
+ ```
38
+
39
+ ### Nguyên tắc
40
+ - Controller KHÔNG chứa business logic
41
+ - Service quản lý transactions
42
+ - Repository CHỈ data access — không business logic
43
+ - DTO cho data transfer — KHÔNG dùng Entity trực tiếp trong response
44
+
45
+ ---
46
+
47
+ ## 3. PROJECT STRUCTURE
48
+
49
+ ### Backend
50
+ <!-- CHƯA KHỞI TẠO — Agent sẽ điền từ tree output -->
51
+ ```
52
+ src/main/java/com/evn/{{PROJECT_NAME}}/
53
+ ├── config/ ← Application configuration
54
+ ├── common/ ← Shared utilities, base classes
55
+ │ ├── dto/ ← ResponseData, PageDTO
56
+ │ └── exception/ ← BusinessException, GlobalExceptionHandler
57
+ ├── security/ ← JWT filter, SecurityConfig
58
+ └── {module}/ ← Feature modules
59
+ ├── controller/
60
+ ├── service/
61
+ ├── repository/
62
+ └── dto/
63
+ ```
64
+
65
+ ### Frontend
66
+ <!-- CHƯA KHỞI TẠO -->
67
+ ```
68
+ src/app/
69
+ ├── core/ ← Guards, interceptors, core services
70
+ ├── shared/ ← Reusable components, pipes, directives
71
+ ├── features/ ← Feature modules (lazy-loaded)
72
+ │ └── {module}/
73
+ │ ├── pages/
74
+ │ ├── components/
75
+ │ ├── services/
76
+ │ └── models/
77
+ └── assets/ ← Static assets, i18n files
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 4. DEVELOPMENT COMMANDS
83
+
84
+ ### Backend
85
+ ```bash
86
+ ./mvnw clean install # Build
87
+ ./mvnw spring-boot:run # Run
88
+ ./mvnw test # Test
89
+ ./mvnw spotless:check # Lint
90
+ ./mvnw flyway:migrate # Migration
91
+ ./mvnw jooq-codegen:generate # JOOQ codegen
92
+ ```
93
+
94
+ ### Frontend
95
+ ```bash
96
+ npm install # Install
97
+ ng serve # Run
98
+ ng test --watch=false # Test
99
+ ng lint # Lint
100
+ ng build --configuration=production # Build
101
+ npm audit # Security
102
+ ```
103
+
104
+ ---
105
+
106
+ ## 5. CODING CONVENTIONS
107
+
108
+ <!-- CHƯA KHỞI TẠO — /evnict-kit:init-rules sẽ điền project-specific -->
109
+
110
+ ### Naming
111
+ | Loại | Convention | Ví dụ |
112
+ |------|-----------|-------|
113
+ | Class | PascalCase | `CustomerService` |
114
+ | Method | camelCase | `findByStatus()` |
115
+ | Variable | camelCase | `customerId` |
116
+ | Constant | UPPER_SNAKE | `MAX_FILE_SIZE` |
117
+ | Table | UPPER_SNAKE | `CUSTOMER` |
118
+ | Column | UPPER_SNAKE | `CREATED_DATE` |
119
+ | API path | kebab-case | `/api/customers` |
120
+
121
+ ### API Response Format
122
+ ```java
123
+ public class ResponseData {
124
+ private int status; // 0 = success, 1 = error
125
+ private String message;
126
+ private Object data;
127
+ }
128
+ // ResponseData.ok(data) → { status: 0, message: "Thành công", data: {...} }
129
+ // ResponseData.error("msg") → { status: 1, message: "msg", data: null }
130
+ ```
131
+
132
+ ### Commit Message
133
+ ```
134
+ {type}({scope}): {description} [task-{N}]
135
+ Types: feat, fix, refactor, test, docs, chore
136
+ ```
137
+
138
+ ### API Endpoint Pattern
139
+ ```
140
+ GET /api/{module} → List (paginated)
141
+ GET /api/{module}/{id} → Get by ID
142
+ POST /api/{module} → Create
143
+ PUT /api/{module}/{id} → Update
144
+ DELETE /api/{module}/{id} → Delete
145
+ POST /api/{module}/search → Complex search
146
+ ```
147
+
148
+ ### Database
149
+ - Migration Tool: Flyway — `V{YYYYMMDD}_{seq}__{desc}.sql`
150
+ - Audit columns BẮT BUỘC: CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE
151
+ - Soft delete: IS_DELETED NUMBER(1) DEFAULT 0
152
+
153
+ ---
154
+
155
+ ## 6. RULES — PHẢI TUÂN THỦ
156
+
157
+ ### General Rules (R01-R08)
158
+ - **R01 No Secrets**: KHÔNG hardcode API keys, passwords, connection strings, JWT secrets. Dùng env vars / @Value.
159
+ - **R02 No Auto Push**: KHÔNG tự động `git push`. Commit OK, push PHẢI HỎI USER.
160
+ - **R03 No Destructive Ops**: KHÔNG `rm -rf` src/, KHÔNG `DROP TABLE` production, KHÔNG `git reset --hard` shared branch.
161
+ - **R04 No PII In Logs**: KHÔNG log password, token, CMND, phone, card number. Log IDs và actions.
162
+ - **R05 Test Before Commit**: BẮT BUỘC test pass trước commit. Build fail → fix trước.
163
+ - **R06 Minimal Diff**: CHỈ sửa code liên quan. KHÔNG refactor/rename ngoài scope. Vibe coding (sửa >3 lần) → DỪNG.
164
+ - **R07 No Placeholder Code**: KHÔNG `// TODO: implement later`. Mỗi function PHẢI có logic thực tế.
165
+ - **R08 Respect Gitignore**: KHÔNG tạo/commit files thuộc .gitignore (node_modules, .env, *.key).
166
+
167
+ ### Backend Rules (RB01-RB06)
168
+ - **RB01 Input Validation**: MỌI input validate ở Controller (@Valid, @NotNull, @Size). Whitelist sort columns.
169
+ - **RB02 Service Layer**: Controller → Service → Repository. Business logic CHỈ trong Service.
170
+ - **RB03 Error Handling**: GlobalExceptionHandler, KHÔNG expose stack trace. Log đầy đủ nội bộ, message chung cho client.
171
+ - **RB04 Database Migration**: Schema changes qua Flyway scripts. BẮT BUỘC có rollback script.
172
+ - **RB05 Auth Every Route**: Mọi endpoint PHẢI authenticated (default deny). Public endpoints whitelist rõ ràng.
173
+ - **RB06 Rate Limiting**: API public (login) → rate limit BẮT BUỘC.
174
+
175
+ ### Frontend Rules (RF01-RF06)
176
+ - **RF01 No Inline Styles**: Tất cả styles trong .scss. Dùng CSS classes, KHÔNG [style] binding.
177
+ - **RF02 Component Reuse**: Kiểm tra PrimeNG + shared/ trước khi tạo mới. Component dùng ≥2 nơi → shared/.
178
+ - **RF03 No Hardcoded Text**: Tất cả text qua i18n (ngx-translate). Labels, messages, tooltips → translate.
179
+ - **RF04 Accessibility**: img PHẢI có alt. Form field PHẢI có label/aria-label. Color contrast ≥ 4.5:1.
180
+ - **RF05 No Direct DOM**: KHÔNG document.getElementById(). Dùng @ViewChild, Renderer2, template bindings.
181
+ - **RF06 Responsive**: Desktop + Tablet + Mobile. PrimeNG Grid hoặc CSS Grid/Flexbox. Table scrollable mobile.
182
+
183
+ ### Security Rules (ATTT01-ATTT08)
184
+ - **ATTT01 SQL Injection**: JOOQ type-safe (mặc định an toàn). KHÔNG string concatenation trong SQL.
185
+ - **ATTT02 XSS**: Angular interpolation (auto-escaped). KHÔNG [innerHTML] / bypassSecurityTrust.
186
+ - **ATTT03 CSRF**: JWT stateless → disable CSRF OK. Session-based → CsrfTokenRepository.
187
+ - **ATTT04 JWT**: RS256/RS512 ONLY — KHÔNG HS256. Key ≥ 2048 bits. Exp ≤ 24h.
188
+ - **ATTT05 Dependency CVE**: `mvnw dependency-check:check`, `npm audit`. Critical → 24h hotfix.
189
+ - **ATTT06 File Upload**: Extension whitelist + MIME check + size limit + UUID rename + MinIO storage.
190
+ - **ATTT07 No Data Exposure**: LUÔN dùng DTO response, KHÔNG return Entity trực tiếp.
191
+ - **ATTT08 Anti-Vibe-Coding**: Sửa >3 lần cùng đoạn → DỪNG. Code không giải thích được = không merge.
192
+
193
+ ### Checkpoint (BẮT BUỘC)
194
+ Trước phiên AI: `git checkout -b feature/ai-task-xxx` hoặc `git commit -m "checkpoint: before AI session"`
195
+
196
+ ---
197
+
198
+ ## 7. SAFETY & PERMISSIONS
199
+
200
+ ```
201
+ ❌ KHÔNG tự động git push
202
+ ❌ KHÔNG xóa file/folder quan trọng
203
+ ❌ KHÔNG hardcode secrets, passwords, API keys
204
+ ❌ KHÔNG log PII (password, CMND, phone, token)
205
+ ❌ KHÔNG expose stack trace cho client
206
+ ❌ KHÔNG sửa code ngoài scope yêu cầu
207
+ ❌ KHÔNG tiếp tục khi test fail > 3 lần (3-strike rule)
208
+
209
+ ✅ Luôn tạo checkpoint trước phiên AI
210
+ ✅ Luôn chạy test trước commit
211
+ ✅ Luôn dùng DTO, không Entity trực tiếp
212
+ ✅ Luôn validate input ở Controller
213
+ ✅ Luôn transaction ở Service
214
+ ```
215
+
216
+ ---
217
+
218
+ ## 8. INTEGRATION MAP
219
+
220
+ <!-- CHƯA KHỞI TẠO — /evnict-kit:init-context sẽ điền -->
221
+
222
+ | Service | Protocol | Usage |
223
+ |---------|----------|-------|
224
+ | EVN SSO | JWT (RS256) | Authentication |
225
+ | MinIO | S3 API | File storage |
226
+ | Redis | TCP | Session + cache |
227
+ | CMIS | HTTP | Document management |
228
+ | Azure DevOps | Git + Pipeline | CI/CD |
229
+
230
+ ---
231
+
232
+ ## 9. AVAILABLE COMMANDS
233
+
234
+ ### Phase 1: Init (chạy 1 lần)
235
+ | Command | Mô tả |
236
+ |---------|--------|
237
+ | `/evnict-kit:init-rules` | Agent đọc code → điền rules RP01-RP07 |
238
+ | `/evnict-kit:init-context` | Agent sinh CLAUDE.md context |
239
+ | `/evnict-kit:init-check` | Verify setup |
240
+ | `/evnict-kit:init-wiki` | Setup llm-wiki knowledge base |
241
+
242
+ ### Phase 2: Development (thường xuyên)
243
+ | Command | Mô tả |
244
+ |---------|--------|
245
+ | `/evnict-kit:feature-large` | Feature lớn: spec→plan→TDD→archive |
246
+ | `/evnict-kit:feature-small` | Feature nhỏ: plan→TDD |
247
+ | `/evnict-kit:bug-fix` | Sửa lỗi: reproduce→TDD fix |
248
+ | `/evnict-kit:implement` | TDD implement từ plan |
249
+ | `/evnict-kit:plan` | Tạo implementation plan |
250
+ | `/evnict-kit:attt` | Scan ATTT (full hoặc module) |
251
+ | `/evnict-kit:review` | Auto review trước merge |
252
+ | `/evnict-kit:handoff` | FE↔BE coordination |
253
+ | `/evnict-kit:archive-wiki` | Archive spec + push wiki |
254
+ | `/evnict-kit:spec-archive` | Quản lý specs |
255
+
256
+ ### Wiki Commands
257
+ | Command | Mô tả |
258
+ |---------|--------|
259
+ | `/evnict-kit:wiki-scan-project` | Scan code → sinh wiki notes |
260
+ | `/evnict-kit:wiki-archive-feature` | Archive feature → wiki |
261
+ | `/evnict-kit:wiki-query` | Tìm kiếm trong wiki |
262
+
263
+ ---
264
+
265
+ ## 10. WORKSPACE STRUCTURE
266
+
267
+ ```
268
+ workspace/
269
+ ├── .evnict/ ← Workspace config
270
+ │ ├── config.yaml
271
+ │ ├── handoff/ ← FE↔BE coordination
272
+ │ │ ├── contracts/
273
+ │ │ └── handoff.md
274
+ │ └── specs/ ← Feature specs
275
+ ├── {{BE_FOLDER}}/ ← Backend project
276
+ │ ├── .claude/
277
+ │ │ └── commands/ ← Slash commands (workflows)
278
+ │ ├── CLAUDE.md ← THIS FILE
279
+ │ └── Instruct-Agent-AI.md
280
+ ├── {{FE_FOLDER}}/ ← Frontend project
281
+ │ └── (same structure)
282
+ ├── docs/
283
+ ├── database/
284
+ │ └── migrations/
285
+ └── {{PROJECT_NAME}}-wiki/ ← LLM Wiki
286
+ ```
287
+
288
+ ---
289
+
290
+ ## 11. REFERENCES
291
+
292
+ - **QĐ-TTPM**: Quy định hướng dẫn sử dụng AI trong PTPM tại EVNICT
293
+ - Điều 7: Thiết lập ngữ cảnh
294
+ - Điều 8: Nguyên tắc sử dụng AI an toàn
295
+ - **OWASP Top 10:2021**: https://owasp.org/Top10/
296
+ - **evnict-kit**: v0.2.1
297
+
298
+ ---
299
+
300
+ > ⚠️ **File này chứa sections "CHƯA KHỞI TẠO"**
301
+ > Chạy `/evnict-kit:init-context` để Agent tự động điền nội dung.
@@ -0,0 +1,60 @@
1
+ # {{PROJECT_NAME}} — GitHub Copilot Instructions
2
+ > Generated by evnict-kit v0.2.1 | {{TECH_STACK}} | {{DATABASE}}
3
+
4
+ ## Project Context
5
+ - **Tech**: {{TECH_STACK}}, {{DATABASE}}, JOOQ, Angular + PrimeNG
6
+ - **Architecture**: Controller → Service → Repository → DB
7
+ - **Auth**: JWT RS256 via EVN SSO
8
+ - **File Storage**: MinIO (S3-compatible)
9
+
10
+ ## Coding Rules
11
+
12
+ ### CRITICAL — Không bao giờ
13
+ - Hardcode API keys, passwords, JWT secrets, connection strings
14
+ - `git push` (commit ok, push phải hỏi user)
15
+ - `rm -rf` trên src/, database/, docs/
16
+ - Log password, token, CMND, phone, card number
17
+ - Return Entity trực tiếp (luôn dùng DTO)
18
+ - Expose stack trace cho client
19
+ - Viết `// TODO: implement later` (code PHẢI có logic thực tế)
20
+
21
+ ### Backend
22
+ - Input validation: @Valid, @NotNull, @Size ở Controller
23
+ - Business logic CHỈ trong Service, KHÔNG trong Controller
24
+ - GlobalExceptionHandler — generic message cho client, full log nội bộ
25
+ - Mọi endpoint PHẢI authenticated (default deny)
26
+ - Schema changes qua Flyway migration scripts, BẮT BUỘC rollback
27
+
28
+ ### Frontend
29
+ - Styles trong .scss (KHÔNG inline styles)
30
+ - Reuse PrimeNG components trước khi tạo mới
31
+ - i18n tất cả text (ngx-translate)
32
+ - KHÔNG document.getElementById() — dùng @ViewChild, Renderer2
33
+ - Responsive: Desktop + Tablet + Mobile
34
+
35
+ ## Security Rules
36
+ - SQL: JOOQ type-safe queries mặc định an toàn. KHÔNG string concatenation.
37
+ - XSS: Angular interpolation auto-escaped. KHÔNG [innerHTML].
38
+ - JWT: RS256 only, key ≥ 2048 bits, exp ≤ 24h
39
+ - File upload: extension whitelist + MIME check + UUID rename + MinIO
40
+ - Dependency scan: `mvnw dependency-check:check`, `npm audit`
41
+
42
+ ## Conventions
43
+ - **Naming**: Class=PascalCase, method=camelCase, constant=UPPER_SNAKE, table=UPPER_SNAKE
44
+ - **Response**: `ResponseData { status, message, data }` — `ResponseData.ok()` / `.error()`
45
+ - **API**: `GET /api/{module}`, `POST /api/{module}`, `PUT /api/{module}/{id}`, `DELETE /api/{module}/{id}`
46
+ - **Commit**: `{type}({scope}): {description} [task-{N}]`
47
+ - **DB audit columns**: CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE (bắt buộc)
48
+
49
+ ## Workflow Guide
50
+ Khi được yêu cầu tạo feature / fix bug:
51
+ 1. Hỏi clarify trước khi code
52
+ 2. Tạo checkpoint: `git checkout -b feature/ai-task-xxx`
53
+ 3. Viết test trước (TDD) nếu có thể
54
+ 4. Follow conventions ở trên
55
+ 5. Chạy `./mvnw test` (BE) hoặc `ng test --watch=false` (FE) trước commit
56
+ 6. Không tự push git — chỉ commit
57
+
58
+ ## Anti-Vibe-Coding
59
+ - Sửa cùng đoạn code >3 lần mà lỗi chưa fix → DỪNG, chia nhỏ yêu cầu
60
+ - Code không giải thích được = không merge
@@ -0,0 +1,114 @@
1
+ # {{PROJECT_NAME}} — Cursor AI Context
2
+ > Generated by evnict-kit v0.2.1 | {{TECH_STACK}} | {{DATABASE}}
3
+
4
+ ## Project Overview
5
+ <!-- CHƯA KHỞI TẠO — chạy /evnict-kit:init-context -->
6
+ - Tech: {{TECH_STACK}} + {{DATABASE}}
7
+ - Architecture: Controller → Service → Repository → DB
8
+ - Auth: JWT RS256 via EVN SSO
9
+ - File Storage: MinIO (S3-compatible)
10
+
11
+ ## Project Structure
12
+ ```
13
+ Backend: src/main/java/com/evn/{{PROJECT_NAME}}/{module}/{controller,service,repository,dto}/
14
+ Frontend: src/app/{core,shared,features}/{module}/{pages,components,services,models}/
15
+ ```
16
+
17
+ ## Development Commands
18
+ ```bash
19
+ # Backend
20
+ ./mvnw test && ./mvnw spring-boot:run
21
+
22
+ # Frontend
23
+ ng test --watch=false && ng serve
24
+
25
+ # Database
26
+ ./mvnw flyway:migrate && ./mvnw jooq-codegen:generate
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Coding Conventions
32
+
33
+ ### Naming
34
+ - Class: PascalCase (`CustomerService`), Method: camelCase (`findByStatus()`)
35
+ - Table/Column: UPPER_SNAKE (`CUSTOMER`, `CREATED_DATE`), API: kebab-case (`/api/customers`)
36
+
37
+ ### API Response
38
+ ```java
39
+ ResponseData { status: 0|1, message: "...", data: {...} }
40
+ // ResponseData.ok(data) | ResponseData.error("msg")
41
+ ```
42
+
43
+ ### Commit: `{type}({scope}): {description} [task-{N}]`
44
+
45
+ ### API Pattern
46
+ ```
47
+ GET /api/{module}, POST /api/{module}, PUT /api/{module}/{id}, DELETE /api/{module}/{id}
48
+ ```
49
+
50
+ ### Database
51
+ - Flyway migration: `V{YYYYMMDD}_{seq}__{desc}.sql` + rollback
52
+ - Audit columns: CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE
53
+ - Soft delete: IS_DELETED NUMBER(1) DEFAULT 0
54
+
55
+ ---
56
+
57
+ ## Rules — PHẢI TUÂN THỦ
58
+
59
+ ### Critical Rules
60
+ - ❌ No Secrets: KHÔNG hardcode API keys, passwords, JWT secrets. Dùng env vars.
61
+ - ❌ No Auto Push: KHÔNG `git push`. Commit OK, push HỎI USER.
62
+ - ❌ No Destructive Ops: KHÔNG `rm -rf`, `DROP TABLE`, `git reset --hard`.
63
+ - ❌ No PII In Logs: KHÔNG log password, token, CMND, phone.
64
+ - ❌ No Placeholder Code: KHÔNG `// TODO`. Mỗi function PHẢI có logic thực tế.
65
+
66
+ ### Backend
67
+ - Input validation @Valid ở Controller. Business logic CHỈ trong Service.
68
+ - GlobalExceptionHandler — KHÔNG expose stack trace.
69
+ - Auth mọi route (default deny). Flyway migrations + rollback.
70
+
71
+ ### Frontend
72
+ - Styles trong .scss (KHÔNG inline). Reuse PrimeNG + shared/ components.
73
+ - i18n tất cả text. Accessibility: alt, aria-label. KHÔNG document.querySelector().
74
+ - Responsive: Desktop + Tablet + Mobile.
75
+
76
+ ### Security
77
+ - SQL: JOOQ type-safe, KHÔNG string concat. XSS: Angular interpolation, KHÔNG innerHTML.
78
+ - JWT RS256 only, key ≥ 2048 bits, exp ≤ 24h.
79
+ - File upload: extension whitelist + MIME + UUID rename + MinIO.
80
+ - LUÔN dùng DTO response, KHÔNG Entity trực tiếp.
81
+ - Anti-vibe-coding: sửa >3 lần cùng đoạn → DỪNG NGAY.
82
+
83
+ ### Checkpoint
84
+ Trước phiên AI: `git checkout -b feature/ai-task-xxx` hoặc commit checkpoint.
85
+
86
+ ---
87
+
88
+ ## Safety (NON-NEGOTIABLE)
89
+ ```
90
+ ❌ git push | ❌ rm -rf src/ | ❌ hardcode secrets | ❌ log PII | ❌ expose stack trace
91
+ ✅ checkpoint trước AI | ✅ test trước commit | ✅ DTO response | ✅ @Valid input
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Commands Guide
97
+ > Cursor không có slash commands. User gõ tự nhiên:
98
+ - "Tạo feature mới quản lý công suất" → Cursor đọc rules + conventions
99
+ - "Fix bug lỗi validate ngày" → Cursor áp dụng security + backend rules
100
+ - "Scan ATTT module customer" → Cursor chạy scan commands theo security rules
101
+
102
+ ---
103
+
104
+ ## Integration Map
105
+ | Service | Protocol | Usage |
106
+ |---------|----------|-------|
107
+ | EVN SSO | JWT (RS256) | Authentication |
108
+ | MinIO | S3 API | File storage |
109
+ | Redis | TCP | Session + cache |
110
+ | CMIS | HTTP | Document management |
111
+
112
+ ---
113
+
114
+ > ⚠️ File này chứa sections "CHƯA KHỞI TẠO". Tham khảo `.cursor/rules/` cho chi tiết.
@@ -0,0 +1,96 @@
1
+ # Instruct-Agent-AI.md — Backend
2
+ # Project: {{PROJECT_NAME}} | Tech: {{TECH_STACK}} | DB: {{DATABASE}}
3
+ # Generated by evnict-kit v0.1.3
4
+
5
+ ---
6
+
7
+ ## Hướng dẫn Agent khởi tạo Backend Project
8
+
9
+ Bạn là AI Agent đang khởi tạo cấu hình cho project backend.
10
+ Đọc hướng dẫn dưới đây và thực hiện TỪNG BƯỚC.
11
+
12
+ ---
13
+
14
+ ## Bước 1: Đọc rules hiện tại
15
+ Đọc tất cả files trong `{{AGENT_DIR}}/rules/`:
16
+ - `01-evnict-kit-general-rules.md` → Nắm general rules
17
+ - `02-evnict-kit-security-rules.md` → Nắm security rules
18
+ - `03-evnict-kit-backend-conventions.md` → Nắm BE conventions
19
+ - `05-evnict-kit-project-conventions.md` → Xem sections cần điền
20
+
21
+ ## Bước 2: Chạy `/evnict-kit:init-rules`
22
+ Skill này sẽ hướng dẫn bạn:
23
+
24
+ ### Task 1: Scan project structure
25
+ ```bash
26
+ tree -L 3 --dirsfirst
27
+ ```
28
+ → Ghi nhận package structure, module organization
29
+
30
+ ### Task 2: RP01 — Naming Convention
31
+ Đọc 5-10 file Java → extract naming patterns:
32
+ - Package: `com.evn.{{PROJECT_NAME}}.{module}`
33
+ - Class: `{Module}{Type}.java`
34
+ - Method: camelCase, prefix find/get/create/update/delete
35
+ - Table/Column: UPPER_SNAKE_CASE
36
+ → Cập nhật RP01 trong `05-evnict-kit-project-conventions.md`
37
+
38
+ ### Task 3: RP02 — Architecture Pattern
39
+ Phân tích folder structure → xác định:
40
+ - Architecture type (MVC, Clean, Hexagonal)
41
+ - Layer organization
42
+ - Module organization
43
+ → Cập nhật RP02
44
+
45
+ ### Task 4: RP03 — Coding Convention
46
+ Đọc code → extract:
47
+ - Indentation, import ordering
48
+ - Method ordering, comment style
49
+ - Logging framework, null handling
50
+ → Cập nhật RP03
51
+
52
+ ### Task 5: RP04 — API Convention
53
+ Đọc Controller classes → extract:
54
+ - Base URL pattern, HTTP methods
55
+ - Request/Response format (ResponseData)
56
+ - Pagination pattern
57
+ → Cập nhật RP04
58
+
59
+ ### Task 6: RP05 — Database Convention
60
+ Đọc migration scripts, config → extract:
61
+ - Schema structure, naming
62
+ - PK pattern, audit columns
63
+ - Soft delete pattern
64
+ → Cập nhật RP05
65
+
66
+ ### Task 7: RP07 — Integration Map
67
+ Đọc dependencies, config files → extract:
68
+ - External services (SSO, MinIO, CMIS)
69
+ - Cache, messaging
70
+ → Cập nhật RP07
71
+
72
+ ### Task 8: Summary
73
+ Tạo file `{{AGENT_DIR}}/context/init-summary-backend.md`:
74
+ ```markdown
75
+ # Init Summary — Backend
76
+ ## Date: {YYYY-MM-DD}
77
+ ## Conventions found: {count}/7
78
+ ## Key findings:
79
+ - {finding 1}
80
+ - {finding 2}
81
+ ```
82
+
83
+ ## Bước 3: Chạy `/evnict-kit:init-context`
84
+ → Sinh file AGENTS.md ở root project (400-600 dòng)
85
+
86
+ ## Bước 4: Chạy `/evnict-kit:init-check`
87
+ → Sinh demo code để verify setup
88
+
89
+ ---
90
+
91
+ ## Bảo mật — NGHIÊM CẤM
92
+ - ❌ KHÔNG ghi secrets, passwords, API keys
93
+ - ❌ KHÔNG ghi IP nội bộ, URLs production
94
+ - ❌ KHÔNG ghi connection strings
95
+ - ❌ KHÔNG ghi thông tin nhân sự, tổ chức cụ thể
96
+ - ✅ Chỉ ghi PATTERNS, không ghi VALUES
@@ -0,0 +1,79 @@
1
+ # Instruct-Agent-AI.md — Frontend
2
+ # Project: {{PROJECT_NAME}} | Tech: {{TECH_STACK}}
3
+ # Generated by evnict-kit v0.1.3
4
+
5
+ ---
6
+
7
+ ## Hướng dẫn Agent khởi tạo Frontend Project
8
+
9
+ Bạn là AI Agent đang khởi tạo cấu hình cho project frontend.
10
+ Đọc hướng dẫn dưới đây và thực hiện TỪNG BƯỚC.
11
+
12
+ ---
13
+
14
+ ## Bước 1: Đọc rules hiện tại
15
+ Đọc tất cả files trong `{{AGENT_DIR}}/rules/`:
16
+ - `01-evnict-kit-general-rules.md` → Nắm general rules
17
+ - `02-evnict-kit-security-rules.md` → Nắm security rules
18
+ - `04-evnict-kit-frontend-conventions.md` → Nắm FE conventions
19
+ - `05-evnict-kit-project-conventions.md` → Xem sections cần điền
20
+
21
+ ## Bước 2: Chạy `/evnict-kit:init-rules`
22
+
23
+ ### Task 1: Scan project structure
24
+ ```bash
25
+ tree -L 3 --dirsfirst
26
+ ```
27
+
28
+ ### Task 2: RP01 — Naming Convention
29
+ Đọc component, service, module files → extract:
30
+ - Component naming: `{name}.component.ts`
31
+ - Service naming: `{name}.service.ts`
32
+ - Selector prefix: `app-`
33
+ - File structure patterns
34
+ → Cập nhật RP01
35
+
36
+ ### Task 3: RP02 — Architecture Pattern
37
+ Phân tích folder structure → xác định:
38
+ - Module organization (feature-based, core/shared/features)
39
+ - Routing pattern (lazy-loaded modules)
40
+ - State management approach
41
+ → Cập nhật RP02
42
+
43
+ ### Task 4: RP03 — Coding Convention
44
+ Đọc TypeScript files → extract:
45
+ - Indentation, import ordering
46
+ - Component structure (properties → constructor → lifecycle → methods)
47
+ - RxJS patterns (takeUntil, async pipe)
48
+ → Cập nhật RP03
49
+
50
+ ### Task 5: RP06 — Component Convention
51
+ Đọc component files → extract:
52
+ - Shared vs feature components
53
+ - UI library usage (PrimeNG components)
54
+ - Form handling (Reactive Forms / Template-driven)
55
+ - State management
56
+ → Cập nhật RP06
57
+
58
+ ### Task 6: RP07 — Integration Map
59
+ Đọc environment files, services → extract:
60
+ - API base URLs pattern
61
+ - Auth interceptor
62
+ - File upload service
63
+ → Cập nhật RP07
64
+
65
+ ### Task 7: Summary
66
+ Tạo file `{{AGENT_DIR}}/context/init-summary-frontend.md`
67
+
68
+ ## Bước 3: Chạy `/evnict-kit:init-context`
69
+ → Sinh file AGENTS.md ở root project
70
+
71
+ ## Bước 4: Chạy `/evnict-kit:init-check`
72
+ → Sinh demo component để verify setup
73
+
74
+ ---
75
+
76
+ ## Bảo mật — NGHIÊM CẤM
77
+ - ❌ KHÔNG ghi secrets, API keys
78
+ - ❌ KHÔNG ghi production URLs/IPs
79
+ - ✅ Chỉ ghi PATTERNS, không ghi VALUES