vibes-plug 1.0.0 → 2.11.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 (183) hide show
  1. package/.claude/rules/vibes-plug-core.md +32 -0
  2. package/.cursor/rules/vibes-plug-core.mdc +51 -0
  3. package/.cursorrules +42 -0
  4. package/AGENTS.md +96 -0
  5. package/BLUEPRINT.md +309 -125
  6. package/CHANGELOG.md +183 -1
  7. package/CLAUDE.md +70 -0
  8. package/LICENSE +1 -1
  9. package/README.md +641 -263
  10. package/index.js +19 -0
  11. package/package.json +61 -25
  12. package/plugin.json +24 -7
  13. package/scripts/generate_swarm_gif.py +295 -0
  14. package/scripts/install.js +201 -0
  15. package/skills/accessibility-testing-expert/SKILL.md +116 -0
  16. package/skills/ai-cost-token-optimizer/SKILL.md +82 -0
  17. package/skills/ai-evals-benchmark-expert/SKILL.md +188 -0
  18. package/skills/ai-llm-integration-expert/SKILL.md +147 -122
  19. package/skills/ai-media-generation-expert/SKILL.md +172 -0
  20. package/skills/ai-prompt-engineering-expert/SKILL.md +84 -0
  21. package/skills/angular-expert/SKILL.md +148 -0
  22. package/skills/api-design-expert/SKILL.md +316 -309
  23. package/skills/api-gateway-proxy-expert/SKILL.md +81 -0
  24. package/skills/app-analyzer-optimizer/SKILL.md +195 -188
  25. package/skills/apple-ecosystem-expert/SKILL.md +145 -0
  26. package/skills/{asisten_ramah → asisten-ramah}/SKILL.md +7 -1
  27. package/skills/astro-framework-expert/SKILL.md +200 -0
  28. package/skills/async-queue-temporal-expert/SKILL.md +240 -0
  29. package/skills/authentication-identity-expert/SKILL.md +279 -45
  30. package/skills/auto-doc-updater/SKILL.md +219 -203
  31. package/skills/autonomous-chaos-monkey/SKILL.md +63 -0
  32. package/skills/autonomous-red-teamer/SKILL.md +203 -0
  33. package/skills/autonomous-tdd-debugger/SKILL.md +71 -0
  34. package/skills/background-jobs-queue-expert/SKILL.md +235 -0
  35. package/skills/biome-linter-formatter-expert/SKILL.md +89 -0
  36. package/skills/blockchain-web3-expert/SKILL.md +115 -0
  37. package/skills/bootstrap-to-modern/SKILL.md +93 -86
  38. package/skills/brainstorming/SKILL.md +381 -353
  39. package/skills/browser-automation-expert/SKILL.md +222 -0
  40. package/skills/bun-runtime-expert/SKILL.md +7 -1
  41. package/skills/chatbot-messaging-expert/SKILL.md +114 -0
  42. package/skills/ci-cd-devops-architect/SKILL.md +81 -45
  43. package/skills/cloud-hosting-expert/SKILL.md +249 -243
  44. package/skills/coderabbit/SKILL.md +197 -191
  45. package/skills/compliance-gdpr-privacy-expert/SKILL.md +85 -0
  46. package/skills/cron-scheduler-expert/SKILL.md +304 -0
  47. package/skills/data-pipeline-etl-expert/SKILL.md +84 -0
  48. package/skills/data-telemetry-expert/SKILL.md +218 -212
  49. package/skills/data-visualization-expert/SKILL.md +154 -0
  50. package/skills/database-migration-versioning-expert/SKILL.md +90 -0
  51. package/skills/database-orm-expert/SKILL.md +303 -293
  52. package/skills/dependency-upgrade-migrator/SKILL.md +301 -0
  53. package/skills/design-system-architect/SKILL.md +278 -242
  54. package/skills/desktop-electron-expert/SKILL.md +128 -0
  55. package/skills/documentation-site-expert/SKILL.md +59 -0
  56. package/skills/doku-mcp-server/SKILL.md +257 -0
  57. package/skills/doku-payment-gateway/SKILL.md +233 -0
  58. package/skills/domain-driven-design-expert/SKILL.md +82 -0
  59. package/skills/e2e-testing-expert/SKILL.md +320 -314
  60. package/skills/ecommerce-expert/SKILL.md +87 -0
  61. package/skills/edge-serverless-db-expert/SKILL.md +99 -0
  62. package/skills/email-notification-expert/SKILL.md +368 -0
  63. package/skills/error-resilience-expert/SKILL.md +486 -0
  64. package/skills/event-driven-architect/SKILL.md +86 -80
  65. package/skills/feature-flag-analytics-expert/SKILL.md +66 -0
  66. package/skills/file-upload-media-expert/SKILL.md +437 -0
  67. package/skills/firebase-security-expert/SKILL.md +7 -1
  68. package/skills/form-validation-expert/SKILL.md +407 -0
  69. package/skills/fullstack-expert/SKILL.md +260 -201
  70. package/skills/fullstack-expert/references/api_design_guide.md +466 -466
  71. package/skills/fullstack-expert/references/multi_language_backend.md +528 -528
  72. package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -253
  73. package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -326
  74. package/skills/gemini-agent-booster/SKILL.md +142 -104
  75. package/skills/geospatial-maps-expert/SKILL.md +80 -0
  76. package/skills/global-a11y-i18n-expert/SKILL.md +86 -80
  77. package/skills/glsl-shader-expert/SKILL.md +107 -0
  78. package/skills/go-programming-expert/SKILL.md +300 -294
  79. package/skills/graph-rag-knowledge-expert/SKILL.md +159 -0
  80. package/skills/graphql-apollo-expert/SKILL.md +114 -0
  81. package/skills/headless-cms-expert/SKILL.md +181 -0
  82. package/skills/hig/SKILL.md +193 -187
  83. package/skills/js-backend-expert/SKILL.md +218 -191
  84. package/skills/legacy-code-translator/SKILL.md +71 -0
  85. package/skills/local-slm-edge-ai-expert/SKILL.md +167 -0
  86. package/skills/logging-error-tracking-expert/SKILL.md +344 -0
  87. package/skills/mcp-client-orchestrator/SKILL.md +76 -0
  88. package/skills/mcp-server-architect/SKILL.md +226 -126
  89. package/skills/micro-frontend-architect/SKILL.md +112 -0
  90. package/skills/mobile-expo-expert/SKILL.md +191 -185
  91. package/skills/mobile-push-notification-expert/SKILL.md +71 -0
  92. package/skills/modern-css-native-expert/SKILL.md +189 -0
  93. package/skills/monday-design-aesthetic/SKILL.md +72 -66
  94. package/skills/monorepo-architect/SKILL.md +232 -226
  95. package/skills/mpa-orchestrator/SKILL.md +120 -101
  96. package/skills/multi-agent-orchestration/SKILL.md +173 -153
  97. package/skills/multiple-entry-points/SKILL.md +91 -55
  98. package/skills/mvc-expert/SKILL.md +237 -231
  99. package/skills/n8n-automation-expert/SKILL.md +89 -0
  100. package/skills/nextjs-app-router-expert/SKILL.md +148 -0
  101. package/skills/openapi-swagger-codegen-expert/SKILL.md +67 -0
  102. package/skills/payment-gateway-expert/SKILL.md +129 -45
  103. package/skills/pdf-document-generation-expert/SKILL.md +91 -0
  104. package/skills/performance-web-vitals/SKILL.md +337 -331
  105. package/skills/post-quantum-crypto-migrator/SKILL.md +57 -0
  106. package/skills/prd-architect/SKILL.md +206 -190
  107. package/skills/proactive-background-watcher/SKILL.md +68 -0
  108. package/skills/production-ready-hardener/PRODUCTION_READINESS_REPORT.md +67 -0
  109. package/skills/production-ready-hardener/SKILL.md +461 -468
  110. package/skills/production-ready-hardener/references/production_checklist.md +161 -161
  111. package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +881 -875
  112. package/skills/project-context-mapper/SKILL.md +85 -0
  113. package/skills/pwa-offline-first-expert/SKILL.md +185 -0
  114. package/skills/python-programming-expert/SKILL.md +407 -270
  115. package/skills/rate-limit-abuse-prevention/SKILL.md +377 -0
  116. package/skills/realtime-collaboration-expert/SKILL.md +99 -45
  117. package/skills/rich-text-editor-expert/SKILL.md +177 -0
  118. package/skills/rust-programming-expert/SKILL.md +240 -234
  119. package/skills/saas-billing/SKILL.md +382 -376
  120. package/skills/saas-multi-tenant/SKILL.md +256 -236
  121. package/skills/saas-mvp-launcher/SKILL.md +30 -1
  122. package/skills/saas-transformer/SKILL.md +499 -445
  123. package/skills/saas-transformer/references/billing_integration_guide.md +401 -401
  124. package/skills/saas-transformer/references/feature_gating_patterns.md +137 -137
  125. package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -121
  126. package/skills/saas-transformer/scripts/saas_transformation_scanner.py +39 -29
  127. package/skills/scalability-clean-code/SKILL.md +234 -228
  128. package/skills/search-engine-expert/SKILL.md +89 -0
  129. package/skills/secure-fuzz-testing/SKILL.md +7 -1
  130. package/skills/self-evolving-memory-graph/SKILL.md +91 -0
  131. package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -0
  132. package/skills/senior-frontend/SKILL.md +85 -105
  133. package/skills/seo/SKILL.md +258 -224
  134. package/skills/session-context-loader/SKILL.md +83 -0
  135. package/skills/session-handoff-resume/SKILL.md +163 -157
  136. package/skills/{skill_baru → skill-baru}/SKILL.md +177 -146
  137. package/skills/solidjs-expert/SKILL.md +80 -0
  138. package/skills/spa-orchestrator/SKILL.md +306 -287
  139. package/skills/sse-websocket-streaming-expert/SKILL.md +93 -0
  140. package/skills/state-management-expert/SKILL.md +277 -271
  141. package/skills/supabase-migration/SKILL.md +47 -1
  142. package/skills/supabase-security-expert/SKILL.md +248 -242
  143. package/skills/svelte-sveltekit-expert/SKILL.md +91 -0
  144. package/skills/svg-animation-motion-expert/SKILL.md +115 -0
  145. package/skills/tailwind-expert/SKILL.md +139 -187
  146. package/skills/tanstack-query-expert/SKILL.md +204 -198
  147. package/skills/tauri-expert/SKILL.md +7 -1
  148. package/skills/token-saver/SKILL.md +118 -110
  149. package/skills/typescript-expert/SKILL.md +329 -278
  150. package/skills/ui-components-expert/SKILL.md +166 -63
  151. package/skills/ui-ux-pro-max/SKILL.md +221 -200
  152. package/skills/vector-db-rag-expert/SKILL.md +208 -0
  153. package/skills/vibe-code-gardener/SKILL.md +180 -172
  154. package/skills/visual-qa-vision-agent/SKILL.md +71 -0
  155. package/skills/voice-ai-realtime-agent/SKILL.md +202 -0
  156. package/skills/vue-frontend-expert/SKILL.md +132 -0
  157. package/skills/wasm-edge-computing-expert/SKILL.md +97 -0
  158. package/skills/web-3d-graphics-expert/SKILL.md +137 -0
  159. package/skills/web-game-engine-expert/SKILL.md +102 -0
  160. package/skills/web-scraper/SKILL.md +98 -146
  161. package/skills/website-design-cloner/SKILL.md +180 -0
  162. package/skills/webxr-ar-vr-expert/SKILL.md +123 -0
  163. package/skills/wordpress-headless-expert/SKILL.md +144 -0
  164. package/skills/zero-to-prod-orchestrator/SKILL.md +231 -180
  165. package/skills/zero-trust-secret-vault/SKILL.md +88 -0
  166. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  167. package/CONTRIBUTING.md +0 -199
  168. package/SECURITY.md +0 -21
  169. package/banner.png +0 -0
  170. package/skills/senior-fullstack/SKILL.md +0 -167
  171. package/skills/senior-fullstack/references/architecture_patterns.md +0 -160
  172. package/skills/senior-fullstack/references/development_workflows.md +0 -222
  173. package/skills/senior-fullstack/references/tech_stack_guide.md +0 -190
  174. package/skills/senior-fullstack/scripts/code_quality_analyzer.py +0 -114
  175. package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +0 -114
  176. package/skills/senior-fullstack/scripts/project_scaffolder.py +0 -114
  177. package/skills/seo-aeo-landing-page-writer/SKILL.md +0 -97
  178. package/skills/seo-geo/SKILL.md +0 -188
  179. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  180. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  181. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  182. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  183. package/skills/ui_ux_expert/SKILL.md +0 -114
