ai-developer-skill-os 1.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +142 -0
  4. package/_template/SKILL.md +154 -0
  5. package/_template/examples/example-en.md +49 -0
  6. package/_template/examples/example-vi.md +49 -0
  7. package/bin/install.js +56 -0
  8. package/docs/CHI_TIET_SKILLS.md +117 -0
  9. package/docs/HUONG_DAN_SU_DUNG.md +102 -0
  10. package/package.json +34 -0
  11. package/skills/backend/auth-security/SKILL.md +94 -0
  12. package/skills/backend/backend-architecture/SKILL.md +123 -0
  13. package/skills/backend/database-engineer/SKILL.md +102 -0
  14. package/skills/backend/deployment/SKILL.md +94 -0
  15. package/skills/engineering/agent-orchestrator/SKILL.md +177 -0
  16. package/skills/engineering/api-integration/SKILL.md +378 -0
  17. package/skills/engineering/bug-fix/SKILL.md +211 -0
  18. package/skills/engineering/context-manager/SKILL.md +174 -0
  19. package/skills/engineering/git-engineer/SKILL.md +302 -0
  20. package/skills/engineering/migration/SKILL.md +282 -0
  21. package/skills/engineering/project-audit/SKILL.md +278 -0
  22. package/skills/engineering/refactor/SKILL.md +220 -0
  23. package/skills/frontend/accessibility-audit/SKILL.md +119 -0
  24. package/skills/frontend/component-generator/SKILL.md +134 -0
  25. package/skills/frontend/design-system/SKILL.md +135 -0
  26. package/skills/frontend/form-builder/SKILL.md +138 -0
  27. package/skills/frontend/frontend-architecture/SKILL.md +153 -0
  28. package/skills/frontend/frontend-debug/SKILL.md +131 -0
  29. package/skills/frontend/frontend-performance/SKILL.md +127 -0
  30. package/skills/frontend/frontend-testing/SKILL.md +144 -0
  31. package/skills/frontend/state-management/SKILL.md +138 -0
  32. package/skills/frontend/table-crud-generator/SKILL.md +125 -0
  33. package/skills/frontend/ui-builder/SKILL.md +150 -0
  34. package/skills.json +667 -0
