ai-developer-skill-os 9.1.2 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.agents/AGENTS.md +139 -42
  2. package/.agents/DEV_PROFILE.md +95 -0
  3. package/.agents/registry/capability-graph.yml +171 -334
  4. package/.agents/registry/graph.json +37 -19
  5. package/.agents/registry/index.yaml +59 -13
  6. package/.agents/registry/skills-index.yml +204 -447
  7. package/.agents/rules/coding.md +23 -0
  8. package/.agents/rules/global.md +44 -30
  9. package/.agents/skills/_template/SKILL.md +2 -377
  10. package/.agents/skills/qk-access-policy/SKILL.md +98 -473
  11. package/.agents/skills/qk-agent-observability/SKILL.md +3 -439
  12. package/.agents/skills/qk-ai-builder/SKILL.md +132 -565
  13. package/.agents/skills/qk-api-consumer/SKILL.md +256 -0
  14. package/.agents/skills/qk-api-consumer/capability.yaml +21 -0
  15. package/.agents/skills/qk-api-consumer/evals/scorecard.yaml +29 -0
  16. package/.agents/skills/qk-api-lifecycle/SKILL.md +133 -456
  17. package/.agents/skills/qk-bug-resolution/SKILL.md +128 -561
  18. package/.agents/skills/qk-code-review/SKILL.md +142 -420
  19. package/.agents/skills/qk-context-loader/SKILL.md +99 -471
  20. package/.agents/skills/qk-data-engineer/SKILL.md +119 -340
  21. package/.agents/skills/qk-data-lifecycle/SKILL.md +89 -488
  22. package/.agents/skills/qk-db-optimizer/SKILL.md +102 -488
  23. package/.agents/skills/qk-design-system-engineering/SKILL.md +76 -461
  24. package/.agents/skills/qk-devops-platform/SKILL.md +77 -463
  25. package/.agents/skills/qk-docs/SKILL.md +88 -494
  26. package/.agents/skills/qk-engineering-standard/SKILL.md +4 -588
  27. package/.agents/skills/qk-fe-api-integration/SKILL.md +343 -343
  28. package/.agents/skills/qk-fe-api-integration/evals/scorecard.yaml +29 -29
  29. package/.agents/skills/qk-feature-delivery/SKILL.md +137 -445
  30. package/.agents/skills/qk-feature-delivery/evals/scorecard.yaml +1 -1
  31. package/.agents/skills/qk-frontend-architecture/SKILL.md +5 -479
  32. package/.agents/skills/qk-help/evals/scorecard.yaml +13 -13
  33. package/.agents/skills/qk-orchestrator/SKILL.md +63 -502
  34. package/.agents/skills/qk-orchestrator/references/routing-table.md +10 -14
  35. package/.agents/skills/qk-product-specification/SKILL.md +70 -479
  36. package/.agents/skills/qk-production-release/SKILL.md +80 -537
  37. package/.agents/skills/qk-project-audit/SKILL.md +174 -0
  38. package/.agents/skills/qk-project-bootstrap/SKILL.md +243 -471
  39. package/.agents/skills/qk-project-health/SKILL.md +97 -496
  40. package/.agents/skills/qk-project-memory/SKILL.md +76 -21
  41. package/.agents/skills/qk-refactor/SKILL.md +167 -384
  42. package/.agents/skills/qk-security-audit/SKILL.md +141 -463
  43. package/.agents/skills/qk-security-audit/capability.yaml +1 -2
  44. package/.agents/skills/qk-system-evolution/SKILL.md +343 -343
  45. package/.agents/skills/qk-system-evolution/evals/scorecard.yaml +26 -26
  46. package/.agents/skills/qk-test-engineering/SKILL.md +119 -509
  47. package/.agents/skills/qk-ui-audit/SKILL.md +73 -537
  48. package/.agents/skills/qk-ui-builder/SKILL.md +521 -482
  49. package/.agents/skills/qk-ui-system-builder/SKILL.md +68 -514
  50. package/.agents/skills/qk-upgrade/SKILL.md +301 -0
  51. package/.agents/skills/qk-upgrade/capability.yaml +24 -0
  52. package/.agents/skills/qk-upgrade/evals/scorecard.yaml +26 -0
  53. package/.agents/skills/qk-validation-gate/SKILL.md +4 -603
  54. package/.agents/skills/qk-web-quality-gate/SKILL.md +85 -463
  55. package/.agents/workflows/bug-resolution.yml +6 -6
  56. package/.agents/workflows/context-discovery.yml +94 -0
  57. package/.agents/workflows/feature-delivery.yml +8 -4
  58. package/.agents/workflows/refactor.yml +6 -3
  59. package/.agents/workflows/shared/quality-gate.yml +94 -0
  60. package/.agents/workflows/skin-governance.yml +115 -0
  61. package/README.md +152 -67
  62. package/package.json +2 -2
  63. package/tooling/build-registry.js +30 -8
@@ -1,600 +1,372 @@
1
1
  ---
2
2
  # ── Identity ───────────────────────────────────────────────
3
3
  name: qk-project-bootstrap
4
- version: 9.1.0
4
+ version: 9.2.0
5
5
  status: stable
6
- description: "Khởi tạo dự án mới theo chuẩn V8.2 Blueprint Plugin Generator (project.yaml, 4-folder AI RAG hoặc Coding) với cấu trúc kiên cường."
6
+ description: "Khởi tạo dự án mới HOẶC setup DEV_PROFILE.md cho dự án đang chạy — auto-detect stack từ manifest files, không hỏi lại những gì đã có thể đọc được. Dùng skill này khi user nhắc đến: khởi tạo dự án, project setup, scaffold, bootstrap, new app, setup dev profile, detect stack, cấu hình skin — kể cả khi chỉ nói 'bắt đầu dự án mới'."
7
7
  platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
