ai-developer-skill-os 9.1.1 → 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 +52 -18
  5. package/.agents/registry/index.yaml +66 -12
  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 -300
  10. package/.agents/skills/qk-access-policy/SKILL.md +98 -393
  11. package/.agents/skills/qk-agent-observability/SKILL.md +3 -359
  12. package/.agents/skills/qk-ai-builder/SKILL.md +132 -485
  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 -376
  17. package/.agents/skills/qk-bug-resolution/SKILL.md +128 -481
  18. package/.agents/skills/qk-code-review/SKILL.md +142 -340
  19. package/.agents/skills/qk-context-loader/SKILL.md +99 -391
  20. package/.agents/skills/qk-data-engineer/SKILL.md +253 -0
  21. package/.agents/skills/qk-data-lifecycle/SKILL.md +89 -408
  22. package/.agents/skills/qk-db-optimizer/SKILL.md +102 -408
  23. package/.agents/skills/qk-design-system-engineering/SKILL.md +76 -381
  24. package/.agents/skills/qk-devops-platform/SKILL.md +77 -383
  25. package/.agents/skills/qk-docs/SKILL.md +88 -414
  26. package/.agents/skills/qk-engineering-standard/SKILL.md +4 -508
  27. package/.agents/skills/qk-fe-api-integration/SKILL.md +343 -263
  28. package/.agents/skills/qk-fe-api-integration/evals/scorecard.yaml +29 -29
  29. package/.agents/skills/qk-feature-delivery/SKILL.md +137 -365
  30. package/.agents/skills/qk-feature-delivery/evals/scorecard.yaml +1 -1
  31. package/.agents/skills/qk-frontend-architecture/SKILL.md +5 -399
  32. package/.agents/skills/qk-help/evals/scorecard.yaml +13 -13
  33. package/.agents/skills/qk-orchestrator/SKILL.md +63 -422
  34. package/.agents/skills/qk-orchestrator/references/routing-table.md +10 -14
  35. package/.agents/skills/qk-product-specification/SKILL.md +70 -399
  36. package/.agents/skills/qk-production-release/SKILL.md +80 -457
  37. package/.agents/skills/qk-project-audit/SKILL.md +174 -0
  38. package/.agents/skills/qk-project-bootstrap/SKILL.md +244 -392
  39. package/.agents/skills/qk-project-health/SKILL.md +97 -416
  40. package/.agents/skills/qk-project-memory/SKILL.md +76 -21
  41. package/.agents/skills/qk-refactor/SKILL.md +167 -304
  42. package/.agents/skills/qk-security-audit/SKILL.md +141 -383
  43. package/.agents/skills/qk-security-audit/capability.yaml +1 -2
  44. package/.agents/skills/qk-system-evolution/SKILL.md +343 -263
  45. package/.agents/skills/qk-system-evolution/evals/scorecard.yaml +26 -26
  46. package/.agents/skills/qk-test-engineering/SKILL.md +119 -429
  47. package/.agents/skills/qk-ui-audit/SKILL.md +73 -457
  48. package/.agents/skills/qk-ui-builder/SKILL.md +521 -482
  49. package/.agents/skills/qk-ui-system-builder/SKILL.md +68 -434
  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 -523
  54. package/.agents/skills/qk-web-quality-gate/SKILL.md +85 -383
  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,9 +1,9 @@
1
- ---
1
+ ---
2
2
  # ── Identity ───────────────────────────────────────────────
3
3
  name: qk-ui-system-builder
4
- version: 9.1.0
4
+ version: 9.2.0
5
5
  status: stable
6
- description: "Xây dựng Design System và token library từ DESIGN.md — không tự đặt ra token ngoài contract."
6
+ description: "Xây dựng Design System và token library từ DESIGN.md — không tự đặt ra token ngoài contract. Dùng skill này khi user nhắc đến: design system, token, setup css, ui system, tạo design system, cấu hình token — kể cả khi chỉ nói 'tạo file tailwind tokens từ bảng màu này'."
7
7
  platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
8
8
 
9
9
  # ── V9: Classification ─────────────────────────────────────
@@ -21,11 +21,14 @@ complexity:
21
21
  has_external_dependency: false
22
22
  has_breaking_change: false
23
23
 
24
- triggers:
25
- - "tạo design system"
26
- - "build token"
27
- - "ui system"
28
- - "setup css"
24
+ triggers:
25
+ - "design system"
26
+ - "token"
27
+ - "setup css"
28
+ - "ui system"
29
+ - "tạo design system"
30
+ - "cấu hình token"
31
+
29
32
 
