ai-developer-skill-os 7.0.2 → 7.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/.agents/AGENTS.md +44 -88
  2. package/.agents/CHANGELOG.md +70 -0
  3. package/.agents/LICENSE +21 -0
  4. package/.agents/README.md +100 -0
  5. package/.agents/docs/CHI_TIET_SKILLS.md +126 -0
  6. package/.agents/docs/GOVERNANCE.md +40 -0
  7. package/.agents/docs/HUONG_DAN_SU_DUNG.md +120 -0
  8. package/.agents/docs/SPEC.md +87 -0
  9. package/.agents/docs/adr/0001-intent-based-architecture.md +19 -0
  10. package/.agents/docs/adr/0002-kernel-freeze.md +21 -0
  11. package/.agents/docs/adr/0003-risk-based-verification.md +20 -0
  12. package/.agents/docs/adr/0004-progressive-evidence.md +19 -0
  13. package/.agents/docs/skill-classification.md +25 -0
  14. package/.agents/skills/qk-access-policy/SKILL.md +179 -0
  15. package/.agents/skills/qk-ai-builder/SKILL.md +215 -0
  16. package/.agents/skills/qk-api-lifecycle/SKILL.md +176 -0
  17. package/.agents/skills/qk-bug-resolution/SKILL.md +307 -0
  18. package/.agents/skills/qk-context-loader/SKILL.md +218 -0
  19. package/.agents/skills/qk-data-lifecycle/SKILL.md +192 -0
  20. package/.agents/skills/qk-db-optimizer/SKILL.md +196 -0
  21. package/.agents/skills/qk-docs/SKILL.md +198 -0
  22. package/.agents/skills/qk-engineering-standard/SKILL.md +351 -0
  23. package/.agents/skills/qk-engineering-standard/rules/backend.md +122 -0
  24. package/.agents/skills/qk-engineering-standard/rules/database.md +3 -0
  25. package/.agents/skills/qk-engineering-standard/rules/frontend.md +152 -0
  26. package/.agents/skills/qk-engineering-standard/rules/security.md +3 -0
  27. package/.agents/skills/qk-engineering-standard/rules/testing.md +3 -0
  28. package/.agents/skills/qk-fe-api-integration/SKILL.md +326 -0
  29. package/.agents/skills/qk-feature-delivery/SKILL.md +305 -0
  30. package/.agents/skills/qk-help/SKILL.md +193 -0
  31. package/.agents/skills/qk-orchestrator/SKILL.md +278 -0
  32. package/.agents/skills/qk-orchestrator/references/routing-table.md +78 -0
  33. package/.agents/skills/qk-production-release/SKILL.md +284 -0
  34. package/.agents/skills/qk-project-bootstrap/SKILL.md +235 -0
  35. package/.agents/skills/qk-project-health/SKILL.md +199 -0
  36. package/.agents/skills/qk-project-memory/SKILL.md +218 -0
  37. package/.agents/skills/qk-system-evolution/SKILL.md +281 -0
  38. package/.agents/skills/qk-ui-audit/SKILL.md +315 -0
  39. package/.agents/skills/qk-ui-audit/references/anti-slop-checklist.md +136 -0
  40. package/.agents/skills/qk-ui-builder/SKILL.md +446 -0
  41. package/.agents/skills/qk-ui-builder/references/anti-patterns.md +295 -0
  42. package/.agents/skills/qk-ui-builder/references/color.md +115 -0
  43. package/.agents/skills/qk-ui-builder/references/component-cookbook.md +1194 -0
  44. package/.agents/skills/qk-ui-builder/references/copy.md +250 -0
  45. package/.agents/skills/qk-ui-builder/references/interaction-and-states.md +115 -0
  46. package/.agents/skills/qk-ui-builder/references/layout-and-space.md +111 -0
  47. package/.agents/skills/qk-ui-builder/references/macrostructures/01-bento-grid.md +48 -0
  48. package/.agents/skills/qk-ui-builder/references/macrostructures/02-long-document.md +50 -0
  49. package/.agents/skills/qk-ui-builder/references/macrostructures/03-marquee-hero.md +51 -0
  50. package/.agents/skills/qk-ui-builder/references/macrostructures/04-stat-led.md +49 -0
  51. package/.agents/skills/qk-ui-builder/references/macrostructures/05-workbench.md +44 -0
  52. package/.agents/skills/qk-ui-builder/references/macrostructures/06-conversational-faq.md +50 -0
  53. package/.agents/skills/qk-ui-builder/references/macrostructures/07-manifesto.md +51 -0
  54. package/.agents/skills/qk-ui-builder/references/macrostructures/08-photographic.md +50 -0
  55. package/.agents/skills/qk-ui-builder/references/macrostructures/09-quote-led.md +50 -0
  56. package/.agents/skills/qk-ui-builder/references/macrostructures/11-catalogue.md +49 -0
  57. package/.agents/skills/qk-ui-builder/references/macrostructures/12-letter.md +49 -0
  58. package/.agents/skills/qk-ui-builder/references/macrostructures/13-index-first.md +49 -0
  59. package/.agents/skills/qk-ui-builder/references/macrostructures/14-narrative-workflow.md +48 -0
  60. package/.agents/skills/qk-ui-builder/references/macrostructures/15-split-studio.md +48 -0
  61. package/.agents/skills/qk-ui-builder/references/macrostructures/16-feature-stack.md +51 -0
  62. package/.agents/skills/qk-ui-builder/references/macrostructures/17-type-specimen.md +48 -0
  63. package/.agents/skills/qk-ui-builder/references/macrostructures/18-portfolio-grid.md +48 -0
  64. package/.agents/skills/qk-ui-builder/references/macrostructures/19-map-diagram.md +50 -0
  65. package/.agents/skills/qk-ui-builder/references/macrostructures/20-ecosystem-index.md +48 -0
  66. package/.agents/skills/qk-ui-builder/references/macrostructures/21-component-playground.md +45 -0
  67. package/.agents/skills/qk-ui-builder/references/macrostructures.md +38 -0
  68. package/.agents/skills/qk-ui-builder/references/motion.md +95 -0
  69. package/.agents/skills/qk-ui-builder/references/responsive.md +115 -0
  70. package/.agents/skills/qk-ui-builder/references/slop-test.md +135 -0
  71. package/.agents/skills/qk-ui-builder/references/structure.md +280 -0
  72. package/.agents/skills/qk-ui-builder/references/themes/atmospheric.md +53 -0
  73. package/.agents/skills/qk-ui-builder/references/themes/carnival.md +52 -0
  74. package/.agents/skills/qk-ui-builder/references/themes/cobalt.md +52 -0
  75. package/.agents/skills/qk-ui-builder/references/themes/editorial.md +52 -0
  76. package/.agents/skills/qk-ui-builder/references/themes/garden.md +52 -0
  77. package/.agents/skills/qk-ui-builder/references/themes/hum.md +52 -0
  78. package/.agents/skills/qk-ui-builder/references/themes/lumen.md +52 -0
  79. package/.agents/skills/qk-ui-builder/references/themes/midnight.md +52 -0
  80. package/.agents/skills/qk-ui-builder/references/themes/modern-minimal.md +52 -0
  81. package/.agents/skills/qk-ui-builder/references/themes/playful.md +52 -0
  82. package/.agents/skills/qk-ui-builder/references/themes/specimen.md +52 -0
  83. package/.agents/skills/qk-ui-builder/references/themes/terminal.md +52 -0
  84. package/.agents/skills/qk-ui-builder/references/typography.md +129 -0
  85. package/.agents/skills/qk-ui-system-builder/SKILL.md +221 -0
  86. package/.agents/skills/qk-validation-gate/SKILL.md +359 -0
  87. package/.agents/skills.json +819 -0
  88. package/.github/workflows/ci.yml +1 -1
  89. package/CHANGELOG.md +2 -1
  90. package/CLAUDE.md +110 -0
  91. package/README.md +52 -10
  92. package/add_lang.js +21 -0
  93. package/add_lang.py +25 -0
  94. package/add_sections.py +53 -0
  95. package/bin/install.js +225 -170
  96. package/bin/lint.js +123 -0
  97. package/docs/CHI_TIET_SKILLS.md +27 -26
  98. package/docs/HUONG_DAN_SU_DUNG.md +3 -3
  99. package/docs/SPEC.md +70 -20
  100. package/framework/decision-primitives.md +2 -1
  101. package/framework/skill-schema.md +310 -0
  102. package/package.json +16 -5
  103. package/patch.js +15 -0
  104. package/patch.py +89 -0
  105. package/patch2.py +83 -0
  106. package/skills/_archive_old_skills/qk-accessibility-audit/SKILL.md +1 -0
  107. package/skills/_archive_old_skills/qk-agent-orchestrator/SKILL.md +1 -0
  108. package/skills/_archive_old_skills/qk-api-integration/SKILL.md +1 -0
  109. package/skills/_archive_old_skills/qk-auth-security/SKILL.md +1 -0
  110. package/skills/_archive_old_skills/qk-backend-architecture/SKILL.md +1 -0
  111. package/skills/_archive_old_skills/qk-bug-fix/SKILL.md +1 -0
  112. package/skills/_archive_old_skills/qk-component-generator/SKILL.md +1 -0
  113. package/skills/_archive_old_skills/qk-context-manager/SKILL.md +1 -0
  114. package/skills/_archive_old_skills/qk-database-engineer/SKILL.md +1 -0
  115. package/skills/_archive_old_skills/qk-deployment/SKILL.md +1 -0
  116. package/skills/_archive_old_skills/qk-design-system/SKILL.md +1 -0
  117. package/skills/_archive_old_skills/qk-form-builder/SKILL.md +1 -0
  118. package/skills/_archive_old_skills/qk-frontend-architecture/SKILL.md +1 -0
  119. package/skills/_archive_old_skills/qk-frontend-debug/SKILL.md +1 -0
  120. package/skills/_archive_old_skills/qk-frontend-performance/SKILL.md +1 -0
  121. package/skills/_archive_old_skills/qk-frontend-testing/SKILL.md +1 -0
  122. package/skills/_archive_old_skills/qk-git-engineer/SKILL.md +1 -0
  123. package/skills/_archive_old_skills/qk-help/SKILL.md +1 -0
  124. package/skills/_archive_old_skills/qk-migration/SKILL.md +1 -0
  125. package/skills/_archive_old_skills/qk-project-audit/SKILL.md +1 -0
  126. package/skills/_archive_old_skills/qk-refactor/SKILL.md +1 -0
  127. package/skills/_archive_old_skills/qk-state-management/SKILL.md +1 -0
  128. package/skills/_archive_old_skills/qk-table-crud-generator/SKILL.md +1 -0
  129. package/skills/_archive_old_skills/qk-ui-builder/SKILL.md +1 -0
  130. package/skills/_template/SKILL.md +239 -0
  131. package/skills/qk-access-policy/SKILL.md +180 -39
  132. package/skills/qk-ai-builder/SKILL.md +216 -40
  133. package/skills/qk-api-lifecycle/SKILL.md +177 -46
  134. package/skills/qk-bug-resolution/SKILL.md +308 -46
  135. package/skills/qk-context-loader/SKILL.md +219 -43
  136. package/skills/qk-data-lifecycle/SKILL.md +193 -44
  137. package/skills/qk-db-optimizer/SKILL.md +197 -41
  138. package/skills/qk-docs/SKILL.md +199 -40
  139. package/skills/qk-engineering-standard/SKILL.md +352 -42
  140. package/skills/qk-fe-api-integration/SKILL.md +327 -55
  141. package/skills/qk-feature-delivery/SKILL.md +306 -48
  142. package/skills/qk-help/SKILL.md +179 -23
  143. package/skills/qk-orchestrator/SKILL.md +279 -42
  144. package/skills/qk-orchestrator/references/routing-table.md +78 -0
  145. package/skills/qk-production-release/SKILL.md +285 -41
  146. package/skills/qk-project-bootstrap/SKILL.md +236 -38
  147. package/skills/qk-project-health/SKILL.md +200 -40
  148. package/skills/qk-project-memory/SKILL.md +219 -40
  149. package/skills/qk-system-evolution/SKILL.md +282 -40
  150. package/skills/qk-ui-audit/SKILL.md +316 -42
  151. package/skills/qk-ui-audit/references/anti-slop-checklist.md +136 -0
  152. package/skills/qk-ui-builder/SKILL.md +447 -0
  153. package/skills/qk-ui-builder/references/anti-patterns.md +295 -0
  154. package/skills/qk-ui-builder/references/color.md +115 -0
  155. package/skills/qk-ui-builder/references/component-cookbook.md +1194 -0
  156. package/skills/qk-ui-builder/references/copy.md +250 -0
  157. package/skills/qk-ui-builder/references/interaction-and-states.md +115 -0
  158. package/skills/qk-ui-builder/references/layout-and-space.md +111 -0
  159. package/skills/qk-ui-builder/references/macrostructures/01-bento-grid.md +48 -0
  160. package/skills/qk-ui-builder/references/macrostructures/02-long-document.md +50 -0
  161. package/skills/qk-ui-builder/references/macrostructures/03-marquee-hero.md +51 -0
  162. package/skills/qk-ui-builder/references/macrostructures/04-stat-led.md +49 -0
  163. package/skills/qk-ui-builder/references/macrostructures/05-workbench.md +44 -0
  164. package/skills/qk-ui-builder/references/macrostructures/06-conversational-faq.md +50 -0
  165. package/skills/qk-ui-builder/references/macrostructures/07-manifesto.md +51 -0
  166. package/skills/qk-ui-builder/references/macrostructures/08-photographic.md +50 -0
  167. package/skills/qk-ui-builder/references/macrostructures/09-quote-led.md +50 -0
  168. package/skills/qk-ui-builder/references/macrostructures/11-catalogue.md +49 -0
  169. package/skills/qk-ui-builder/references/macrostructures/12-letter.md +49 -0
  170. package/skills/qk-ui-builder/references/macrostructures/13-index-first.md +49 -0
  171. package/skills/qk-ui-builder/references/macrostructures/14-narrative-workflow.md +48 -0
  172. package/skills/qk-ui-builder/references/macrostructures/15-split-studio.md +48 -0
  173. package/skills/qk-ui-builder/references/macrostructures/16-feature-stack.md +51 -0
  174. package/skills/qk-ui-builder/references/macrostructures/17-type-specimen.md +48 -0
  175. package/skills/qk-ui-builder/references/macrostructures/18-portfolio-grid.md +48 -0
  176. package/skills/qk-ui-builder/references/macrostructures/19-map-diagram.md +50 -0
  177. package/skills/qk-ui-builder/references/macrostructures/20-ecosystem-index.md +48 -0
  178. package/skills/qk-ui-builder/references/macrostructures/21-component-playground.md +45 -0
  179. package/skills/qk-ui-builder/references/macrostructures.md +38 -0
  180. package/skills/qk-ui-builder/references/motion.md +95 -0
  181. package/skills/qk-ui-builder/references/responsive.md +115 -0
  182. package/skills/qk-ui-builder/references/slop-test.md +135 -0
  183. package/skills/qk-ui-builder/references/structure.md +280 -0
  184. package/skills/qk-ui-builder/references/themes/atmospheric.md +53 -0
  185. package/skills/qk-ui-builder/references/themes/carnival.md +52 -0
  186. package/skills/qk-ui-builder/references/themes/cobalt.md +52 -0
  187. package/skills/qk-ui-builder/references/themes/editorial.md +52 -0
  188. package/skills/qk-ui-builder/references/themes/garden.md +52 -0
  189. package/skills/qk-ui-builder/references/themes/hum.md +52 -0
  190. package/skills/qk-ui-builder/references/themes/lumen.md +52 -0
  191. package/skills/qk-ui-builder/references/themes/midnight.md +52 -0
  192. package/skills/qk-ui-builder/references/themes/modern-minimal.md +52 -0
  193. package/skills/qk-ui-builder/references/themes/playful.md +52 -0
  194. package/skills/qk-ui-builder/references/themes/specimen.md +52 -0
  195. package/skills/qk-ui-builder/references/themes/terminal.md +52 -0
  196. package/skills/qk-ui-builder/references/typography.md +129 -0
  197. package/skills/qk-ui-system-builder/SKILL.md +222 -43
  198. package/skills/qk-validation-gate/SKILL.md +360 -40
  199. package/skills.json +815 -825
  200. package/specs/fixtures/user-payload.json +12 -0
  201. package/specs/regressions/api-integration-null-fields.yaml +19 -0
  202. package/temp_fix.js +61 -0
  203. package/tests/registry.test.js +1 -1
  204. package/update_template.js +28 -0
  205. package/skills/qk-design-to-code/SKILL.md +0 -46
  206. package/skills/qk-policy-engine/SKILL.md +0 -39
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: qk-api-lifecycle
3
+ category: fullstack
4
+ version: 7.5.0
5
+ description: "Thiết kế, triển khai API endpoints với Zero-Trust — contract trước, code sau."
6
+ platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
7
+ execution_mode: deterministic
8
+
9
+ cost: medium
10
+ latency: medium
11
+ risk: medium
12
+ side_effects: edit_files
13
+ produces: [code, report]
14
+ consumes: [context-graph, user-description]
15
+
16
+ token_budget:
17
+ max_files_read: 3
18
+ max_lines_per_read: 150
19
+ max_shell_commands: 1
20
+ stop_early: true
21
+
22
+ exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
23
+ skill_version: 7.5.0
24
+ runtime_version: 1
25
+ schema_version: 2
26
+ ---
27
+
28
+ # qk-api-lifecycle — API Design & Implementation
29
+
30
+ > **Language rule:** Code, identifiers, file names ? English. Explanations, summaries ? Vietnamese.
31
+
32
+ ---
33
+
34
+ ## Preconditions
35
+ - [ ] API purpose and resource name are defined
36
+ - [ ] Request/response shape is specified (or sample JSON provided)
37
+
38
+ ```
39
+ On missing precondition:
40
+ EXIT: BLOCKED
41
+ Message: "Cần định nghĩa: resource name + expected request/response shape trước khi code."
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Scope
47
+ - ✅ Define OpenAPI/Swagger contract BEFORE writing code
48
+ - ✅ Implement endpoint strictly to contract
49
+ - ✅ Validate all inputs, handle all error cases
50
+ - ✅ Ensure backward compatibility
51
+
52
+ ## Non-Goals
53
+ - ❌ Introduce breaking changes without versioning
54
+ - ❌ Bypass auth checks
55
+ - ❌ Guess external API shapes without evidence
56
+
57
+ ---
58
+
59
+ ## Priority Order
60
+
61
+ | Priority | Task | Skip Threshold |
62
+ |----------|------|----------------|
63
+ | P1 | Contract definition (TypeScript types) | Never |
64
+ | P2 | Success response + correct status code | Never |
65
+ | P3 | Input validation middleware | Never |
66
+ | P4 | Error responses (400, 401, 404, 422, 500) | Budget < 30% |
67
+ | P5 | Documentation (JSDoc or OpenAPI annotation) | Budget < 60% |
68
+
69
+ ---
70
+
71
+ ## Workflow
72
+
73
+ ### Phase 1 — Contract Definition
74
+ 1. Define TypeScript interfaces for Request + Response
75
+ 2. Specify HTTP method, route, status codes
76
+ 3. Document error cases
77
+
78
+ **Decision:**
79
+ ```
80
+ IF contract is clear → go to Phase 2
81
+ ELSE → EXIT: BLOCKED — define contract first
82
+ ```
83
+
84
+ ### Phase 2 — Implementation
85
+ 1. Build route handler strictly matching contract
86
+ 2. Add input validation (zod/yup/class-validator)
87
+ 3. Handle all error cases with correct HTTP status
88
+
89
+ ### Phase 3 — Verification
90
+ 1. Read implemented code vs defined contract
91
+ 2. Verify: method, route, response shape, error codes match
92
+
93
+ **Decision:**
94
+ ```
95
+ IF contract and implementation match → EXIT: SUCCESS
96
+ ELSE → fix gaps, EXIT: PARTIAL
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Confidence Model
102
+ | Level | Condition | Action |
103
+ |-------|-----------|--------|
104
+ | HIGH | Contract defined, implementation matches | Report SUCCESS |
105
+ | MEDIUM | Contract inferred from context | Note assumption |
106
+ | LOW | No contract, guessing from usage | EXIT: BLOCKED |
107
+
108
+ ---
109
+
110
+ ## Evidence Format
111
+ ```
112
+ [SEVERITY] src/routes/[resource].ts:LINE
113
+ Issue: [mismatch between contract and implementation]
114
+ Confidence: HIGH
115
+ Fix: [specific change needed]
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Handoff Contract
121
+ ### Consumes
122
+ ```json
123
+ { "from": "user", "required_fields": ["resource_name", "request_shape", "response_shape"] }
124
+ ```
125
+ ### Produces
126
+ ```json
127
+ { "to": "qk-validation-gate", "output_fields": ["route_file", "types_file", "contract_doc", "exit_code"] }
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Exit Codes
133
+ | Code | Meaning | When |
134
+ |------|---------|------|
135
+ | SUCCESS | Contract defined, implemented, verified | Implementation matches contract |
136
+ | PARTIAL | Implemented but missing error cases or docs | Core logic done, edge cases missing |
137
+ | BLOCKED | No contract defined — cannot code | Missing payload/schema |
138
+ | FAILED | Implementation breaks existing contract | Backward incompatibility |
139
+
140
+ ---
141
+
142
+ ## Severity
143
+ | Level | Definition | Example |
144
+ |-------|-----------|---------|
145
+ | CRITICAL | Broken contract on public API | Renamed `userId` to `id` in response |
146
+ | HIGH | Missing input validation | SQL Injection or crash on null input |
147
+ | MEDIUM | Returning 500 for validation errors | Not using 400/422 |
148
+ | LOW | Missing JSDoc | Undocumented route |
149
+
150
+ ---
151
+
152
+ ## Retry Policy
153
+ ```
154
+ Contract verification fails
155
+ └─ Implementation does not match contract
156
+ ├─ Fix route handler to match contract
157
+ └─ Do NOT retry more than 1 time
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Escalation Rules
163
+ ```
164
+ BLOCKED: No contract defined
165
+ Missing:
166
+ - Request payload structure
167
+ - Response payload structure
168
+ Questions:
169
+ 1. Payload gửi lên (Request) có những field gì?
170
+ 2. Payload trả về (Response) có cấu trúc thế nào?
171
+ Recommended Assumptions:
172
+ - Default JSON response with `{ data, message }` wrapper
173
+ ```
174
+
175
+ ---
176
+
@@ -0,0 +1,307 @@
1
+ ---
2
+ name: qk-bug-resolution
3
+ category: maintenance
4
+ version: 7.5.0
5
+ description: "Sửa lỗi (bugs) bằng chu trình khép kín: Quan sát → Giả thuyết → Bằng chứng → Sửa."
6
+ platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
7
+ execution_mode: deterministic
8
+
9
+ cost: medium
10
+ latency: medium
11
+ risk: medium
12
+ side_effects: edit_files
13
+ produces: [code, report]
14
+ consumes: [stack-trace, error-message, user-description, context-graph]
15
+
16
+ token_budget:
17
+ max_files_read: 3
18
+ max_lines_per_read: 150
19
+ max_shell_commands: 2
20
+ stop_early: true
21
+
22
+ exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
23
+ skill_version: 7.5.0
24
+ runtime_version: 1
25
+ schema_version: 2
26
+ ---
27
+
28
+ # qk-bug-resolution — Diagnose & Repair
29
+
30
+ > **Language rule:** Code, identifiers, file names → English. Explanations, summaries → Vietnamese.
31
+
32
+ ---
33
+
34
+ ## Preconditions
35
+ - [ ] A specific symptom is provided (error message, wrong behavior, crash)
36
+ - [ ] The affected file or feature area is identifiable
37
+ - [ ] Reproduction steps or stack trace provided
38
+
39
+ ```
40
+ On missing precondition:
41
+ EXIT: BLOCKED
42
+ Message: "Cần thêm thông tin: [error message / stack trace / bước tái hiện lỗi]"
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Scope
48
+ - ✅ Diagnose existing defects with concrete evidence
49
+ - ✅ Apply minimal targeted patches directly to source files
50
+ - ✅ Verify fix with evidence (static or runtime)
51
+
52
+ ## Non-Goals
53
+ - ❌ Refactor code outside the buggy area
54
+ - ❌ Create Node.js/Python/shell scripts to apply patches — edit source files directly
55
+ - ❌ Read entire files > 150 lines — use `grep_search` or targeted `view_file[StartLine:EndLine]`
56
+ - ❌ Run shell commands > 2 times per cycle
57
+ - ❌ Guess root cause without concrete evidence
58
+ - ❌ Mark as done without verifying the fix
59
+ - ❌ Proceed with MEDIUM confidence — only HIGH confidence is acceptable for fix
60
+ - ❌ Use `?.` or `!` to silence errors instead of fixing root cause
61
+
62
+ ---
63
+
64
+ ## Priority Order
65
+
66
+ | Priority | Check | Skip Threshold |
67
+ |----------|-------|----------------|
68
+ | P1 | Identify exact file:line of failure | Never |
69
+ | P2 | Trace data flow to root cause | Budget < 30% → EXIT: BLOCKED |
70
+ | P3 | Check adjacent code for similar bugs | Budget < 50% |
71
+ | P4 | Suggest regression test | Budget < 70% |
72
+
73
+ ---
74
+
75
+ ## Workflow
76
+
77
+ ### Phase 1 — Triage (Read Only)
78
+
79
+ **Steps:**
80
+ 1. `grep_search` — search for error message, function name, or symptom keyword
81
+ 2. `view_file[StartLine:EndLine]` — read ONLY the relevant section (≤ 150 lines)
82
+ 3. Identify the exact file and approximate line of failure
83
+
84
+ **Exit When:**
85
+ - Exact file:line identified → go to Phase 2
86
+ - `max_files_read` (3) reached without exact identification → EXIT: BLOCKED
87
+
88
+ **Decision:**
89
+ ```
90
+ IF stack trace provided
91
+ → Parse top frame inside project code → go to Phase 2
92
+
93
+ ELSE IF error message provided
94
+ → grep_search for error string → go to Phase 2
95
+
96
+ ELSE
97
+ → EXIT: BLOCKED — ask for reproduction steps
98
+ ```
99
+
100
+ **On Blocked:**
101
+ ```
102
+ EXIT: BLOCKED
103
+ Missing: Reproduction steps or error output
104
+ Questions:
105
+ 1. Lỗi xảy ra ở bước nào? (URL / action / input)
106
+ 2. Error message hoặc stack trace cụ thể là gì?
107
+ Recommended Assumptions: none — cannot proceed without this
108
+ ```
109
+
110
+ ---
111
+
112
+ ### Phase 2 — Root Cause Analysis
113
+
114
+ **Steps:**
115
+ 1. Read the identified file section (`view_file[StartLine:EndLine]`, ≤ 150 lines)
116
+ 2. Trace: What condition triggers the failure?
117
+ 3. Check context graph for blast radius assessment
118
+ 4. Assign confidence level
119
+
120
+ **Common Root Cause Categories:**
121
+ - Logic error (wrong condition, wrong operator)
122
+ - Null / undefined / missing data
123
+ - Async timing or race condition
124
+ - Type mismatch or stale state
125
+ - API contract change
126
+
127
+ **Decision:**
128
+ ```
129
+ IF root cause found with direct evidence (file:line + stack trace confirms)
130
+ → Confidence: HIGH → go to Phase 3
131
+
132
+ ELSE IF root cause still unclear after reading identified file
133
+ → Read 1 more file (budget check)
134
+ → Still unclear → EXIT: BLOCKED
135
+
136
+ ELSE IF root cause inferred from pattern (no direct evidence)
137
+ → EXIT: BLOCKED — cannot fix without concrete evidence
138
+ ```
139
+
140
+ ---
141
+
142
+ ### Phase 3 — Apply Fix (Direct Edit Only)
143
+
144
+ **Steps:**
145
+ 1. Apply fix using `replace_file_content` or `multi_replace_file_content`
146
+ - **NEVER** create a helper script to do the patching
147
+ - Keep the change minimal — smallest diff that resolves the issue
148
+ 2. Re-read the fixed section to confirm correctness (static verification)
149
+ 3. Run shell command ONLY if runtime verification is strictly required (counts toward max 2)
150
+
151
+ **Exit When:**
152
+ - Fix applied and verified statically → EXIT: SUCCESS
153
+ - Fix applied but runtime verification needed and command budget exhausted → EXIT: FAILED — cannot verify
154
+
155
+ ---
156
+
157
+ ## Confidence Model
158
+
159
+ | Level | Condition | Action |
160
+ |-------|-----------|--------|
161
+ | HIGH | Direct evidence — exact file:line + stack trace confirms it | Proceed with fix |
162
+ | MEDIUM | Inferred from code patterns, similar bugs nearby | EXIT: BLOCKED — collect more evidence |
163
+ | LOW | Assumption without code evidence | STOP — ask user before applying fix |
164
+
165
+ ---
166
+
167
+ ## Severity
168
+
169
+ | Level | Definition | Example |
170
+ |-------|-----------|---------|
171
+ | CRITICAL | Data loss / security / app crash | Hardcoded secret, unhandled null crash on login |
172
+ | HIGH | Core feature broken, blocking users | API returns 500, form submission fails |
173
+ | MEDIUM | Degraded UX, workaround exists | Wrong label, minor calculation off |
174
+ | LOW | Cosmetic, non-blocking | Console.log left in code |
175
+
176
+ ---
177
+
178
+ ## Evidence Format
179
+
180
+ ```
181
+ [SEVERITY] path/to/file.ts:LINE
182
+ Reason: [why this causes the bug]
183
+ Impact: [which modules/users are affected]
184
+ Confidence: [HIGH|MEDIUM|LOW]
185
+ Fix: [what was changed]
186
+ ```
187
+
188
+ **Example:**
189
+ ```
190
+ [HIGH] src/services/auth.service.ts:87
191
+ Reason: Missing null check on `user.profile` — crashes when profile is not yet loaded
192
+ Impact: Affects all login flows; 100% of users hitting this path
193
+ Confidence: HIGH
194
+ Fix: Added `user.profile?.email ?? ''` guard
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Retry Policy
200
+
201
+ ```
202
+ Fix applied
203
+ └─ Static verification (re-read fixed section)
204
+ ├─ PASS → EXIT: SUCCESS
205
+ └─ Issue detected → attempt 1 correction
206
+ └─ Re-verify
207
+ ├─ PASS → EXIT: SUCCESS
208
+ └─ FAIL → EXIT: FAILED + report both attempts
209
+ └─ Do NOT attempt 3rd fix — ESCALATE to user
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Escalation Rules
215
+
216
+ ```
217
+ BLOCKED: [Specific reason]
218
+ Missing:
219
+ - [Stack trace / error message / reproduction steps]
220
+ Questions:
221
+ 1. Lỗi xuất hiện khi nào? (action/URL/input cụ thể)
222
+ 2. Lỗi có tái hiện được không?
223
+ Recommended Assumptions (if proceeding without full info):
224
+ - [Safe assumption based on available context]
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Handoff Contract
230
+
231
+ ### Consumes
232
+ ```json
233
+ {
234
+ "from": "user or qk-orchestrator",
235
+ "required_fields": ["symptom_description", "context_graph"],
236
+ "optional_fields": ["stack_trace", "error_message", "affected_file"]
237
+ }
238
+ ```
239
+
240
+ ### Produces
241
+ ```json
242
+ {
243
+ "to": "user",
244
+ "output_fields": ["changed_files", "root_cause", "impact", "severity", "confidence", "exit_code"]
245
+ }
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Output Format
251
+
252
+ ```
253
+ 🐛 Bug Report
254
+ ─────────────────────────────────────────────────
255
+ Symptom: [What broke + how to reproduce]
256
+ Root cause: [file:line — exact reason]
257
+ Severity: [CRITICAL | HIGH | MEDIUM | LOW]
258
+ Confidence: [HIGH | MEDIUM | LOW]
259
+ Impact: [Which modules/users affected]
260
+
261
+ 🔧 Fix Applied
262
+ ─────────────────────────────────────────────────
263
+ File: [path/to/file.ts]
264
+ Change: [What changed and why it's minimal]
265
+
266
+ ✅ Verification
267
+ ─────────────────────────────────────────────────
268
+ Static: [Re-read section — looks correct]
269
+ Runtime: [PASS | SKIPPED — reason]
270
+
271
+ Exit Code: [SUCCESS | PARTIAL | BLOCKED | FAILED]
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Exit Codes
277
+
278
+ | Code | Meaning | When |
279
+ |------|---------|------|
280
+ | SUCCESS | Bug fixed and verified | Fix applied + static/runtime check passed |
281
+ | PARTIAL | Fix applied, verification inconclusive | Budget exhausted or environment inaccessible |
282
+ | BLOCKED | Cannot diagnose without more info | Missing stack trace / reproduction steps |
283
+ | FAILED | Fix attempted, issue persists after 2 retries OR budget exhausted without verification | Complex race condition or architectural issue |
284
+
285
+ ---
286
+
287
+ Diagnose and fix a specific bug with minimal, targeted changes while preserving all existing behavior.
288
+ This skill is triggered when a user reports a specific defect with a stack trace, error message, or reproduction steps. It requires concrete evidence before any code modification.
289
+ - Symptom description (error message, wrong behavior, crash)
290
+ - Stack trace or reproduction steps
291
+ - Affected file or feature area (if known)
292
+ - Context graph (for blast radius assessment)
293
+ 1. **Observe:** Read error output, stack trace, and affected code section
294
+ 2. **Hypothesize:** Identify potential root causes based on evidence
295
+ 3. **Verify:** Confirm root cause with direct file:line evidence
296
+ 4. **Fix:** Apply minimal patch using direct edit only
297
+ 5. **Verify:** Re-read fixed code and confirm correctness
298
+ - MUST have exact file:line before proceeding to fix
299
+ - MUST NOT guess root cause without direct evidence
300
+ - MUST keep changes minimal — smallest diff that resolves the issue
301
+ - MUST NOT exceed token_budget (max 3 files, 150 lines each, 2 shell commands)
302
+ - MUST verify fix before marking done
303
+ - Zero-Trust: No fix without HIGH confidence (direct evidence)
304
+ - Minimal Change: Fix only the bug, no refactoring
305
+ - Backward Compat: Preserve all existing public API behavior
306
+ - Evidence First: Every finding must use Evidence Format with file:line
307
+ ---
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: qk-context-loader
3
+ category: utilities
4
+ version: 7.5.0
5
+ description: "Tải context và vẽ dependency graph chính xác trước khi code — ngăn hallucination kiến trúc."
6
+ platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
7
+ execution_mode: deterministic
8
+
9
+ cost: low
10
+ latency: fast
11
+ risk: low
12
+ side_effects: read_only
13
+ produces: [context-graph]
14
+ consumes: [source-code]
15
+
16
+ token_budget:
17
+ max_files_read: 5
18
+ max_lines_per_read: 100
19
+ max_shell_commands: 1
20
+ stop_early: true
21
+
22
+ exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
23
+ skill_version: 7.5.0
24
+ runtime_version: 1
25
+ schema_version: 2
26
+ ---
27
+
28
+ # qk-context-loader — Dependency Graph Builder
29
+
30
+ > **Language rule:** Code, identifiers, file names ? English. Explanations, summaries ? Vietnamese.
31
+
32
+ skill_version: 7.5.0
33
+ runtime_version: 1
34
+ schema_version: 2
35
+ ---
36
+
37
+ ## Preconditions
38
+ - [ ] Entry point file or module name is specified
39
+ - [ ] Repository is accessible
40
+
41
+ ```
42
+ On missing precondition:
43
+ EXIT: BLOCKED
44
+ Message: "Vui lòng chỉ định entry point (file hoặc module cần map)."
45
+ ```
46
+
47
+ skill_version: 7.5.0
48
+ runtime_version: 1
49
+ schema_version: 2
50
+ ---
51
+
52
+ ## Scope
53
+ - ✅ Trace imports/exports from entry point
54
+ - ✅ Build topological dependency graph (max depth 3)
55
+ - ✅ Identify risk level per module
56
+
57
+ ## Non-Goals
58
+ - ❌ Modify any code
59
+ - ❌ Load `node_modules` or vendor directories
60
+ - ❌ Guess file names — only follow explicit imports
61
+ - ❌ Load entire repo (max 5 files)
62
+
63
+ skill_version: 7.5.0
64
+ runtime_version: 1
65
+ schema_version: 2
66
+ ---
67
+
68
+ ## Priority Order
69
+
70
+ | Priority | Task | Skip Threshold |
71
+ |----------|------|----------------|
72
+ | P1 | Trace direct imports of entry point | Never |
73
+ | P2 | Trace 2nd-level dependencies | Budget < 40% |
74
+ | P3 | Identify shared/risky modules | Budget < 60% |
75
+ | P4 | Annotate with risk levels | Budget < 70% |
76
+
77
+ skill_version: 7.5.0
78
+ runtime_version: 1
79
+ schema_version: 2
80
+ ---
81
+
82
+ ## Workflow
83
+
84
+ ### Phase 1 — Entry Point Analysis
85
+
86
+ **Steps:**
87
+ 1. `grep_search` — search for import/export statements in entry file
88
+ 2. `view_file[StartLine:EndLine]` — read import block only (first ~30 lines)
89
+ 3. List direct dependencies
90
+
91
+ **Decision:**
92
+ ```
93
+ IF entry file found and imports readable
94
+ → go to Phase 2
95
+
96
+ ELSE IF entry file not found
97
+ → EXIT: BLOCKED — ask for correct path
98
+ ```
99
+
100
+ skill_version: 7.5.0
101
+ runtime_version: 1
102
+ schema_version: 2
103
+ ---
104
+
105
+ ### Phase 2 — Graph Traversal (Max Depth 3)
106
+
107
+ **Steps:**
108
+ 1. For each direct dependency → `grep_search` for its imports
109
+ 2. Build adjacency list: `{ file → [imports] }`
110
+ 3. Stop at depth 3 OR max_files_read reached
111
+
112
+ **Decision:**
113
+ ```
114
+ IF depth 3 reached OR max_files_read (5) hit
115
+ → EXIT: PARTIAL — note graph is truncated at depth N
116
+
117
+ IF circular dependency detected
118
+ → Flag as [HIGH RISK] in output
119
+ → Continue building rest of graph
120
+ ```
121
+
122
+ skill_version: 7.5.0
123
+ runtime_version: 1
124
+ schema_version: 2
125
+ ---
126
+
127
+ ### Phase 3 — Risk Assessment & Output
128
+
129
+ **Steps:**
130
+ 1. Identify: shared modules (imported by 3+ files) = HIGH risk to change
131
+ 2. Identify: entry points with many dependents = CRITICAL to change carefully
132
+ 3. Generate graph in standard JSON + Markdown format
133
+
134
+ skill_version: 7.5.0
135
+ runtime_version: 1
136
+ schema_version: 2
137
+ ---
138
+
139
+ ## Output Format (Mandatory Schema)
140
+
141
+ ```json
142
+ {
143
+ "entry": "src/modules/auth/auth.service.ts",
144
+ "depth_reached": 3,
145
+ "truncated": false,
146
+ "nodes": [
147
+ {
148
+ "file": "src/modules/auth/auth.service.ts",
149
+ "imports": ["src/common/jwt.util.ts", "src/users/users.repository.ts"],
150
+ "exports": ["AuthService"],
151
+ "risk_level": "high",
152
+ "imported_by_count": 4
153
+ }
154
+ ],
155
+ "risks": [
156
+ {
157
+ "file": "src/common/jwt.util.ts",
158
+ "reason": "Imported by 6 modules — changes here have wide blast radius",
159
+ "risk_level": "critical"
160
+ }
161
+ ]
162
+ }
163
+ ```
164
+
165
+ skill_version: 7.5.0
166
+ runtime_version: 1
167
+ schema_version: 2
168
+ ---
169
+
170
+ ## Evidence Format
171
+
172
+ ```
173
+ [RISK] path/to/file.ts
174
+ Reason: [why this file is risky to change]
175
+ Imported by: [N files]
176
+ Exports: [key exports]
177
+ ```
178
+
179
+ skill_version: 7.5.0
180
+ runtime_version: 1
181
+ schema_version: 2
182
+ ---
183
+
184
+ ## Handoff Contract
185
+
186
+ ### Consumes
187
+ ```json
188
+ {
189
+ "from": "user or qk-orchestrator",
190
+ "required_fields": ["entry_point"],
191
+ "optional_fields": ["max_depth", "exclude_patterns"]
192
+ }
193
+ ```
194
+
195
+ ### Produces
196
+ ```json
197
+ {
198
+ "to": "qk-feature-delivery | qk-bug-resolution | qk-data-lifecycle | qk-api-lifecycle",
199
+ "output_fields": ["dependency_graph_json", "risk_summary", "exit_code"]
200
+ }
201
+ ```
202
+
203
+ skill_version: 7.5.0
204
+ runtime_version: 1
205
+ schema_version: 2
206
+ ---
207
+
208
+ ## Exit Codes
209
+
210
+ | Code | Meaning | When |
211
+ |------|---------|------|
212
+ | SUCCESS | Full graph built within depth limit | All imports traced |
213
+ | PARTIAL | Graph truncated at token/depth limit | Note where it was cut |
214
+ | BLOCKED | Entry point not found or inaccessible | Ask for correct path |
215
+ | FAILED | Cannot determine architecture (circular imports, obfuscated code) | Report and escalate |
216
+
217
+ ---
218
+