ai-developer-skill-os 2.1.1 → 3.1.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 (41) hide show
  1. package/.agents/AGENTS.md +81 -0
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +84 -130
  4. package/docs/GOVERNANCE.md +40 -0
  5. package/docs/SPEC.md +37 -0
  6. package/docs/adr/0001-intent-based-architecture.md +19 -0
  7. package/docs/adr/0002-kernel-freeze.md +21 -0
  8. package/docs/adr/0003-risk-based-verification.md +20 -0
  9. package/docs/adr/0004-progressive-evidence.md +19 -0
  10. package/docs/skill-classification.md +25 -0
  11. package/knowledge/backend/nodejs.md +52 -0
  12. package/knowledge/frontend/react.md +81 -0
  13. package/package.json +1 -1
  14. package/skills/qk-access-policy/SKILL.md +40 -127
  15. package/skills/qk-ai-builder/SKILL.md +41 -33
  16. package/skills/qk-api-lifecycle/SKILL.md +62 -420
  17. package/skills/qk-bug-resolution/SKILL.md +67 -371
  18. package/skills/qk-context-loader/SKILL.md +47 -206
  19. package/skills/qk-data-lifecycle/SKILL.md +60 -135
  20. package/skills/qk-design-to-code/SKILL.md +46 -33
  21. package/skills/qk-docs/SKILL.md +52 -335
  22. package/skills/qk-documentation-system/SKILL.md +38 -33
  23. package/skills/qk-engineering-standard/SKILL.md +63 -171
  24. package/skills/qk-feature-delivery/SKILL.md +65 -432
  25. package/skills/qk-help/SKILL.md +37 -95
  26. package/skills/qk-orchestrator/SKILL.md +52 -272
  27. package/skills/qk-policy-engine/SKILL.md +52 -33
  28. package/skills/qk-production-release/SKILL.md +47 -127
  29. package/skills/qk-project-bootstrap/SKILL.md +43 -33
  30. package/skills/qk-project-health/SKILL.md +58 -650
  31. package/skills/qk-project-memory/SKILL.md +35 -33
  32. package/skills/qk-system-evolution/SKILL.md +65 -315
  33. package/skills/qk-ui-audit/SKILL.md +60 -152
  34. package/skills/qk-ui-system-builder/SKILL.md +40 -444
  35. package/skills/qk-validation-gate/SKILL.md +61 -33
  36. package/skills.json +36 -40
  37. package/templates/bug-report.md +21 -0
  38. package/templates/design-report.md +21 -0
  39. package/templates/feature-report.md +20 -0
  40. package/templates/review-report.md +21 -0
  41. package/templates/skill-template.md +38 -0
@@ -1,371 +1,67 @@
1
- ---
2
- name: qk-bug-resolution
3
- description: 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ĩ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
1
+ ---
2
+ name: qk-bug-resolution
3
+ version: 3.0.0
4
+ updated: 2026-07-02
5
+ description: Fix bugs and prevent regressions.
6
+ category: engineering
7
+ behavior: development
8
+ intent: fix-bug
9
+ priority: high
10
+ tags: [bug, debug, regression]
11
+ platforms: [claude-code, cursor, windsurf, gemini-cli]
12
+ trigger: User reports an error or crash.
13
+ inputs: [Error log, Bug description, File path]
14
+ outputs: [Fixed code, Verification report]
15
+ allowed_tools: [run_command, read_file, grep_search]
16
+ pipeline: [analyze, implement, engineering-standard, validate, complete]
17
+ ---
18
+
19
+ # 🛠️ qk-bug-resolution - Standard Operating Procedure
20
+
21
+ > **Goal:** Định vị nguyên nhân, sửa lỗi triệt để, đảm bảo lỗi không bị lặp lại (Regression Prevention).
22
+
23
+ ## 🔄 1. Chain of Thought (SOP)
24
+ 1. **Analyze (Root Cause Analysis):**
25
+ - Read the provided error log or bug description.
26
+ - Trace the error to the exact file and line of code.
27
+ - Identify if the bug is a syntax error, logic error, state issue, or boundary case.
28
+ 2. **Plan (Fix Strategy):**
29
+ - Determine the minimal change required to fix the bug.
30
+ - If the bug is UI-related, refer to frontend knowledge (e.g., `knowledge/frontend/react.md`).
31
+ 3. **Execute (Implement Fix):**
32
+ - Modify the source code exactly where needed.
33
+ - Do NOT rewrite unrelated code blocks.
34
+ 4. **Verify (Validation):**
35
+ - Provide steps to test the fix.
36
+ - Ensure backward compatibility.
37
+
38
+ ## 🛡️ 3. Constraints & Rules
39
+ - **No Guesses:** Do not assume the shape of an API response. Print it or read the type definitions first.
40
+ - **Minimal Fix:** Always prefer a 1-line fix over a 100-line refactor, unless the architecture is fundamentally broken.
41
+ - **Clean Up:** Remove any `console.log()` or debugger statements introduced during the debugging process.
42
+
43
+ ## 🌳 3. Decision Tree
44
+ ```text
45
+ Is there a Stack Trace?
46
+ ├── YES → Use grep_search to find the exact file and line number.
47
+ └── NO → Ask the user for the file path or use grep_search with keywords from the bug description.
48
+
49
+ Is the bug related to State/Re-rendering?
50
+ ├── YES → Load `knowledge/frontend/react.md` to check for stale closures or missing dependencies.
51
+ └── NO → Proceed with standard logic debugging.
52
+ ```
53
+
54
+ ## 🤝 4. Handoff Pipeline
55
+ After implementing the fix, map to the pipeline:
56
+ 1. `engineering-standard`: Ensure the fix follows naming and architecture rules.
57
+ 2. `validate`: Run linters and tests (via `qk-validation-gate` equivalent).
58
+ 3. `complete`: Output the final report.
59
+
60
+ ## 📝 5. Output Format
61
+ Vui lòng sử dụng template `templates/bug-report.md` (Báo Cáo Xử Lỗi) để phản hồi lại cho người dùng bằng Tiếng Việt. Nội dung bao gồm:
62
+ - Summary
63
+ - Changes
64
+ - Root Cause
65
+ - Verification
66
+ - Risks
67
+ - Next Action