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,272 +1,52 @@
1
- ---
2
- name: qk-orchestrator
3
- purpose: Điều hướng request, phân tích ý đồ và chọn workflow phù hợp nhất.
4
- mode_supported: [standard]
5
- input: [User request]
6
- output: [Workflow được chọn và bàn giao cho skill tương ứng]
7
- workflow: [1. Nhận lệnh -> 2. Phân tích -> 3. Handoff]
8
- allowed_tools: [ask_question, run_command]
9
- handoff_to: [qk-context-loader]
10
- ---
11
-
12
- # 🛠️ qk-orchestrator - Quy Trình Vận Hành Chuẩn (SOP)
13
-
14
- > **Mô tả:** Điều hướng request, phân tích ý đồ và chọn workflow phù hợp nhất.
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-context-loader`
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 quy tắc chi tiết kế thừa từ kỹ sư)*
38
-
39
- ---
40
-
41
-
42
-
43
- # Agent Orchestrator
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
- > ⚠️ **CRITICAL CONSTRAINT: This skill MUST NOT write any code.**
51
- > Its only job is to analyze, plan, and delegate.
52
- > If the orchestrator starts writing implementation code it is violating its role.
53
- > Immediately stop and delegate to the appropriate skill instead.
54
-
55
- ---
56
-
57
- ## Trigger
58
-
59
- Activate this skill when:
60
- - User describes a task without knowing where to start
61
- - User request spans multiple concerns (UI + API + state + tests)
62
- - Request is ambiguous and needs decomposition before action
63
- - User says: "help me plan", "what should I do first", "how do I approach this"
64
-
65
- ---
66
-
67
- ## Scope
68
-
69
- - ✅ Analyze the user's request
70
- - ✅ Identify which skills are needed
71
- - ✅ Define the correct execution order
72
- - ✅ Create a step-by-step plan
73
- - ✅ Delegate each step to the correct skill
74
- - ✅ Track overall progress
75
-
76
- ---
77
-
78
- ## Non-goals
79
-
80
- - ❌ Do NOT write implementation code
81
- - ❌ Do NOT modify files
82
- - ❌ Do NOT fix bugs directly (delegate to `bug-fix`)
83
- - ❌ Do NOT build UI directly (delegate to `ui-builder`)
84
- - ❌ Do NOT make architectural decisions unilaterally (delegate to `frontend-architecture`)
85
-
86
- ---
87
-
88
- ## Workflow
89
-
90
- ### Phase 1 — Request Analysis
91
-
92
- Parse the user's request:
93
-
94
- 1. **What** is being asked? (feature, fix, refactor, review, deploy?)
95
- 2. **Where** does it belong? (frontend, backend, shared, infrastructure?)
96
- 3. **What is the scope?** (single component, full feature, entire codebase?)
97
- 4. **What is unknown?** List any ambiguities that need clarification.
98
-
99
- If critical information is missing → ask before planning.
100
-
101
- ---
102
-
103
- ### Phase 2 — Skill Selection
104
-
105
- Map the request to skills from the registry:
106
-
107
- | Request type | Recommended skill(s) |
108
- |---|---|
109
- | "I don't know what's wrong" | `project-audit` → `bug-fix` |
110
- | "Build a new page" | `frontend-architecture` → `design-system` → `ui-builder` |
111
- | "Add API call" | `context-manager` → `api-integration` |
112
- | "App is slow" | `project-audit` → `frontend-performance` |
113
- | "Upgrade dependencies" | `migration` |
114
- | "Write tests" | `frontend-testing` |
115
-
116
- Always check dependencies from `skills.json` — load dependent skills first.
117
-
118
- ---
119
-
120
- ### Phase 3 — Execution Plan
121
-
122
- Produce a numbered, ordered plan. Each step maps to one skill.
123
-
124
- Format:
125
- ```
126
- Step 1: [skill-name] — [what it will do]
127
- Step 2: [skill-name] — [what it will do]
128
- Step 3: [skill-name] — [what it will do]
129
- ```
130
-
131
- Mark dependencies explicitly:
132
- ```
133
- Step 2 requires Step 1 to complete first.
134
- ```
135
-
136
- ---
137
-
138
- ### Phase 4 — Delegation
139
-
140
- For each step in the plan:
141
- 1. Announce which skill is being activated
142
- 2. Pass relevant context to that skill
143
- 3. Wait for skill output
144
- 4. Confirm completion before moving to next step
145
-
146
- ---
147
-
148
- ### Phase 5 — Progress Tracking
149
-
150
- After each skill completes:
151
- - Mark step as ✅ done
152
- - Note any output or blockers
153
- - Adjust remaining plan if needed
154
- - Report overall progress to user
155
-
156
- ---
157
-
158
- ## Decision Tree
159
-
160
- ```
161
- Is the request clear enough to plan?
162
- ├── No → Ask 1-3 clarifying questions, then plan
163
- └── Yes → Does it span multiple concerns?
164
- ├── Yes → Create multi-step plan with skill sequence
165
- └── No → Route directly to single skill
166
- ```
167
-
168
- ```
169
- Does a skill dependency exist?
170
- ├── Yes → Run dependency skill first
171
- └── No → Run skill directly
172
- ```
173
-
174
- ---
175
-
176
- ## Output Format
177
-
178
- ```
179
- 📋 Plan: [Brief description of what we're doing]
180
-
181
- Step 1: `[skill-name]` — [Purpose]
182
- Step 2: `[skill-name]` — [Purpose] ← requires Step 1
183
- Step 3: `[skill-name]` — [Purpose]
184
-
185
- ⏳ Starting with Step 1...
186
- ```
187
-
188
- After each step:
189
- ```
190
- ✅ Step 1 complete: [Brief outcome]
191
- ▶️ Moving to Step 2: `[skill-name]`
192
- ```
193
-
194
- ---
195
-
196
- ## Validation Checklist
197
-
198
- Before finishing orchestration:
199
-
200
- - [ ] All planned steps completed
201
- - [ ] Each step was handled by the correct skill
202
- - [ ] No code was written by the orchestrator itself
203
- - [ ] User has been informed of final outcome
204
- - [ ] Next recommended actions provided if relevant
205
-
206
- ---
207
-
208
- ## Examples
209
-
210
- See `examples/` folder.
211
-
212
- ---
213
-
214
-
215
-
216
- # 📚 Cẩm nang AI Developer Skill OS
217
-
218
- > **Nhiệm vụ của bạn (AI):** Khi người dùng gọi lệnh `./qk-help`, hãy xuất ra màn hình (bằng tiếng Việt) danh sách các kỹ năng phân theo nhóm và các Mẹo sử dụng (Pro-tips) dưới đây một cách sinh động, dễ đọc (dùng markdown, in đậm, emoji). Không cần phân tích code, chỉ đóng vai trò là "Sách hướng dẫn sử dụng".
219
-
220
- ---
221
-
222
- ## 🎯 1. Danh sách Kỹ năng (Skills Directory)
223
-
224
- Dưới đây là các kỹ năng chính bạn có thể gọi bằng cách gõ `./qk-[tên-kỹ-năng]`:
225
-
226
- ### 🎨 Frontend (Giao diện)
227
- - **`qk-ui-builder`**: Xây dựng UI, Layout, Component, Modal phức tạp.
228
- - **`qk-table-crud-generator`**: Chuyên vẽ bảng danh sách (Table), phân trang, lọc và form Thêm/Sửa/Xóa.
229
- - **`qk-form-builder`**: Chuyên làm Form nhập liệu, validate (Zod/Yup).
230
- - **`qk-component-generator`**: Tạo Component độc lập, tái sử dụng (Button, Input, Card).
231
- - **`qk-state-management`**: Xử lý Redux, Zustand, React Query.
232
- - **`qk-frontend-debug`**: Bắt bệnh vỡ layout, infinite re-render, lỗi Hydration.
233
- - **`qk-frontend-performance`**: Tối ưu tốc độ, chống re-render thừa.
234
- - **`qk-frontend-architecture`**: Tư vấn kiến trúc thư mục Frontend.
235
- - **`qk-frontend-testing`**: Viết Unit Test / E2E Test cho Frontend.
236
- - **`qk-accessibility-audit`**: Sửa lỗi a11y, hỗ trợ Screen reader.
237
-
238
- ### ⚙️ Engineering & Integration (Tích hợp)
239
- - **`qk-api-integration`**: [Cực mạnh] Bóc tách tài liệu API (Curl, Postman) -> Gen Type, Service, Hook -> (Tùy chọn) Ốp thẳng vào UI.
240
- - **`qk-refactor`**: Tối ưu, dọn dẹp mã nguồn sạch sẽ.
241
- - **`qk-bug-fix`**: Chẩn đoán lỗi sâu và sửa an toàn.
242
- - **`qk-project-audit`**: Quét toàn bộ dự án tìm nợ kỹ thuật.
243
- - **`qk-git-engineer`**: Viết Commit / PR chuẩn Conventional.
244
- - **`qk-migration`**: Nâng cấp version framework / thư viện.
245
- - **`qk-agent-orchestrator`**: Kiến trúc sư, lên plan phân rã task lớn.
246
- - **`qk-context-manager`**: Tóm tắt kiến trúc dự án.
247
-
248
- ### 🗄️ Backend (Máy chủ)
249
- - **`qk-database-engineer`**: Thiết kế Schema, ORM (Prisma/Drizzle), Migration.
250
- - **`qk-backend-architecture`**: Setup kiến trúc Backend (Node/Nest/Python).
251
- - **`qk-auth-security`**: Phân quyền RBAC, JWT, OAuth.
252
- - **`qk-deployment`**: Viết Dockerfile, CI/CD Pipeline.
253
-
254
- ---
255
-
256
- ## 💡 2. Mẹo sử dụng Nâng cao (Pro-Tips)
257
-
258
- ### Mẹo 1: Kết hợp Kỹ năng (Skill Chaining) 🔗
259
- Đừng bắt AI làm từ A-Z bằng 1 câu prompt. Hãy gọi liên hoàn:
260
- > *"Hãy dùng `./qk-api-integration` để bóc tách API này thành hook React Query. Sau đó dùng `./qk-table-crud-generator` vẽ cái Bảng hiển thị danh sách tích hợp hook đó."*
261
-
262
- ### Mẹo 2: Chế độ "Một phát ăn ngay" (End-to-End) 🚀
263
- Nếu bạn đã có sẵn 1 màn hình UI (chỉ thiếu data), hãy ép `qk-api-integration` làm End-to-End:
264
- > *"./qk-api-integration Dưới đây là API Get Profile. Hãy khai báo Type, viết Hook và TÍCH HỢP THẲNG LUÔN vào file \`Profile.tsx\` đang mở."*
265
-
266
- ### Mẹo 3: Truyền tham số ép buộc (Arguments) 🎯
267
- Bạn có thể ép AI dùng công nghệ bạn muốn bằng cách thêm \`--tham_số\`:
268
- > *"./qk-ui-builder --fw=react --css=tailwind Hãy vẽ màn hình Đăng nhập."*
269
-
270
- ### Mẹo 4: Nhờ "Kiến trúc sư" phân việc 🧠
271
- Nếu bạn có một tính năng quá lớn (ví dụ: Làm tính năng Giỏ Hàng), đừng tự chia việc, hãy gọi:
272
- > *"./qk-agent-orchestrator Tôi muốn làm tính năng Giỏ hàng. Hãy phân tích và lên kế hoạch gọi các skill \`qk-\` nào cho phù hợp."*
1
+ ---
2
+ name: qk-orchestrator
3
+ version: 3.0.0
4
+ updated: 2026-07-02
5
+ description: Route user requests, parse intents, and delegate to the correct sub-skills.
6
+ category: orchestration
7
+ priority: critical
8
+ tags: [router, orchestrator, delegation, ai-manager]
9
+ platforms: [claude-code, cursor, windsurf, gemini-cli]
10
+ trigger: Triggered initially when the user provides a vague or complex multi-step request.
11
+ inputs: [User intent, Raw Context]
12
+ outputs: [Workflow routing, Sub-skill delegation]
13
+ allowed_tools: [grep_search, read_file]
14
+ pipeline: [analyze, plan, delegate]
15
+ ---
16
+
17
+ # 🛠️ qk-orchestrator - Standard Operating Procedure
18
+
19
+ > **Goal:** "Tổng tư lệnh" (Master Orchestrator). Phân tích ý đồ của người dùng và điều phối các kỹ năng (Skills) khác để giải quyết vấn đề thay vì làm mọi thứ một cách thủ công.
20
+
21
+ ## 🔄 1. Chain of Thought (SOP)
22
+ 1. **Analyze (Intent Parsing):**
23
+ - Read the user's request. Determine the goal: Is it a Bug Fix, a New Feature, a Refactor, or just a Question?
24
+ 2. **Plan (Context Gathering & Skill Selection):**
25
+ - Determine which specific files are needed.
26
+ - Select the most appropriate Skill (e.g., `qk-feature-delivery` for new UI, `qk-bug-resolution` for fixing errors).
27
+ 3. **Delegate (Handoff):**
28
+ - Handoff the gathered context to the selected Skill.
29
+
30
+ ## 🛡️ 2. Constraints & Rules
31
+ - **Delegation First:** Do not write source code directly while acting as the Orchestrator. Delegate to the correct specialized Skill.
32
+ - **Ambiguity Check:** If the user's intent is unclear, give them 2-3 Skill suggestions to choose from.
33
+
34
+ ## 🌳 3. Decision Tree
35
+ ```text
36
+ Is the task a massive project (e.g., "Build an Admin Dashboard")?
37
+ ├── YES Break it down:
38
+ │ 1. `qk-project-bootstrap` (Setup)
39
+ │ 2. `qk-data-lifecycle` (DB Schema)
40
+ │ 3. `qk-api-lifecycle` (Endpoints)
41
+ │ 4. `qk-feature-delivery` (UI).
42
+ └── NO → Delegate to the single most appropriate skill.
43
+ ```
44
+
45
+ ## 🤝 4. Handoff Pipeline
46
+ 1. `delegate`: Call the target Skill.
47
+
48
+ ## 📝 5. Output Format
49
+ Vui lòng trả kết quả bằng Tiếng Việt.
50
+ - **Tóm tắt (Summary):** Đã phân tích xong yêu cầu của User.
51
+ - **Quyết định điều phối (Reasoning):** Giao việc cho Skill nào.
52
+ - **Hành động tiếp (Next Action):** Tự động chuyển vai trò sang Skill được chọn.
@@ -1,33 +1,52 @@
1
- ---
2
- name: qk-policy-engine
3
- purpose: Động cơ xét duyệt chính sách, đảm bảo tác vụ hợp lệ trước khi thực thi.
4
- mode_supported: [enterprise]
5
- input: [Task request]
6
- output: [Policy validation result]
7
- workflow: [1. Đọc chính sách -> 2. Đối chiếu request -> 3. Phê duyệt/Từ chối]
8
- allowed_tools: [read_file]
9
- handoff_to: [qk-access-policy]
10
- ---
11
-
12
- # 🛠️ qk-policy-engine - Quy Trình Vận Hành Chuẩn (SOP)
13
-
14
- > **Mô tả:** Động cơ xét duyệt chính sách, đảm bảo tác vụ hợp lệ trước khi thực thi.
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 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-access-policy`
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.
1
+ ---
2
+ name: qk-policy-engine
3
+ version: 3.0.0
4
+ updated: 2026-07-02
5
+ description: Policy evaluation engine to ensure actions are authorized and safe.
6
+ category: security
7
+ priority: high
8
+ tags: [security, policy, guardrails, authorization]
9
+ platforms: [claude-code, cursor, windsurf, gemini-cli]
10
+ trigger: User asks to perform a high-risk destructive action (e.g., DROP table, mass delete).
11
+ inputs: [Requested Action, Context]
12
+ outputs: [Approval/Denial, Policy violations]
13
+ allowed_tools: [read_file]
14
+ pipeline: [analyze, evaluate, complete]
15
+ ---
16
+
17
+ # 🛠️ qk-policy-engine - Standard Operating Procedure
18
+
19
+ > **Goal:** Đóng vai trò là "Bộ quy tắc thép" (Policy Enforcer). Ngăn chặn các lệnh sai lầm có thể phá hoại hệ thống.
20
+
21
+ ## 🔄 1. Chain of Thought (SOP)
22
+ 1. **Analyze (Risk Assessment):**
23
+ - Classify the user's request (Low, Medium, High risk).
24
+ - High Risk: Dropping databases, deleting multiple files, force-pushing to `main`.
25
+ 2. **Evaluate (Policy Check):**
26
+ - Load security policies (from `.agents/AGENTS.md` or `.cursorrules`).
27
+ - Check if the action violates any safety constraints.
28
+ 3. **Complete (Decision):**
29
+ - Approve (Allow execution) or Deny (Block execution) with explicit reasons.
30
+
31
+ ## 🛡️ 2. Constraints & Rules
32
+ - **Deny by Default:** If an action is highly destructive and no backup plan exists, DENY it.
33
+ - **Override:** Only allow skipping the policy if the user explicitly passes an `--override` flag in their prompt.
34
+
35
+ ## 🌳 3. Decision Tree
36
+ ```text
37
+ Does the action involve deleting data or resources in Production?
38
+ ├── YES → Has the user provided a backup confirmation?
39
+ │ ├── YES → Approve.
40
+ │ └── NO → DENY and request backup confirmation.
41
+ └── NO → Approve.
42
+ ```
43
+
44
+ ## 🤝 4. Handoff Pipeline
45
+ 1. `complete`: Generate the Policy Decision Report.
46
+
47
+ ## 📝 5. Output Format
48
+ Vui lòng trả kết quả bằng Tiếng Việt.
49
+ - **Tóm tắt (Summary):** Mức độ rủi ro (Risk Level).
50
+ - **Phán quyết (Decision):** ✅ APPROVED hoặc ❌ DENIED.
51
+ - **Nguyên nhân (Reasoning):** Vi phạm chính sách nào (nếu bị Deny).
52
+ - **Hành động tiếp (Next Action):** ...
@@ -1,127 +1,45 @@
1
- ---
2
- name: qk-production-release
3
- purpose: Build, CI/CD, Deploy, Observability, Security Release.
4
- mode_supported: [enterprise]
5
- input: [Release candidate]
6
- output: [Production deployment]
7
- workflow: [1. Build -> 2. CI -> 3. Deploy -> 4. Observe -> 5. Security Audit]
8
- allowed_tools: [run_command]
9
- handoff_to: [none]
10
- ---
11
-
12
- # 🛠️ qk-production-release - Quy Trình Vận Hành Chuẩn (SOP)
13
-
14
- > **Mô tả:** Build, CI/CD, Deploy, Observability, Security Release.
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 ).
30
-
31
- ## 🤝 4. Giao Thức Bàn Giao (Handoff Protocol)
32
- - Đích đến: `none`
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
- # Deployment & DevOps
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 "how do I deploy this?", "create a Dockerfile", or "setup CI/CD"
56
- - Configuring GitHub Actions, GitLab CI, or Jenkins
57
- - Preparing a project for Vercel, Netlify, Render, or AWS
58
- - Setting up environment variables for production
59
-
60
- ---
61
-
62
- ## Scope
63
-
64
- - ✅ **Containerization:** Write `Dockerfile` and `docker-compose.yml`.
65
- - ✅ **CI/CD Pipelines:** Write GitHub Actions YAML for testing, building, and deploying.
66
- - ✅ **Environment Setup:** Create `.env.example` and document required production variables.
67
- - ✅ **Build Scripts:** Ensure `package.json` has correct build and start commands.
68
-
69
- ---
70
-
71
- ## Non-goals
72
-
73
- - ❌ Do NOT expose real production secrets. Always use placeholders or CI secrets.
74
- - ❌ Do NOT over-complicate (e.g., don't setup Kubernetes if a simple Docker container on a VPS is enough).
75
-
76
- ---
77
-
78
- ## Workflow
79
-
80
- ### Phase 1 — Platform Selection
81
-
82
- Ask the user where they are deploying (if not specified):
83
- 1. **PaaS (Vercel, Render, Heroku):** Very easy, mostly relies on `vercel.json` or standard build scripts. No Docker needed usually.
84
- 2. **VPS/VM (DigitalOcean, AWS EC2):** Needs Docker and/or PM2 + Nginx reverse proxy.
85
- 3. **Container Service (AWS ECS, Google Cloud Run):** Needs a highly optimized Dockerfile.
86
-
87
- ### Phase 2 — Containerization (If required)
88
-
89
- Create a multi-stage Dockerfile for minimal image size:
90
- 1. `deps` stage: Install dependencies.
91
- 2. `builder` stage: Build the app.
92
- 3. `runner` stage: Copy only the built assets and prod modules, start the app.
93
-
94
- ### Phase 3 — CI/CD Pipeline
95
-
96
- Create `.github/workflows/deploy.yml`:
97
- - Trigger on `push` to `main`.
98
- - Job 1: Setup Node/Python/Go, install deps, run tests, run linter.
99
- - Job 2: Build image and push to registry, or deploy to PaaS.
100
-
101
- ### Phase 4 — Environment Variables
102
-
103
- Audit the codebase for `process.env.XYZ` and create a `.env.example` file listing every required variable.
104
-
105
- ---
106
-
107
- ## Output Format
108
-
109
- ```
110
- 🚀 Deployment Plan
111
- ─────────────────────────────────────────────────
112
- Target: [Vercel / Docker VPS / AWS]
113
- Tooling: [GitHub Actions, Docker]
114
-
115
- Files Created/Modified:
116
- ✅ `Dockerfile` (Multi-stage build)
117
- ✅ `.github/workflows/deploy.yml`
118
- ✅ `.env.example`
119
-
120
- ⚠️ Prerequisites:
121
- Before deploying, you must set these secrets in GitHub Actions:
122
- - `DOCKER_USERNAME`
123
- - `DATABASE_URL`
124
-
125
- 🔗 Next Steps:
126
- Commit these files and push to `main` to trigger the pipeline.
127
- ```
1
+ ---
2
+ name: qk-production-release
3
+ version: 3.0.0
4
+ updated: 2026-07-02
5
+ description: Prepare the codebase for a production release (Build, CI/CD, Security).
6
+ category: operations
7
+ priority: high
8
+ tags: [deploy, release, build, production]
9
+ platforms: [claude-code, cursor, windsurf, gemini-cli]
10
+ trigger: User asks to deploy the app, build for production, or release a new version.
11
+ inputs: [Release request, Environment configs]
12
+ outputs: [Deployment artifacts, Release checklist]
13
+ allowed_tools: [run_command, grep_search]
14
+ pipeline: [analyze, review, implement, validate, complete]
15
+ ---
16
+
17
+ # 🛠️ qk-production-release - Standard Operating Procedure
18
+
19
+ > **Goal:** Chuẩn bị gói phần mềm để đẩy lên môi trường Production an toàn và tối ưu nhất (Minified, Tree-shaked).
20
+
21
+ ## 🔄 1. Chain of Thought (SOP)
22
+ 1. **Analyze (Pre-flight Checks):**
23
+ - Check if the git branch is clean.
24
+ - Verify environment variables are documented.
25
+ 2. **Implement (Build & Optimize):**
26
+ - Run `npm run build`.
27
+ 3. **Validate (Security Gate):**
28
+ - Scan the build output (e.g., `dist/` or `.next/`) for leaked API Keys (`grep_search`).
29
+ 4. **Complete (Deployment Plan):**
30
+ - Provide a manual checklist for the user to execute the final deployment.
31
+
32
+ ## 🛡️ 2. Constraints & Rules
33
+ - **No Rogue Deploys:** Never run commands like `firebase deploy` or `vercel --prod` without explicit, undeniable user approval.
34
+ - **Secret Safety:** Never hardcode URLs. Ensure they are injected via ENV.
35
+
36
+ ## 🤝 3. Handoff Pipeline
37
+ 1. `validate`: Run security sweep on the build output.
38
+ 2. `complete`: Output the Release Report.
39
+
40
+ ## 📝 4. Output Format
41
+ Vui lòng trả kết quả bằng Tiếng Việt.
42
+ - **Tóm tắt (Summary):** Trạng thái Build.
43
+ - **Chi tiết (Changes):** Dung lượng Bundle (Bundle size optimization).
44
+ - **Rủi ro (Risks):** Có lộ secret không.
45
+ - **Hành động tiếp (Next Action):** Checklist để user tự Deploy.