@@ -1,231 +1,237 @@
1
- ---
2
- name: mvc-expert
3
- description: "Expert guidelines to refactor legacy PHP codebases into clean, modern, and scalable MVC-structured projects / Pedoman ahli untuk merefaktor codebase PHP lama menjadi proyek terstruktur MVC yang bersih, modern, dan skalabel."
4
- author: "Antigravity"
5
- ---
6
-
7
- # PHP MVC Expert & Modernization
8
-
9
- [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
-
11
- ---
12
-
13
- <a name="english"></a>
14
- ## English
15
-
16
- ### Description
17
- This skill provides the agent with structured protocols, coding patterns, and architectural guidelines to audit, refactor, and modernize legacy/obsolete PHP codebases (plain spaghetti PHP) into a clean, modern, secure, and scalable Model-View-Controller (MVC) structure adhering to PSR standards and modern PHP (v8.2+) capabilities.
18
-
19
- ### Instructions
20
-
21
- #### 1. Audit Protocol for Legacy PHP
22
- Before writing new structures, run a detailed audit on the legacy files to map out:
23
- - **Routing & Entry Points**: Identify raw `.php` files acting as endpoints (e.g., `about.php`, `contact.php`, `process.php`).
24
- - **Data Access & SQL**: Find inline SQL queries, string-concatenated queries (SQL Injection risks), and direct `mysqli` or `mysql_*` usages.
25
- - **Session & Global State**: Identify direct session mutations (`$_SESSION`), raw cookies, and unchecked global variables (`$_GET`, `$_POST`, `$_REQUEST`).
26
- - **Spaghetti Mixing**: Locate files where database connection, business logic, session validation, and HTML rendering are in a single script.
27
- - **Hardcoded Secrets**: Identify database credentials, API keys, and configurations defined inside individual files.
28
-
29
- #### 2. Modernization Strategy & Composer Setup
30
- Apply a standard project directory structure and initialize dependency management:
31
- - **PSR-4 Autoloading**: Create a `composer.json` file and define namespace mappings:
32
- ```json
33
- {
34
- "autoload": {
35
- "psr-4": {
36
- "App\\": "src/"
37
- }
38
- }
39
- }
40
- ```
41
- - **Standard Directory Structure**:
42
- - `public/`: Single entry point containing `index.php` (Front Controller), assets (CSS, JS), and uploaded files.
43
- - `src/`: Root namespace for MVC structure (`src/Models/`, `src/Controllers/`, `src/Views/`, `src/Core/`).
44
- - `config/`: Database configurations, router configurations, and app configurations.
45
- - `.env` & `.env.example`: Store environment configurations.
46
-
47
- #### 3. Implementing MVC Architecture
48
- Refactor the spaghetti code into distinct MVC layers:
49
- - **Front Controller (Unified Routing)**:
50
- Use a clean routing engine (like AltoRouter or a lightweight custom router) in `public/index.php`. Map all requests through a single file using `.htaccess` or server redirects:
51
- ```php
52
- // public/index.php
53
- require_once __DIR__ . '/../vendor/autoload.php';
54
-
55
- $router = new App\Core\Router();
56
- $router->add('GET', '/', 'HomeController@index');
57
- $router->add('GET', '/users', 'UserController@index');
58
- $router->dispatch($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
59
- ```
60
- - **Models**:
61
- Isolate all database access inside Model classes. Implement prepared statements using PDO:
62
- ```php
63
- namespace App\Models;
64
- use App\Core\Database;
65
- use PDO;
66
-
67
- class User {
68
- private PDO $db;
69
- public function __construct() {
70
- $this->db = Database::getInstance()->getConnection();
71
- }
72
- public function getAll(): array {
73
- $stmt = $this->db->prepare("SELECT id, name, email FROM users ORDER BY name ASC");
74
- $stmt->execute();
75
- return $stmt->fetchAll(PDO::FETCH_ASSOC);
76
- }
77
- }
78
- ```
79
- - **Controllers**:
80
- Extract requests and input parameters, invoke models, and return/render views:
81
- ```php
82
- namespace App\Controllers;
83
- use App\Models\User;
84
-
85
- class UserController {
86
- public function index(): void {
87
- $model = new User();
88
- $users = $model->getAll();
89
- render_view('users/index', ['users' => $users]);
90
- }
91
- }
92
- ```
93
- - **Views**:
94
- Never echo HTML directly in controllers. Implement clean PHP template rendering or integrate a lightweight template engine like Twig. Ensure all HTML output is properly escaped.
95
-
96
- #### 4. Security Enhancements
97
- Integrate the following standard security gates during refactoring:
98
- - **SQL Injection Prevention**: Enforce prepared statements with parameters for every SQL query.
99
- - **XSS Prevention**: Build or use a global escape helper (e.g., `htmlspecialchars($str, ENT_QUOTES, 'UTF-8')`) for all dynamic view output.
100
- - **CSRF Protection**: Generate and validate CSRF tokens for all state-changing requests (`POST`, `PUT`, `DELETE`).
101
- - **Secrets Management**: Load configuration via `.env` files using `vlucas/phpdotenv`.
102
-
103
- #### 5. Leveraging Modern PHP (v8.2+)
104
- Refactor old PHP logic to use modern constructs:
105
- - **Constructor Property Promotion** and **Typed Properties**.
106
- - **Readonly Classes** for immutable service/data classes.
107
- - **Strict Types Declaration**: Add `declare(strict_types=1);` to all class files.
108
-
109
- #### 6. Multi-Page Application (MPA) Approach in a Single Repository
110
- When organizing a project as a Multi-Page Application within a single repository, adhere to the following guidelines:
111
- - **Centralized Routing**: Use the Front Controller (`public/index.php`) to handle all page requests. Route each request to its respective controller and view, ensuring each page load is fully processed on the server side.
112
- - **Shared Layouts & Partials**: Avoid duplicating HTML (headers, footers, navigation). Create a `src/Views/layouts/` directory for base templates and a `src/Views/partials/` directory for reusable UI components. Controllers should inject page-specific content into the base layout.
113
- - **Asset Management**: Store all static assets (CSS, JS, images) in the `public/` directory. Use cache-busting techniques (e.g., appending file modification time `?v=123`) when linking assets in the views.
114
- - **State Management**: Use server-side sessions securely for user authentication, flash messages, and tracking state across full page reloads.
115
-
116
- ### Trigger Conditions
117
- Active whenever the user requests to:
118
- - Modernize a legacy PHP project or spaghetti PHP script.
119
- - Design an MVC architecture or introduce a clean routing pattern in plain PHP.
120
- - Implement object-oriented programming (OOP), Composer namespaces (PSR-4), or clean up database access via PDO in a PHP application.
121
-
122
- ---
123
-
124
- <a name="bahasa-indonesia"></a>
125
- ## Bahasa Indonesia
126
-
127
- ### Deskripsi
128
- Skill ini memberikan protokol terstruktur, pola penulisan kode, dan panduan arsitektur bagi agen untuk melakukan audit, refaktorisasi, dan modernisasi terhadap codebase PHP lama yang usang (Plain Spaghetti PHP) menjadi struktur Model-View-Controller (MVC) yang bersih, modern, aman, dan skalabel yang mematuhi standar PSR serta kemampuan PHP modern (v8.2+).
129
-
130
- ### Instruksi
131
-
132
- #### 1. Protokol Audit Kode PHP Lama
133
- Sebelum membuat struktur baru, jalankan langkah audit terperinci pada file-file proyek lama untuk memetakan:
134
- - **Titik Entri & Routing**: Identifikasi file-file `.php` mentah yang bertindak langsung sebagai endpoint (misal `about.php`, `contact.php`, `process.php`).
135
- - **Akses Data & SQL**: Cari query SQL inline, penggabungan query menggunakan string concatenation (berisiko SQL Injection), dan penggunaan langsung `mysqli` atau `mysql_*`.
136
- - **Session & State Global**: Identifikasi mutasi langsung session (`$_SESSION`), cookie mentah, dan variabel global yang tidak divalidasi (`$_GET`, `$_POST`, `$_REQUEST`).
137
- - **Pencampuran Logika (Spaghetti)**: Temukan file di mana koneksi database, logika bisnis, validasi session, dan render HTML berada dalam satu berkas tunggal.
138
- - **Secret Hardcoded**: Identifikasi kredensial database, API key, dan konfigurasi lainnya yang didefinisikan di dalam file.
139
-
140
- #### 2. Strategi Modernisasi & Konfigurasi Composer
141
- Terapkan struktur direktori proyek standar dan inisialisasi manajemen dependensi:
142
- - **PSR-4 Autoloading**: Buat file `composer.json` dan definisikan pemetaan namespace:
143
- ```json
144
- {
145
- "autoload": {
146
- "psr-4": {
147
- "App\\": "src/"
148
- }
149
- }
150
- }
151
- ```
152
- - **Struktur Direktori Standar**:
153
- - `public/`: Titik entri tunggal yang berisi `index.php` (Front Controller), aset (CSS, JS), serta file upload.
154
- - `src/`: Namespace root untuk struktur MVC (`src/Models/`, `src/Controllers/`, `src/Views/`, `src/Core/`).
155
- - `config/`: Konfigurasi database, konfigurasi router, dan konfigurasi aplikasi.
156
- - `.env` & `.env.example`: Menyimpan konfigurasi environment.
157
-
158
- #### 3. Menerapkan Arsitektur MVC
159
- Refaktorkan kode spageti ke dalam lapisan MVC yang terpisah:
160
- - **Front Controller (Routing Terpusat)**:
161
- Gunakan library routing yang bersih (seperti AltoRouter atau router kustom ringan) di `public/index.php`. Arahkan semua request melalui satu file menggunakan `.htaccess` atau pengalihan server:
162
- ```php
163
- // public/index.php
164
- require_once __DIR__ . '/../vendor/autoload.php';
165
-
166
- $router = new App\Core\Router();
167
- $router->add('GET', '/', 'HomeController@index');
168
- $router->add('GET', '/users', 'UserController@index');
169
- $router->dispatch($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
170
- ```
171
- - **Models**:
172
- Pisahkan semua akses database di dalam kelas Model. Gunakan prepared statements dengan PDO:
173
- ```php
174
- namespace App\Models;
175
- use App\Core\Database;
176
- use PDO;
177
-
178
- class User {
179
- private PDO $db;
180
- public function __construct() {
181
- $this->db = Database::getInstance()->getConnection();
182
- }
183
- public function getAll(): array {
184
- $stmt = $this->db->prepare("SELECT id, name, email FROM users ORDER BY name ASC");
185
- $stmt->execute();
186
- return $stmt->fetchAll(PDO::FETCH_ASSOC);
187
- }
188
- }
189
- ```
190
- - **Controllers**:
191
- Ekstrak request dan parameter input, panggil model, lalu return/render view:
192
- ```php
193
- namespace App\Controllers;
194
- use App\Models\User;
195
-
196
- class UserController {
197
- public function index(): void {
198
- $model = new User();
199
- $users = $model->getAll();
200
- render_view('users/index', ['users' => $users]);
201
- }
202
- }
203
- ```
204
- - **Views**:
205
- Jangan pernah me-render atau menggunakan `echo` HTML langsung di dalam controller. Terapkan render template PHP yang bersih atau gunakan template engine ringan seperti Twig. Pastikan semua output HTML divalidasi dan lolos proses escaping.
206
-
207
- #### 4. Peningkatan Keamanan
208
- Integrasikan filter keamanan standar berikut selama refaktorisasi:
209
- - **Pencegahan SQL Injection**: Wajibkan prepared statements dengan parameter terikat untuk setiap query SQL.
210
- - **Pencegahan XSS**: Buat atau gunakan fungsi helper escape global (misal `htmlspecialchars($str, ENT_QUOTES, 'UTF-8')`) pada setiap output dinamis pada view.
211
- - **Proteksi CSRF**: Hasilkan dan validasi token CSRF untuk setiap request yang mengubah state data (`POST`, `PUT`, `DELETE`).
212
- - **Manajemen Secrets**: Muat konfigurasi via file `.env` menggunakan library `vlucas/phpdotenv`.
213
-
214
- #### 5. Memanfaatkan PHP Modern (v8.2+)
215
- Refaktorkan logika PHP lama agar menggunakan fitur modern:
216
- - **Constructor Property Promotion** dan **Typed Properties** untuk properti kelas.
217
- - **Readonly Classes** untuk kelas layanan atau data yang bersifat immutable (tidak dapat diubah).
218
- - **Deklarasi Strict Types**: Tambahkan `declare(strict_types=1);` di bagian paling atas setiap file kelas.
219
-
220
- #### 6. Pendekatan Multi-Page Application (MPA) dalam Satu Repositori
221
- Saat mengatur proyek sebagai Multi-Page Application di dalam satu repositori, ikuti panduan berikut:
222
- - **Routing Terpusat (Centralized Routing)**: Gunakan Front Controller (`public/index.php`) untuk menangani semua permintaan halaman. Arahkan setiap permintaan ke controller dan view masing-masing, memastikan setiap pemuatan halaman diproses sepenuhnya di sisi server.
223
- - **Layout & Parsial Bersama (Shared Layouts & Partials)**: Hindari duplikasi HTML (header, footer, navigasi). Buat direktori `src/Views/layouts/` untuk template dasar dan direktori `src/Views/partials/` untuk komponen UI yang dapat digunakan kembali. Controller harus menyuntikkan konten spesifik halaman ke dalam layout dasar.
224
- - **Manajemen Aset**: Simpan semua aset statis (CSS, JS, gambar) di direktori `public/`. Gunakan teknik cache-busting (misalnya, menambahkan waktu modifikasi file `?v=123`) saat menautkan aset di dalam view.
225
- - **Manajemen State**: Gunakan session sisi server secara aman untuk autentikasi pengguna, pesan flash, dan melacak state di seluruh proses reload halaman secara penuh.
226
-
227
- ### Kondisi Pemicu
228
- Aktif setiap kali pengguna meminta untuk:
229
- - Memodernisasi proyek PHP lama atau script PHP spageti.
230
- - Merancang arsitektur MVC atau memperkenalkan pola routing yang bersih di plain PHP.
231
- - Menerapkan pemrograman berorientasi objek (OOP), namespace Composer (PSR-4), atau membersihkan akses database via PDO pada aplikasi PHP.
1
+ ---
2
+ name: mvc-expert
3
+ description: "Expert guidelines to refactor legacy PHP codebases into clean, modern, and scalable MVC-structured projects / Pedoman ahli untuk merefaktor codebase PHP lama menjadi proyek terstruktur MVC yang bersih, modern, dan skalabel."
4
+ author: "Roedy Rustam"
5
+ ---
6
+
7
+ # PHP MVC Expert & Modernization
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Orchestration & Integration
17
+ Connects and orchestrates with relevant domain skills like `brainstorming`, `zero-to-prod-orchestrator`, and `project-context-mapper` to ensure cohesive execution.
18
+
19
+ ### Description
20
+ This skill provides the agent with structured protocols, coding patterns, and architectural guidelines to audit, refactor, and modernize legacy/obsolete PHP codebases (plain spaghetti PHP) into a clean, modern, secure, and scalable Model-View-Controller (MVC) structure adhering to PSR standards and modern PHP (v8.2+) capabilities.
21
+
22
+ ### Instructions
23
+
24
+ #### 1. Audit Protocol for Legacy PHP
25
+ Before writing new structures, run a detailed audit on the legacy files to map out:
26
+ - **Routing & Entry Points**: Identify raw `.php` files acting as endpoints (e.g., `about.php`, `contact.php`, `process.php`).
27
+ - **Data Access & SQL**: Find inline SQL queries, string-concatenated queries (SQL Injection risks), and direct `mysqli` or `mysql_*` usages.
28
+ - **Session & Global State**: Identify direct session mutations (`$_SESSION`), raw cookies, and unchecked global variables (`$_GET`, `$_POST`, `$_REQUEST`).
29
+ - **Spaghetti Mixing**: Locate files where database connection, business logic, session validation, and HTML rendering are in a single script.
30
+ - **Hardcoded Secrets**: Identify database credentials, API keys, and configurations defined inside individual files.
31
+
32
+ #### 2. Modernization Strategy & Composer Setup
33
+ Apply a standard project directory structure and initialize dependency management:
34
+ - **PSR-4 Autoloading**: Create a `composer.json` file and define namespace mappings:
35
+ ```json
36
+ {
37
+ "autoload": {
38
+ "psr-4": {
39
+ "App\\": "src/"
40
+ }
41
+ }
42
+ }
43
+ ```
44
+ - **Standard Directory Structure**:
45
+ - `public/`: Single entry point containing `index.php` (Front Controller), assets (CSS, JS), and uploaded files.
46
+ - `src/`: Root namespace for MVC structure (`src/Models/`, `src/Controllers/`, `src/Views/`, `src/Core/`).
47
+ - `config/`: Database configurations, router configurations, and app configurations.
48
+ - `.env` & `.env.example`: Store environment configurations.
49
+
50
+ #### 3. Implementing MVC Architecture
51
+ Refactor the spaghetti code into distinct MVC layers:
52
+ - **Front Controller (Unified Routing)**:
53
+ Use a clean routing engine (like AltoRouter or a lightweight custom router) in `public/index.php`. Map all requests through a single file using `.htaccess` or server redirects:
54
+ ```php
55
+ // public/index.php
56
+ require_once __DIR__ . '/../vendor/autoload.php';
57
+
58
+ $router = new App\Core\Router();
59
+ $router->add('GET', '/', 'HomeController@index');
60
+ $router->add('GET', '/users', 'UserController@index');
61
+ $router->dispatch($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
62
+ ```
63
+ - **Models**:
64
+ Isolate all database access inside Model classes. Implement prepared statements using PDO:
65
+ ```php
66
+ namespace App\Models;
67
+ use App\Core\Database;
68
+ use PDO;
69
+
70
+ class User {
71
+ private PDO $db;
72
+ public function __construct() {
73
+ $this->db = Database::getInstance()->getConnection();
74
+ }
75
+ public function getAll(): array {
76
+ $stmt = $this->db->prepare("SELECT id, name, email FROM users ORDER BY name ASC");
77
+ $stmt->execute();
78
+ return $stmt->fetchAll(PDO::FETCH_ASSOC);
79
+ }
80
+ }
81
+ ```
82
+ - **Controllers**:
83
+ Extract requests and input parameters, invoke models, and return/render views:
84
+ ```php
85
+ namespace App\Controllers;
86
+ use App\Models\User;
87
+
88
+ class UserController {
89
+ public function index(): void {
90
+ $model = new User();
91
+ $users = $model->getAll();
92
+ render_view('users/index', ['users' => $users]);
93
+ }
94
+ }
95
+ ```
96
+ - **Views**:
97
+ Never echo HTML directly in controllers. Implement clean PHP template rendering or integrate a lightweight template engine like Twig. Ensure all HTML output is properly escaped.
98
+
99
+ #### 4. Security Enhancements
100
+ Integrate the following standard security gates during refactoring:
101
+ - **SQL Injection Prevention**: Enforce prepared statements with parameters for every SQL query.
102
+ - **XSS Prevention**: Build or use a global escape helper (e.g., `htmlspecialchars($str, ENT_QUOTES, 'UTF-8')`) for all dynamic view output.
103
+ - **CSRF Protection**: Generate and validate CSRF tokens for all state-changing requests (`POST`, `PUT`, `DELETE`).
104
+ - **Secrets Management**: Load configuration via `.env` files using `vlucas/phpdotenv`.
105
+
106
+ #### 5. Leveraging Modern PHP (v8.2+)
107
+ Refactor old PHP logic to use modern constructs:
108
+ - **Constructor Property Promotion** and **Typed Properties**.
109
+ - **Readonly Classes** for immutable service/data classes.
110
+ - **Strict Types Declaration**: Add `declare(strict_types=1);` to all class files.
111
+
112
+ #### 6. Multi-Page Application (MPA) Approach in a Single Repository
113
+ When organizing a project as a Multi-Page Application within a single repository, adhere to the following guidelines:
114
+ - **Centralized Routing**: Use the Front Controller (`public/index.php`) to handle all page requests. Route each request to its respective controller and view, ensuring each page load is fully processed on the server side.
115
+ - **Shared Layouts & Partials**: Avoid duplicating HTML (headers, footers, navigation). Create a `src/Views/layouts/` directory for base templates and a `src/Views/partials/` directory for reusable UI components. Controllers should inject page-specific content into the base layout.
116
+ - **Asset Management**: Store all static assets (CSS, JS, images) in the `public/` directory. Use cache-busting techniques (e.g., appending file modification time `?v=123`) when linking assets in the views.
117
+ - **State Management**: Use server-side sessions securely for user authentication, flash messages, and tracking state across full page reloads.
118
+
119
+ ### Trigger Conditions
120
+ Active whenever the user requests to:
121
+ - Modernize a legacy PHP project or spaghetti PHP script.
122
+ - Design an MVC architecture or introduce a clean routing pattern in plain PHP.
123
+ - Implement object-oriented programming (OOP), Composer namespaces (PSR-4), or clean up database access via PDO in a PHP application.
124
+
125
+ ---
126
+
127
+ <a name="bahasa-indonesia"></a>
128
+ ## Bahasa Indonesia
129
+
130
+ ### Integrasi Orkestrasi
131
+ Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `project-context-mapper` untuk memastikan eksekusi yang kohesif.
132
+
133
+ ### Deskripsi
134
+ Skill ini memberikan protokol terstruktur, pola penulisan kode, dan panduan arsitektur bagi agen untuk melakukan audit, refaktorisasi, dan modernisasi terhadap codebase PHP lama yang usang (Plain Spaghetti PHP) menjadi struktur Model-View-Controller (MVC) yang bersih, modern, aman, dan skalabel yang mematuhi standar PSR serta kemampuan PHP modern (v8.2+).
135
+
136
+ ### Instruksi
137
+
138
+ #### 1. Protokol Audit Kode PHP Lama
139
+ Sebelum membuat struktur baru, jalankan langkah audit terperinci pada file-file proyek lama untuk memetakan:
140
+ - **Titik Entri & Routing**: Identifikasi file-file `.php` mentah yang bertindak langsung sebagai endpoint (misal `about.php`, `contact.php`, `process.php`).
141
+ - **Akses Data & SQL**: Cari query SQL inline, penggabungan query menggunakan string concatenation (berisiko SQL Injection), dan penggunaan langsung `mysqli` atau `mysql_*`.
142
+ - **Session & State Global**: Identifikasi mutasi langsung session (`$_SESSION`), cookie mentah, dan variabel global yang tidak divalidasi (`$_GET`, `$_POST`, `$_REQUEST`).
143
+ - **Pencampuran Logika (Spaghetti)**: Temukan file di mana koneksi database, logika bisnis, validasi session, dan render HTML berada dalam satu berkas tunggal.
144
+ - **Secret Hardcoded**: Identifikasi kredensial database, API key, dan konfigurasi lainnya yang didefinisikan di dalam file.
145
+
146
+ #### 2. Strategi Modernisasi & Konfigurasi Composer
147
+ Terapkan struktur direktori proyek standar dan inisialisasi manajemen dependensi:
148
+ - **PSR-4 Autoloading**: Buat file `composer.json` dan definisikan pemetaan namespace:
149
+ ```json
150
+ {
151
+ "autoload": {
152
+ "psr-4": {
153
+ "App\\": "src/"
154
+ }
155
+ }
156
+ }
157
+ ```
158
+ - **Struktur Direktori Standar**:
159
+ - `public/`: Titik entri tunggal yang berisi `index.php` (Front Controller), aset (CSS, JS), serta file upload.
160
+ - `src/`: Namespace root untuk struktur MVC (`src/Models/`, `src/Controllers/`, `src/Views/`, `src/Core/`).
161
+ - `config/`: Konfigurasi database, konfigurasi router, dan konfigurasi aplikasi.
162
+ - `.env` & `.env.example`: Menyimpan konfigurasi environment.
163
+
164
+ #### 3. Menerapkan Arsitektur MVC
165
+ Refaktorkan kode spageti ke dalam lapisan MVC yang terpisah:
166
+ - **Front Controller (Routing Terpusat)**:
167
+ Gunakan library routing yang bersih (seperti AltoRouter atau router kustom ringan) di `public/index.php`. Arahkan semua request melalui satu file menggunakan `.htaccess` atau pengalihan server:
168
+ ```php
169
+ // public/index.php
170
+ require_once __DIR__ . '/../vendor/autoload.php';
171
+
172
+ $router = new App\Core\Router();
173
+ $router->add('GET', '/', 'HomeController@index');
174
+ $router->add('GET', '/users', 'UserController@index');
175
+ $router->dispatch($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
176
+ ```
177
+ - **Models**:
178
+ Pisahkan semua akses database di dalam kelas Model. Gunakan prepared statements dengan PDO:
179
+ ```php
180
+ namespace App\Models;
181
+ use App\Core\Database;
182
+ use PDO;
183
+
184
+ class User {
185
+ private PDO $db;
186
+ public function __construct() {
187
+ $this->db = Database::getInstance()->getConnection();
188
+ }
189
+ public function getAll(): array {
190
+ $stmt = $this->db->prepare("SELECT id, name, email FROM users ORDER BY name ASC");
191
+ $stmt->execute();
192
+ return $stmt->fetchAll(PDO::FETCH_ASSOC);
193
+ }
194
+ }
195
+ ```
196
+ - **Controllers**:
197
+ Ekstrak request dan parameter input, panggil model, lalu return/render view:
198
+ ```php
199
+ namespace App\Controllers;
200
+ use App\Models\User;
201
+
202
+ class UserController {
203
+ public function index(): void {
204
+ $model = new User();
205
+ $users = $model->getAll();
206
+ render_view('users/index', ['users' => $users]);
207
+ }
208
+ }
209
+ ```
210
+ - **Views**:
211
+ Jangan pernah me-render atau menggunakan `echo` HTML langsung di dalam controller. Terapkan render template PHP yang bersih atau gunakan template engine ringan seperti Twig. Pastikan semua output HTML divalidasi dan lolos proses escaping.
212
+
213
+ #### 4. Peningkatan Keamanan
214
+ Integrasikan filter keamanan standar berikut selama refaktorisasi:
215
+ - **Pencegahan SQL Injection**: Wajibkan prepared statements dengan parameter terikat untuk setiap query SQL.
216
+ - **Pencegahan XSS**: Buat atau gunakan fungsi helper escape global (misal `htmlspecialchars($str, ENT_QUOTES, 'UTF-8')`) pada setiap output dinamis pada view.
217
+ - **Proteksi CSRF**: Hasilkan dan validasi token CSRF untuk setiap request yang mengubah state data (`POST`, `PUT`, `DELETE`).
218
+ - **Manajemen Secrets**: Muat konfigurasi via file `.env` menggunakan library `vlucas/phpdotenv`.
219
+
220
+ #### 5. Memanfaatkan PHP Modern (v8.2+)
221
+ Refaktorkan logika PHP lama agar menggunakan fitur modern:
222
+ - **Constructor Property Promotion** dan **Typed Properties** untuk properti kelas.
223
+ - **Readonly Classes** untuk kelas layanan atau data yang bersifat immutable (tidak dapat diubah).
224
+ - **Deklarasi Strict Types**: Tambahkan `declare(strict_types=1);` di bagian paling atas setiap file kelas.
225
+
226
+ #### 6. Pendekatan Multi-Page Application (MPA) dalam Satu Repositori
227
+ Saat mengatur proyek sebagai Multi-Page Application di dalam satu repositori, ikuti panduan berikut:
228
+ - **Routing Terpusat (Centralized Routing)**: Gunakan Front Controller (`public/index.php`) untuk menangani semua permintaan halaman. Arahkan setiap permintaan ke controller dan view masing-masing, memastikan setiap pemuatan halaman diproses sepenuhnya di sisi server.
229
+ - **Layout & Parsial Bersama (Shared Layouts & Partials)**: Hindari duplikasi HTML (header, footer, navigasi). Buat direktori `src/Views/layouts/` untuk template dasar dan direktori `src/Views/partials/` untuk komponen UI yang dapat digunakan kembali. Controller harus menyuntikkan konten spesifik halaman ke dalam layout dasar.
230
+ - **Manajemen Aset**: Simpan semua aset statis (CSS, JS, gambar) di direktori `public/`. Gunakan teknik cache-busting (misalnya, menambahkan waktu modifikasi file `?v=123`) saat menautkan aset di dalam view.
231
+ - **Manajemen State**: Gunakan session sisi server secara aman untuk autentikasi pengguna, pesan flash, dan melacak state di seluruh proses reload halaman secara penuh.
232
+
233
+ ### Kondisi Pemicu
234
+ Aktif setiap kali pengguna meminta untuk:
235
+ - Memodernisasi proyek PHP lama atau script PHP spageti.
236
+ - Merancang arsitektur MVC atau memperkenalkan pola routing yang bersih di plain PHP.
237
+ - Menerapkan pemrograman berorientasi objek (OOP), namespace Composer (PSR-4), atau membersihkan akses database via PDO pada aplikasi PHP.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: n8n-automation-expert
3
+ description: "Expert guide for workflow automation (n8n, Zapier, Make), custom nodes, webhook triggers, and AI-powered automation chains / Panduan ahli otomasi workflow (n8n, Zapier, Make), custom nodes, webhook triggers, dan rantai otomasi berbasis AI."
4
+ author: "Roedy Rustam"
5
+ ---
6
+
7
+ # Workflow Automation Expert (2026 Edition)
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Orchestration & Integration
17
+ - **`cron-scheduler-expert`**: Scheduled triggers for automation workflows.
18
+ - **`ai-llm-integration-expert`**: AI-powered automation steps and LLM chains.
19
+ - **`email-notification-expert`**: Email triggers and notification actions.
20
+ - **`webhook-receiver`**: Webhook endpoints as automation triggers.
21
+
22
+ ### Description
23
+ Expert guide for building automation workflows with n8n (self-hosted, open-source), Zapier, and Make (Integromat). Covers workflow design, custom n8n nodes, webhook triggers, AI chains within workflows, error handling, credential management, and integration patterns with databases, APIs, and messaging platforms.
24
+
25
+ ### Trigger Conditions
26
+ - Building automated workflows connecting multiple services.
27
+ - Setting up n8n for self-hosted automation.
28
+ - Creating AI-powered automation pipelines.
29
+ - Integrating no-code/low-code automation with custom applications.
30
+
31
+ ---
32
+
33
+ ### Platform Selection
34
+
35
+ | Platform | Hosting | Custom Code | AI Support | Pricing | Best For |
36
+ |----------|---------|-------------|------------|---------|----------|
37
+ | n8n | Self-hosted/Cloud | ✅ Full | ✅ AI nodes | Free (self) | Developers, privacy |
38
+ | Zapier | Cloud only | Limited | ✅ AI actions | $29+/mo | Non-technical teams |
39
+ | Make | Cloud only | ✅ Modules | ✅ AI modules | $10+/mo | Visual workflows |
40
+
41
+ **Recommendation:** Use **n8n** for developer teams needing full control and self-hosting. Use **Zapier** for simple integrations by non-technical users.
42
+
43
+ ### n8n Core Patterns
44
+
45
+ ```typescript
46
+ // Custom n8n node — AI Content Processor
47
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
48
+
49
+ export class AiContentProcessor implements INodeType {
50
+ description: INodeTypeDescription = {
51
+ displayName: 'AI Content Processor',
52
+ name: 'aiContentProcessor',
53
+ group: ['transform'],
54
+ version: 1,
55
+ inputs: ['main'],
56
+ outputs: ['main'],
57
+ properties: [
58
+ { displayName: 'Prompt Template', name: 'prompt', type: 'string', default: '' },
59
+ { displayName: 'Model', name: 'model', type: 'options', options: [
60
+ { name: 'GPT-4o', value: 'gpt-4o' },
61
+ { name: 'Claude 4 Sonnet', value: 'claude-4-sonnet' },
62
+ ], default: 'gpt-4o' },
63
+ ],
64
+ };
65
+
66
+ async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
67
+ const items = this.getInputData();
68
+ const prompt = this.getNodeParameter('prompt', 0) as string;
69
+ // Process each item with AI...
70
+ return [items];
71
+ }
72
+ }
73
+ ```
74
+
75
+ ## Orchestration & Integration
76
+ - `cron-scheduler-expert`, `ai-llm-integration-expert`, `webhook-receiver`
77
+
78
+ ---
79
+
80
+ <a name="bahasa-indonesia"></a>
81
+ ## Bahasa Indonesia
82
+
83
+ ### Deskripsi
84
+ Panduan ahli untuk membangun alur kerja otomatis dengan n8n, Zapier, dan Make. Mencakup desain workflow, custom nodes n8n, webhook triggers, rantai AI, dan integrasi dengan database dan API.
85
+
86
+ ### Kondisi Pemicu
87
+ - Membangun alur kerja otomatis yang menghubungkan beberapa layanan.
88
+ - Menyiapkan n8n untuk otomasi self-hosted.
89
+ - Membuat pipeline otomasi berbasis AI.