8
8
 
9
- # ── V9: Classification ─────────────────────────────────────
9
+ # ── Classification ─────────────────────────────────────────
10
10
  type: capability
11
11
 
12
12
  intent:
13
13
  - project-initialization
14
- - setup
14
+ - dev-profile-setup
15
+ - stack-detection
16
+ - scaffolding
15
17
 
16
18
  complexity:
17
19
  level: high
18
20
  criteria:
19
21
  files_affected: "10+"
20
- has_behavior_change: true
21
- has_external_dependency: true
22
+ has_behavior_change: false
23
+ has_external_dependency: false
22
24
  has_breaking_change: false
23
25
 
24
26
  triggers:
25
- - "khởi tạo project"
26
- - "tạo dự án mới"
27
+ - "khởi tạo dự án"
28
+ - "project setup"
29
+ - "scaffold"
27
30
  - "bootstrap"
28
- - "setup project"
29
- - "init repo"
31
+ - "new app"
32
+ - "setup dev profile"
33
+ - "detect stack"
34
+ - "cấu hình skin"
30
35
 
31
- # ── V8: References ─────────────────────────────────────────
36
+ # ── References ─────────────────────────────────────────────
32
37
  workflow: feature-delivery
33
38
 
34
39
  rules:
35
40
  - global
36
41
  - safety
37
- - filesystem-boundary
38
42
 
39
43
  tools:
40
44
  - filesystem
41
45
  - terminal
42
46
 
43
47
  related_skills:
44
- - qk-engineering-standard
48
+ - qk-context-loader # Load sau khi DEV_PROFILE.md đã được tạo
45
49
 
46
50
  knowledge_scope:
47
51
  owns:
48
52
  - project-structure
49
- - initial-setup
53
+ - dev-profile-setup
54
+ - stack-detection
50
55
  references:
51
56
  - architecture
52
57
  - security
53
- - anti-patterns
54
58
 
55
- # ── V8: Verification ───────────────────────────────────────
59
+ # ── Verification ───────────────────────────────────────────
56
60
  verification:
57
61
  required: true
58
- strategy: bootstrap-validation
59
-
60
- selection:
61
- priority: medium
62
- confidence_threshold: 0.85
62
+ strategy: bootstrap
63
63
 
64
64
  examples: []
65
65
  learnings: []
66
66
 
67
- # ── V7 Runtime ─────────────────────────────────────────────
67
+ # ── Runtime ────────────────────────────────────────────────
68
68
  execution_mode: deterministic
69
- cost: high
70
- latency: slow
69
+ cost: low
70
+ latency: fast
71
71
  risk: low
72
- side_effects: edit_files
73
- produces: [code, schema, plan]
74
- consumes: [user-description]
72
+ side_effects: create_files
73
+ produces: [dev-profile, scaffold]
74
+ consumes: [manifest-files, user-description]
75
75
 
76
76
  token_budget:
77
- max_files_read: 1
78
- max_lines_per_read: 50
77
+ max_files_read: 10
78
+ max_lines_per_read: 80
79
79
  max_shell_commands: 2
80
80
  stop_early: true
81
81
 
82
82
  exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
83
83
  ---
84
84
 
85
- # qk-project-bootstrap — Project Foundation Builder
85
+ # qk-project-bootstrap — Project Setup & Stack Detection
86
86
 
87
87
  > **Language rule:** Code, identifiers, file names → English. Explanations, summaries → Vietnamese.
88
88
 
89
89
  ---
90
90
 
91
- ## Memory Workflow
92
-
93
- ### 0. Self-Init Protocol (Khởi Tạo Bộ Nhớ Local & Gitignore)
94
- - Trước khi tra cứu hoặc lưu trữ tri thức, BẮT BUỘC kiểm tra sự tồn tại của thư mục `.ai-local/` tại gốc dự án:
95
- - **Tự động tạo mới:** Nếu `.ai-local/` chưa tồn tại, AI phải tự động tạo cấu trúc thư mục `.ai-local/knowledge/` (và file `index.yaml` nếu cần thiết) cùng `.ai-local/candidates/`. Tuyệt đối không ngưng chạy hay hỏi ý kiến người dùng về thao tác khởi tạo tiêu chuẩn này.
96
- - **Bảo mật Gitignore:** BẮT BUỘC kiểm tra file `.gitignore` của dự án, nếu chưa có dòng `.ai-local/` thì phải tự động thêm vào để tuyệt đối bảo mật tri thức cá nhân và tránh lộ lọt lên Git.
97
-
98
- ---
99
-
100
- ### Pre-flight Retrieve (Trước khi thực thi)
101
- - Trước các task có tính lặp lại, debug, refactor, kiến trúc hoặc rủi ro cao:
102
- bắt buộc tra cứu:
103
- - `.ai-local/knowledge/index.yaml` (Private Local Knowledge)
104
-
105
- - Ưu tiên sử dụng các Knowledge đang có trạng thái `Active` thuộc:
106
- - Architecture
107
- - Hard Bug
108
- - Convention
109
- - Pattern
110
- - Tech Debt Pattern
111
- - 👉 *Domain Focus:* Architecture / Convention (vd: mô hình 4-folder RAG/Agent, blueprint quy chuẩn V9).
112
-
113
- - Memory chỉ đóng vai trò **Navigator (bản đồ chỉ đường)**.
114
- Không được xem Memory là Source of Truth.
115
- Luôn xác minh lại bằng source code, configuration và trạng thái hiện tại của dự án trước khi áp dụng.
116
-
117
- ---
118
-
119
- ### Learning Flow (AI tự học có kiểm soát)
120
- - Trong quá trình làm việc, AI được phép tự phát hiện và tạo **Candidate Memory** khi nhận thấy:
121
- - Hard Bug có khả năng tái diễn.
122
- - Pattern làm việc lặp lại trong dự án.
123
- - Convention hoặc quy tắc kiến trúc mới.
124
- - Quyết định Architecture quan trọng.
125
- - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
126
- - 👉 *Domain Harvest:* Cấu trúc thư mục hoặc template scaffold mẫu mới của dự án.
127
-
128
- - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
129
- - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
130
- - AI không được tự động Promote Candidate Memory thành Project Knowledge.
131
-
132
- ---
133
-
134
- ### Post-flight Harvest (Đề xuất → Phê duyệt)
135
- Sau khi hoàn thành task:
136
- - AI đánh giá các Candidate Memory đã tạo.
137
- - Nếu phát hiện tri thức có giá trị tái sử dụng:
138
- - Đề xuất người dùng xem xét.
139
- - Gửi yêu cầu phê duyệt thông qua:
140
- - `/learn`
141
- - `qk-project-memory`
142
- - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
143
-
144
- ```
145
- .ai-local/candidates/ ──(Approve)──> .ai-local/knowledge/index.yaml
146
- ```
147
-
148
- - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
149
- - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
150
-
151
- ---
152
-
153
- ### Ignore (Không đưa vào Memory)
154
- Không lưu:
155
- - Trace log của một session đơn lẻ.
156
- - Temporary debugging data.
157
- - Output của một lần chạy test/scan.
158
- - Report health tạm thời của một đợt kiểm tra.
159
- - Lỗi nhỏ chỉ xảy ra một lần.
160
- - Thông tin không có khả năng tái sử dụng.
161
- - 👉 *Domain Ignore:* File cấu hình local rác (đã đưa vào gitignore).
91
+ ## Preconditions
162
92
 