30
33
  # ── V8: References ─────────────────────────────────────────
31
34
  workflow: feature-delivery
@@ -83,467 +86,98 @@ produces: [code, tokens]
83
86
  consumes: [design-md]
84
87
 
85
88
  token_budget:
86
- max_files_read: 2
87
- max_lines_per_read: 100
89
+ max_files_read: 3
90
+ max_lines_per_read: 150
88
91
  max_shell_commands: 0
89
92
  stop_early: true
90
93
 
91
- exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
94
+ exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
92
95
  ---
93
96
 
94
- # qk-ui-system-builder — Design System Constructor
97
+ # qk-ui-system-builder — Design System & Token Constructor
95
98
 
96
99
  > **Language rule:** Code, identifiers, file names → English. Explanations, summaries → Vietnamese.
97
100
 
101
+ Chịu trách nhiệm hiện thực hóa hệ thống Design Tokens (màu sắc, typography, spacing, shadows, radius) thành mã nguồn (CSS Variables, Tailwind Config, hoặc TypeScript Tokens) dựa trên tài liệu thiết kế (`DESIGN.md`). **Tuyệt đối không tự ý bịa đặt token ngoài hợp đồng thiết kế.**
102
+
98
103
  ---
99
104
 
100
- ## Memory Workflow
101
-
102
- ### 0. Self-Init Protocol (Khởi Tạo Bộ Nhớ Local & Gitignore)
103
- - 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:
104
- - **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.
105
- - **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.
106
-
107
- ---
108
-
109
- ### Pre-flight Retrieve (Trước khi thực thi)
110
- - Trước các task có tính lặp lại, debug, refactor, kiến trúc hoặc rủi ro cao:
111
- bắt buộc tra cứu:
112
- - `.ai-local/knowledge/index.yaml` (Private Local Knowledge)
113
-
114
- - Ưu tiên sử dụng các Knowledge đang có trạng thái `Active` thuộc:
115
- - Architecture
116
- - Hard Bug
117
- - Convention
118
- - Pattern
119
- - Tech Debt Pattern
120
- - 👉 *Domain Focus:* Architecture / Convention (vd: ánh xạ 1:1 từ contract DESIGN.md sang biến CSS).
121
-
122
- - Memory chỉ đóng vai trò **Navigator (bản đồ chỉ đường)**.
123
- Không được xem Memory là Source of Truth.
124
- 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.
125
-
126
- ---
127
-
128
- ### Learning Flow (AI tự học có kiểm soát)
129
- - 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:
130
- - Hard Bug có khả năng tái diễn.
131
- - Pattern làm việc lặp lại trong dự án.
132
- - Convention hoặc quy tắc kiến trúc mới.
133
- - Quyết định Architecture quan trọng.
134
- - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
135
- - 👉 *Domain Harvest:* Chuẩn quy tắc đặt tên (--color-role-shade) hoặc cơ chế scale Dark Mode.
136
-
137
- - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
138
- - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
139
- - AI không được tự động Promote Candidate Memory thành Project Knowledge.
140
-
141
- ---
142
-
143
- ### Post-flight Harvest (Đề xuất → Phê duyệt)
144
- Sau khi hoàn thành task:
145
- - AI đánh giá các Candidate Memory đã tạo.
146
- - Nếu phát hiện tri thức có giá trị tái sử dụng:
147
- - Đề xuất người dùng xem xét.
148
- - Gửi yêu cầu phê duyệt thông qua:
149
- - `/learn`
150
- - `qk-project-memory`
151
- - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
152
-
153
- ```
154
- .ai-local/candidates/ ──(Approve)──> .ai-local/knowledge/index.yaml
155
- ```
156
-
157
- - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
158
- - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
159
-
160
- ---
161
-
162
- ### Ignore (Không đưa vào Memory)
163
- Không lưu:
164
- - Trace log của một session đơn lẻ.
165
- - Temporary debugging data.
166
- - Output của một lần chạy test/scan.
167
- - Report health tạm thời của một đợt kiểm tra.
168
- - Lỗi nhỏ chỉ xảy ra một lần.
169
- - Thông tin không có khả năng tái sử dụng.
170
- - 👉 *Domain Ignore:* Giá trị màu thử nghiệm ngoài hợp đồng (bị nghiêm cấm).
171
-
172
- ---
173
-
174
- ### Golden Rule
175
- > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
176
- > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
177
-
178
- ---
179
-
180
-
181
-
182
- ### Pre-flight Retrieve (Trước khi thực thi)
183
- - Trước các task có tính lặp lại, debug, refactor, kiến trúc hoặc rủi ro cao:
184
- bắt buộc tra cứu:
185
- - `.agents/knowledge/index.yaml` (Shared Project Knowledge)
186
- - `.ai-local/knowledge/index.yaml` (Private Local Knowledge)
187
-
188
- - Ưu tiên sử dụng các Knowledge đang có trạng thái `Active` thuộc:
189
- - Architecture
190
- - Hard Bug
191
- - Convention
192
- - Pattern
193
- - Tech Debt Pattern
194
- - 👉 *Domain Focus:* Architecture / Convention (vd: ánh xạ 1:1 từ contract DESIGN.md sang biến CSS).
195
-
196
- - Memory chỉ đóng vai trò **Navigator (bản đồ chỉ đường)**.
197
- Không được xem Memory là Source of Truth.
198
- 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.
199
-
200
- ---
201
-
202
- ### Learning Flow (AI tự học có kiểm soát)
203
- - 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:
204
- - Hard Bug có khả năng tái diễn.
205
- - Pattern làm việc lặp lại trong dự án.
206
- - Convention hoặc quy tắc kiến trúc mới.
207
- - Quyết định Architecture quan trọng.
208
- - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
209
- - 👉 *Domain Harvest:* Chuẩn quy tắc đặt tên (--color-role-shade) hoặc cơ chế scale Dark Mode.
210
-
211
- - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
212
- - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
213
- - AI không được tự động Promote Candidate Memory thành Project Knowledge.
214
-
215
- ---
216
-
217
- ### Post-flight Harvest (Đề xuất → Phê duyệt)
218
- Sau khi hoàn thành task:
219
- - AI đánh giá các Candidate Memory đã tạo.
220
- - Nếu phát hiện tri thức có giá trị tái sử dụng:
221
- - Đề xuất người dùng xem xét.
222
- - Gửi yêu cầu phê duyệt thông qua:
223
- - `/learn`
224
- - `qk-project-memory`
225
- - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
226
-
227
- ```
228
- .ai-local/candidates/ ──(Approve)──> .agents/knowledge/index.yaml
229
- ```
230
-
231
- - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
232
- - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
233
-
234
- ---
235
-
236
- ### Ignore (Không đưa vào Memory)
237
- Không lưu:
238
- - Trace log của một session đơn lẻ.
239
- - Temporary debugging data.
240
- - Output của một lần chạy test/scan.
241
- - Report health tạm thời của một đợt kiểm tra.
242
- - Lỗi nhỏ chỉ xảy ra một lần.
243
- - Thông tin không có khả năng tái sử dụng.
244
- - 👉 *Domain Ignore:* Giá trị màu thử nghiệm ngoài hợp đồng (bị nghiêm cấm).
245
-
246
- ---
247
-
248
- ### Golden Rule
249
- > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
250
- > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
251
-
252
- ---
253
- ---
254
-
255
- ### Learning Flow (AI tự học có kiểm soát)
256
- - 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:
257
- - Hard Bug có khả năng tái diễn.
258
- - Pattern làm việc lặp lại trong dự án.
259
- - Convention hoặc quy tắc kiến trúc mới.
260
- - Quyết định Architecture quan trọng.
261
- - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
262
- - 👉 *Domain Harvest:* Chuẩn quy tắc đặt tên (--color-role-shade) hoặc cơ chế scale Dark Mode.
263
-
264
- - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
265
- - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
266
- - AI không được tự động Promote Candidate Memory thành Project Knowledge.
267
-
268
- ---
269
-
270
- ### Post-flight Harvest (Đề xuất → Phê duyệt)
271
- Sau khi hoàn thành task:
272
- - AI đánh giá các Candidate Memory đã tạo.
273
- - Nếu phát hiện tri thức có giá trị tái sử dụng:
274
- - Đề xuất người dùng xem xét.
275
- - Gửi yêu cầu phê duyệt thông qua:
276
- - `/learn`
277
- - `qk-project-memory`
278
- - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
279
-
280
- ```
281
- .ai-local/candidates/ ──(Approve)──> .agents/knowledge/index.yaml
282
- ```
283
-
284
- - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
285
- - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
286
-
287
- ---
288
-
289
- ### Ignore (Không đưa vào Memory)
290
- Không lưu:
291
- - Trace log của một session đơn lẻ.
292
- - Temporary debugging data.
293
- - Output của một lần chạy test/scan.
294
- - Report health tạm thời của một đợt kiểm tra.
295
- - Lỗi nhỏ chỉ xảy ra một lần.
296
- - Thông tin không có khả năng tái sử dụng.
297
- - 👉 *Domain Ignore:* Giá trị màu thử nghiệm ngoài hợp đồng (bị nghiêm cấm).
298
-
299
- ---
300
-
301
- ### Golden Rule
302
- > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
303
- > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
304
-
305
- ---
306
- ---
307
-
308
- ### Learning Flow (AI tự học có kiểm soát)
309
- - 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:
310
- - Hard Bug có khả năng tái diễn.
311
- - Pattern làm việc lặp lại trong dự án.
312
- - Convention hoặc quy tắc kiến trúc mới.
313
- - Quyết định Architecture quan trọng.
314
- - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
315
- - 👉 *Domain Harvest:* Chuẩn quy tắc đặt tên (--color-role-shade) hoặc cơ chế scale Dark Mode.
316
-
317
- - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
318
- - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
319
- - AI không được tự động Promote Candidate Memory thành Project Knowledge.
320
-
321
- ---
322
-
323
- ### Post-flight Harvest (Đề xuất → Phê duyệt)
324
- Sau khi hoàn thành task:
325
- - AI đánh giá các Candidate Memory đã tạo.
326
- - Nếu phát hiện tri thức có giá trị tái sử dụng:
327
- - Đề xuất người dùng xem xét.
328
- - Gửi yêu cầu phê duyệt thông qua:
329
- - `/learn`
330
- - `qk-project-memory`
331
- - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
332
-
333
- ```
334
- .ai-local/candidates/ ──(Approve)──> .agents/knowledge/index.yaml
335
- ```
336
-
337
- - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
338
- - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
339
-
340
- ---
341
-
342
- ### Ignore (Không đưa vào Memory)
343
- Không lưu:
344
- - Trace log của một session đơn lẻ.
345
- - Temporary debugging data.
346
- - Output của một lần chạy test/scan.
347
- - Report health tạm thời của một đợt kiểm tra.
348
- - Lỗi nhỏ chỉ xảy ra một lần.
349
- - Thông tin không có khả năng tái sử dụng.
350
- - 👉 *Domain Ignore:* Giá trị màu thử nghiệm ngoài hợp đồng (bị nghiêm cấm).
351
-
352
- ---
353
-
354
- ### Golden Rule
355
- > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
356
- > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
357
-
358
- ---
359
- ---
360
- ---
361
- ---
362
-
363
105
  ## Preconditions
