ai-developer-skill-os 10.1.0 → 10.2.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 (98) hide show
  1. package/.agents/AGENTS.md +13 -0
  2. package/.agents/LICENSE +21 -21
  3. package/.agents/docs/ARCHITECTURE.md +56 -120
  4. package/.agents/docs/GOVERNANCE.md +3 -3
  5. package/.agents/docs/SPEC.md +137 -60
  6. package/.agents/docs/VERSIONING.md +25 -57
  7. package/.agents/docs/adr/0005-v10-platform-consolidation.md +50 -0
  8. package/.agents/docs/schemas/learning.schema.yml +22 -57
  9. package/.agents/docs/schemas/skill.schema.yml +116 -161
  10. package/.agents/docs/schemas/workflow.schema.yml +51 -26
  11. package/.agents/docs/skill-classification.md +1 -1
  12. package/.agents/registry/graph.json +171 -77
  13. package/.agents/registry/index.yaml +68 -35
  14. package/.agents/rules/coding.md +1 -1
  15. package/.agents/rules/command-safety.md +1 -1
  16. package/.agents/rules/global.md +1 -1
  17. package/.agents/rules/prompt-compiler.md +1 -1
  18. package/.agents/rules/safety.md +1 -1
  19. package/.agents/rules/security.md +1 -1
  20. package/.agents/rules/skill-quality.md +18 -3
  21. package/.agents/skills/_template/SKILL.md +238 -88
  22. package/.agents/skills/qk-api-data-discovery/SKILL.md +176 -190
  23. package/.agents/skills/qk-api-data-discovery/references/bronze-record-format.md +47 -0
  24. package/.agents/skills/qk-api-data-discovery/references/data-contract-yaml.md +72 -0
  25. package/.agents/skills/qk-api-data-discovery/references/discovery-report-template.md +110 -0
  26. package/.agents/skills/qk-backend-data/SKILL.md +150 -1
  27. package/.agents/skills/qk-bug-resolution/SKILL.md +153 -1
  28. package/.agents/skills/qk-bug-resolution/evals/scorecard.yaml +1 -1
  29. package/.agents/skills/qk-code-cleaner/SKILL.md +150 -1
  30. package/.agents/skills/qk-code-review/SKILL.md +195 -1
  31. package/.agents/skills/qk-code-review/evals/scorecard.yaml +1 -1
  32. package/.agents/skills/qk-code-review/references/ai/{v8-schema-validation.md → schema-validation.md} +2 -2
  33. package/.agents/skills/qk-code-review/references/cross-cutting/async-concurrency-patterns.md +515 -515
  34. package/.agents/skills/qk-code-review/references/cross-cutting/error-handling-principles.md +492 -492
  35. package/.agents/skills/qk-code-review/references/cross-cutting/n-plus-one-queries.md +309 -309
  36. package/.agents/skills/qk-code-review/references/cross-cutting/sql-injection-prevention.md +307 -307
  37. package/.agents/skills/qk-code-review/references/cross-cutting/xss-prevention.md +263 -263
  38. package/.agents/skills/qk-code-review/references/languages/angular.md +768 -768
  39. package/.agents/skills/qk-code-review/references/languages/c.md +890 -890
  40. package/.agents/skills/qk-code-review/references/languages/cpp.md +893 -893
  41. package/.agents/skills/qk-code-review/references/languages/css-less-sass.md +661 -661
  42. package/.agents/skills/qk-code-review/references/languages/django.md +985 -985
  43. package/.agents/skills/qk-code-review/references/languages/fastapi.md +580 -580
  44. package/.agents/skills/qk-code-review/references/languages/go.md +993 -993
  45. package/.agents/skills/qk-code-review/references/languages/java.md +409 -409
  46. package/.agents/skills/qk-code-review/references/languages/java8.md +586 -586
  47. package/.agents/skills/qk-code-review/references/languages/kotlin.md +1018 -1018
  48. package/.agents/skills/qk-code-review/references/languages/nestjs.md +593 -593
  49. package/.agents/skills/qk-code-review/references/languages/php.md +684 -684
  50. package/.agents/skills/qk-code-review/references/languages/python.md +1073 -1073
  51. package/.agents/skills/qk-code-review/references/languages/qt.md +757 -757
  52. package/.agents/skills/qk-code-review/references/languages/react.md +871 -871
  53. package/.agents/skills/qk-code-review/references/languages/ruby.md +964 -964
  54. package/.agents/skills/qk-code-review/references/languages/rust.md +846 -846
  55. package/.agents/skills/qk-code-review/references/languages/svelte.md +1064 -1064
  56. package/.agents/skills/qk-code-review/references/languages/swift.md +936 -936
  57. package/.agents/skills/qk-code-review/references/languages/typescript.md +1016 -1016
  58. package/.agents/skills/qk-code-review/references/languages/vue.md +924 -924
  59. package/.agents/skills/qk-code-review/references/languages/zig.md +440 -440
  60. package/.agents/skills/qk-devops-release/SKILL.md +150 -1
  61. package/.agents/skills/qk-feature-delivery/SKILL.md +153 -1
  62. package/.agents/skills/qk-feature-delivery/evals/scorecard.yaml +1 -1
  63. package/.agents/skills/qk-orchestrator/SKILL.md +187 -2
  64. package/.agents/skills/qk-orchestrator/evals/scorecard.yaml +1 -1
  65. package/.agents/skills/qk-orchestrator/references/routing-table.md +1 -1
  66. package/.agents/skills/qk-product-spec/SKILL.md +150 -1
  67. package/.agents/skills/qk-prompt-compiler/SKILL.md +188 -65
  68. package/.agents/skills/qk-ui-engineer/SKILL.md +150 -1
  69. package/.agents/workflows/_schema.yml +146 -146
  70. package/.agents/workflows/bug-resolution.yml +155 -121
  71. package/.agents/workflows/code-review.yml +127 -93
  72. package/.agents/workflows/context-discovery.yml +128 -94
  73. package/.agents/workflows/documentation.yml +124 -90
  74. package/.agents/workflows/feature-delivery.yml +158 -124
  75. package/.agents/workflows/production-release.yml +207 -173
  76. package/.agents/workflows/prompt-compilation.yml +126 -0
  77. package/.agents/workflows/refactor.yml +136 -102
  78. package/.agents/workflows/security-audit.yml +149 -115
  79. package/.agents/workflows/shared/quality-gate.yml +3 -1
  80. package/.agents/workflows/skin-governance.yml +149 -115
  81. package/.agents/workflows/spec-driven-development.yml +78 -71
  82. package/CHANGELOG.md +61 -0
  83. package/README.md +3 -3
  84. package/bin/install.js +38 -51
  85. package/package.json +68 -74
  86. package/tooling/build-registry.js +226 -208
  87. package/tooling/run-aar.js +55 -126
  88. package/tooling/sync-versions.js +2 -2
  89. package/tooling/validate-graph.js +100 -87
  90. package/tooling/validate-skills.js +32 -14
  91. package/.agents/docs/decisions/ADR-001-v8-migration.md +0 -58
  92. package/.agents/docs/decisions/ADR-002-workflow-separation.md +0 -50
  93. package/.agents/docs/decisions/ADR-003-registry-generated.md +0 -54
  94. package/.agents/docs/decisions/ADR-008-skill-boundary-review.md +0 -27
  95. package/.agents/registry/capability-graph.yml +0 -390
  96. package/.agents/registry/skills-index.yml +0 -305
  97. package/.agents/skills/_template/capability.yaml +0 -34
  98. package/.agents/skills/_template/evals/scorecard.yaml +0 -19