163
- ---
93
+ Trước khi khởi tạo dự án hoặc setup DEV_PROFILE.md, AI BẮT BUỘC kiểm tra:
164
94
 
165
- ### Golden Rule
166
- > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
167
- > **AI quan sát Đề xuất Con người phê duyệt Dự án tiến hóa.**
95
+ - [ ] Xác định thư mục root của dự án.
96
+ - [ ] Kiểm tra xem thư mục có file manifest nào tồn tại không (`package.json`, `requirements.txt`, `go.mod`, `Cargo.toml`, v.v.) để chọn Mode A (dự án mới) hay Mode B (dự án hiện có).
97
+ - [ ] Kiểm tra xem `.agents/DEV_PROFILE.md` đã tồn tại chưa. Nếu đã user không yêu cầu ghi đè:
98
+ → **EXIT: PARTIAL**
99
+ → Đề xuất cập nhật hoặc giữ nguyên thay vì overwrite toàn bộ.
168
100
 
169
101
  ---
170
102
 
103
+ ## Hai chế độ hoạt động
171
104
 
105
+ **Mode A — New Project:** Tạo project mới từ đầu theo Blueprint template
106
+ **Mode B — Existing Project:** Scan project đang có, detect stack, tạo/cập nhật `DEV_PROFILE.md`
172
107
 
173
- ### 0. Self-Init Protocol (Khởi Tạo Bộ Nhớ Local & Gitignore)
174
- - Trước khi tra cứu hoặc lưu trữ tri thức, BẮT BUỘC kiểm tra sự tồn tại của thư mục `.ai-local/` tại gốc dự án:
175
- - **Tự động tạo mới:** Nếu `.ai-local/` chưa tồn tại, AI phải tự động tạo cấu trúc thư mục `.ai-local/knowledge/` (và file `index.yaml` nếu cần thiết) cùng `.ai-local/candidates/`. Tuyệt đối không ngưng chạy hay hỏi ý kiến người dùng về thao tác khởi tạo tiêu chuẩn này.
176
- - **Bảo mật Gitignore:** BẮT BUỘC kiểm tra file `.gitignore` của dự án, nếu chưa có dòng `.ai-local/` thì phải tự động thêm vào để tuyệt đối bảo mật tri thức cá nhân và tránh lộ lọt lên Git.
108
+ AI tự xác định mode dựa vào context:
109
+ - `package.json` / `requirements.txt` / `go.mod` tồn tại **Mode B**
110
+ - Không **Mode A**
111
+ - User nói follow user
177
112
 
178
113
  ---
179
114
 
180
- ### Pre-flight Retrieve (Trước khi thực thi)
181
- - Trước các task có tính lặp lại, debug, refactor, kiến trúc hoặc rủi ro cao:
182
- bắt buộc tra cứu:
183
- - `.ai-local/knowledge/index.yaml` (Private Local Knowledge)
115
+ ## Scope
184
116
 
185
- - Ưu tiên sử dụng các Knowledge đang có trạng thái `Active` thuộc:
186
- - Architecture
187
- - Hard Bug
188
- - Convention
189
- - Pattern
190
- - Tech Debt Pattern
191
- - 👉 *Domain Focus:* Architecture / Convention (vd: mô hình 4-folder RAG/Agent, blueprint quy chuẩn V9).
117
+ Skill này làm:
118
+ - Auto-detect tech stack từ manifest files
119
+ - Tạo / cập nhật `.agents/DEV_PROFILE.md` với stack được detect
120
+ - Tạo cấu trúc project theo Blueprint template đúng loại
121
+ - Setup `.gitignore`, `.env.example`, `README.md` ban đầu
122
+ - Gợi ý skills phù hợp với stack được detect
192
123
 
193
- - Memory chỉ đóng vai trò **Navigator (bản đồ chỉ đường)**.
194
- Không được xem Memory Source of Truth.
195
- Luôn xác minh lại bằng source code, configuration và trạng thái hiện tại của dự án trước khi áp dụng.
124
+ Skill này KHÔNG làm:
125
+ - Viết business logic hay feature code
126
+ - Setup CI/CD pipeline (→ `qk-devops-platform`)
127
+ - Deploy hay publish (→ `qk-production-release`)
128
+ - Viết test (→ `qk-test-engineering`)
196
129
 