364
- - [ ] `DESIGN.md` exists with color, spacing, typography tokens
365
106
 
366
- ```
367
- On missing precondition:
368
- EXIT: BLOCKED
369
- Message: "DESIGN.md missing. Run qk-project-bootstrap to create one."
370
- ```
107
+ Trước khi tạo hoặc sửa đổi file token, AI BẮT BUỘC kiểm tra:
371
108
 
372
- ---
373
-
374
- ## Scope
375
- - Extract tokens from DESIGN.md ONLY never invent
376
- - Generate CSS custom properties (variables) or framework theme
377
- - Ensure all components are accessible (A11y)
378
-
379
- ## Non-Goals
380
- - ❌ Invent tokens not in DESIGN.md (e.g., standard Tailwind defaults)
381
- - ❌ Create duplicate tokens for same visual value
382
- - ❌ Generate component library without token foundation
109
+ - [ ] Tìm và đọc file đặc tả thiết kế (`DESIGN.md` hoặc styleguide document).
110
+ - [ ] Xác định CSS framework đang sử dụng từ `.agents/DEV_PROFILE.md` (Tailwind CSS, CSS Modules, Styled Components, Vanilla CSS).
111
+ - [ ] Kiểm tra xem đã có hệ thống tokens cũ chưa (tránh ghi đè làm vỡ giao diện đang chạy).
112
+ - [ ] Nếu không có `DESIGN.md` user không cung cấp giá trị màu sắc/kích thước cụ thể:
113
+ **EXIT: BLOCKED**
114
+ Báo cáo user yêu cầu cung cấp bảng màu (Palette) hoặc file quy chuẩn thiết kế trước.
383
115
 