@@ -1,9 +1,11 @@
1
1
  ---
2
2
  name: qk-product-spec
3
- version: 10.1.0
3
+ version: 10.2.0
4
4
  status: stable
5
5
  subtitle: "Viết Spec & PRD"
6
6
  description: "Chuyển hóa ý tưởng sơ khai thành đặc tả kỹ thuật chuẩn mực: PRD, Acceptance Criteria (BDD Given/When/Then), Gap Analysis và Đánh giá tính khả thi. Dùng khi: viết spec, viết PRD, phân tích yêu cầu, acceptance criteria, user story, bdd, gherkin, gap analysis, feasibility, đánh giá rủi ro, clarify requirements — TUYỆT ĐỐI KHÔNG dùng để trực tiếp viết code tính năng (dùng qk-feature-delivery)."
7
+ platforms: [antigravity, claude, opencode]
8
+ runtime_version: 1
7
9
  tools:
8
10
  - filesystem
9
11
  rules:
@@ -29,6 +31,83 @@ triggers:
29
31
 
30
32
  ---
31
33
 
34
+ ## Memory Workflow
35
+
36
+ ### 0. Self-Init Protocol (Khởi Tạo Bộ Nhớ Local & Gitignore)
37
+ - 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:
38
+ - **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.
39
+ - **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.
40
+
41
+ ---
42
+
43
+ ### Pre-flight Retrieve (Trước khi thực thi)
44
+ - Trước các task có tính lặp lại, debug, refactor, kiến trúc hoặc rủi ro cao:
45
+ bắt buộc tra cứu:
46
+ - `.ai-local/knowledge/index.yaml` (Private Local Knowledge)
47
+
48
+ - Ưu tiên sử dụng các Knowledge đang có trạng thái `Active` thuộc:
49
+ - Architecture
50
+ - Hard Bug
51
+ - Convention
52
+ - Pattern
53
+ - Tech Debt Pattern
54
+
55
+ - Memory chỉ đóng vai trò **Navigator (bản đồ chỉ đường)**.
56
+ Không được xem Memory là Source of Truth.
57
+ 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.
58
+
59
+ ---
60
+
61
+ ### Learning Flow (AI tự học có kiểm soát)
62
+ - 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:
63
+ - Hard Bug có khả năng tái diễn.
64
+ - Pattern làm việc lặp lại trong dự án.
65
+ - Convention hoặc quy tắc kiến trúc mới.
66
+ - Quyết định Architecture quan trọng.
67
+ - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
68
+
69
+ - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
70
+ - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
71
+ - AI không được tự động Promote Candidate Memory thành Project Knowledge.
72
+
73
+ ---
74
+
75
+ ### Post-flight Harvest (Đề xuất → Phê duyệt)
76
+ Sau khi hoàn thành task:
77
+ - AI đánh giá các Candidate Memory đã tạo.
78
+ - Nếu phát hiện tri thức có giá trị tái sử dụng:
79
+ - Đề xuất người dùng xem xét.
80
+ - Gửi yêu cầu phê duyệt thông qua:
81
+ - `/learn`
82
+ - `qk-project-memory`
83
+ - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
84
+
85
+ ```
86
+ .ai-local/candidates/ ──(Approve)──> .ai-local/knowledge/index.yaml
87
+ ```
88
+
89
+ - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
90
+ - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
91
+
92
+ ---
93
+
94
+ ### Ignore (Không đưa vào Memory)
95
+ Không lưu:
96
+ - Trace log của một session đơn lẻ.
97
+ - Temporary debugging data.
98
+ - Output của một lần chạy test/scan.
99
+ - Report health tạm thời của một đợt kiểm tra.
100
+ - Lỗi nhỏ chỉ xảy ra một lần.
101
+ - Thông tin không có khả năng tái sử dụng.
102
+
103
+ ---
104
+
105
+ ### Golden Rule
106
+ > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
107
+ > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
108
+
109
+ ---
110
+
32
111
  ## 1. Nguyên Tắc Cốt Lõi & Luật Chống Over-Engineering