197
130
  ---
198
131
 
199
- ### Learning Flow (AI tự học kiểm soát)
200
- - Trong quá trình làm việc, AI được phép tự phát hiện và tạo **Candidate Memory** khi nhận thấy:
201
- - Hard Bug có khả năng tái diễn.
202
- - Pattern làm việc lặp lại trong dự án.
203
- - Convention hoặc quy tắc kiến trúc mới.
204
- - Quyết định Architecture quan trọng.
205
- - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
206
- - 👉 *Domain Harvest:* Cấu trúc thư mục hoặc template scaffold mẫu mới của dự án.
132
+ ## Execution Steps Mode B: Detect Stack cho dự án đang có
207
133
 
208
- - Candidate Memory chỉ bản nháp quan sát, chưa phải tri thức chính thức.
209
- - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
210
- - AI không được tự động Promote Candidate Memory thành Project Knowledge.
134
+ > Đây mode quan trọng nhất dùng khi muốn setup skin cho project hiện tại.
211
135
 
212
- ---
213
-
214
- ### Post-flight Harvest (Đề xuất → Phê duyệt)
215
- Sau khi hoàn thành task:
216
- - AI đánh giá các Candidate Memory đã tạo.
217
- - Nếu phát hiện tri thức có giá trị tái sử dụng:
218
- - Đề xuất người dùng xem xét.
219
- - Gửi yêu cầu phê duyệt thông qua:
220
- - `/learn`
221
- - `qk-project-memory`
222
- - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
223
-
224
- ```
225
- .ai-local/candidates/ ──(Approve)──> .ai-local/knowledge/index.yaml
136
+ ### Step 1 — Scan Manifest Files
226
137
  ```
138
+ Actions (chạy song song, đọc lần lượt từng file nếu tồn tại):
227
139
 
228
- - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
229
- - thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
230
-
231
- ---
232
-
233
- ### Ignore (Không đưa vào Memory)
234
- Không lưu:
235
- - Trace log của một session đơn lẻ.
236
- - Temporary debugging data.
237
- - Output của một lần chạy test/scan.
238
- - Report health tạm thời của một đợt kiểm tra.
239
- - Lỗi nhỏ chỉ xảy ra một lần.
240
- - Thông tin không có khả năng tái sử dụng.
241
- - 👉 *Domain Ignore:* File cấu hình local rác (đã đưa vào gitignore).
242
-
243
- ---
244
-
245
- ### Golden Rule
246
- > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
247
- > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
248
-
249
- ---
140
+ JavaScript / TypeScript:
141
+ - package.json → dependencies, devDependencies, scripts
142
+ - tsconfig.json → strict mode, paths, target
143
+ - .nvmrc / .node-version → Node version
250
144
 