384
116
  ---
385
117
 
386
- ## Token Naming Convention
387
-
388
- ```css
389
- /* Colors — HSL always */
390
- --color-[role]-[shade]: hsl(H, S%, L%);
391
- /* Example: */
392
- --color-primary-500: hsl(220, 80%, 55%);
393
- --color-surface-100: hsl(220, 15%, 98%);
394
-
395
- /* Spacing — scale-based */
396
- --space-[n]: [n * base]px;
397
- /* Example: */
398
- --space-1: 4px; --space-2: 8px; --space-4: 16px;
399
-
400
- /* Typography */
401
- --font-[family]: '[Name]', fallback;
402
- --font-size-[scale]: [value]rem;
403
- --font-weight-[name]: [value];
404
-
405
- /* Border Radius */
406
- --radius-[size]: [value]px;
407
-
408
- /* Shadows */
409
- --shadow-[level]: [value];
410
-
411
- /* Animation */
412
- --duration-[speed]: [value]ms;
413
- --ease-[type]: [cubic-bezier or keyword];
414
-
415
- /* Z-index */
416
- --z-[layer]: [value]; /* dropdown=100, modal=200, toast=300 */
417
- ```
118
+ ## Scope
418
119
 
419
- ---
120
+ ✅ Skill này làm:
121
+ - Chuyển đổi mã màu Hex/HSL thành semantic CSS custom properties (`--color-primary`, `--color-surface-base`).
122
+ - Cấu hình file `tailwind.config.js` / `tailwind.config.ts` khớp chính xác với Design Tokens.
123
+ - Khai báo token cho Spacing (bội số của 4px/8px), Font sizes, Border Radius, Shadows, Transitions.
124
+ - Tạo theme hỗ trợ Light/Dark mode qua CSS variables.
125
+ - Xuất type definition TypeScript cho autocomplete token trong code.
420
126
 