33
112
 
34
113
  > **Core Principle:** Right-size the specification. Do not write a 20-page enterprise PRD for a 10-line UI tweak. Scale the spec depth proportionally to the project risk and complexity.
@@ -111,3 +190,73 @@ Tiêu chí nghiệm thu cốt lõi (BDD Gherkin):
111
190
  Đã khởi tạo artifact: [implementation_plan.md](file:///C:/Users/qkhanh/.gemini/antigravity-ide/brain/f7ef21b2-6e3e-4177-a422-5ddcad5a5843/implementation_plan.md)
112
191
  👉 Hãy xem lại kế hoạch và bấm [Proceed] để bắt đầu viết code.
113
192
  ```
193
+
194
+ ---
195
+
196
+ ## 6. Mô Hình Độ Tin Cậy (Confidence Model)
197
+
198
+ | Level | Condition | Action |
199
+ |-------|-----------|--------|
200
+ | HIGH | Direct evidence available | Proceed |
201
+ | MEDIUM | Some assumptions needed | Note assumptions |
202
+ | LOW | Insufficient evidence | EXIT: BLOCKED |
203
+
204
+ ---
205
+
206
+ ## 7. Thoái Ra Mã (Exit Codes)
207
+
208
+ | Code | Meaning | When |
209
+ |------|---------|------|
210
+ | SUCCESS | Task completed and verified | All acceptance criteria met |
211
+ | PARTIAL | Task done with minor gaps | Some checks skipped |
212
+ | BLOCKED | Missing precondition or info | Ask user |
213
+ | FAILED | Task failed after max retries | Report error |
214
+
215
+ ---
216
+
217
+ ## 8. Bằng Chứng Định Dạng (Evidence Format)
218
+
219
+ ```
220
+ [SEVERITY] path/to/file.ts:LINE
221
+ Reason: [why this matters]
222
+ Confidence: [HIGH|MEDIUM|LOW]
223
+ Fix: [suggestion]
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Platform-Specific Instructions
229
+
230
+ ### Antigravity (Google Gemini)
231
+ - Uses `.agents/AGENTS.md` as entry point
232
+ - Supports Cockpit integration
233
+ - Rewrite absolute paths for global mode
234
+ - `GEMINI.md` copied for global installs
235
+
236
+ ### Claude Code (Anthropic)
237
+ - Reads `.claude/CLAUDE.md` automatically
238
+ - Large context window (~200K tokens)
239
+ - Can handle full skill files without trimming
240
+ - Uses native tool format (Read, Write, Edit, Bash)
241
+
242
+ ### OpenCode (Open Source)
243
+ - Reads `.opencode/config.yaml`
244
+ - Context window ~128K tokens
245
+ - Keep skill files lean when possible
246
+ - Supports custom tool format
247
+
248
+ ---
249
+
250
+ ## Compliance
251
+
252
+ | Check | Status |
253
+ |-------|--------|
254
+ | Runtime Standard | 11/11 |
255
+ | Frontmatter Complete | ✅ |
256
+ | Platforms Field | ✅ |
257
+ | References Valid | ✅ |
258
+ | Decision Trees | PASS |
259
+ | Thresholds Defined | PASS |
260
+ | schema_version | 10.2.0 |
261
+ | runtime_version | 1 |
262
+ | platforms | [antigravity, claude, opencode] |
@@ -1,9 +1,11 @@
1
1
  ---
2
2
  name: qk-prompt-compiler
3
- version: 11.1.0
3
+ version: 10.2.0
4
4
  status: stable
5
5
  subtitle: "Cổng Kiểm Soát Hành Vi & Biên Dịch Prompt (Control Plane & Behavioral Gate)"
6
6
  description: "Cổng kiểm soát hành vi (Control Plane / Behavioral Gate): Chuyển hóa câu lệnh tự nhiên thành Compiled Execution Prompt minh bạch, bóc tách Prompt Delta, áp dụng 4 lớp cổng chặn (Prompt Quality Gate, Risk Gate R0-R4, Change Budget Gate, Scope Expansion Gate, Evidence Gate CLAIM <= EVIDENCE), quyết định 3 chế độ thực thi (AUTO / CONFIRM / ASK) trước khi đụng vào code. Dùng khi: viết prompt, compile prompt, viết lại prompt, chuẩn hóa prompt, prompt compiler, tối ưu prompt, prompt delta, intent gate."
7
+ platforms: [antigravity, claude, opencode]
8
+ runtime_version: 1
7
9
  tools:
8
10
  - filesystem
9
11
  - terminal
@@ -23,11 +25,11 @@ triggers:
23
25
  - "prompt rulebook"
24
26
  ---
25
27
 
26
- # qk-prompt-compiler v11.1 — Control Plane & Behavioral Gate
28
+ # qk-prompt-compiler v10.2 — Control Plane & Behavioral Gate
27
29
 
28
30
  > **Core Principle:**
29
31
  > User speaks naturally. AI converts the request into an explicit, reviewable Execution Prompt before execution.
30
- >
32
+ >
31
33
  > **Core Maxims:**
32
34
  > 1. `AI MUST NEVER INCREASE THE USER'S INTENDED SCOPE SILENTLY.`
33
35
  > 2. `The AI may increase implementation detail, but must never silently increase business scope, behavioral scope, architectural scope, security scope, data scope, or change budget.`
@@ -36,64 +38,93 @@ triggers:
36
38
 
37
39
  ---
38
40
 
39
- ## 1. Kiến Trúc Toàn Diện Control Plane
41
+ ## 1. Nguyên Tắc Cốt Lõi & Kiểm Soát Hành Vi (Core Maxims)
42
+
43
+ > **Core Principle:** User speaks naturally. AI converts the request into an explicit, reviewable Execution Prompt before execution.
44
+ > **Anti-Sprawl Principle:** AI MUST NEVER increase the user's intended scope silently. Implementation detail may increase; business scope, behavioral scope, architectural scope, security scope, data scope, and change budget must NOT.
45
+ > **Evidence Principle:** CLAIM LEVEL <= EVIDENCE LEVEL. Never claim VERIFIED without executing the actual command.
46
+
47
+ ### 🛡️ Anti-Overengineering Rule (CẤM TẠO GIA TRỊ GIẢ)
48
+ - **CẤM** tạo compiled prompt phức tạp cho request đơn giản (L0-L1). Compiled Prompt chỉ cần 3-5 thành phần cho task nhỏ.
49
+ - **CẤM** auto-increase scope trong khi biên dịch prompt. User nói "fix login" → không tự động mở rộng thành "fix login + sửa database + update UI".
50
+ - **Ưu tiên minimal compiled prompt**: 3 fields (Objective, Scope, Constraints) cho L0-L1, đầy đủ 9 fields cho L3-L4.
51
+
52
+ ### 🔒 Change Budget Enforcement (R-G-14.5)
53
+ - **Hard cap files**: Maximum 5 files changed per compiled prompt execution.
54
+ - **Zero new dependencies by default**: Cấm tự ý `npm install` thêm package nếu chưa hỏi user.
55
+ - **API contract frozen**: Không đổi API contract trừ khi request explicitly yêu cầu thiết kế API mới.
56
+ - **Database schema protected**: Không đổi schema/migration trừ khi request explicit.
57
+
58
+ ### ⚖️ Evidence Gate (R-G-14.7)
59
+ - **VERIFIED**: Đã chạy lệnh test/build thực tế + exit code 0. Bằng chứng: lệnh + kết quả.
60
+ - **PARTIALLY VERIFIED**: Đã kiểm tra tĩnh (tsc, lint) PASS. Chưa chạy integration test.
61
+ - **UNVERIFIED**: Chỉ đọc code. CẤM ghi "100% fixed" hoặc "All green".
62
+
63
+ ### 🚨 Scope Expansion Gate (CẤM BẠCH TRỞ PHẠM VI)
64
+ - **STOP ngay** khi phát hiện scope thực tế vượt Compiled Scope.
65
+ - **Report Scope Expansion** với: ban đầu → mới phát hiện → lý do → rủi ro tăng.
66
+ - **Recompile & CONFIRM** trước khi chạm vào file mới.
67
+
68
+ ---
69
+
70
+ ## 2. Kiến Trúc Toàn Diện Control Plane
40
71
 
41
72
  ```text
42
- USER REQUEST (Câu lệnh tự nhiên thô)
43
- │
44
- ▼
45
- ┌─────────────┐
46
- │ UNDERSTAND │ ──► Nhận diện mục tiêu cốt lõi (Actual Goal)
47
- └──────┬──────┘
48
- ▼
49
- ┌─────────────┐
50
- │ INTERPRET │ ──► Ánh xạ vào Context & DEV_PROFILE.md
51
- └──────┬──────┘
52
- ▼
53
- ┌─────────────┐
54
- │ COMPILE │ ──► Sinh Compiled Execution Prompt (9 thành phần)
55
- └──────┬──────┘
56
- ▼
57
- ┌──────────────────────┐
58
- │ PROMPT QUALITY GATE │ ──► Kiểm tra đủ 8 tiêu chí hợp đồng
59
- └──────────┬───────────┘
60
- ▼
61
- ┌──────────────────────┐
62
- │ SCOPE / RISK GATE │ ──► Đánh giá Complexity (L0–L4) & Risk (R0–R4)
63
- └──────────┬───────────┘
64
- ▼
65
- ┌──────────────────────┐
66
- │ CHANGE BUDGET GATE │ ──► Khóa ngân sách: Files, Deps, API, DB
67
- └──────────┬───────────┘
68
- ▼
69
- ┌─────────────┐
70
- │ SHOW DELTA │ ──► Công khai: User Said vs Inferred vs Not Assumed
71
- └──────┬──────┘
72
- ▼
73
- ┌──────────────────────┐
74
- │ AUTO / CONFIRM / ASK │ ──► Quyết định chế độ hành động
75
- └──────────┬───────────┘
76
- ▼
77
- EXECUTE
78
- │
79
- ▼
80
- SCOPE EXPANSION?
81
- / \
82
- NO YES
83
- │ │
84
- ▼ ▼
85
- VALIDATE STOP EXPANSION + RECOMPILE + CONFIRM
86
- │
87
- ▼
88
- EVIDENCE GATE (CLAIM LEVEL <= EVIDENCE LEVEL)
89
- │
90
- ▼
91
- EXECUTION REPORT
73
+ USER REQUEST (Câu lệnh tự nhiên thô)
74
+ │
75
+ ▼
76
+ ┌─────────────┐
77
+ │ UNDERSTAND │ ──► Nhận diện mục tiêu cốt lõi (Actual Goal)
78
+ └──────┬──────┘
79
+ ▼
80
+ ┌─────────────┐
81
+ │ INTERPRET │ ──► Ánh xạ vào Context & DEV_PROFILE.md
82
+ └──────┬──────┘
83
+ ▼
84
+ ┌─────────────┐
85
+ │ COMPILE │ ──► Sinh Compiled Execution Prompt (9 thành phần)
86
+ └──────┬──────┘
87
+ ▼
88
+ ┌──────────────────────┐
89
+ │ PROMPT QUALITY GATE │ ──► Kiểm tra đủ 8 tiêu chí hợp đồng
90
+ └──────────┬───────────┘
91
+ ▼
92
+ ┌──────────────────────┐
93
+ │ SCOPE / RISK GATE │ ──► Đánh giá Complexity (L0–L4) & Risk (R0–R4)
94
+ └──────────┬───────────┘
95
+ ▼
96
+ ┌──────────────────────┐
97
+ │ CHANGE BUDGET GATE │ ──► Khóa ngân sách: Files, Deps, API, DB
98
+ └──────────┬───────────┘
99
+ ▼
100
+ ┌─────────────┐
101
+ │ SHOW DELTA │ ──► Công khai: User Said vs Inferred vs Not Assumed
102
+ └──────┬──────┘
103
+ ▼
104
+ ┌──────────────────────┐
105
+ │ AUTO / CONFIRM / ASK │ ──► Quyết định chế độ hành động
106
+ └──────────┬───────────┘
107
+ ▼
108
+ EXECUTE
109
+ │
110
+ ▼
111
+ SCOPE EXPANSION?
112
+ / \
113
+ NO YES
114
+ │ │
115
+ ▼ ▼
116
+ VALIDATE STOP EXPANSION + RECOMPILE + CONFIRM
117
+ │
118
+ ▼
119
+ EVIDENCE GATE (CLAIM LEVEL <= EVIDENCE LEVEL)
120
+ │
121
+ ▼
122
+ EXECUTION REPORT
92
123
  ```
93
124
 
94
125
  ---
95
126
 
96
- ## 2. Thứ Bậc Ngữ Cảnh Hóa Biên Dịch (Context-Aware Compilation Hierarchy)
127
+ ## 3. Thứ Bậc Ngữ Cảnh Hóa Biên Dịch (Context-Aware Compilation Hierarchy)
97
128
 
98
129
  Để không gây hiểu lầm rằng "User Request có độ ưu tiên thấp nhất", hệ thống quy định phân tầng nhận thức rõ ràng:
99
130
 
@@ -118,12 +149,12 @@ EXECUTION PLAN ◄── [QUY CHUẨN KỸ THUẬT & RANH GIỚI BẢO VỆ (H
118
149
  ```
119
150
 
120
151
  > [!IMPORTANT]
121
- > **User Requirement** luôn là nguồn sự thật duy nhất xác định **Mục tiêu bạn muốn làm gì (WHAT)**.
152
+ > **User Requirement** luôn là nguồn sự thật duy nhất xác định **Mục tiêu bạn muốn làm gì (WHAT)**.
122
153
  > Các tầng Rules, Profile và Codebase bên trên quyết định **Cách AI được phép thực hiện an toàn (HOW & CONSTRAINTS)** để không phá vỡ dự án.
123
154
 
124
155
  ---
125
156
 
126
- ## 3. Phân Cấp Phức Tạp & Rủi Ro (Complexity vs Risk Gate)
157
+ ## 4. Phân Cấp Phức Tạp & Rủi Ro (Complexity vs Risk Gate)
127
158
 
128
159
  > **Nguyên tắc vàng:** `Complexity ≠ Risk`. Một thay đổi 1 dòng trong file cấu hình Production (`L1`) có thể mang rủi ro chí mạng (`R4`). Do đó, hai trục này phải được đánh giá độc lập:
129
160
 
@@ -153,7 +184,7 @@ IF thiếu thông tin / intent mơ hồ ──► BẮT BUỘC ASK (Hỏi
153
184
 
154
185
  ---
155
186
 
156
- ## 4. Ngân Sách Thay Đổi (Change Budget Gate)
187
+ ## 5. Ngân Sách Thay Đổi (Change Budget Gate)
157
188
 
158
189
  AI không chỉ được biết *được phép sửa gì*, mà phải bị khóa chặt *được phép sửa nhiều đến đâu*:
159
190
 
@@ -194,9 +225,9 @@ CHỜ USER DUYỆT (CONFIRM)
194
225
 
195
226
  ---
196
227
 
197
- ## 5. Cổng Chặn Bành Trướng Phạm Vi (Scope Expansion Gate)
228
+ ## 6. Cổng Chặn Bành Trưởng Phạm Vi (Scope Expansion Gate)
198
229
 
199
- > **Chống hiện tượng "AI càng làm càng lan":**
230
+ > **Chống hiện tượng "AI càng làm càng lan":**
200
231
  > Ví dụ: Bạn yêu cầu `"fix bug login"`, AI ban đầu xác định chỉ sửa `LoginForm.tsx`. Nhưng khi inspect phát hiện lỗi do `LoginForm.tsx → auth.ts → api-client.ts → backend middleware`.
201
232
 
202
233
  **Quy tắc:** AI **TUYỆT ĐỐI KHÔNG ĐƯỢC TỰ Ý MỞ RỘNG SCOPE ÂM THẦM**.
@@ -212,7 +243,7 @@ Khi phát hiện scope thực tế vượt quá Compiled Scope:
212
243
 
213
244
  ---
214
245
 
215
- ## 6. Cổng Bằng Chứng Khẳng Định (Evidence Gate)
246
+ ## 7. Cổng Bằng Chứng Khẳng Định (Evidence Gate)
216
247
 
217
248
  ```text
218
249
  NGUYÊN TẮC THÉP:
@@ -234,11 +265,11 @@ AI phân loại trạng thái nghiệm thu thành 3 cấp bậc rõ ràng:
234
265
  3. **`UNVERIFIED` (Chưa chứng minh):**
235
266
  - Chỉ mới đọc code hoặc sửa code mà môi trường không có test tự động.
236
267
  - **CẤM TUYỆT ĐỐI** ghi: "Đã fix xong 100%", "All green".
237
- - BẮT BUỘC ghi rõ: *"Trạng thái: NOT VERIFIED — Đã sửa logic dựa trên code inspection. Cần người dùng kiểm thử thủ công."*
268
+ - **BẮT BUỘC** ghi rõ: *"Trạng thái: NOT VERIFIED — Đã sửa logic dựa trên code inspection. Cần người dùng kiểm thử thủ công."*
238
269
 
239
270
  ---
240
271
 
241
- ## 7. Khung Hiển Thị Mặc Định (Default UI Block với Prompt Delta & Budget)
272
+ ## 8. Khung Hiển Thị Mặc Định (Default UI Block với Prompt Delta & Budget)
242
273
 
243
274
  Khi bạn đưa ra yêu cầu, AI mở đầu câu trả lời bằng cấu trúc minh bạch sau:
244
275
 
@@ -289,7 +320,7 @@ Acceptance Criteria:
289
320
 
290
321
  ---
291
322
 
292
- ## 8. Báo Cáo Nghiệm Thu Thực Thi (Execution Report)
323
+ ## 9. Báo Cáo Nghiệm Thu Thực Thi (Execution Report)
293
324
 
294
325
  Sau khi hoàn tất công việc:
295
326
 
@@ -314,8 +345,100 @@ Sau khi hoàn tất công việc:
314
345
 
315
346
  ---
316
347
 
317
- ## 9. Quy Tắc Vàng Hệ Thống (System Golden Rule)
348
+ ## 10. Quy Tắc Vàng Hệ Thống (System Golden Rule)
318
349
 
319
350
  ```text
320
351
  Before executing a non-trivial task, convert the user's natural-language request into an explicit, reviewable Execution Prompt, show the interpretation, assumptions, Prompt Delta and Change Budget, select AUTO/CONFIRM/ASK, enforce Scope Expansion Gates during execution, and report results strictly bounded by the Evidence Gate (CLAIM LEVEL <= EVIDENCE LEVEL).
321
352
  ```
353
+
354
+ ---
355
+
356
+ ## 11. Thích Ứng Theo Role Kỹ Thuật (Role Adaptation)
357
+
358
+ | Role | Trọng tâm khi compile prompt | Hành vi đặc thù |
359
+ |---|---|---|
360
+ | `frontend` | UI component changes, CSS, interaction | Compile with design-token constraints |
361
+ | `backend` | API, database, service logic | Compile with Zod/Pydantic schemas |
362
+ | `fullstack` | End-to-end feature | Compile with contract-first approach |
363
+ | `devops` | Infrastructure, CI/CD, deployment | Compile with safety gates |
364
+ | `qa` | Test, validation, verification | Compile with test-first approach |
365
+
366
+ ---
367
+
368
+ ## 12. Mô Hình Độ Tin Cậy (Confidence Model)
369
+
370
+ | Level | Condition | Action |
371
+ |-------|-----------|--------|
372
+ | HIGH | Compiled prompt executed with all gates PASS | Report as VERIFIED |
373
+ | MEDIUM | Scope expansion detected but within budget | Report with delta |
374
+ | LOW | Gates failed or cannot verify | EXIT: BLOCKED or FAILED |
375
+
376
+ ---
377
+
378
+ ## 13. Bằng Chứng Định Dạng (Evidence Format)
379
+
380
+ ```
381
+ [SEVERITY] scope: [compiled-scope-id]
382
+ Claim Level: [VERIFIED|PARTIALLY VERIFIED|UNVERIFIED]
383
+ Evidence: [command executed + exit code]
384
+ Delta: [what AI added vs what user said]
385
+ Confidence: [HIGH|MEDIUM|LOW]
386
+ ```
387
+
388
+ **Example:**
389
+ ```
390
+ [VERIFIED] scope: L2-bugfix-login
391
+ Claim Level: VERIFIED
392
+ Evidence: npm test auth.test.ts → PASS (12/12)
393
+ Delta: User said "fix login" → AI added token refresh logic
394
+ Confidence: HIGH
395
+ ```
396
+
397
+ ---
398
+
399
+ ## 14. Thoái Ra Mã (Exit Codes)
400
+
401
+ | Code | Meaning | When |
402
+ |------|---------|------|
403
+ | SUCCESS | Compiled prompt executed, all gates passed | Evidence gate PASS |
404
+ | PARTIAL | Executed but scope expanded or partial verification | Scope expansion detected |
405
+ | BLOCKED | Intent unclear or missing required context | ASK mode triggered |
406
+ | FAILED | Gates failed or scope violation detected | Evidence gate FAIL |
407
+
408
+ ---
409
+
410
+ ## Platform-Specific Instructions
411
+
412
+ ### Antigravity (Google Gemini)
413
+ - Uses `.agents/AGENTS.md` as entry point
414
+ - Supports Cockpit integration
415
+ - Rewrite absolute paths for global mode
416
+ - `GEMINI.md` copied for global installs
417
+
418
+ ### Claude Code (Anthropic)
419
+ - Reads `.claude/CLAUDE.md` automatically
420
+ - Large context window (~200K tokens)
421
+ - Can handle full skill files without trimming
422
+ - Uses native tool format (Read, Write, Edit, Bash)
423
+
424
+ ### OpenCode (Open Source)
425
+ - Reads `.opencode/config.yaml`
426
+ - Context window ~128K tokens
427
+ - Keep skill files lean when possible
428
+ - Supports custom tool format
429
+
430
+ ---
431
+
432
+ ## Compliance
433
+
434
+ | Check | Status |
435
+ |-------|--------|
436
+ | Runtime Standard | 11/11 |
437
+ | Frontmatter Complete | ✅ |
438
+ | Platforms Field | ✅ |
439
+ | References Valid | ✅ |
440
+ | Decision Trees | PASS |
441
+ | Thresholds Defined | PASS |
442
+ | schema_version | 10.2.0 |
443
+ | runtime_version | 1 |
444
+ | platforms | [antigravity, claude, opencode] |
@@ -1,9 +1,11 @@
1
1
  ---
2
2
  name: qk-ui-engineer
3
- version: 10.1.0
3
+ version: 10.2.0
4
4
  status: stable
5
5
  subtitle: "Build UI & Component"
6
6
  description: "Kỹ sư Giao diện & Design System toàn diện: Xây dựng Design Tokens, phát triển UI Components responsive đầy đủ interaction states, và kiểm toán 57 tiêu chí Anti-Slop UI. Dùng khi: build ui, làm giao diện, css, layout, component, figma, design tokens, token library, design system, variants, review ui, audit giao diện, lỗi spacing — TUYỆT ĐỐI KHÔNG dùng khi viết API/Database (dùng qk-backend-data) hoặc đo lường SEO/Web Vitals sâu (dùng qk-code-review)."
7
+ platforms: [antigravity, claude, opencode]
8
+ runtime_version: 1
7
9
  tools:
8
10
  - filesystem
9
11
  - terminal
@@ -33,6 +35,83 @@ triggers:
33
35
 
34
36
  ---
35
37
 
38
+ ## Memory Workflow
39
+
40
+ ### 0. Self-Init Protocol (Khởi Tạo Bộ Nhớ Local & Gitignore)
41
+ - 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:
42
+ - **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.
43
+ - **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.
44
+
45
+ ---
46
+
47
+ ### Pre-flight Retrieve (Trước khi thực thi)
48
+ - Trước các task có tính lặp lại, debug, refactor, kiến trúc hoặc rủi ro cao:
49
+ bắt buộc tra cứu:
50
+ - `.ai-local/knowledge/index.yaml` (Private Local Knowledge)
51
+
52
+ - Ưu tiên sử dụng các Knowledge đang có trạng thái `Active` thuộc:
53
+ - Architecture
54
+ - Hard Bug
55
+ - Convention
56
+ - Pattern
57
+ - Tech Debt Pattern
58
+
59
+ - Memory chỉ đóng vai trò **Navigator (bản đồ chỉ đường)**.
60
+ Không được xem Memory là Source of Truth.
61
+ 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.
62
+
63
+ ---
64
+
65
+ ### Learning Flow (AI tự học có kiểm soát)
66
+ - 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:
67
+ - Hard Bug có khả năng tái diễn.
68
+ - Pattern làm việc lặp lại trong dự án.
69
+ - Convention hoặc quy tắc kiến trúc mới.
70
+ - Quyết định Architecture quan trọng.
71
+ - Tech Debt Pattern hoặc Code Smell có tính hệ thống.
72
+
73
+ - Candidate Memory chỉ là bản nháp quan sát, chưa phải tri thức chính thức.
74
+ - Candidate Memory có thể lưu tạm tại: `.ai-local/candidates/`
75
+ - AI không được tự động Promote Candidate Memory thành Project Knowledge.
76
+
77
+ ---
78
+
79
+ ### Post-flight Harvest (Đề xuất → Phê duyệt)
80
+ Sau khi hoàn thành task:
81
+ - AI đánh giá các Candidate Memory đã tạo.
82
+ - Nếu phát hiện tri thức có giá trị tái sử dụng:
83
+ - Đề xuất người dùng xem xét.
84
+ - Gửi yêu cầu phê duyệt thông qua:
85
+ - `/learn`
86
+ - `qk-project-memory`
87
+ - Chỉ sau khi được phê duyệt, Candidate Memory mới được chuyển thành Knowledge chính thức:
88
+
89
+ ```
90
+ .ai-local/candidates/ ──(Approve)──> .ai-local/knowledge/index.yaml
91
+ ```
92
+
93
+ - Project Knowledge phải được xem như tài sản kỹ thuật của dự án:
94
+ - Có thể review, cập nhật, loại bỏ và có lịch sử thay đổi.
95
+
96
+ ---
97
+
98
+ ### Ignore (Không đưa vào Memory)
99
+ Không lưu:
100
+ - Trace log của một session đơn lẻ.
101
+ - Temporary debugging data.
102
+ - Output của một lần chạy test/scan.
103
+ - Report health tạm thời của một đợt kiểm tra.
104
+ - Lỗi nhỏ chỉ xảy ra một lần.
105
+ - Thông tin không có khả năng tái sử dụng.
106
+
107
+ ---
108
+
109
+ ### Golden Rule
110
+ > **AI được phép học, nhưng không được tự quyết định tri thức chính thức.**
111
+ > **AI quan sát → Đề xuất → Con người phê duyệt → Dự án tiến hóa.**
112
+
113
+ ---
114
+
36
115
  ## 1. Nguyên Tắc Cốt Lõi & Luật Chống Over-Engineering
37
116
 
38
117
  > **Core Principle:** Co-locate tightly coupled UI elements. Do not over-modularize simple components into micro-files. A beautiful UI is disciplined in its tokens and clean in its markup.
@@ -135,3 +214,73 @@ Kiểm soát Anti-Slop & Truth-First:
135
214
  • Visual Verification: [Đã verify qua browser / NOT VERIFIED (Cần user test mắt)]
136
215
  • Zero Hack: ✅ Không dùng overflow: hidden trên body, không ép kiểu props
137
216
  ```
217
+
218
+ ---
219
+
220
+ ## 7. Mô Hình Độ Tin Cậy (Confidence Model)
221
+
222
+ | Level | Condition | Action |
223
+ |-------|-----------|--------|
224
+ | HIGH | Direct evidence available | Proceed |
225
+ | MEDIUM | Some assumptions needed | Note assumptions |
226
+ | LOW | Insufficient evidence | EXIT: BLOCKED |
227
+
228
+ ---
229
+
230
+ ## 8. Thoái Ra Mã (Exit Codes)
231
+
232
+ | Code | Meaning | When |
233
+ |------|---------|------|
234
+ | SUCCESS | Task completed and verified | All acceptance criteria met |
235
+ | PARTIAL | Task done with minor gaps | Some checks skipped |
236
+ | BLOCKED | Missing precondition or info | Ask user |
237
+ | FAILED | Task failed after max retries | Report error |
238
+
239
+ ---
240
+
241
+ ## 9. Bằng Chứng Định Dạng (Evidence Format)
242
+
243
+ ```
244
+ [SEVERITY] path/to/file.ts:LINE
245
+ Reason: [why this matters]
246
+ Confidence: [HIGH|MEDIUM|LOW]
247
+ Fix: [suggestion]
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Platform-Specific Instructions
253
+
254
+ ### Antigravity (Google Gemini)
255
+ - Uses `.agents/AGENTS.md` as entry point
256
+ - Supports Cockpit integration
257
+ - Rewrite absolute paths for global mode
258
+ - `GEMINI.md` copied for global installs
259
+
260
+ ### Claude Code (Anthropic)
261
+ - Reads `.claude/CLAUDE.md` automatically
262
+ - Large context window (~200K tokens)
263
+ - Can handle full skill files without trimming
264
+ - Uses native tool format (Read, Write, Edit, Bash)
265
+
266
+ ### OpenCode (Open Source)
267
+ - Reads `.opencode/config.yaml`
268
+ - Context window ~128K tokens
269
+ - Keep skill files lean when possible
270
+ - Supports custom tool format
271
+
272
+ ---
273
+
274
+ ## Compliance
275
+
276
+ | Check | Status |
277
+ |-------|--------|
278
+ | Runtime Standard | 11/11 |
279
+ | Frontmatter Complete | ✅ |
280
+ | Platforms Field | ✅ |
281
+ | References Valid | ✅ |
282
+ | Decision Trees | PASS |
283
+ | Thresholds Defined | PASS |
284
+ | schema_version | 10.2.0 |
285
+ | runtime_version | 1 |
286
+ | platforms | [antigravity, claude, opencode] |