145
+ Python:
146
+ - requirements.txt / requirements/*.txt
147
+ - pyproject.toml (poetry/pdm sections)
148
+ - setup.py / setup.cfg
149
+ - Pipfile
251
150
 
151
+ Go:
152
+ - go.mod → module name, Go version, dependencies
252
153
 
253
- ### 0. Self-Init Protocol (Khởi Tạo Bộ Nhớ Local & Gitignore)
254
- - Trước khi tra cứu hoặc lưu trữ tri thức, BẮT BUỘC kiểm tra sự tồn tại của thư mục `.ai-local/` tại gốc dự án:
255
- - **Tự động tạo mới:** Nếu `.ai-local/` chưa tồn tại, AI phải tự động tạo cấu trúc thư mục `.ai-local/knowledge/` (và file `index.yaml` nếu cần thiết) cùng `.ai-local/candidates/`. Tuyệt đối không ngưng chạy hay hỏi ý kiến người dùng về thao tác khởi tạo tiêu chuẩn này.
256
- - **Bảo mật Gitignore:** BẮT BUỘC kiểm tra file `.gitignore` của dự án, nếu chưa có dòng `.ai-local/` thì phải tự động thêm vào để tuyệt đối bảo mật tri thức cá nhân và tránh lộ lọt lên Git.
154
+ Rust:
155
+ - Cargo.toml
257
156
 
258
- ---
157
+ Java / Kotlin:
158
+ - pom.xml / build.gradle / build.gradle.kts
259
159
 
260
- ### Pre-flight Retrieve (Trước khi thực thi)
261
- - Trước các task có tính lặp lại, debug, refactor, kiến trúc hoặc rủi ro cao:
262
- bắt buộc tra cứu:
263
- - `.ai-local/knowledge/index.yaml` (Private Local Knowledge)
160
+ Data / AI:
161
+ - dbt_project.yml → dbt version, profile
162
+ - airflow.cfg / dag folder structure
163
+ - mlflow.yml / kedro.yml
164
+ - .env.example → DB_URL, OPENAI_API_KEY hints
264
165
 
265
- - Ưu tiên sử dụng các Knowledge đang có trạng thái `Active` thuộc:
266
- - Architecture
267
- - Hard Bug
268
- - Convention
269
- - Pattern
270
- - Tech Debt Pattern
271
- - 👉 *Domain Focus:* Architecture / Convention (vd: mô hình 4-folder RAG/Agent, blueprint quy chuẩn V9).
166
+ Infrastructure:
167
+ - docker-compose.yml → services (db type, cache, queue)
168
+ - Dockerfile → base image → language + version
169
+ - .github/workflows/ → CI tools
170
+ - terraform/ / pulumi/ → infra provider
272
171
 
273
- - Memory chỉ đóng vai trò **Navigator (bản đồ chỉ đường)**.
274
- Không được xem Memory là Source of Truth.
275
- Luôn xác minh lại bằng source code, configuration và trạng thái hiện tại của dự án trước khi áp dụng.
276
-
277
- ---
278
-
279
- ### Learning Flow (AI tự học có kiểm soát)
280
- - Trong quá trình làm việc, AI được phép tự phát hiện và tạo **Candidate Memory** khi nhận thấy:
281
- - Hard Bug có khả năng tái diễn.
282
- - Pattern làm việc lặp lại trong dự án.
283
- - Convention hoặc quy tắc kiến trúc mới.
284
- - Quyết định Architecture quan trọng.
285
- - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
286
- - 👉 *Domain Harvest:* Cấu trúc thư mục hoặc template scaffold mẫu mới của dự án.
287
-
288
- - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
289
- - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
290
- - AI không được tự động Promote Candidate Memory thành Project Knowledge.
291
-
292
- ---
293
-
294
- ### Post-flight Harvest (Đề xuất → Phê duyệt)
295
- Sau khi hoàn thành task:
296
- - AI đánh giá các Candidate Memory đã tạo.
297
- - Nếu phát hiện tri thức có giá trị tái sử dụng:
298
- - Đề xuất người dùng xem xét.
299
- - Gửi yêu cầu phê duyệt thông qua:
300
- - `/learn`
301
- - `qk-project-memory`
302
- - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
303
-
304
- ```
305
- .ai-local/candidates/ ──(Approve)──> .ai-local/knowledge/index.yaml
172
+ Output: raw_detected = { language, frameworks[], databases[], tools[] }
306
173
  ```
307
174
 
308
- - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
309
- - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
310
-
311
- ---
312
-
313
- ### Ignore (Không đưa vào Memory)
314
- Không lưu:
315
- - Trace log của một session đơn lẻ.
316
- - Temporary debugging data.
317
- - Output của một lần chạy test/scan.
318
- - Report health tạm thời của một đợt kiểm tra.
319
- - Lỗi nhỏ chỉ xảy ra một lần.
320
- - Thông tin không có khả năng tái sử dụng.
321
- - 👉 *Domain Ignore:* File cấu hình local rác (đã đưa vào gitignore).
322
-
323
- ---
324
-
325
- ### Golden Rule
326
- > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
327
- > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
328
-
329
- ---
330
-
331
- ## Preconditions
332
- - [ ] Framework/language preference is stated (or ask before proceeding)
333
- - [ ] Project purpose is clear (web app, API, CLI, library)
334
-
175
+ ### Step 2 Classify Stack
335
176
  ```
336
- On missing precondition:
337
- EXIT: BLOCKED
338
- Message: "Vui lòng cho biết: framework (React/Next.js/NestJS/Express...) và mục đích dự án."
339
- ```
340
-
341
- ---
342
-
343
- ## Scope & V8.2 Blueprint Generator
344
- - **One-Click Blueprint Selection:** Choose from Blueprint Plugins (`coding`, `rag`, `workflow`, `enterprise`).
345
- - **Generate `project.yaml`:** Copy appropriate manifest from `.agents/blueprints/<type>/project.yaml.tpl` to workspace root.
346
- - **Initialize Project Scaffolding:** Create standard directory structure (including the **4-Folder RAG Architecture** for AI projects).
347
- - ✅ **Initialize Project Knowledge V1:** Setup Local Private Memory architecture (`.ai-local/` directory with automatic `.gitignore` entry included by default) containing concise `AGENTS.md` (<100 lines) and `knowledge/index.yaml` (4 core types: Architecture, Convention, Pattern, Hard Bug).
348
- - **Configure Tooling:** Linter, Prettier, TypeScript strict mode, or Python environment depending on stack.
349
- - ✅ **Generate `DESIGN.md`:** Mandatory brand & token contract for any UI project.
350
-
351
- ## Non-Goals
352
- - Skip `project.yaml` workspace manifest initialization
353
- - Skip Project Knowledge V1 (`AGENTS.md` & `index.yaml` memory setup in `.ai-local/`)
354
- - Skip DESIGN.md for UI projects
355
- - Hardcode outdated dependency versions or absolute machine disk paths
356
- - Skip README or documentation
357
-
358
- ---
359
-
360
- ## V8.2 Blueprint Plugins & Directory Structures
361
-
362
- ### 1. RAG & AI Agents (The 4-Folder Architecture Blueprint)
363
- *Activated when building AI agents, RAG engines, or domain automation.*
364
- ```text
365
- project.yaml # V8.2 Workspace Manifest (Profiles & Capabilities)
366
- .ai-local/ # V1 Private Project Memory (Self-Init & Gitignored by default)
367
- ├── AGENTS.md # Project roadmap & quick actions (<100 lines)
368
- └── knowledge/
369
- └── index.yaml # Architecture, Convention, Pattern & Hard Bug repository
370
- prompts/ # Prompt instructions managed as code
371
- ├── system/
372
- ├── tasks/
373
- └── tools/
374
- data/ # Strict data discipline
375
- ├── raw/ # IMMUTABLE original files (PDFs, Excel, Revit/CAD)
376
- └── processed/ # Cleaned, standardized chunks for AI ingestion
377
- agents/ # Agent configurations and domain micro-skills
378
- ├── skills/
379
- └── tools/
380
- evals/ # Quantitative validation evidence
381
- ├── tests/
382
- ├── traces/ # Audit execution traces
383
- └── scorecards/ # scorecard.yaml eval rubrics
177
+ Inputs: raw_detected
178
+ Actions:
179
+ Determine role từ stack combination:
180
+
181
+ fe: React/Vue/Angular + NO backend framework trong cùng repo
182
+ be: Express/FastAPI/NestJS/Django + NO React/Vue trong cùng repo
183
+ fullstack: Frontend framework + Backend framework TRONG CÙNG REPO
184
+ (Next.js = fullstack mặc định; Nuxt = fullstack mặc định)
185
+ data: dbt / Airflow / Spark / Dagster / Prefect / Pandas heavy
186
+ ai-engineer: LangChain / LlamaIndex / OpenAI SDK + vector DB
187
+ devops: Terraform / Pulumi / GitHub Actions heavy, ít application code
188
+
189
+ Nếu ambiguous default: fullstack, ghi chú để user confirm
190
+
191
+ Map dependencies → specific stack fields:
192
+
193
+ frontend: next "Next.js", nuxt "Nuxt 3", react (no next) → "React",
194
+ vue "Vue 3", angular "Angular", svelte "SvelteKit"
195
+ backend: express "Express", fastapi "FastAPI", nestjs → "NestJS",
196
+ django "Django", laravel "Laravel", gin "Gin (Go)"
197
+ database: pg/postgres "PostgreSQL", mysql "MySQL",
198
+ mongodb → "MongoDB", sqlite → "SQLite",
199
+ supabase → "Supabase", prisma → also check schema.prisma
200
+ orm: prisma → "Prisma", typeorm → "TypeORM", drizzle → "Drizzle",
201
+ sqlalchemy "SQLAlchemy", sequelize "Sequelize"
202
+ css: tailwind → "Tailwind CSS", sass/scss → "SCSS",
203
+ styled-components "Styled Components", @emotion "Emotion"
204
+ state: zustand "Zustand", redux "Redux Toolkit",
205
+ jotai → "Jotai", pinia → "Pinia", @tanstack/query → "React Query"
206
+ auth: next-auth/auth.js "NextAuth", clerk "Clerk",
207
+ passport "Passport.js", supabase/auth "Supabase Auth"
208
+ test: jest "Jest", vitest "Vitest", pytest "Pytest",
209
+ playwright → "Playwright", cypress → "Cypress"
210
+ language: typescript in deps → "TypeScript", python "Python",
211
+ go.mod exists "Go"
212
+
213
+ Output: classified_stack = fully mapped stack object
384
214
  ```
385
215
 
386
- ### 2. Standard Coding Workspaces (Next.js / React / Node)
387
- *Activated when developing software applications or UI components.*
388
- ```text
389
- project.yaml # ⭐ V8.2 Workspace Manifest
390
- .ai-local/ # ⭐ V1 Private Project Memory (Self-Init & Gitignored by default)
391
- ├── AGENTS.md # Project roadmap & quick actions (<100 lines)
392
- └── knowledge/
393
- └── index.yaml # Architecture, Convention, Pattern & Hard Bug repository
394
- src/
395
- ├── app/ # Pages or App Router
396
- ├── components/ # Shared UI components & Design system primitives
397
- ├── hooks/
398
- ├── lib/
399
- ├── services/ # API integration & State stores
400
- ├── types/
401
- └── styles/
402
- DESIGN.md # Brand & Design Contract
216
+ ### Step 3 Tạo / Cập nhật DEV_PROFILE.md
403
217
  ```
404
-
405
- ### 3. Automation Workflows (n8n & Data ETL)
406
- ```text
407
- project.yaml # V8.2 Workspace Manifest
408
- .ai-local/ # V1 Private Project Memory (Self-Init & Gitignored by default)
409
- workflows/ # Automation graphs & JSON blueprints
410
- connectors/ # API & Database integrations
411
- pipelines/ # Transformation scripts
412
- evals/ # Traceability logs
218
+ Inputs: classified_stack, detected role
219
+ Actions:
220
+ - Đọc DEV_PROFILE.md hiện tại nếu tồn tại (không overwrite những gì user đã điền)
221
+ - Điền các field detect được, giữ nguyên field user đã điền tay
222
+ - Để trống những field không detect được (không đoán )
223
+ - Thêm comment "# auto-detected" sau mỗi giá trị được detect
224
+ - Nếu conflict giữa detected và existing → giữ existing, ghi chú
225
+
226
+ Output: .agents/DEV_PROFILE.md được điền đầy đủ phần detect được
413
227
  ```
414
228
 
415
- ---
416
-
417
- ## Required Files Checklist
229
+ ### Step 4 — Report & Suggest Next Steps
418
230
  ```
419
- [ ] project.yaml — V8.2 Machine-readable Workspace Manifest
420
- [ ] .ai-local/AGENTS.md V1 Project Architecture Navigator (<100 lines)
421
- [ ] .ai-local/knowledge/index.yaml V1 Actionable Knowledge Base (Self-Init on demand)
422
- [ ] package.json / pyproject.toml dependencies and scripts
423
- [ ] tsconfig.json strict mode enabled (if TypeScript)
424
- [ ] .eslintrc / .prettierrc — project standard linting and formatting
425
- [ ] .gitignore — standard entries (MUST include .ai-local/ to protect personal project memory)
426
- [ ] README.md — project description + setup instructions
427
- [ ] DESIGN.md — (UI projects) brand contract with color/font/spacing tokens
428
- [ ] evals/scorecard.yaml — (AI/RAG/Workflow projects) eval standard
429
- [ ] .agents/rules/anti-patterns.md — Bắt buộc phải có (chuẩn V8.3 R-C-09)
430
- [ ] .agents/rules/security.md — Bắt buộc phải có (chuẩn V8.3 R-SEC-04)
431
- ```
432
- -----
433
-
434
- ## DESIGN.md Minimum Template
435
- ```markdown
436
- # Design System
437
-
438
- ## Colors (HSL)
439
- --color-primary: hsl(220, 80%, 55%);
440
- --color-surface: hsl(220, 15%, 12%);
441
- --color-text: hsl(220, 10%, 90%);
442
-
443
- ## Spacing Scale (4px base)
444
- --space-1: 4px; --space-2: 8px; --space-3: 16px;
445
- --space-4: 24px; --space-5: 32px; --space-6: 48px;
446
-
447
- ## Typography
448
- --font-sans: 'Inter', system-ui, sans-serif;
449
- --font-size-base: 1rem;
450
- --font-size-lg: 1.25rem;
451
-
452
- ## Border Radius
453
- --radius-sm: 4px; --radius-md: 8px; --radius-lg: 16px;
454
-
455
- ## Animation
456
- --transition-fast: 150ms ease;
457
- --transition-base: 250ms ease;
231
+ Actions:
232
+ - Hiển thị detected stack summary cho user confirm
233
+ - List những field còn trống cần user điền tay
234
+ - Suggest 3 skills phù hợp nhất để bắt đầu với stack này
235
+ - Suggest conventions dựa trên stack ( dụ: Next.js → feature-based folder)
458
236
  ```
459
237
 
460
238
  ---
461
239
 
462
- ## Workflow
240
+ ## Execution Steps — Mode A: New Project
463
241
 
464
- ### Phase 1 — Blueprint Selection
465
- **Steps:**
466
- 1. Assess Preconditions to determine framework/purpose.
467
- 2. Select appropriate blueprint (coding, rag, workflow, enterprise).
242
+ ### Blueprint Types
468
243
 
469
- **Decision:**
244
+ **Type 1: Standard Web App** (fe / be / fullstack)
470
245
  ```
471
- IF framework/purpose is clear
472
- → Confidence: HIGH → go to Phase 2
473
- ELSE
474
- EXIT: BLOCKED ask user
246
+ Cấu trúc:
247
+ src/
248
+ ├── features/ # Feature-based modules
249
+ ├── components/ # Shared UI components
250
+ ├── lib/ # Utilities, helpers
251
+ ├── hooks/ # Custom React hooks (nếu React)
252
+ ├── types/ # TypeScript interfaces
253
+ ├── api/ # API layer / service functions
254
+ └── config/ # App configuration
255
+
256
+ Files sinh ra:
257
+ .gitignore, .env.example, README.md,
258
+ DESIGN.md (placeholder), .agents/DEV_PROFILE.md (pre-filled)
475
259
  ```
476
260
 
477
- ### Phase 2 Scaffold Generation
478
- **Steps:**
479
- 1. Generate `project.yaml` manifest.
480
- 2. Create directory tree structure based on blueprint.
481
- 3. Configure tooling and generate `DESIGN.md` if UI project.
482
-
483
- **Decision:**
261
+ **Type 2: RAG / AI Agent** (ai-engineer)
484
262
  ```
485
- IF directories and files are generated
486
- Confidence: HIGH go to Phase 3
487
- ELSE
488
- EXIT: FAILED
263
+ Cấu trúc (4-folder chuẩn):
264
+ prompts/ # System prompts, few-shot examples
265
+ data/
266
+ ├── raw/ # Source data — KHÔNG bao giờ edit
267
+ ├── processed/ # Cleaned, chunked
268
+ └── embeddings/ # Vector representations
269
+ agents/ # Agent definitions, tool configs
270
+ evals/
271
+ ├── traces/ # Execution logs
272
+ ├── datasets/ # Golden Q&A sets
273
+ └── scorecards/ # Metric definitions
274
+
275
+ Files sinh ra:
276
+ .gitignore (data/raw/, .env), .env.example,
277
+ README.md, .agents/DEV_PROFILE.md (ai-engineer role pre-filled)
489
278
  ```
490
279
 
491
- ### Phase 3 Verification
492
- **Steps:**
493
- 1. Check Required Files Checklist against what was actually created.
494
- 2. Ensure no mandatory files are missing.
495
-
496
- **Decision:**
280
+ **Type 3: Data Pipeline** (data)
497
281
  ```
498
- IF all required files exist
499
- EXIT: SUCCESS
500
- ELSE
501
- EXIT: PARTIAL
282
+ Cấu trúc:
283
+ dags/ / pipelines/ # DAG definitions
284
+ models/
285
+ ├── staging/ # Raw cleaned
286
+ ├── intermediate/ # Business transforms
287
+ └── mart/ # Final analytics tables
288
+ tests/ # Data quality tests
289
+ docs/ # Data lineage docs
290
+ seeds/ # Static reference data
291
+
292
+ Files sinh ra:
293
+ .gitignore, .env.example, README.md,
294
+ dbt_project.yml (nếu dbt), .agents/DEV_PROFILE.md (data role)
502
295
  ```
503
296
 
504
- ---
505
-
506
- ## Evidence Format
507
-
297
+ **Type 4: DevOps / Platform** (devops)
508
298
  ```
509
- [SEVERITY] path/to/expected-file
510
- Issue: [MISSING_MANIFEST | MISSING_DESIGN_MD | WRONG_STRUCTURE]
511
- Confidence: HIGH
512
- Fix: [specific file to create]
299
+ Cấu trúc:
300
+ .github/workflows/ # CI/CD pipelines
301
+ terraform/ / pulumi/ # IaC modules
302
+ scripts/ # Automation scripts
303
+ docs/
304
+ ├── runbooks/ # Incident response
305
+ └── architecture/ # System diagrams
306
+
307
+ Files sinh ra:
308
+ .gitignore, .env.example, README.md,
309
+ .agents/DEV_PROFILE.md (devops role)
513
310
  ```
514
311
 
515
312
  ---
516
313
 
517
- ## Priority Order
518
-
519
- | Priority | Task | Skip Threshold |
520
- |----------|------|----------------|
521
- | P1 | project.yaml manifest created | Never |
522
- | P2 | Core scaffolding per blueprint type | Never |
523
- | P3 | Tooling config | Budget < 40% |
524
- | P4 | DESIGN.md for UI projects | Never for UI |
525
- | P5 | README | Budget < 60% |
526
-
527
- ---
528
- ## Exit Codes
529
- | Code | Meaning | When |
530
- |------|---------|------|
531
- | SUCCESS | All required files created, structure matches framework standard | Full bootstrap complete |
532
- | PARTIAL | Structure created but DESIGN.md incomplete (UI project) | Follow-up needed |
533
- | BLOCKED | Framework/purpose not specified | Ask user |
534
- | FAILED | Cannot initialize (permission error, invalid framework) | Report error |
535
-
536
- ---
314
+ ## Prompt Template
537
315
 
538
- ## Confidence Model
539
- | Level | Condition | Action |
540
- |-------|-----------|--------|
541
- | HIGH | Framework explicitly stated, directory structure clear | Build directly |
542
- | MEDIUM | Framework inferred from context (found React imports) | Note assumption, proceed |
543
- | LOW | Cannot determine framework or project type | EXIT: BLOCKED |
316
+ ```
317
+ Mode: [new / existing / profile-only]
318
+ Role: [fe / be / fullstack / data / ai-engineer / devops — hoặc "auto-detect"]
319
+ Name: [Tên project]
320
+ tả: [1-2 câu app làm gì]
321
+ Stack: [Nếu biết rồi hoặc để trống để AI detect]
322
+ ```
544
323
 
545
324
  ---
546
325
 
547
- ## Severity
548
- | Level | Definition | Example |
549
- |-------|-----------|----------|
550
- | CRITICAL | Security misconfiguration in bootstrap | .env with real secrets committed |
551
- | HIGH | Missing mandatory file blocks all future work | No DESIGN.md for UI project |
552
- | MEDIUM | Incomplete setup reduces developer experience | Missing ESLint config |
553
- | LOW | Cosmetic or optional file missing | Missing .editorconfig |
554
-
555
- ---
326
+ ### Ví dụ theo từng tình huống:
556
327
 
557
- ## Retry Policy
328
+ **Tình huống 1 — Dự án đang có, muốn setup DEV_PROFILE nhanh**
558
329
  ```
559
- File creation fails
560
- └─ Check: permission issue vs path error
561
- ├─ Path error → correct path and retry
562
- └─ Permission error → EXIT: FAILED, report exact path
563
- └─ Do NOT retry more than 1 time per file
330
+ Mode: existing
331
+ Role: auto-detect
332
+ Name: (đọc từ project)
564
333
  ```
334
+ → AI scan `package.json`, detect `Next.js + Prisma + Tailwind + TypeScript`,
335
+ điền DEV_PROFILE.md với `role: fullstack`, toàn bộ stack fields,
336
+ gợi ý: "Tiếp theo dùng `qk-feature-delivery` để build feature đầu tiên".
565
337
 
566
- ---
567
-
568
- ## Escalation Rules
338
+ **Tình huống 2 — Dự án mới Fullstack**
569
339
  ```
570
- BLOCKED: Framework or project type not specified
571
- Missing:
572
- - Framework name (React, Next.js, NestJS, Express, etc.)
573
- - Project purpose (web app, API, CLI, library)
574
- Questions:
575
- 1. Framework nào bạn muốn dùng?
576
- 2. Dự án này là web app, API server, hay CLI tool?
577
- Recommended Assumptions (if proceeding):
578
- - Default: Next.js 14 (App Router) + TypeScript + ESLint
340
+ Mode: new
341
+ Role: fullstack
342
+ Name: ecommerce-platform
343
+ Mô tả: Nền tảng thương mại điện tử B2C — quản lý sản phẩm, đơn hàng, thanh toán
344
+ Stack: Next.js 14 + Prisma + PostgreSQL + Tailwind + TypeScript
579
345
  ```
346
+ → AI tạo: folder structure theo Standard Web App blueprint,
347
+ `.env.example` với `DATABASE_URL`, `NEXTAUTH_SECRET`, `STRIPE_SECRET_KEY`,
348
+ `README.md` với setup instructions, `DEV_PROFILE.md` pre-filled.
580
349
 
581
- ---
582
-
583
- ## Handoff Contract
584
- ### Consumes
585
- ```json
586
- {
587
- "from": "user",
588
- "required_fields": ["framework", "project_purpose"],
589
- "optional_fields": ["project_name", "existing_dir"]
590
- }
350
+ **Tình huống 3 — Setup RAG pipeline**
591
351
  ```
592
- ### Produces
593
- ```json
594
- {
595
- "to": "qk-feature-delivery or qk-ui-builder",
596
- "output_fields": ["project_structure", "design_md_path", "tooling_config", "exit_code"]
597
- }
352
+ Mode: new
353
+ Role: ai-engineer
354
+ Name: internal-kb-assistant
355
+ Mô tả: Q&A bot trả lời từ tài liệu nội bộ công ty (PDF, Confluence)
356
+ Stack: OpenAI GPT-4o + pgvector + LangChain + FastAPI
598
357
  ```
358
+ → AI tạo: 4-folder AI structure, `prompts/system.txt` placeholder,
359
+ `evals/scorecards/rag_metrics.yml` template (faithfulness, relevance, groundedness),
360
+ `DEV_PROFILE.md` với `role: ai-engineer`, full `data_stack` filled.
599
361
 
600
- ---
362
+ **Tình huống 4 — Data pipeline mới**
363
+ ```
364
+ Mode: new
365
+ Role: data
366
+ Name: sales-analytics
367
+ Mô tả: Pipeline load sales data từ Salesforce → BigQuery, build mart cho dashboard
368
+ Stack: dbt + Airflow + BigQuery + Python
369
+ ```
370
+ → AI tạo: dbt project structure (staging/intermediate/mart),
371
+ `dbt_project.yml`, Airflow DAG folder, `DEV_PROFILE.md` với `role: data`,
372
+ full `data_stack` (pipeline: "dbt + Airflow", warehouse: "BigQuery").