421
- ## Dark/Light Mode Pattern
422
- ```css
423
- :root {
424
- --color-background: hsl(0, 0%, 100%);
425
- --color-text: hsl(220, 15%, 10%);
426
- }
427
-
428
- [data-theme="dark"] {
429
- --color-background: hsl(220, 15%, 10%);
430
- --color-text: hsl(220, 10%, 90%);
431
- }
432
- ```
127
+ Skill này KHÔNG làm:
128
+ - Dựng các màn hình hay component hoàn chỉnh (→ `qk-ui-builder`).
129
+ - Định nghĩa chiến lược quy chuẩn thiết kế cấp cao (→ `qk-design-system-engineering`).
130
+ - Sửa đổi business logic backend.
433
131
 
434
132
  ---
435
133
 
436
- ## Workflow
437
-
438
- ### Phase 1 — Extract from DESIGN.md
439
- 1. Read DESIGN.md → list all defined tokens
440
- 2. Categorize: Colors / Spacing / Typography / Radius / Shadow / Animation
441
-
442
- ### Phase 2 — Generate Token File
443
- 1. Create `src/styles/tokens.css` (or equivalent)
444
- 2. Apply naming convention above
445
- 3. Add dark mode variants if DESIGN.md specifies
134
+ ## Execution Steps
446
135
 
447
- ### Phase 3Verify No Invented Tokens
448
- 1. Cross-check: every generated token has source in DESIGN.md
449
- 2. Flag any token that was "inferred" vs explicitly defined
450
-
451
- **Decision:**
136
+ ### Step 1Parse Design Specs & Contracts
452
137
  ```
453
- IF all tokens sourced from DESIGN.md EXIT: SUCCESS
454
- IF some tokens inferred (MEDIUM confidence) → EXIT: PARTIAL, list them
138
+ Inputs: DESIGN.md, Bảng màu từ user
139
+ Actions:
140
+ - Trích xuất: Primitive tokens (Brand colors, Neutrals, Font families).
141
+ - Trích xuất: Semantic tokens (Background, Foreground, Border, Primary, Destructive).
142
+ - Phân loại thang đo Spacing, Radius và Elevation (box-shadow).
143
+ Output: Structured Token Contract
455
144
  ```
456
145
 
