ai-developer-skill-os 2.0.1 → 3.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.
@@ -1,171 +1,61 @@
1
- ---
2
- name: qk-engineering-standard
3
- purpose: Rút trích các bộ luật thép (Folder, Naming, State, Boundary) cần tuân thủ cho task.
4
- mode_supported: [enterprise]
5
- input: [Context]
6
- output: [Validated Context + Rules]
7
- workflow: [1. Đọc rules/frontend.md... -> 2. Gắn luật vào Context -> 3. Handoff]
8
- allowed_tools: [read_file]
9
- handoff_to: [[Target Execution Skill]]
10
- ---
11
-
12
- # 🛠️ qk-engineering-standard - Quy Trình Vận Hành Chuẩn (SOP)
13
-
14
- > **Mô tả:** Rút trích các bộ luật thép (Folder, Naming, State, Boundary) cần tuân thủ cho 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: `[Target Execution Skill`
33
- - Nội dung bàn giao: Chuyển toàn bộ ngữ cảnh 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 quy tắc chi tiết kế thừa từ kỹ sư)*
38
-
39
- ---
40
-
41
-
42
-
43
- # State Management
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 asks to "store this data", "share state between components", or "cache API results"
56
- - Prop drilling becomes excessive (>3 levels deep)
57
- - Integrating complex UI interactions that need memory (e.g., shopping cart, multi-step wizard)
58
- - Managing async server data and loading/error states
59
-
60
- ---
61
-
62
- ## Scope
63
-
64
- - ✅ Decide which state layer to use based on the data's lifecycle and scope
65
- - ✅ Implement local state (`useState`, `useReducer`, `ref`)
66
- - ✅ Implement global UI state (Zustand, Pinia, Context, Redux)
67
- - ✅ Implement server state (React Query, SWR, Apollo)
68
- - ✅ Ensure state is immutable and updates correctly
69
- - ✅ Prevent race conditions and stale state bugs
70
-
71
- ---
72
-
73
- ## Non-goals
74
-
75
- - ❌ Do NOT introduce a new state management library if the project already uses one
76
- - ❌ Do NOT put server data (API responses) in a global UI store (like Redux) if React Query is available
77
- - ❌ Do NOT use global state for something that should be local (e.g., a modal's `isOpen` state)
78
-
79
- ---
80
-
81
- ## Workflow
82
-
83
- ### Phase 1 — State Classification
84
-
85
- Analyze the data the user wants to manage and classify it:
86
-
87
- 1. **Local UI State:** Only needed by one component (e.g., toggle button, input value).
88
- 2. **Shared UI State:** Needed by multiple components, but not saved to DB (e.g., dark mode, cart items, selected filters).
89
- 3. **Server State:** Data fetched from an API. Needs caching, refetching, and loading states.
90
- 4. **URL State:** Data that should be shareable or survive refresh (e.g., search query `?q=shoes`, current page).
91
-
92
- ---
93
-
94
- ### Phase 2 — Strategy Selection
95
-
96
- Based on the classification and project stack (`project-audit`), choose the tool:
97
-
98
- | State Type | Recommended Tool |
99
- |------------|------------------|
100
- | Local UI | `useState`, `useReducer` |
101
- | Shared UI | Zustand, Pinia, Redux, Context API |
102
- | Server | React Query, RTK Query, Apollo, SWR |
103
- | URL | React Router `useSearchParams`, Next.js `useRouter` |
104
-
105
- **Rule:** Always respect existing project conventions. If they use Redux for everything, use Redux.
106
-
107
- ---
108
-
109
- ### Phase 3 — Implementation
110
-
111
- Generate the required code.
112
-
113
- **Example for Server State (React Query):**
114
- - Create query key factory
115
- - Create custom hook (`useUserList`)
116
- - Handle `isLoading`, `isError`, and `data`
117
-
118
- **Example for Global UI State (Zustand):**
119
- - Create store file (`userStore.ts`)
120
- - Define state interface and initial values
121
- - Define update actions (mutations)
122
-
123
- ---
124
-
125
- ### Phase 4 — Validation
126
-
127
- - [ ] Does it update correctly without mutating state directly?
128
- - [ ] Are unnecessary re-renders avoided?
129
- - [ ] Is server state properly cached and invalidated after mutations?
130
- - [ ] Is it placed in the correct directory (e.g., `src/store/` or `src/hooks/`)?
131
-
132
- ---
133
-
134
- ## Decision Tree
135
-
136
- ```
137
- Is the data fetched from a backend API?
138
- ├── Yes → Use Server State (React Query / SWR / RTK Query)
139
- └── No → Is the data only needed in one component and its direct children?
140
- ├── Yes → Use Local State (`useState`)
141
- └── No → Is the data used across many distinct branches of the app?
142
- ├── Yes → Use Global State (Zustand / Redux)
143
- └── No → Use Context API or lift state up
144
- ```
145
-
146
- ---
147
-
148
- ## Output Format
149
-
150
- ```
151
- 🧠 State Management Plan
152
- ─────────────────────────────────────────────────
153
- State Type: [Server / Global UI / Local / URL]
154
- Tool Used: [React Query / Zustand / useState / etc.]
155
-
156
- Implementation:
157
- ✅ [File 1] — [Store / Hook definition]
158
- ✅ [File 2] — [Component integration]
159
-
160
- ⚠️ Considerations:
161
- • [Note on caching, stale time, or performance]
162
-
163
- 🔗 Next Steps:
164
- State is ready. Use the hook in your component.
165
- ```
166
-
167
- ---
168
-
169
- ## Examples
170
-
171
- See `examples/` folder.
1
+ ---
2
+ name: qk-engineering-standard
3
+ version: 3.0.0
4
+ updated: 2026-07-02
5
+ description: Enforce SOLID, DRY, Clean Code, and Naming conventions.
6
+ category: standard
7
+ priority: critical
8
+ tags: [clean-code, architecture, refactoring, solid]
9
+ platforms: [claude-code, cursor, windsurf, gemini-cli]
10
+ trigger: User asks to review code, refactor code, or as part of the pipeline before validation.
11
+ inputs: [Source Code, Target Directory]
12
+ outputs: [Refactored Code, Code Review Report]
13
+ allowed_tools: [grep_search, read_file, write_to_file]
14
+ pipeline: [analyze, review, implement, validate, complete]
15
+ ---
16
+
17
+ # 🛠️ qk-engineering-standard - Standard Operating Procedure
18
+
19
+ > **Goal:** Đóng vai trò là "Kiến trúc sư trưởng", rà soát và ép buộc mã nguồn phải tuân thủ chuẩn mực Clean Code, dễ đọc và dễ bảo trì.
20
+
21
+ ## 🔄 1. Chain of Thought (SOP)
22
+ 1. **Analyze (Context Review):**
23
+ - Scan the target file(s) and determine their role (UI, Logic, API, Config).
24
+ 2. **Review (Smell Detection):**
25
+ - Check for Naming violations (e.g., `temp`, `data`, `res` instead of `userData`).
26
+ - Check for Magic Numbers/Strings.
27
+ - Check for God Components (Files > 300 lines or > 3 responsibilities).
28
+ 3. **Implement (Refactoring):**
29
+ - Extract inline styles or raw strings into constants.
30
+ - Split large components into smaller, pure components.
31
+ - Separate UI rendering from Business Logic (Custom Hooks).
32
+ 4. **Verify (Validation):**
33
+ - Ensure the refactoring did NOT change the business logic or behavior of the app (Regression check).
34
+
35
+ ## 🛡️ 2. Constraints & Rules
36
+ - **Code is for Humans:** Write code that junior developers can easily understand. Avoid overly clever or obscure syntax.
37
+ - **Scope Limit:** Do NOT refactor the entire project if the user only asked to review one file. Limit the scope to the current task context.
38
+ - **Preserve Behavior:** Refactoring must strictly preserve backward compatibility.
39
+
40
+ ## 🌳 3. Decision Tree
41
+ ```text
42
+ Is the file larger than 300 lines?
43
+ ├── YES → Propose splitting the file into sub-components or moving logic to hooks.
44
+ └── NO → Continue normal inspection.
45
+
46
+ Does the React Component contain `fetch()` or heavy data mapping?
47
+ ├── YES Extract the logic into a separate `use[Feature]Data.ts` hook.
48
+ └── NO Pass.
49
+ ```
50
+
51
+ ## 🤝 4. Handoff Pipeline
52
+ 1. `validate`: Run static analysis (Linters, TypeScript compiler) to ensure the refactored code has no syntax errors.
53
+ 2. `complete`: Generate the review report.
54
+
55
+ ## 📝 5. Output Format
56
+ Vui lòng trả kết quả bằng Tiếng Việt. Cấu trúc báo cáo bao gồm:
57
+ - **Tóm tắt (Summary):** File nào vừa được Refactor / Review.
58
+ - **Chi tiết (Changes):** Các thay đổi cụ thể về Tên biến, Cấu trúc.
59
+ - **Nguyên nhân (Reasoning):** Giải thích tại sao code cũ là "Bad Practice" và code mới tốt hơn thế nào.
60
+ - **Xác thực (Verification):** Đảm bảo code chạy không lỗi.
61
+ - **Hành động tiếp (Next Action):** Bàn giao lại cho Pipeline.