ai-developer-skill-os 1.8.1 → 2.0.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.
- package/README.md +130 -171
- package/docs/CHI_TIET_SKILLS.md +89 -81
- package/docs/HUONG_DAN_SU_DUNG.md +120 -152
- package/package.json +1 -1
- package/skills/{qk-accessibility-audit → _archive_old_skills/qk-accessibility-audit}/SKILL.md +1 -1
- package/skills/{qk-agent-orchestrator → _archive_old_skills/qk-agent-orchestrator}/SKILL.md +1 -1
- package/skills/{qk-bug-fix → _archive_old_skills/qk-bug-fix}/SKILL.md +1 -1
- package/skills/{qk-component-generator → _archive_old_skills/qk-component-generator}/SKILL.md +1 -1
- package/skills/{qk-database-engineer → _archive_old_skills/qk-database-engineer}/SKILL.md +1 -1
- package/skills/{qk-design-system → _archive_old_skills/qk-design-system}/SKILL.md +1 -1
- package/skills/{qk-form-builder → _archive_old_skills/qk-form-builder}/SKILL.md +1 -1
- package/skills/{qk-frontend-architecture → _archive_old_skills/qk-frontend-architecture}/SKILL.md +1 -1
- package/skills/{qk-frontend-debug → _archive_old_skills/qk-frontend-debug}/SKILL.md +1 -1
- package/skills/{qk-frontend-performance → _archive_old_skills/qk-frontend-performance}/SKILL.md +1 -1
- package/skills/{qk-git-engineer → _archive_old_skills/qk-git-engineer}/SKILL.md +1 -1
- package/skills/_archive_old_skills/qk-help/SKILL.md +67 -0
- package/skills/{qk-state-management → _archive_old_skills/qk-state-management}/SKILL.md +1 -1
- package/skills/{qk-table-crud-generator → _archive_old_skills/qk-table-crud-generator}/SKILL.md +1 -1
- package/skills/qk-access-policy/SKILL.md +127 -0
- package/skills/qk-ai-builder/SKILL.md +33 -0
- package/skills/qk-api-lifecycle/SKILL.md +420 -0
- package/skills/qk-bug-resolution/SKILL.md +371 -0
- package/skills/qk-context-loader/SKILL.md +206 -0
- package/skills/qk-data-lifecycle/SKILL.md +135 -0
- package/skills/qk-design-to-code/SKILL.md +33 -0
- package/skills/qk-docs/SKILL.md +335 -0
- package/skills/qk-documentation-system/SKILL.md +33 -0
- package/skills/qk-engineering-standard/SKILL.md +171 -0
- package/skills/qk-engineering-standard/rules/backend.md +122 -0
- package/skills/qk-engineering-standard/rules/database.md +3 -0
- package/skills/qk-engineering-standard/rules/frontend.md +152 -0
- package/skills/qk-engineering-standard/rules/security.md +3 -0
- package/skills/qk-engineering-standard/rules/testing.md +3 -0
- package/skills/qk-feature-delivery/SKILL.md +432 -0
- package/skills/qk-help/SKILL.md +95 -67
- package/skills/qk-orchestrator/SKILL.md +272 -0
- package/skills/qk-policy-engine/SKILL.md +33 -0
- package/skills/qk-production-release/SKILL.md +127 -0
- package/skills/qk-project-bootstrap/SKILL.md +33 -0
- package/skills/qk-project-health/SKILL.md +650 -0
- package/skills/qk-project-memory/SKILL.md +33 -0
- package/skills/qk-system-evolution/SKILL.md +315 -0
- package/skills/qk-ui-audit/SKILL.md +152 -0
- package/skills/qk-ui-system-builder/SKILL.md +444 -0
- package/skills/qk-validation-gate/SKILL.md +33 -0
- /package/skills/{qk-api-integration → _archive_old_skills/qk-api-integration}/SKILL.md +0 -0
- /package/skills/{qk-auth-security → _archive_old_skills/qk-auth-security}/SKILL.md +0 -0
- /package/skills/{qk-backend-architecture → _archive_old_skills/qk-backend-architecture}/SKILL.md +0 -0
- /package/skills/{qk-context-manager → _archive_old_skills/qk-context-manager}/SKILL.md +0 -0
- /package/skills/{qk-deployment → _archive_old_skills/qk-deployment}/SKILL.md +0 -0
- /package/skills/{qk-frontend-testing → _archive_old_skills/qk-frontend-testing}/SKILL.md +0 -0
- /package/skills/{qk-migration → _archive_old_skills/qk-migration}/SKILL.md +0 -0
- /package/skills/{qk-project-audit → _archive_old_skills/qk-project-audit}/SKILL.md +0 -0
- /package/skills/{qk-refactor → _archive_old_skills/qk-refactor}/SKILL.md +0 -0
- /package/skills/{qk-ui-builder → _archive_old_skills/qk-ui-builder}/SKILL.md +0 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-bug-resolution
|
|
3
|
+
purpose: Tái hiện lỗi, tìm root cause, sửa lỗi và chống hồi quy (Regression check).
|
|
4
|
+
mode_supported: [standard]
|
|
5
|
+
input: [Bug report]
|
|
6
|
+
output: [Fixed code, Regression test]
|
|
7
|
+
workflow: [1. Reproduce -> 2. Root Cause -> 3. Fix -> 4. Test]
|
|
8
|
+
allowed_tools: [grep_search, run_command, replace_file_content]
|
|
9
|
+
handoff_to: [qk-validation-gate]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# 🛠️ qk-bug-resolution - Quy Trình Vận Hành Chuẩn (SOP)
|
|
13
|
+
|
|
14
|
+
> **Mô tả:** Tái hiện lỗi, tìm root cause, sửa lỗi và chống hồi quy (Regression check).
|
|
15
|
+
|
|
16
|
+
## 🎯 1. Mục Tiêu (Goal)
|
|
17
|
+
- Hoàn thành thành công tác vụ được giao liên quan đến nhiệm vụ của skill.
|
|
18
|
+
- Đảm bảo chất lượng mã nguồn và tính nhất quán của hệ thống.
|
|
19
|
+
|
|
20
|
+
## 🔄 2. Chuỗi Hành Động (Chain of Thought / SOP)
|
|
21
|
+
*(Bắt buộc AI phải suy nghĩ và làm theo đúng thứ tự)*
|
|
22
|
+
1. **Phân tích (Analyze):** Thu thập ngữ cảnh và hiểu rõ yêu cầu đầu vào.
|
|
23
|
+
2. **Lên kế hoạch (Plan):** Xác định các bước cần thay đổi/tạo mới dựa trên bộ luật (rules).
|
|
24
|
+
3. **Thực thi (Execute):** Tiến hành sửa đổi mã nguồn hoặc tạo tài liệu.
|
|
25
|
+
4. **Xác thực (Verify):** Đảm bảo đầu ra đáp ứng đúng yêu cầu và không vi phạm quy định.
|
|
26
|
+
|
|
27
|
+
## 🛡️ 3. Ràng Buộc & Quy Tắc (Constraints)
|
|
28
|
+
- CẤM bỏ qua việc kiểm tra `qk-engineering-standard` trước khi viết code.
|
|
29
|
+
- Mọi quyết định kỹ thuật phải dựa trên nội dung tại phần Deep Knowledge (nếu có).
|
|
30
|
+
|
|
31
|
+
## 🤝 4. Giao Thức Bàn Giao (Handoff Protocol)
|
|
32
|
+
- Đích đến: `qk-validation-gate`
|
|
33
|
+
- Nội dung bàn giao: Chuyển toàn bộ ngữ cảnh và kết quả đã thực thi cho bước tiếp theo.
|
|
34
|
+
|
|
35
|
+
## 📚 5. Kiến Thức Chuyên Sâu (Deep Knowledge)
|
|
36
|
+
|
|
37
|
+
*(Nền tảng kiến thức và quy tắc chi tiết kế thừa từ kỹ sư)*
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Bug Fix — Diagnose & Repair
|
|
44
|
+
|
|
45
|
+
> **Language rule:**
|
|
46
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
47
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
48
|
+
> The user may write in any language — detect and match it automatically.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Trigger
|
|
53
|
+
|
|
54
|
+
Activate this skill when:
|
|
55
|
+
- User reports a specific bug with a stack trace, error message, or behavior description
|
|
56
|
+
- A test is failing
|
|
57
|
+
- The app crashes or hangs
|
|
58
|
+
- A regression occurred after a code change
|
|
59
|
+
- User says "it's broken", "this doesn't work", "I'm getting an error"
|
|
60
|
+
|
|
61
|
+
**Not this skill** → Use `project-audit` if the problem is unknown and needs discovery first.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Scope
|
|
66
|
+
|
|
67
|
+
- ✅ Reproduce the reported bug
|
|
68
|
+
- ✅ Identify the root cause (not just the symptom)
|
|
69
|
+
- ✅ Apply a minimal, targeted fix
|
|
70
|
+
- ✅ Verify the fix with evidence (tests, logs, comparison)
|
|
71
|
+
- ✅ Prevent recurrence with guards or tests
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Non-goals
|
|
76
|
+
|
|
77
|
+
- ❌ Do NOT refactor code outside the buggy area
|
|
78
|
+
- ❌ Do NOT change public APIs unless the bug requires it
|
|
79
|
+
- ❌ Do NOT silence errors with empty `try/catch` or blind `?.` / `!`
|
|
80
|
+
- ❌ Do NOT change formatting or unrelated code
|
|
81
|
+
- ❌ Do NOT mark as done without verifying the fix
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Severity Levels
|
|
86
|
+
|
|
87
|
+
| Level | Meaning |
|
|
88
|
+
|-------|---------|
|
|
89
|
+
| P0 | Production down, data loss, security breach |
|
|
90
|
+
| P1 | Core feature broken, blocking users |
|
|
91
|
+
| P2 | Non-critical feature broken, workaround exists |
|
|
92
|
+
| P3 | Edge case, cosmetic, minor annoyance |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Workflow
|
|
97
|
+
|
|
98
|
+
### Phase 1 — Triage & Understand
|
|
99
|
+
|
|
100
|
+
Before touching code, gather:
|
|
101
|
+
- What is the symptom? (error message, wrong behavior, crash)
|
|
102
|
+
- What is the expected behavior?
|
|
103
|
+
- How to reproduce? (steps, conditions, environment)
|
|
104
|
+
- What changed recently? (git log, deployment, dependency update)
|
|
105
|
+
- What is the severity and impact scope?
|
|
106
|
+
|
|
107
|
+
If critical information is missing → ask before proceeding.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### Phase 2 — Reproduce the Issue
|
|
112
|
+
|
|
113
|
+
1. Write a failing test or script that triggers the bug
|
|
114
|
+
2. Confirm the bug is consistently reproducible
|
|
115
|
+
3. For intermittent bugs → identify timing, data, or environment conditions
|
|
116
|
+
4. Document the exact reproduction steps
|
|
117
|
+
|
|
118
|
+
> Rule: **Never skip reproduction.** A fix without a repro is a guess.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### Phase 3 — Localize the Problem
|
|
123
|
+
|
|
124
|
+
1. Read the stack trace top-down, following frames inside project code
|
|
125
|
+
2. Use logs, breakpoints, or `git blame` / `git bisect` to narrow scope
|
|
126
|
+
3. Identify the exact file and line where the failure originates
|
|
127
|
+
4. Trace the data flow that leads to the failure
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### Phase 4 — Root Cause Analysis
|
|
132
|
+
|
|
133
|
+
Answer: *Why does this happen? What condition triggers it?*
|
|
134
|
+
|
|
135
|
+
Common root cause categories:
|
|
136
|
+
- Logic error (wrong condition, wrong operator)
|
|
137
|
+
- Off-by-one or boundary case
|
|
138
|
+
- Null / undefined / missing data
|
|
139
|
+
- Async timing or race condition
|
|
140
|
+
- Type mismatch
|
|
141
|
+
- Stale state or stale closure
|
|
142
|
+
- Config or environment issue
|
|
143
|
+
- API contract change
|
|
144
|
+
- Dependency version change
|
|
145
|
+
|
|
146
|
+
Use 5 Whys: keep asking "why" until you reach the actual cause, not just the symptom.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### Phase 5 — Apply the Fix
|
|
151
|
+
|
|
152
|
+
Rules:
|
|
153
|
+
- Fix the root cause, not the symptom
|
|
154
|
+
- Smallest possible change that fully resolves the issue
|
|
155
|
+
- Keep existing code style, naming, and conventions
|
|
156
|
+
- Handle related edge cases to prevent similar bugs
|
|
157
|
+
- Remove all debug code, console.logs, and temporary patches
|
|
158
|
+
- Do not change public APIs unless strictly required
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### Phase 6 — Verify the Result
|
|
163
|
+
|
|
164
|
+
- [ ] The failing test from Phase 2 now passes
|
|
165
|
+
- [ ] Run the related test suite — no new failures
|
|
166
|
+
- [ ] Run lint and type-check — clean
|
|
167
|
+
- [ ] Manually reproduce the original steps — bug is gone
|
|
168
|
+
- [ ] No regressions in adjacent functionality
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### Phase 7 — Report & Prevent
|
|
173
|
+
|
|
174
|
+
Summarize and propose prevention:
|
|
175
|
+
- What was the root cause?
|
|
176
|
+
- What was changed and why?
|
|
177
|
+
- Are there similar patterns elsewhere in the codebase?
|
|
178
|
+
- Should a test be added to prevent regression?
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Decision Tree
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
Is the bug reproducible?
|
|
186
|
+
├── No → Isolate timing, data, environment conditions first
|
|
187
|
+
└── Yes → Is the root cause known?
|
|
188
|
+
├── No → Run Phase 3-4 (localize + analyze)
|
|
189
|
+
└── Yes → Apply minimal fix → verify → report
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
Is the fix risky (touches shared code / public API)?
|
|
194
|
+
├── Yes → Confirm scope with user before applying
|
|
195
|
+
└── No → Apply fix
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Output Format
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
🐛 Bug Report
|
|
204
|
+
─────────────────────────────────────────────────
|
|
205
|
+
Symptom: [What broke + how to reproduce]
|
|
206
|
+
Root cause: [Exact file:line — why it happens]
|
|
207
|
+
Severity: [P0 / P1 / P2 / P3]
|
|
208
|
+
|
|
209
|
+
🔧 Fix Applied
|
|
210
|
+
─────────────────────────────────────────────────
|
|
211
|
+
Changed: [File(s) modified]
|
|
212
|
+
Change: [What was changed and why it's minimal]
|
|
213
|
+
|
|
214
|
+
✅ Verification
|
|
215
|
+
─────────────────────────────────────────────────
|
|
216
|
+
Tests: [Test name / command — PASSED]
|
|
217
|
+
Lint/Types: [Clean / warnings noted]
|
|
218
|
+
Manual: [Reproduced original steps — bug gone]
|
|
219
|
+
Regression: [No new failures]
|
|
220
|
+
|
|
221
|
+
🛡️ Prevention
|
|
222
|
+
─────────────────────────────────────────────────
|
|
223
|
+
Test added: [Yes / No — reason]
|
|
224
|
+
Similar areas to check: [file or pattern to review]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Validation Checklist
|
|
230
|
+
|
|
231
|
+
- [ ] Bug was reproduced before fixing
|
|
232
|
+
- [ ] Root cause identified at exact file:line with explanation
|
|
233
|
+
- [ ] Fix is minimal — only changes what's needed
|
|
234
|
+
- [ ] Failing test now passes
|
|
235
|
+
- [ ] Related tests and lint/type-check clean
|
|
236
|
+
- [ ] No debug code left behind
|
|
237
|
+
- [ ] Side effects documented
|
|
238
|
+
- [ ] Prevention strategy noted
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Examples
|
|
243
|
+
|
|
244
|
+
See `examples/` folder.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# Frontend Debugger
|
|
251
|
+
|
|
252
|
+
> **Language rule:**
|
|
253
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
254
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
255
|
+
> The user may write in any language — detect and match it automatically.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Trigger
|
|
260
|
+
|
|
261
|
+
Activate this skill when:
|
|
262
|
+
- User reports a UI-specific bug ("screen is blank", "button doesn't work")
|
|
263
|
+
- React throws a Hydration Error (`Text content did not match. Server: "A" Client: "B"`)
|
|
264
|
+
- React throws an infinite loop error (`Too many re-renders`)
|
|
265
|
+
- CSS styling is broken or overflowing unexpectedly
|
|
266
|
+
- Form validation behaves incorrectly
|
|
267
|
+
|
|
268
|
+
**Note:** For backend or general logic bugs, use `bug-fix`. For performance issues, use `frontend-performance`.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Scope
|
|
273
|
+
|
|
274
|
+
- ✅ Diagnose and fix React hydration mismatches (Next.js / SSR)
|
|
275
|
+
- ✅ Fix infinite loops in `useEffect` and missing dependencies
|
|
276
|
+
- ✅ Resolve state staleness (stale closures in async functions or hooks)
|
|
277
|
+
- ✅ Fix CSS layout issues (Flexbox/Grid blowouts, z-index stacking context)
|
|
278
|
+
- ✅ Provide a targeted, minimal fix that doesn't break other UI elements
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Non-goals
|
|
283
|
+
|
|
284
|
+
- ❌ Do NOT rewrite the entire component to fix a small CSS bug
|
|
285
|
+
- ❌ Do NOT disable hydration checks (`suppressHydrationWarning`) unless absolutely necessary and justified
|
|
286
|
+
- ❌ Do NOT apply quick-fixes (like `// @ts-ignore` or wrapping everything in `setTimeout`) without understanding the root cause
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Workflow
|
|
291
|
+
|
|
292
|
+
### Phase 1 — Reproduction & Isolation
|
|
293
|
+
|
|
294
|
+
1. Identify the exact error message or visual symptom.
|
|
295
|
+
2. Isolate the component causing the issue.
|
|
296
|
+
3. Determine the environment (SSR, CSR, mobile, specific browser).
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
### Phase 2 — Common Issue Diagnosis
|
|
301
|
+
|
|
302
|
+
**Hydration Errors (Next.js/SSR):**
|
|
303
|
+
- Cause: Rendering `window`, `localStorage`, or random data (e.g., `Math.random()`, Dates) on the first pass.
|
|
304
|
+
- Fix: Move client-only rendering inside a `useEffect` (isMounted pattern) or use dynamic imports with `ssr: false`.
|
|
305
|
+
|
|
306
|
+
**Too many re-renders:**
|
|
307
|
+
- Cause: Updating state directly in the render body, or inside a `useEffect` without proper dependencies.
|
|
308
|
+
- Fix: Move state updates into event handlers, or fix `useEffect` dependencies.
|
|
309
|
+
|
|
310
|
+
**Stale Closures:**
|
|
311
|
+
- Cause: A `useEffect` or `useCallback` is using old state because it's missing from the dependency array.
|
|
312
|
+
- Fix: Add dependencies, use refs (`useRef`) for mutable values, or use functional state updates (`setState(prev => prev + 1)`).
|
|
313
|
+
|
|
314
|
+
**CSS Z-Index/Stacking Issues:**
|
|
315
|
+
- Cause: Missing `position: relative/absolute` on parent, or a new stacking context was created.
|
|
316
|
+
- Fix: Inspect parent elements, adjust `z-index`, or use Portals for modals.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
### Phase 3 — Fix Application
|
|
321
|
+
|
|
322
|
+
Apply the minimal fix required to resolve the issue while preserving surrounding logic and styles.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Decision Tree
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
Is it a Hydration Error?
|
|
330
|
+
├── Yes → Is it caused by client-side APIs (window/localStorage)?
|
|
331
|
+
│ ├── Yes → Use `useEffect` to delay rendering until mounted
|
|
332
|
+
│ └── No → Check for mismatched HTML tags (e.g., <p> inside <p>)
|
|
333
|
+
└── No → Proceed to next check
|
|
334
|
+
|
|
335
|
+
Is it an infinite loop?
|
|
336
|
+
├── Yes → Check `useEffect` dependencies. Are objects/arrays re-created every render?
|
|
337
|
+
│ ├── Yes → Memoize them (`useMemo`) or move outside component
|
|
338
|
+
│ └── No → Ensure `setState` isn't called unconditionally in render
|
|
339
|
+
└── No → Proceed
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Output Format
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
🪲 Frontend Debug Report
|
|
348
|
+
─────────────────────────────────────────────────
|
|
349
|
+
Symptom: [Description of the bug]
|
|
350
|
+
Root Cause: [Explanation of why it failed, e.g., Stale Closure in useEffect]
|
|
351
|
+
|
|
352
|
+
🔧 Fix Applied:
|
|
353
|
+
[Brief description of the code change]
|
|
354
|
+
|
|
355
|
+
✅ Verification:
|
|
356
|
+
- Error no longer throws
|
|
357
|
+
- UI renders correctly
|
|
358
|
+
|
|
359
|
+
⚠️ Notes:
|
|
360
|
+
[Any side effects or things to watch out for]
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Validation Checklist
|
|
366
|
+
|
|
367
|
+
- [ ] Root cause clearly identified (not just patched)
|
|
368
|
+
- [ ] Fix is minimal and targeted
|
|
369
|
+
- [ ] No Hydration warnings remain
|
|
370
|
+
- [ ] Component doesn't infinitely loop
|
|
371
|
+
- [ ] No regression on related UI
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-context-loader
|
|
3
|
+
purpose: Load ngữ cảnh thực tại (file, folder, logic) liên quan trực tiếp đến task.
|
|
4
|
+
mode_supported: [standard]
|
|
5
|
+
input: [Workflow task]
|
|
6
|
+
output: [Context summaries, loaded files]
|
|
7
|
+
workflow: [1. Quét file bị ảnh hưởng -> 2. Gom nhóm ngữ cảnh -> 3. Handoff]
|
|
8
|
+
allowed_tools: [grep_search, read_file, list_dir]
|
|
9
|
+
handoff_to: [qk-policy-engine]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# 🛠️ qk-context-loader - Quy Trình Vận Hành Chuẩn (SOP)
|
|
13
|
+
|
|
14
|
+
> **Mô tả:** Load ngữ cảnh thực tại (file, folder, logic) liên quan trực tiếp đến task.
|
|
15
|
+
|
|
16
|
+
## 🎯 1. Mục Tiêu (Goal)
|
|
17
|
+
- Hoàn thành thành công tác vụ được giao liên quan đến nhiệm vụ của skill.
|
|
18
|
+
- Đảm bảo chất lượng mã nguồn và tính nhất quán của hệ thống.
|
|
19
|
+
|
|
20
|
+
## 🔄 2. Chuỗi Hành Động (Chain of Thought / SOP)
|
|
21
|
+
*(Bắt buộc AI phải suy nghĩ và làm theo đúng thứ tự)*
|
|
22
|
+
1. **Phân tích (Analyze):** Thu thập ngữ cảnh và hiểu rõ yêu cầu đầu vào.
|
|
23
|
+
2. **Lên kế hoạch (Plan):** Xác định các bước cần thay đổi/tạo mới dựa trên bộ luật (rules).
|
|
24
|
+
3. **Thực thi (Execute):** Tiến hành sửa đổi mã nguồn hoặc tạo tài liệu.
|
|
25
|
+
4. **Xác thực (Verify):** Đảm bảo đầu ra đáp ứng đúng yêu cầu và không vi phạm quy định.
|
|
26
|
+
|
|
27
|
+
## 🛡️ 3. Ràng Buộc & Quy Tắc (Constraints)
|
|
28
|
+
- CẤM bỏ qua việc kiểm tra `qk-engineering-standard` trước khi viết code.
|
|
29
|
+
- Mọi quyết định kỹ thuật phải dựa trên nội dung tại phần Deep Knowledge (nếu có).
|
|
30
|
+
|
|
31
|
+
## 🤝 4. Giao Thức Bàn Giao (Handoff Protocol)
|
|
32
|
+
- Đích đến: `qk-policy-engine`
|
|
33
|
+
- Nội dung bàn giao: Chuyển toàn bộ ngữ cảnh và kết quả đã thực thi cho bước tiếp theo.
|
|
34
|
+
|
|
35
|
+
## 📚 5. Kiến Thức Chuyên Sâu (Deep Knowledge)
|
|
36
|
+
|
|
37
|
+
*(Nền tảng kiến thức và quy tắc chi tiết kế thừa từ kỹ sư)*
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Context Manager
|
|
44
|
+
|
|
45
|
+
> **Language rule:**
|
|
46
|
+
> Use **English** for: file paths, architecture terms, module names, technical labels.
|
|
47
|
+
> Use **the user's language** for: explanations, summaries, and questions.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Trigger
|
|
52
|
+
|
|
53
|
+
Activate this skill when:
|
|
54
|
+
- Starting work on an unfamiliar or large codebase
|
|
55
|
+
- About to read many files and need to prioritize
|
|
56
|
+
- Context window is at risk of overflowing
|
|
57
|
+
- User asks "where is X", "what does Y do", "how is this project structured"
|
|
58
|
+
- Another skill (e.g. `project-audit`, `frontend-architecture`) needs project context first
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Scope
|
|
63
|
+
|
|
64
|
+
- ✅ Identify which files are relevant to the current task
|
|
65
|
+
- ✅ Summarize project architecture in structured format
|
|
66
|
+
- ✅ Map folder structure to responsibilities
|
|
67
|
+
- ✅ Track what has been read and what still needs reading
|
|
68
|
+
- ✅ Flag context window risks
|
|
69
|
+
- ✅ Maintain a working memory summary for multi-turn sessions
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Non-goals
|
|
74
|
+
|
|
75
|
+
- ❌ Do NOT modify any files
|
|
76
|
+
- ❌ Do NOT fix bugs
|
|
77
|
+
- ❌ Do NOT make architectural decisions
|
|
78
|
+
- ❌ Do NOT read every file blindly — be selective and efficient
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Workflow
|
|
83
|
+
|
|
84
|
+
### Phase 1 — Project Discovery
|
|
85
|
+
|
|
86
|
+
Read only top-level signals first:
|
|
87
|
+
1. `package.json` / `pyproject.toml` / `Cargo.toml` → detect framework, language, scripts
|
|
88
|
+
2. Root config files → `.env.example`, `tsconfig.json`, `vite.config.ts`, `next.config.js`
|
|
89
|
+
3. Folder structure (1-2 levels deep) → identify key directories
|
|
90
|
+
4. Entry points → `src/index.ts`, `app/`, `pages/`, `main.py`
|
|
91
|
+
|
|
92
|
+
Produce: **Project Profile** (framework, language, key directories, architecture style)
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### Phase 2 — Task-Scoped File Selection
|
|
97
|
+
|
|
98
|
+
Given the current task, identify the minimum relevant set of files:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Task type → Files to read
|
|
102
|
+
─────────────────────────────────────────────────────
|
|
103
|
+
UI work → components/, pages/, styles/, design system files
|
|
104
|
+
API work → services/, hooks/, api/, types/
|
|
105
|
+
State work → store/, context/, hooks/
|
|
106
|
+
Bug fix → files mentioned in error, related modules
|
|
107
|
+
Architecture → folder structure, key abstractions
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Rules:
|
|
111
|
+
- Read **entry points** before diving into details
|
|
112
|
+
- Prefer **index files** as anchors
|
|
113
|
+
- Skip `node_modules`, `dist`, `build`, `.git`
|
|
114
|
+
- If uncertain which file → check imports, not the file itself
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### Phase 3 — Architecture Summary
|
|
119
|
+
|
|
120
|
+
Produce a concise summary:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
Project: [Name / repo]
|
|
124
|
+
Framework: [React 18 / Next.js 14 / Vue 3 / etc.]
|
|
125
|
+
Language: [TypeScript / JavaScript / Python]
|
|
126
|
+
Structure: [Feature-based / Layer-based / Domain-based]
|
|
127
|
+
|
|
128
|
+
Key directories:
|
|
129
|
+
src/components/ → Shared UI components
|
|
130
|
+
src/features/ → Feature modules (collocated)
|
|
131
|
+
src/services/ → API and data services
|
|
132
|
+
src/hooks/ → Custom React hooks
|
|
133
|
+
src/types/ → TypeScript interfaces
|
|
134
|
+
|
|
135
|
+
State: [Zustand / Redux / React Query / Pinia]
|
|
136
|
+
HTTP client: [axios instance at src/lib/axios.ts]
|
|
137
|
+
Auth: [JWT stored in httpOnly cookie]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### Phase 4 — Working Memory Maintenance
|
|
143
|
+
|
|
144
|
+
During multi-turn sessions:
|
|
145
|
+
- Track which files have been read (avoid re-reading)
|
|
146
|
+
- Track decisions made (e.g. "we decided to use feature-based structure")
|
|
147
|
+
- Flag when context is approaching limits
|
|
148
|
+
- Offer to summarize and compress if needed
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Decision Tree
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
Is this a new project / first time seeing this codebase?
|
|
156
|
+
├── Yes → Run full Phase 1 + Phase 2 + Phase 3
|
|
157
|
+
└── No → Has something changed since last context load?
|
|
158
|
+
├── Yes → Re-run Phase 2 for affected area
|
|
159
|
+
└── No → Use cached architecture summary
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
Is context window at risk?
|
|
164
|
+
├── Yes → Summarize what's been read, drop low-relevance files
|
|
165
|
+
└── No → Continue loading relevant files
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Output Format
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
🗂️ Project Context Loaded
|
|
174
|
+
|
|
175
|
+
Framework: [framework]
|
|
176
|
+
Language: [language]
|
|
177
|
+
Structure: [style]
|
|
178
|
+
|
|
179
|
+
Relevant files for this task:
|
|
180
|
+
📄 [path/to/file.ts] — [why it's relevant]
|
|
181
|
+
📄 [path/to/file.ts] — [why it's relevant]
|
|
182
|
+
|
|
183
|
+
Architecture summary:
|
|
184
|
+
[2-4 lines describing how this codebase is organized]
|
|
185
|
+
|
|
186
|
+
⚠️ Context notes:
|
|
187
|
+
[Any risks, unknowns, or files that couldn't be read]
|
|
188
|
+
|
|
189
|
+
✅ Ready. Proceeding with: [next skill or action]
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Validation Checklist
|
|
195
|
+
|
|
196
|
+
- [ ] Framework and language correctly identified
|
|
197
|
+
- [ ] Only task-relevant files selected (no noise)
|
|
198
|
+
- [ ] Architecture summary is accurate and concise
|
|
199
|
+
- [ ] Context window usage is reasonable
|
|
200
|
+
- [ ] Working memory updated for this session
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Examples
|
|
205
|
+
|
|
206
|
+
See `examples/` folder.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-data-lifecycle
|
|
3
|
+
purpose: Quản lý Schema, Migration, Repository, Query Tuning.
|
|
4
|
+
mode_supported: [enterprise]
|
|
5
|
+
input: [Data requirement]
|
|
6
|
+
output: [Schema, Migration files]
|
|
7
|
+
workflow: [1. Schema -> 2. Migration -> 3. Repository -> 4. Index]
|
|
8
|
+
allowed_tools: [write_to_file, run_command]
|
|
9
|
+
handoff_to: [qk-validation-gate]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# 🛠️ qk-data-lifecycle - Quy Trình Vận Hành Chuẩn (SOP)
|
|
13
|
+
|
|
14
|
+
> **Mô tả:** Quản lý Schema, Migration, Repository, Query Tuning.
|
|
15
|
+
|
|
16
|
+
## 🎯 1. Mục Tiêu (Goal)
|
|
17
|
+
- Hoàn thành thành công tác vụ được giao liên quan đến nhiệm vụ của skill.
|
|
18
|
+
- Đảm bảo chất lượng mã nguồn và tính nhất quán của hệ thống.
|
|
19
|
+
|
|
20
|
+
## 🔄 2. Chuỗi Hành Động (Chain of Thought / SOP)
|
|
21
|
+
*(Bắt buộc AI phải suy nghĩ và làm theo đúng thứ tự)*
|
|
22
|
+
1. **Phân tích (Analyze):** Thu thập ngữ cảnh và hiểu rõ yêu cầu đầu vào.
|
|
23
|
+
2. **Lên kế hoạch (Plan):** Xác định các bước cần thay đổi/tạo mới dựa trên bộ luật (rules).
|
|
24
|
+
3. **Thực thi (Execute):** Tiến hành sửa đổi mã nguồn hoặc tạo tài liệu.
|
|
25
|
+
4. **Xác thực (Verify):** Đảm bảo đầu ra đáp ứng đúng yêu cầu và không vi phạm quy định.
|
|
26
|
+
|
|
27
|
+
## 🛡️ 3. Ràng Buộc & Quy Tắc (Constraints)
|
|
28
|
+
- CẤM bỏ qua việc kiểm tra `qk-engineering-standard` trước khi viết code.
|
|
29
|
+
- Mọi quyết định kỹ thuật phải dựa trên nội dung tại phần Deep Knowledge (nếu có).
|
|
30
|
+
|
|
31
|
+
## 🤝 4. Giao Thức Bàn Giao (Handoff Protocol)
|
|
32
|
+
- Đích đến: `qk-validation-gate`
|
|
33
|
+
- Nội dung bàn giao: Chuyển toàn bộ ngữ cảnh và kết quả đã thực thi cho bước tiếp theo.
|
|
34
|
+
|
|
35
|
+
## 📚 5. Kiến Thức Chuyên Sâu (Deep Knowledge)
|
|
36
|
+
|
|
37
|
+
*(Nền tảng kiến thức và quy tắc chi tiết kế thừa từ kỹ sư)*
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Database Engineer
|
|
44
|
+
|
|
45
|
+
> **Language rule:**
|
|
46
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
47
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
48
|
+
> The user may write in any language — detect and match it automatically.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Trigger
|
|
53
|
+
|
|
54
|
+
Activate this skill when:
|
|
55
|
+
- User says "create a new table", "add a column", "design the schema"
|
|
56
|
+
- Writing complex data retrieval logic (joins, aggregations)
|
|
57
|
+
- A query is running slowly and needs optimization (indexing)
|
|
58
|
+
- Running or generating database migrations
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Scope
|
|
63
|
+
|
|
64
|
+
- ✅ **Schema Design:** Model tables, relations (1:1, 1:N, N:M), and constraints (Unique, FK).
|
|
65
|
+
- ✅ **ORM Integration:** Generate code for Prisma, Drizzle, TypeORM, Sequelize, or Mongoose.
|
|
66
|
+
- ✅ **Migrations:** Generate SQL or ORM migration files safely.
|
|
67
|
+
- ✅ **Query Optimization:** Prevent N+1 queries, add indexes, use efficient aggregations.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Non-goals
|
|
72
|
+
|
|
73
|
+
- ❌ Do NOT execute destructive migrations (DROP TABLE) on production environments without extreme warnings and approval.
|
|
74
|
+
- ❌ Do NOT mix raw SQL into ORM logic unless necessary for performance.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Workflow
|
|
79
|
+
|
|
80
|
+
### Phase 1 — Schema Design
|
|
81
|
+
|
|
82
|
+
Understand the business entities and relations.
|
|
83
|
+
- Identify primary keys (UUID vs Auto-increment ID).
|
|
84
|
+
- Identify foreign keys and cascade rules (`ON DELETE CASCADE`).
|
|
85
|
+
- Ensure proper normalization (usually 3NF) or denormalization (if NoSQL).
|
|
86
|
+
|
|
87
|
+
### Phase 2 — ORM / Migration Generation
|
|
88
|
+
|
|
89
|
+
Map the design to the project's tool:
|
|
90
|
+
- **Prisma:** Update `schema.prisma`.
|
|
91
|
+
- **Drizzle:** Update `schema.ts`.
|
|
92
|
+
- **Raw SQL:** Write `V1__create_table.sql`.
|
|
93
|
+
|
|
94
|
+
### Phase 3 — Query Implementation
|
|
95
|
+
|
|
96
|
+
Write the data access methods (Repository pattern or direct ORM calls).
|
|
97
|
+
- Avoid fetching `SELECT *` if only 2 columns are needed.
|
|
98
|
+
- Batch queries or use joins to prevent N+1 issues.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Decision Tree
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Is the project using an ORM?
|
|
106
|
+
├── Prisma → Modify `schema.prisma`, use `prisma.entity.findMany()`
|
|
107
|
+
├── Drizzle → Modify schema TS files, use Drizzle query builder
|
|
108
|
+
└── No → Write raw SQL or use query builder (Knex)
|
|
109
|
+
|
|
110
|
+
Does the schema change drop data or alter existing columns?
|
|
111
|
+
├── Yes → Flag as High Risk. Provide rollback strategy. Ask for approval.
|
|
112
|
+
└── No → Standard migration (e.g., adding a nullable column).
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Output Format
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
🗄️ Database Engineering Report
|
|
121
|
+
─────────────────────────────────────────────────
|
|
122
|
+
Action: [Schema Update / Query Optimization]
|
|
123
|
+
Tooling: [Prisma / Raw SQL / etc.]
|
|
124
|
+
|
|
125
|
+
Changes:
|
|
126
|
+
✅ Added model: `User` (1:N with `Post`)
|
|
127
|
+
✅ Added index on `User.email`
|
|
128
|
+
✅ Generated query: `getUserWithPosts`
|
|
129
|
+
|
|
130
|
+
⚠️ Risk Assessment:
|
|
131
|
+
[Low / High — e.g., "Safe addition, no data loss"]
|
|
132
|
+
|
|
133
|
+
🔗 Next Steps:
|
|
134
|
+
Run `npx prisma migrate dev` to apply these changes locally.
|
|
135
|
+
```
|