457
- ---
458
-
459
- ---
460
-
461
- ## Priority Order
462
-
463
- ---
464
-
465
- ## Output Format
466
-
467
- ---
468
- ## Exit Codes
469
- | Code | Meaning | When |
470
- |------|---------|------|
471
- | SUCCESS | All tokens extracted from DESIGN.md, naming convention applied | All generated |
472
- | PARTIAL | Some tokens inferred (not explicitly in DESIGN.md) | Inferred values used |
473
- | BLOCKED | DESIGN.md missing or has no tokens | Cannot start |
474
- | FAILED | Token conflicts detected (duplicate values, naming collision) | Conflict |
475
-
476
- ---
477
-
478
- ## Confidence Model
479
- | Level | Condition | Action |
480
- |-------|-----------|--------|
481
- | HIGH | Token explicitly exists in DESIGN.md | Extract and map |
482
- | MEDIUM | Token value inferred or estimated based on related tokens | Note assumption |
483
- | LOW | Core scale missing entirely (e.g. no spacing definition) | EXIT: BLOCKED |
484
-
485
- ---
486
-
487
- ## Severity
488
- | Level | Definition | Example |
489
- |-------|-----------|---------|
490
- | CRITICAL | Hardcoded values injected without being tokens | Missing the point of the system |
491
- | HIGH | Token naming convention violated | `primary-color` instead of `--color-primary` |
492
- | MEDIUM | Dark mode not supported | Hardcoded white background |
493
- | LOW | Unused token generated | Extraneous variables |
494
-
495
- ---
496
-
497
- ## Evidence Format
146
+ ### Step 2 — CSS Variable & Theme Definition
498
147
  ```
499
- [SEVERITY] src/styles/tokens.css:LINE
500
- Issue: [specific violation or gap]
501
- Confidence: HIGH
502
- Fix: [specific change]
148
+ Inputs: Structured Token Contract
149
+ Actions:
150
+ - Khởi tạo `:root` chứa biến màu Light mode.
151
+ - Khởi tạo `.dark` hoặc `[data-theme="dark"]` chứa biến màu Dark mode tương ứng.
152
+ - Bảo đảm tỉ lệ tương phản đạt chuẩn WCAG AA giữa Foreground và Background.
153
+ Output: globals.css / theme.css
503
154
  ```
504
155
 
505
- ---
506
-
507
- ## Retry Policy
156
+ ### Step 3 — Framework Config Integration
508
157
  ```
509
- Token generation fails
510
- └─ Check if naming collision or syntax error
511
- ├─ Syntax error fix CSS/SCSS format retry
512
- └─ Collision deduplicate retry
513
- └─ Do NOT auto-retry more than 1 time
158
+ Inputs: globals.css, Tailwind config (hoặc tương đương)
159
+ Actions:
160
+ - Mở rộng (extend) theme của Tailwind: colors, spacing, borderRadius, fontSize.
161
+ - Ánh xạ trực tiếp sang `var(--...)` để tận dụng tính năng theme switching động.
162
+ Output: tailwind.config.ts / tokens.ts
514
163
  ```
515
164
 
516
- ---
517
-
518
- ## Escalation Rules
165
+ ### Step 4 — Verification & Type Generation
519
166
  ```
520
- BLOCKED: DESIGN.md missing or empty
521
- Missing:
522
- - Valid DESIGN.md with token specifications
523
- Questions:
524
- 1. Bạn có file design reference nào khác không?
525
- Recommended Assumptions:
526
- - Generate default Tailwind-like scale if requested
167
+ Inputs: Generated config files
168
+ Actions:
169
+ - Kiểm tra pháp config file.
170
+ - Đảm bảo token types được export rõ ràng cho IDE autocomplete.
171
+ Exit: SUCCESS
527
172
  ```
528
173
 
529
174
  ---
530
175
 
531
- ## Handoff Contract
532
- ### Consumes
533
- ```json
534
- {
535
- "from": "user or project-bootstrap",
536
- "required_fields": ["design_md_path"],
537
- "optional_fields": ["css_framework", "output_format"]
538
- }
176
+ ## Prompt Template
177
+
539
178
  ```
540
- ### Produces
541
- ```json
542
- {
543
- "to": "user or design-to-code",
544
- "output_fields": ["token_file_path", "inferred_tokens", "exit_code"]
545
- }
179
+ Tài liệu thiết kế: [Đường dẫn DESIGN.md hoặc paste bảng màu]
180
+ Framework CSS: [Tailwind CSS / CSS Modules / Vanilla CSS]
181
+ Dark Mode: [Có hỗ trợ không — class / data-theme / media query]
182
+ Yêu cầu riêng: [Cần bổ sung font chữ mới, radius đặc biệt, ...]
546
183
  ```
547
-
548
- ---
549
-