@@ -0,0 +1,102 @@
1
+ # Hướng Dẫn Sử Dụng — AI Developer Skill OS
2
+
3
+ **Tác giả:** Quang Khánh
4
+ **Phiên bản:** v1.0.0
5
+
6
+ Chào mừng bạn đến với **AI Developer Skill OS**, bộ khung quản lý kỹ năng (Skill Framework) biến các trợ lý AI (Claude Code, Kilo Code, Antigravity, Cursor, Windsurf) từ một "cỗ máy sinh code" thành một Senior Software Engineer thực thụ.
7
+
8
+ ---
9
+
10
+ ## 1. Cơ chế hoạt động (Tại sao lại cần Skin/Skill này?)
11
+
12
+ Thông thường, khi bạn yêu cầu AI "Làm cho tôi tính năng X", AI sẽ nhảy ngay vào viết code. Điều này ở các dự án lớn thường dẫn đến: phá vỡ kiến trúc, tạo ra code rác, và không tuân thủ các component dùng chung.
13
+
14
+ Với hệ điều hành kỹ năng (Skill OS) này:
15
+ 1. Bạn đưa ra yêu cầu.
16
+ 2. Skill **agent-orchestrator** sẽ tiếp nhận, phân tích và lên kế hoạch (Plan only).
17
+ 3. Nó gọi **context-manager** để đọc đúng những file cần thiết (chống tràn ngữ cảnh).
18
+ 4. Nó gọi các skill chuyên biệt (`ui-builder`, `api-integration`, `database-engineer`...) để thực thi từng bước.
19
+ 5. AI luôn bị ép phải dùng tiếng Anh để viết code/định nghĩa biến, nhưng sẽ dùng tiếng Việt để giao tiếp và báo cáo với bạn.
20
+
21
+ ---
22
+
23
+ ## 2. Hướng dẫn cài đặt
24
+
25
+ Bộ Skin này rất linh hoạt và có thể được tích hợp vào hầu hết các AI Agent IDE hiện đại:
26
+
27
+ ### Cho Antigravity / Gemini IDE
28
+ Bạn cần copy thư mục chứa các skill này vào thư mục `.agents` của dự án:
29
+ ```
30
+ my-project/
31
+ └── .agents/
32
+ └── skills/
33
+ ├── engineering/
34
+ ├── frontend/
35
+ └── backend/
36
+ ```
37
+ Hoặc cấu hình Global trong máy tính của bạn tại:
38
+ `C:\Users\<Tên-Máy-Bạn>\.gemini\config\skills\`
39
+
40
+ ### Cho Claude Code & Kilo Code (CLI AI Agents)
41
+ Claude Code và Kilo Code đọc các quy tắc (rules) từ thư mục gốc của dự án.
42
+ **Cách cài đặt:**
43
+ 1. Copy toàn bộ thư mục `rules-skill/` vào gốc dự án của bạn.
44
+ 2. Tạo (hoặc sửa) file `CLAUDE.md` (đối với Claude) hoặc `KILO.md` (đối với Kilo) ở thư mục gốc, dán nội dung sau vào:
45
+
46
+ ```md
47
+ # System Instructions
48
+ Bạn đang chạy bằng **AI Developer Skill OS** (Tác giả: Quang Khánh).
49
+
50
+ Vui lòng tìm đọc danh sách kỹ năng tại file `./rules-skill/skills.json`.
51
+ Trước khi thực hiện bất kỳ yêu cầu nào, hãy gọi file `SKILL.md` tương ứng trong thư mục `./rules-skill/skills/` để biết quy trình làm việc chuẩn.
52
+ Luôn giao tiếp bằng tiếng Việt nhưng viết code, đặt tên biến, comment trong code bằng tiếng Anh.
53
+ ```
54
+
55
+ ### Cho Cursor / Windsurf (AI Code Editors)
56
+ Cursor và Windsurf sử dụng file quy tắc riêng biệt.
57
+ **Cách cài đặt:**
58
+ 1. Copy toàn bộ thư mục `rules-skill/` vào gốc dự án của bạn.
59
+ 2. Mở file `.cursorrules` (với Cursor) hoặc `.windsurfrules` (với Windsurf), dán nội dung sau vào:
60
+
61
+ ```md
62
+ # AI Developer Skill OS by Quang Khánh
63
+
64
+ When answering or generating code, you MUST act as an expert engineer using the skills defined in `./rules-skill/skills.json`.
65
+ Always read the relevant `SKILL.md` from `./rules-skill/skills/` before providing a solution.
66
+ Speak to me in Vietnamese, but write all code in English.
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 3. Cách tương tác với AI
72
+
73
+ Vì AI giờ đây đã có "nghề" (Skill), bạn không cần phải prompt quá dài dòng. Hãy ra lệnh như giao việc cho một kỹ sư.
74
+
75
+ **Ví dụ 1: Nhờ AI tự lên kế hoạch (Kích hoạt `agent-orchestrator`)**
76
+ > "Quang Khánh ơi, dự án này đang cần thêm tính năng Đăng nhập. Cậu lên kế hoạch giúp mình nên làm gì trước nhé."
77
+
78
+ **Ví dụ 2: Sửa lỗi (Kích hoạt `bug-fix`)**
79
+ > "Bị lỗi Hydration error trên Next.js rồi. Fix giúp mình."
80
+
81
+ **Ví dụ 3: Review Codebase (Kích hoạt `project-audit`)**
82
+ > "Audit nhanh cho tôi thư mục `src/components/`, tìm xem có bị vấn đề về hiệu năng hay code smell không."
83
+
84
+ **Ví dụ 4: Frontend UI (Kích hoạt `ui-builder` + `design-system`)**
85
+ > "Làm cho tôi cái giao diện màn hình Danh sách User. Chú ý dùng chuẩn components của thư mục `src/components/ui/` nhé."
86
+
87
+ **Ví dụ 5: Tích hợp API (Kích hoạt `api-integration`)**
88
+ > "Tích hợp cái swagger login này vào frontend giúp. Nhớ dùng React Query như chuẩn của project."
89
+
90
+ ---
91
+
92
+ ## 4. Tùy chỉnh Skin (Dành cho Advanced User)
93
+
94
+ Nếu bạn muốn thêm kỹ năng mới cho AI, hãy sử dụng mẫu (Template) đã được tác giả chuẩn bị sẵn:
95
+ 1. Copy file từ thư mục `_template/SKILL.md`.
96
+ 2. Chỉnh sửa các thông số: Name, Description, Trigger, Scope, v.v.
97
+ 3. Đăng ký nó vào file `skills.json` ở gốc.
98
+ 4. Tận hưởng AI với kỹ năng mới của riêng bạn!
99
+
100
+ ---
101
+
102
+ Để xem danh sách chi tiết và công dụng của từng skill, vui lòng xem [Chi Tiết Skills](CHI_TIET_SKILLS.md).
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "ai-developer-skill-os",
3
+ "version": "1.0.0",
4
+ "description": "Multi-agent skill package cho AI coding agents (Claude, Cursor, Windsurf, Antigravity) với 23 skills chuyên nghiệp.",
5
+ "main": "bin/install.js",
6
+ "bin": {
7
+ "ai-developer-skill-os": "bin/install.js",
8
+ "ai-skill": "bin/install.js"
9
+ },
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/phamquangkhanh2999/ai-developer-skill-os.git"
16
+ },
17
+ "keywords": [
18
+ "ai",
19
+ "claude",
20
+ "cursor",
21
+ "windsurf",
22
+ "skills",
23
+ "developer",
24
+ "agent",
25
+ "prompts",
26
+ "framework"
27
+ ],
28
+ "author": "Quang Khánh",
29
+ "license": "MIT",
30
+ "bugs": {
31
+ "url": "https://github.com/phamquangkhanh2999/ai-developer-skill-os/issues"
32
+ },
33
+ "homepage": "https://github.com/phamquangkhanh2999/ai-developer-skill-os#readme"
34
+ }
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: auth-security
3
+ description: >-
4
+ Triển khai tính năng đăng nhập (JWT, OAuth), phân quyền (RBAC) và bảo vệ app khỏi các lỗ hổng OWASP.
5
+ version: 1.0.0
6
+ category: backend
7
+ tags: [auth, security, jwt, oauth, rbac, owasp]
8
+ platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
9
+ ---
10
+
11
+ # Auth & Security Engineer
12
+
13
+ > **Language rule:**
14
+ > Use **English** for: security protocols, tokens, headers, algorithms, code.
15
+ > Use **the user's language** for: explanations, summaries, and questions.
16
+
17
+ ---
18
+
19
+ ## Trigger
20
+
21
+ Activate this skill when:
22
+ - User asks to "add login", "protect this route", or "implement OAuth"
23
+ - Defining user roles and permissions (Admin vs User)
24
+ - Project audit flags security vulnerabilities (P0/P1)
25
+ - Handling sensitive data (passwords, PII, API keys)
26
+
27
+ ---
28
+
29
+ ## Scope
30
+
31
+ - ✅ **Authentication:** JWT, Session Cookies, OAuth2 (Google, GitHub, etc.), Magic Links.
32
+ - ✅ **Authorization:** Role-Based Access Control (RBAC), Middleware guards.
33
+ - ✅ **Data Protection:** Hashing passwords (bcrypt, Argon2), encrypting sensitive fields.
34
+ - ✅ **Vulnerability Prevention:** CSRF protection, Rate Limiting, CORS config, input sanitization (SQLi/XSS).
35
+
36
+ ---
37
+
38
+ ## Non-goals
39
+
40
+ - ❌ Do NOT store passwords in plain text. Ever.
41
+ - ❌ Do NOT hardcode secrets or private keys in the code (use `.env`).
42
+ - ❌ Do NOT store JWTs in `localStorage` if cookies (`httpOnly`) are an option, unless explicitly requested.
43
+
44
+ ---
45
+
46
+ ## Workflow
47
+
48
+ ### Phase 1 — Strategy Selection
49
+
50
+ Determine the auth mechanism:
51
+ 1. **Stateless (JWT):** Good for mobile/SPAs, distributed systems.
52
+ 2. **Stateful (Sessions):** Good for traditional web apps, easier revocation.
53
+ 3. **Third-party (OAuth / Auth0 / NextAuth / Supabase):** Offload auth complexity.
54
+
55
+ ### Phase 2 — Implementation
56
+
57
+ **For JWT + Cookies (Recommended Web Pattern):**
58
+ 1. Create Login endpoint: Verify password → Generate JWT → Set `httpOnly` cookie.
59
+ 2. Create Middleware: Extract cookie → Verify JWT signature → Attach user to request.
60
+ 3. Create Logout endpoint: Clear the cookie.
61
+
62
+ **For Authorization:**
63
+ 1. Define roles (e.g., `enum Role { ADMIN, USER }`).
64
+ 2. Create Role Middleware: Check `req.user.role`.
65
+
66
+ ### Phase 3 — Security Audit
67
+
68
+ Verify:
69
+ - Passwords are hashed with a salt (e.g., `bcrypt.hash(password, 10)`).
70
+ - Cookies are `httpOnly`, `Secure` (in prod), and `SameSite`.
71
+ - CORS is configured to only allow trusted origins.
72
+
73
+ ---
74
+
75
+ ## Output Format
76
+
77
+ ```
78
+ 🛡️ Auth & Security Report
79
+ ─────────────────────────────────────────────────
80
+ Mechanism: [JWT in httpOnly Cookie / OAuth / Session]
81
+ Roles: [Admin, User]
82
+
83
+ Components Implemented:
84
+ ✅ Login/Logout handlers
85
+ ✅ Auth Middleware (Guard)
86
+ ✅ Password hashing (bcrypt)
87
+
88
+ Security measures enforced:
89
+ • `httpOnly`, `Secure`, `SameSite=Strict` on cookies
90
+ • CORS restricted to frontend origin
91
+
92
+ 🔗 Next Steps:
93
+ Remember to add `JWT_SECRET` to your production environment variables.
94
+ ```
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: backend-architecture
3
+ description: >-
4
+ Kiểm soát cấu trúc backend, ép buộc tuân thủ mô hình Layer (Controller/Service/Repository) và vị trí file.
5
+ version: 1.0.0
6
+ category: backend
7
+ tags: [architecture, backend, controller, service, repository, structure]
8
+ platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
9
+ ---
10
+
11
+ # Backend Architecture
12
+
13
+ > **Language rule:**
14
+ > Use **English** for: code, folder names, pattern names, technical rules.
15
+ > Use **the user's language** for: explanations, summaries, and questions.
16
+
17
+ ---
18
+
19
+ ## Trigger
20
+
21
+ Activate this skill when:
22
+ - Creating new backend API endpoints, services, or models
23
+ - User asks "where should I put this business logic?"
24
+ - Project audit flags mixed concerns (e.g., SQL queries inside a controller)
25
+ - Inheriting or setting up a Node.js, Python, or Go backend
26
+
27
+ ---
28
+
29
+ ## Scope
30
+
31
+ - ✅ Discover existing backend folder structure
32
+ - ✅ Enforce Layered Architecture (Controller → Service → Data Access)
33
+ - ✅ Enforce Domain/Module-based structure if applicable (`src/users/`, `src/orders/`)
34
+ - ✅ Define where validation, mapping, and error handling should live
35
+ - ✅ Validate file placement before code generation
36
+
37
+ ---
38
+
39
+ ## Non-goals
40
+
41
+ - ❌ Do NOT rewrite the architecture unless requested
42
+ - ❌ Do NOT write the actual database queries (delegate to `database-engineer`)
43
+ - ❌ Do NOT configure server infrastructure (delegate to `deployment`)
44
+
45
+ ---
46
+
47
+ ## Severity Levels
48
+
49
+ | Level | Meaning |
50
+ |-------|---------|
51
+ | P0 | Circular dependency or security bypass in architecture |
52
+ | P1 | Mixed concerns (e.g., ORM logic in route handler) |
53
+ | P2 | Inconsistent folder or file naming |
54
+ | P3 | Minor deviation from convention |
55
+
56
+ ---
57
+
58
+ ## Workflow
59
+
60
+ ### Phase 1 — Architecture Discovery
61
+
62
+ Analyze the project structure:
63
+ 1. **Classic MVC / Layered:** `controllers/`, `services/`, `models/`, `routes/`
64
+ 2. **Domain-Driven (Module):** `src/modules/user/{controller, service, repository}`
65
+ 3. **Framework-specific:** NestJS (`.controller.ts`, `.service.ts`), Django apps, Express monolithic.
66
+ 4. **Serverless:** `functions/`, `handlers/`
67
+
68
+ ---
69
+
70
+ ### Phase 2 — Rule Extraction
71
+
72
+ Extract conventions:
73
+ - **Routes/Controllers:** Should only handle HTTP req/res, params validation, and calling services. No business logic.
74
+ - **Services:** Pure business logic. Does not know about HTTP (`req`/`res`).
75
+ - **Repositories/Data Access:** Only layer that interacts with the DB.
76
+ - **Error Handling:** Centralized error middleware vs local try/catch.
77
+
78
+ ---
79
+
80
+ ### Phase 3 — File Placement & Routing
81
+
82
+ Map a new requirement to the architecture:
83
+
84
+ *Request: "Add an endpoint to update user profile"*
85
+ - Route: `PUT /api/users/:id` mapped in `src/routes/user.routes.ts`
86
+ - Controller: `updateProfile(req, res)` in `src/controllers/user.controller.ts`
87
+ - Service: `updateUserProfile(userId, data)` in `src/services/user.service.ts`
88
+
89
+ ---
90
+
91
+ ## Decision Tree
92
+
93
+ ```
94
+ Does the project group files by Layer or by Domain?
95
+ ├── Layer → Place in `src/controllers/` and `src/services/`
96
+ └── Domain → Place in `src/modules/users/`
97
+
98
+ Where does data validation happen?
99
+ ├── Middleware → Add Zod/Joi validation at the router level
100
+ └── Controller → Validate inside the controller function before calling service
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Output Format
106
+
107
+ ```
108
+ 🏗️ Backend Architecture Plan
109
+ ─────────────────────────────────────────────────
110
+ Structure Type: [Layered / Domain-based / Framework-specific]
111
+
112
+ Layer Mapping:
113
+ ✅ Controller: [path/to/controller.ts] — handles HTTP
114
+ ✅ Service: [path/to/service.ts] — business logic
115
+ ✅ Repo/DB: [handled by database-engineer]
116
+
117
+ ⚠️ Constraints enforced:
118
+ • Do not pass `req` or `res` objects into the Service layer.
119
+ • Validate all inputs at the Controller/Route level.
120
+
121
+ 🔗 Next Steps:
122
+ Proceeding to implement the layers.
123
+ ```
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: database-engineer
3
+ description: >-
4
+ Thiết kế database schema, viết script migration và tối ưu truy vấn cho SQL/NoSQL bằng ORM (Prisma, Drizzle...).
5
+ version: 1.0.0
6
+ category: backend
7
+ tags: [database, sql, prisma, drizzle, schema, migration, query-optimization]
8
+ platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
9
+ ---
10
+
11
+ # Database Engineer
12
+
13
+ > **Language rule:**
14
+ > Use **English** for: table names, columns, queries, ORM code, technical terms.
15
+ > Use **the user's language** for: explanations, summaries, and questions.
16
+
17
+ ---
18
+
19
+ ## Trigger
20
+
21
+ Activate this skill when:
22
+ - User says "create a new table", "add a column", "design the schema"
23
+ - Writing complex data retrieval logic (joins, aggregations)
24
+ - A query is running slowly and needs optimization (indexing)
25
+ - Running or generating database migrations
26
+
27
+ ---
28
+
29
+ ## Scope
30
+
31
+ - ✅ **Schema Design:** Model tables, relations (1:1, 1:N, N:M), and constraints (Unique, FK).
32
+ - ✅ **ORM Integration:** Generate code for Prisma, Drizzle, TypeORM, Sequelize, or Mongoose.
33
+ - ✅ **Migrations:** Generate SQL or ORM migration files safely.
34
+ - ✅ **Query Optimization:** Prevent N+1 queries, add indexes, use efficient aggregations.
35
+
36
+ ---
37
+
38
+ ## Non-goals
39
+
40
+ - ❌ Do NOT execute destructive migrations (DROP TABLE) on production environments without extreme warnings and approval.
41
+ - ❌ Do NOT mix raw SQL into ORM logic unless necessary for performance.
42
+
43
+ ---
44
+
45
+ ## Workflow
46
+
47
+ ### Phase 1 — Schema Design
48
+
49
+ Understand the business entities and relations.
50
+ - Identify primary keys (UUID vs Auto-increment ID).
51
+ - Identify foreign keys and cascade rules (`ON DELETE CASCADE`).
52
+ - Ensure proper normalization (usually 3NF) or denormalization (if NoSQL).
53
+
54
+ ### Phase 2 — ORM / Migration Generation
55
+
56
+ Map the design to the project's tool:
57
+ - **Prisma:** Update `schema.prisma`.
58
+ - **Drizzle:** Update `schema.ts`.
59
+ - **Raw SQL:** Write `V1__create_table.sql`.
60
+
61
+ ### Phase 3 — Query Implementation
62
+
63
+ Write the data access methods (Repository pattern or direct ORM calls).
64
+ - Avoid fetching `SELECT *` if only 2 columns are needed.
65
+ - Batch queries or use joins to prevent N+1 issues.
66
+
67
+ ---
68
+
69
+ ## Decision Tree
70
+
71
+ ```
72
+ Is the project using an ORM?
73
+ ├── Prisma → Modify `schema.prisma`, use `prisma.entity.findMany()`
74
+ ├── Drizzle → Modify schema TS files, use Drizzle query builder
75
+ └── No → Write raw SQL or use query builder (Knex)
76
+
77
+ Does the schema change drop data or alter existing columns?
78
+ ├── Yes → Flag as High Risk. Provide rollback strategy. Ask for approval.
79
+ └── No → Standard migration (e.g., adding a nullable column).
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Output Format
85
+
86
+ ```
87
+ 🗄️ Database Engineering Report
88
+ ─────────────────────────────────────────────────
89
+ Action: [Schema Update / Query Optimization]
90
+ Tooling: [Prisma / Raw SQL / etc.]
91
+
92
+ Changes:
93
+ ✅ Added model: `User` (1:N with `Post`)
94
+ ✅ Added index on `User.email`
95
+ ✅ Generated query: `getUserWithPosts`
96
+
97
+ ⚠️ Risk Assessment:
98
+ [Low / High — e.g., "Safe addition, no data loss"]
99
+
100
+ 🔗 Next Steps:
101
+ Run `npx prisma migrate dev` to apply these changes locally.
102
+ ```
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: deployment
3
+ description: >-
4
+ Cấu hình CI/CD pipelines, tạo Dockerfile và thiết lập môi trường để deploy lên Vercel, AWS hoặc VPS.
5
+ version: 1.0.0
6
+ category: backend
7
+ tags: [deploy, ci-cd, docker, github-actions, devops, hosting]
8
+ platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
9
+ ---
10
+
11
+ # Deployment & DevOps
12
+
13
+ > **Language rule:**
14
+ > Use **English** for: configuration files, Docker commands, YAML syntax, technical concepts.
15
+ > Use **the user's language** for: explanations, summaries, and questions.
16
+
17
+ ---
18
+
19
+ ## Trigger
20
+
21
+ Activate this skill when:
22
+ - User asks "how do I deploy this?", "create a Dockerfile", or "setup CI/CD"
23
+ - Configuring GitHub Actions, GitLab CI, or Jenkins
24
+ - Preparing a project for Vercel, Netlify, Render, or AWS
25
+ - Setting up environment variables for production
26
+
27
+ ---
28
+
29
+ ## Scope
30
+
31
+ - ✅ **Containerization:** Write `Dockerfile` and `docker-compose.yml`.
32
+ - ✅ **CI/CD Pipelines:** Write GitHub Actions YAML for testing, building, and deploying.
33
+ - ✅ **Environment Setup:** Create `.env.example` and document required production variables.
34
+ - ✅ **Build Scripts:** Ensure `package.json` has correct build and start commands.
35
+
36
+ ---
37
+
38
+ ## Non-goals
39
+
40
+ - ❌ Do NOT expose real production secrets. Always use placeholders or CI secrets.
41
+ - ❌ Do NOT over-complicate (e.g., don't setup Kubernetes if a simple Docker container on a VPS is enough).
42
+
43
+ ---
44
+
45
+ ## Workflow
46
+
47
+ ### Phase 1 — Platform Selection
48
+
49
+ Ask the user where they are deploying (if not specified):
50
+ 1. **PaaS (Vercel, Render, Heroku):** Very easy, mostly relies on `vercel.json` or standard build scripts. No Docker needed usually.
51
+ 2. **VPS/VM (DigitalOcean, AWS EC2):** Needs Docker and/or PM2 + Nginx reverse proxy.
52
+ 3. **Container Service (AWS ECS, Google Cloud Run):** Needs a highly optimized Dockerfile.
53
+
54
+ ### Phase 2 — Containerization (If required)
55
+
56
+ Create a multi-stage Dockerfile for minimal image size:
57
+ 1. `deps` stage: Install dependencies.
58
+ 2. `builder` stage: Build the app.
59
+ 3. `runner` stage: Copy only the built assets and prod modules, start the app.
60
+
61
+ ### Phase 3 — CI/CD Pipeline
62
+
63
+ Create `.github/workflows/deploy.yml`:
64
+ - Trigger on `push` to `main`.
65
+ - Job 1: Setup Node/Python/Go, install deps, run tests, run linter.
66
+ - Job 2: Build image and push to registry, or deploy to PaaS.
67
+
68
+ ### Phase 4 — Environment Variables
69
+
70
+ Audit the codebase for `process.env.XYZ` and create a `.env.example` file listing every required variable.
71
+
72
+ ---
73
+
74
+ ## Output Format
75
+
76
+ ```
77
+ 🚀 Deployment Plan
78
+ ─────────────────────────────────────────────────
79
+ Target: [Vercel / Docker VPS / AWS]
80
+ Tooling: [GitHub Actions, Docker]
81
+
82
+ Files Created/Modified:
83
+ ✅ `Dockerfile` (Multi-stage build)
84
+ ✅ `.github/workflows/deploy.yml`
85
+ ✅ `.env.example`
86
+
87
+ ⚠️ Prerequisites:
88
+ Before deploying, you must set these secrets in GitHub Actions:
89
+ - `DOCKER_USERNAME`
90
+ - `DATABASE_URL`
91
+
92
+ 🔗 Next Steps:
93
+ Commit these files and push to `main` to trigger the pipeline.
94
+ ```