vibes-plug 2.14.1 → 3.9.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 (151) hide show
  1. package/.claude/rules/vibes-plug-core.md +5 -0
  2. package/.cursor/rules/vibes-plug-core.mdc +7 -2
  3. package/.cursorrules +8 -2
  4. package/AGENTS.md +23 -2
  5. package/CHANGELOG.md +114 -0
  6. package/CLAUDE.md +10 -3
  7. package/README.md +216 -611
  8. package/bin/vibes.mjs +1104 -0
  9. package/package.json +11 -3
  10. package/plugin.json +4 -3
  11. package/scripts/check-anti-slop.mjs +53 -0
  12. package/scripts/install.js +3 -1
  13. package/scripts/update_skills.js +1 -1
  14. package/scripts/update_skills.mjs +86 -0
  15. package/scripts/validate-skills.mjs +111 -0
  16. package/skills/accessibility-testing-expert/SKILL.md +117 -116
  17. package/skills/affective-computing-emotion-ai/SKILL.md +83 -0
  18. package/skills/agentic-coding-workflow-expert/SKILL.md +297 -0
  19. package/skills/agentic-memory-architect/SKILL.md +52 -0
  20. package/skills/agentic-micro-economy-architect/SKILL.md +92 -0
  21. package/skills/ai-llm-integration-expert/SKILL.md +330 -194
  22. package/skills/ai-media-generation-expert/SKILL.md +173 -172
  23. package/skills/ai-prompt-engineering-expert/SKILL.md +204 -134
  24. package/skills/ai-safety-governance-expert/SKILL.md +223 -0
  25. package/skills/angular-expert/SKILL.md +149 -148
  26. package/skills/anti-slop/SKILL.md +134 -133
  27. package/skills/api-design-expert/SKILL.md +4 -3
  28. package/skills/api-gateway-proxy-expert/SKILL.md +3 -2
  29. package/skills/app-analyzer-optimizer/SKILL.md +4 -3
  30. package/skills/apple-ecosystem-expert/SKILL.md +6 -5
  31. package/skills/astro-framework-expert/SKILL.md +201 -200
  32. package/skills/async-queue-temporal-expert/SKILL.md +218 -217
  33. package/skills/authentication-identity-expert/SKILL.md +174 -173
  34. package/skills/autonomous-red-teamer/SKILL.md +338 -203
  35. package/skills/autonomous-tdd-debugger/SKILL.md +6 -5
  36. package/skills/biome-linter-formatter-expert/SKILL.md +90 -89
  37. package/skills/blockchain-web3-expert/SKILL.md +116 -115
  38. package/skills/brainstorming/SKILL.md +392 -377
  39. package/skills/browser-automation-expert/SKILL.md +260 -222
  40. package/skills/bun-runtime-expert/SKILL.md +5 -4
  41. package/skills/chatbot-messaging-expert/SKILL.md +115 -114
  42. package/skills/ci-cd-devops-architect/SKILL.md +3 -2
  43. package/skills/cloud-hosting-expert/SKILL.md +5 -4
  44. package/skills/coderabbit/SKILL.md +5 -4
  45. package/skills/compliance-gdpr-privacy-expert/SKILL.md +3 -2
  46. package/skills/composable-mach-architect/SKILL.md +338 -0
  47. package/skills/cron-scheduler-expert/SKILL.md +5 -4
  48. package/skills/data-pipeline-etl-expert/SKILL.md +3 -2
  49. package/skills/data-telemetry-expert/SKILL.md +5 -4
  50. package/skills/data-visualization-expert/SKILL.md +155 -154
  51. package/skills/database-orm-expert/SKILL.md +166 -165
  52. package/skills/deep-research-analyst/SKILL.md +182 -136
  53. package/skills/dependency-upgrade-migrator/SKILL.md +11 -10
  54. package/skills/design-system-architect/SKILL.md +4 -3
  55. package/skills/desktop-electron-expert/SKILL.md +129 -128
  56. package/skills/documentation-site-expert/SKILL.md +60 -59
  57. package/skills/doku-mcp-server/SKILL.md +5 -4
  58. package/skills/doku-payment-gateway/SKILL.md +250 -232
  59. package/skills/domain-driven-design-expert/SKILL.md +3 -2
  60. package/skills/e2e-testing-expert/SKILL.md +5 -4
  61. package/skills/ecommerce-expert/SKILL.md +88 -87
  62. package/skills/email-notification-expert/SKILL.md +5 -4
  63. package/skills/ephemeral-generative-ui-architect/SKILL.md +88 -0
  64. package/skills/error-resilience-expert/SKILL.md +14 -13
  65. package/skills/event-driven-architect/SKILL.md +5 -4
  66. package/skills/feature-flag-analytics-expert/SKILL.md +3 -2
  67. package/skills/file-upload-media-expert/SKILL.md +5 -4
  68. package/skills/firebase-security-expert/SKILL.md +5 -4
  69. package/skills/form-validation-expert/SKILL.md +7 -6
  70. package/skills/frontier-ai-models-expert/SKILL.md +116 -0
  71. package/skills/fullstack-expert/SKILL.md +185 -184
  72. package/skills/gemini-agent-booster/SKILL.md +248 -172
  73. package/skills/geospatial-maps-expert/SKILL.md +81 -80
  74. package/skills/global-a11y-i18n-expert/SKILL.md +5 -4
  75. package/skills/glsl-shader-expert/SKILL.md +191 -190
  76. package/skills/go-programming-expert/SKILL.md +5 -4
  77. package/skills/graph-rag-knowledge-expert/SKILL.md +201 -200
  78. package/skills/graphql-apollo-expert/SKILL.md +5 -4
  79. package/skills/headless-cms-expert/SKILL.md +182 -181
  80. package/skills/hig/SKILL.md +5 -4
  81. package/skills/js-backend-expert/SKILL.md +219 -218
  82. package/skills/legacy-code-translator/SKILL.md +6 -5
  83. package/skills/llm-finops-router/SKILL.md +52 -0
  84. package/skills/local-slm-edge-ai-expert/SKILL.md +168 -167
  85. package/skills/logging-error-tracking-expert/SKILL.md +5 -4
  86. package/skills/mcp-server-architect/SKILL.md +315 -307
  87. package/skills/micro-frontend-architect/SKILL.md +5 -4
  88. package/skills/mobile-expo-expert/SKILL.md +5 -4
  89. package/skills/modern-css-native-expert/SKILL.md +190 -189
  90. package/skills/monorepo-architect/SKILL.md +5 -4
  91. package/skills/mpa-orchestrator/SKILL.md +41 -4
  92. package/skills/multi-agent-orchestration/SKILL.md +388 -254
  93. package/skills/mvc-expert/SKILL.md +5 -4
  94. package/skills/n8n-automation-expert/SKILL.md +90 -89
  95. package/skills/nextjs-app-router-expert/SKILL.md +3 -2
  96. package/skills/openapi-swagger-codegen-expert/SKILL.md +4 -3
  97. package/skills/payment-gateway-expert/SKILL.md +131 -128
  98. package/skills/pdf-document-generation-expert/SKILL.md +92 -91
  99. package/skills/performance-web-vitals/SKILL.md +5 -4
  100. package/skills/post-quantum-crypto-migrator/SKILL.md +3 -2
  101. package/skills/prd-architect/SKILL.md +183 -182
  102. package/skills/proactive-background-watcher/SKILL.md +5 -4
  103. package/skills/production-ready-hardener/SKILL.md +10 -9
  104. package/skills/pwa-offline-first-expert/SKILL.md +227 -226
  105. package/skills/pydantic-ai-expert/SKILL.md +162 -161
  106. package/skills/python-programming-expert/SKILL.md +5 -4
  107. package/skills/rate-limit-abuse-prevention/SKILL.md +5 -4
  108. package/skills/realtime-collaboration-expert/SKILL.md +3 -2
  109. package/skills/rich-text-editor-expert/SKILL.md +178 -177
  110. package/skills/rust-programming-expert/SKILL.md +5 -4
  111. package/skills/saas-architect/SKILL.md +155 -154
  112. package/skills/saas-billing/SKILL.md +394 -382
  113. package/skills/saas-multi-tenant/SKILL.md +7 -6
  114. package/skills/scalability-clean-code/SKILL.md +5 -4
  115. package/skills/search-engine-expert/SKILL.md +90 -89
  116. package/skills/self-healing-cloud-orchestrator/SKILL.md +3 -2
  117. package/skills/senior-frontend/SKILL.md +14 -9
  118. package/skills/seo/SKILL.md +4 -4
  119. package/skills/session-memory-manager/SKILL.md +129 -128
  120. package/skills/solidjs-expert/SKILL.md +81 -80
  121. package/skills/spa-orchestrator/SKILL.md +5 -4
  122. package/skills/sse-websocket-streaming-expert/SKILL.md +3 -2
  123. package/skills/state-management-expert/SKILL.md +5 -4
  124. package/skills/supabase-security-expert/SKILL.md +5 -4
  125. package/skills/svelte-sveltekit-expert/SKILL.md +92 -91
  126. package/skills/svg-animation-motion-expert/SKILL.md +3 -2
  127. package/skills/synthetic-data-finetuning-expert/SKILL.md +156 -155
  128. package/skills/tailwind-expert/SKILL.md +62 -5
  129. package/skills/tanstack-query-expert/SKILL.md +5 -4
  130. package/skills/tauri-expert/SKILL.md +5 -4
  131. package/skills/typescript-expert/SKILL.md +5 -4
  132. package/skills/ui-ux-pro-max/SKILL.md +7 -6
  133. package/skills/vector-db-rag-expert/SKILL.md +209 -208
  134. package/skills/vercel-ai-sdk-expert/SKILL.md +226 -181
  135. package/skills/voice-ai-realtime-agent/SKILL.md +243 -242
  136. package/skills/vue-frontend-expert/SKILL.md +5 -4
  137. package/skills/wasm-edge-computing-expert/SKILL.md +3 -2
  138. package/skills/web-3d-graphics-expert/SKILL.md +314 -313
  139. package/skills/web-game-engine-expert/SKILL.md +330 -329
  140. package/skills/web-scraper/SKILL.md +158 -157
  141. package/skills/website-design-cloner/SKILL.md +5 -4
  142. package/skills/webxr-ar-vr-expert/SKILL.md +163 -162
  143. package/skills/wordpress-headless-expert/SKILL.md +145 -144
  144. package/skills/zero-tech-debt-auditor/SKILL.md +115 -0
  145. package/skills/zero-to-prod-orchestrator/SKILL.md +281 -229
  146. package/skills/zero-trust-secret-vault/SKILL.md +3 -2
  147. package/BLUEPRINT.md +0 -319
  148. package/skills/bootstrap-to-modern/SKILL.md +0 -94
  149. package/skills/multiple-entry-points/SKILL.md +0 -91
  150. package/skills/secure-fuzz-testing/SKILL.md +0 -207
  151. package/skills/visual-qa-vision-agent/SKILL.md +0 -71
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  name: mvc-expert
3
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"
4
+ author: "Roedy Rustam"
5
+ version: "3.0.0"
5
6
  ---
6
7
 
7
8
  # PHP MVC Expert & Modernization
@@ -14,7 +15,7 @@ author: "Roedy Rustam"
14
15
  ## English
15
16
 
16
17
  ### 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
+ Connects and orchestrates with relevant domain skills like `brainstorming`, `zero-to-prod-orchestrator`, and `session-memory-manager` to ensure cohesive execution.
18
19
 
19
20
  ### Description
20
21
  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.
@@ -128,7 +129,7 @@ Active whenever the user requests to:
128
129
  ## Bahasa Indonesia
129
130
 
130
131
  ### 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
+ Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `session-memory-manager` untuk memastikan eksekusi yang kohesif.
132
133
 
133
134
  ### Deskripsi
134
135
  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+).
@@ -234,4 +235,4 @@ Saat mengatur proyek sebagai Multi-Page Application di dalam satu repositori, ik
234
235
  Aktif setiap kali pengguna meminta untuk:
235
236
  - Memodernisasi proyek PHP lama atau script PHP spageti.
236
237
  - 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.
238
+ - Menerapkan pemrograman berorientasi objek (OOP), namespace Composer (PSR-4), atau membersihkan akses database via PDO pada aplikasi PHP.
@@ -1,89 +1,90 @@
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.
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
+ version: "3.0.0"
6
+ ---
7
+
8
+ # Workflow Automation Expert (2026 Edition)
9
+
10
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
11
+
12
+ ---
13
+
14
+ <a name="english"></a>
15
+ ## English
16
+
17
+ ### Orchestration & Integration
18
+ - **`cron-scheduler-expert`**: Scheduled triggers for automation workflows.
19
+ - **`ai-llm-integration-expert`**: AI-powered automation steps and LLM chains.
20
+ - **`email-notification-expert`**: Email triggers and notification actions.
21
+ - **`webhook-receiver`**: Webhook endpoints as automation triggers.
22
+
23
+ ### Description
24
+ 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.
25
+
26
+ ### Trigger Conditions
27
+ - Building automated workflows connecting multiple services.
28
+ - Setting up n8n for self-hosted automation.
29
+ - Creating AI-powered automation pipelines.
30
+ - Integrating no-code/low-code automation with custom applications.
31
+
32
+ ---
33
+
34
+ ### Platform Selection
35
+
36
+ | Platform | Hosting | Custom Code | AI Support | Pricing | Best For |
37
+ |----------|---------|-------------|------------|---------|----------|
38
+ | n8n | Self-hosted/Cloud | ✅ Full | ✅ AI nodes | Free (self) | Developers, privacy |
39
+ | Zapier | Cloud only | Limited | ✅ AI actions | $29+/mo | Non-technical teams |
40
+ | Make | Cloud only | ✅ Modules | ✅ AI modules | $10+/mo | Visual workflows |
41
+
42
+ **Recommendation:** Use **n8n** for developer teams needing full control and self-hosting. Use **Zapier** for simple integrations by non-technical users.
43
+
44
+ ### n8n Core Patterns
45
+
46
+ ```typescript
47
+ // Custom n8n node — AI Content Processor
48
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
49
+
50
+ export class AiContentProcessor implements INodeType {
51
+ description: INodeTypeDescription = {
52
+ displayName: 'AI Content Processor',
53
+ name: 'aiContentProcessor',
54
+ group: ['transform'],
55
+ version: 1,
56
+ inputs: ['main'],
57
+ outputs: ['main'],
58
+ properties: [
59
+ { displayName: 'Prompt Template', name: 'prompt', type: 'string', default: '' },
60
+ { displayName: 'Model', name: 'model', type: 'options', options: [
61
+ { name: 'GPT-4o', value: 'gpt-4o' },
62
+ { name: 'Claude 4 Sonnet', value: 'claude-4-sonnet' },
63
+ ], default: 'gpt-4o' },
64
+ ],
65
+ };
66
+
67
+ async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
68
+ const items = this.getInputData();
69
+ const prompt = this.getNodeParameter('prompt', 0) as string;
70
+ // Process each item with AI...
71
+ return [items];
72
+ }
73
+ }
74
+ ```
75
+
76
+ ## Orchestration & Integration
77
+ - `cron-scheduler-expert`, `ai-llm-integration-expert`, `webhook-receiver`
78
+
79
+ ---
80
+
81
+ <a name="bahasa-indonesia"></a>
82
+ ## Bahasa Indonesia
83
+
84
+ ### Deskripsi
85
+ 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.
86
+
87
+ ### Kondisi Pemicu
88
+ - Membangun alur kerja otomatis yang menghubungkan beberapa layanan.
89
+ - Menyiapkan n8n untuk otomasi self-hosted.
90
+ - Membuat pipeline otomasi berbasis AI.
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  name: nextjs-app-router-expert
3
3
  description: "Expert guide for Next.js 15 App Router: RSC, Server Actions, Middleware, Parallel/Intercepting Routes, Streaming, and Caching strategies / Panduan ahli untuk Next.js 15 App Router."
4
- author: "Roedy Rustam"
4
+ author: "Roedy Rustam"
5
+ version: "3.0.0"
5
6
  ---
6
7
 
7
8
  # Next.js 15 App Router Expert
@@ -145,4 +146,4 @@ Bungkus pengambilan data lambat dengan `<Suspense>` untuk menampilkan UI awal se
145
146
  - **`senior-frontend`**: Menguatkan UI/UX dengan pemahaman arsitektur RSC dan cache Next 15.
146
147
  - **`js-backend-expert`**: Menghubungkan Server Actions dengan arsitektur backend Node.js/Bun.
147
148
  - **`tanstack-query-expert`**: Mengelola hidrasi state client-side dari RSC.
148
- - **`performance-web-vitals`**: Optimalisasi Core Web Vitals menggunakan Streaming dan PPR.
149
+ - **`performance-web-vitals`**: Optimalisasi Core Web Vitals menggunakan Streaming dan PPR.
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  name: openapi-swagger-codegen-expert
3
3
  description: "OpenAPI 3.1 spec authoring, Swagger UI, automatic client/server code generation (openapi-typescript, Orval, Kiota), contract testing / Penulisan spesifikasi OpenAPI 3.1, Swagger UI, pembuatan kode klien/server otomatis, dan pengujian kontrak."
4
- author: "Roedy Rustam"
4
+ author: "Roedy Rustam"
5
+ version: "3.0.0"
5
6
  ---
6
7
 
7
8
  # OpenAPI & Swagger Codegen Expert
@@ -39,7 +40,7 @@ Dedicated expert guide for API contract-first development using OpenAPI 3.1, Swa
39
40
  ## Bahasa Indonesia
40
41
 
41
42
  ### Integrasi Orkestrasi
42
- Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `project-context-mapper` untuk memastikan eksekusi yang kohesif.
43
+ Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `zero-to-prod-orchestrator`, dan `session-memory-manager` untuk memastikan eksekusi yang kohesif.
43
44
 
44
45
  ### Deskripsi
45
46
  Panduan ahli khusus untuk pengembangan API dengan pendekatan *contract-first* menggunakan OpenAPI 3.1, Swagger UI, dan otomatisasi pembuatan kode (codegen). Mencakup pembuatan klien API yang *strictly typed* (menggunakan `openapi-typescript`, `Orval`, atau Microsoft `Kiota`), *scaffolding* untuk server, dan implementasi *contract testing* untuk memastikan backend selalu sesuai dengan dokumentasinya.
@@ -64,4 +65,4 @@ Panduan ahli khusus untuk pengembangan API dengan pendekatan *contract-first* me
64
65
  ## Orchestration & Integration
65
66
  - Connects to `api-design-expert` for the core design rules.
66
67
  - Connects to `ci-cd-devops-architect` to implement CI/CD validation.
67
- - Connects to `senior-frontend` / `tanstack-query-expert` to consume the generated clients.
68
+ - Connects to `senior-frontend` / `tanstack-query-expert` to consume the generated clients.
@@ -1,129 +1,132 @@
1
- ---
2
- name: payment-gateway-expert
3
- description: "Expert guide for integrating payment gateways (Stripe, PayPal, Xendit, Midtrans, DOKU) and secure webhooks into SaaS platforms / Panduan ahli integrasi payment gateway dan webhook aman."
1
+ ---
2
+ name: payment-gateway-expert
3
+ description: "Expert guide for integrating payment gateways (Stripe, PayPal, Xendit, Midtrans, DOKU SNAP BI) and secure webhooks into SaaS platforms / Panduan ahli integrasi payment gateway dan webhook aman."
4
4
  author: "Roedy Rustam"
5
- ---
6
-
7
- # Payment Gateway Expert / Ahli Payment Gateway
8
-
9
- [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
-
11
- ---
12
-
13
- <a name="english"></a>
14
- ## English
15
-
16
- ### Description
17
- Expert guide for integrating major payment gateways (Stripe, PayPal, Xendit, Midtrans, DOKU) into modern SaaS platforms. Covers checkout flows, secure webhook handling, subscription management, and synchronization with local databases.
18
-
19
- ### Instructions
20
- - **Security First**: Always validate webhook signatures before processing any payment event. Never trust client-side data for prices or payment status. For DOKU, ensure signature components (like request target) are arranged strictly according to documentation.
21
- - **Idempotency**: Implement idempotency keys for all payment creation requests to avoid duplicate charges. Webhook handlers must also be idempotent. For DOKU, include a unique `Request-Id` header.
22
- - **State Synchronization**: Ensure the local database (e.g., PostgreSQL, Supabase) is updated immediately and transactionally upon receiving successful webhook events.
23
- - **Subscription Management**: Map the provider's subscription statuses (e.g., `active`, `past_due`, `canceled`) accurately to the SaaS platform's internal state machine.
24
- - **Testing**: Use sandbox/test environments provided by the gateways and simulate webhooks using CLI tools (like Stripe CLI) during development.
25
-
26
- ### Implementation Checklist
27
- - [ ] Create a dedicated Webhook endpoint (e.g., `/api/webhooks/stripe`).
28
- - [ ] Use raw request body for signature verification (do not parse JSON before verification).
29
- - [ ] Ensure idempotency by tracking processed event IDs in the database.
30
- - [ ] Update local user/subscription state transactionally upon success.
31
- - [ ] Handle asynchronous failures with a dead-letter queue or retry mechanism.
32
-
33
- ### Example: Stripe Webhook Signature Verification (Next.js App Router)
34
- ```typescript
35
- import Stripe from 'stripe';
36
- import { headers } from 'next/headers';
37
-
38
- const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
39
-
40
- export async function POST(req: Request) {
41
- const body = await req.text(); // Raw body required for signature
42
- const signature = headers().get('Stripe-Signature') as string;
43
-
44
- let event: Stripe.Event;
45
-
46
- try {
47
- event = stripe.webhooks.constructEvent(
48
- body,
49
- signature,
50
- process.env.STRIPE_WEBHOOK_SECRET!
51
- );
52
- } catch (err: any) {
53
- return new Response(`Webhook Error: ${err.message}`, { status: 400 });
54
- }
55
-
56
- // Handle the event
57
- if (event.type === 'checkout.session.completed') {
58
- // Process successful payment, check idempotency, update DB
59
- }
60
-
61
- return new Response(JSON.stringify({ received: true }), { status: 200 });
62
- }
63
- ```
64
-
65
- ## Orchestration & Integration
66
- - Integrates with: `saas-billing`, `doku-payment-gateway`, `saas-mvp-launcher`.
67
-
68
- ### Trigger Conditions
69
- Active whenever the user is working on billing integration, payment checkout, webhook handling, or integrating platforms like PayPal, Stripe, Xendit, Midtrans, or DOKU.
70
-
71
- ---
72
-
73
- <a name="bahasa-indonesia"></a>
74
- ## Bahasa Indonesia
75
-
76
- ### Deskripsi
77
- Panduan ahli untuk mengintegrasikan payment gateway utama (Stripe, PayPal, Xendit, Midtrans, DOKU) ke platform SaaS modern. Mencakup alur checkout, penanganan webhook yang aman, manajemen langganan, dan sinkronisasi dengan database lokal.
78
-
79
- ### Instruksi
80
- - **Keamanan Utama**: Selalu validasi signature webhook sebelum memproses event pembayaran apa pun. Jangan pernah mempercayai data dari sisi klien untuk harga atau status pembayaran. Untuk DOKU, pastikan komponen signature (seperti request target) disusun secara ketat sesuai dokumentasi.
81
- - **Idempotensi**: Implementasikan kunci idempotensi (idempotency keys) untuk semua permintaan pembuatan pembayaran untuk menghindari tagihan ganda. Handler webhook juga harus idempoten. Untuk DOKU, sertakan header `Request-Id` unik.
82
- - **Sinkronisasi State**: Pastikan database lokal (misal: PostgreSQL, Supabase) diperbarui secara langsung dan transaksional saat menerima event webhook yang berhasil.
83
- - **Manajemen Langganan**: Petakan status langganan dari provider (misal: `active`, `past_due`, `canceled`) secara akurat ke state machine internal platform SaaS.
84
- - **Pengujian**: Gunakan lingkungan sandbox/test yang disediakan oleh gateway dan simulasikan webhook menggunakan tool CLI (seperti Stripe CLI) selama pengembangan.
85
-
86
- ### Checklist Implementasi
87
- - [ ] Buat endpoint Webhook khusus (misal: `/api/webhooks/stripe`).
88
- - [ ] Gunakan raw request body untuk verifikasi signature (jangan parse JSON sebelum verifikasi).
89
- - [ ] Pastikan idempotensi dengan melacak ID event yang sudah diproses di database.
90
- - [ ] Perbarui state langganan/pengguna lokal secara transaksional saat sukses.
91
- - [ ] Tangani kegagalan asinkron dengan dead-letter queue atau mekanisme retry.
92
-
93
- ### Contoh: Verifikasi Signature Webhook Stripe (Next.js App Router)
94
- ```typescript
95
- import Stripe from 'stripe';
96
- import { headers } from 'next/headers';
97
-
98
- const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
99
-
100
- export async function POST(req: Request) {
101
- const body = await req.text(); // Raw body dibutuhkan untuk signature
102
- const signature = headers().get('Stripe-Signature') as string;
103
-
104
- let event: Stripe.Event;
105
-
106
- try {
107
- event = stripe.webhooks.constructEvent(
108
- body,
109
- signature,
110
- process.env.STRIPE_WEBHOOK_SECRET!
111
- );
112
- } catch (err: any) {
113
- return new Response(`Webhook Error: ${err.message}`, { status: 400 });
114
- }
115
-
116
- // Tangani event
117
- if (event.type === 'checkout.session.completed') {
118
- // Proses pembayaran sukses, cek idempotensi, update DB
119
- }
120
-
121
- return new Response(JSON.stringify({ received: true }), { status: 200 });
122
- }
123
- ```
124
-
125
- ## Integrasi Orkestrasi
126
- - Terintegrasi dengan: `saas-billing`, `doku-payment-gateway`, `saas-mvp-launcher`.
127
-
128
- ### Kondisi Pemicu
129
- Aktif setiap kali pengguna sedang mengerjakan integrasi billing, checkout pembayaran, penanganan webhook, atau mengintegrasikan platform seperti PayPal, Stripe, Xendit, Midtrans, atau DOKU.
5
+ version: "4.0.0"
6
+ ---
7
+
8
+ # Payment Gateway Expert / Ahli Payment Gateway
9
+
10
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
11
+
12
+ ---
13
+
14
+ <a name="english"></a>
15
+ ## English
16
+
17
+ ### Description
18
+ Expert guide for integrating major payment gateways (Stripe, PayPal, Xendit, Midtrans, DOKU SNAP BI) into modern SaaS platforms. Covers checkout flows, secure raw-body webhook handling, atomic idempotency to prevent race conditions, subscription state machines, and local database synchronization.
19
+
20
+ ### Core Principles
21
+ - **Security First**: Always validate webhook signatures using the raw, unparsed request body before processing any payment event. Never trust client-side data for prices or payment status. For Indonesian gateways (DOKU, Midtrans, Xendit), strictly enforce the **SNAP BI standard (HMAC-SHA512)** and ISO8601 UTC/WIB timestamps.
22
+ - **Idempotency & Race Condition Prevention**: Implement idempotency keys for all payment creation requests. For webhook ingestion, **DO NOT rely solely on `findUnique` checks**, as concurrent webhook retries cause race conditions. Always use **Atomic Updates** (`UPDATE ... WHERE status = 'PENDING'`) or database pessimistic locks (`SELECT ... FOR UPDATE`).
23
+ - **Raw Body Ingestion**: Webhook signature verification fails if JSON is parsed or re-serialized with modified key ordering. Extract the exact raw string buffer (`req.text()` in Fetch API or `express.raw({ type: 'application/json' })` in Express).
24
+ - **Early 200 OK Acknowledgment**: If a webhook event is verified but already processed, immediately return `200 OK` so the payment gateway halts retries.
25
+ - **State Synchronization**: Ensure the local database (e.g., PostgreSQL, Supabase via Drizzle/Prisma) is updated transactionally upon receiving successful webhook events.
26
+ - **Subscription Management**: Map provider subscription statuses (`trialing`, `active`, `past_due`, `canceled`) accurately to internal SaaS state machines.
27
+
28
+ ### Implementation Checklist
29
+ - [ ] Create dedicated raw Webhook endpoint (e.g., `/api/webhooks/stripe`, `/api/webhooks/doku`).
30
+ - [ ] Use raw request body string for signature verification (never parsed JSON).
31
+ - [ ] Verify signature using proper algorithm (HMAC-SHA256 for Stripe/PayPal; HMAC-SHA512 for SNAP BI).
32
+ - [ ] Implement Atomic Update idempotency (`WHERE status = 'PENDING'`) to eliminate race conditions.
33
+ - [ ] Acknowledge duplicate webhooks immediately with HTTP `200 OK`.
34
+ - [ ] Offload heavy post-payment operations (invoicing, emails, webhooks) to background job queues (BullMQ/Temporal).
35
+
36
+ ### Example: SNAP BI Webhook & Atomic Idempotency (Next.js App Router)
37
+ ```typescript
38
+ import { headers } from 'next/headers';
39
+ import crypto from 'crypto';
40
+ import { db } from '@/lib/db';
41
+
42
+ export async function POST(req: Request) {
43
+ const rawBody = await req.text(); // Raw body is mandatory
44
+ const headerList = await headers();
45
+
46
+ const timestamp = headerList.get('x-timestamp') || '';
47
+ const receivedSig = headerList.get('x-signature') || '';
48
+ const authHeader = headerList.get('authorization') || '';
49
+ const token = authHeader.replace(/^Bearer\s+/i, '');
50
+ const path = new URL(req.url).pathname;
51
+
52
+ // 1. SNAP BI Body Hash & Signature Verification (HMAC-SHA512)
53
+ const bodyHash = crypto.createHash('sha256').update(rawBody, 'utf8').digest('hex').toLowerCase();
54
+ const stringToSign = `POST:${path}:${token}:${bodyHash}:${timestamp}`;
55
+ const calculatedSig = crypto
56
+ .createHmac('sha512', process.env.DOKU_SECRET_KEY!)
57
+ .update(stringToSign, 'utf8')
58
+ .digest('base64');
59
+
60
+ const isValid = crypto.timingSafeEqual(Buffer.from(receivedSig), Buffer.from(calculatedSig));
61
+ if (!isValid) {
62
+ return new Response('Invalid Signature', { status: 401 });
63
+ }
64
+
65
+ const payload = JSON.parse(rawBody);
66
+ const invoiceNumber = payload.order?.invoice_number;
67
+
68
+ // 2. Atomic Update: Eliminates Race Conditions by locking on 'PENDING' status
69
+ const updated = await db.transaction.updateMany({
70
+ where: {
71
+ invoiceNumber: invoiceNumber,
72
+ status: 'PENDING', // Key race condition prevention gate
73
+ },
74
+ data: {
75
+ status: 'PAID',
76
+ paidAt: new Date(),
77
+ externalReference: payload.transaction?.original_reference_no,
78
+ },
79
+ });
80
+
81
+ // 3. Duplicate Webhook Handling (Idempotency)
82
+ if (updated.count === 0) {
83
+ // Already processed or invalid invoice — return 200 to halt gateway retry spam
84
+ return new Response(JSON.stringify({ status: 'ALREADY_PROCESSED' }), { status: 200 });
85
+ }
86
+
87
+ // 4. Fulfillment (Execute only once)
88
+ await grantUserSubscription(invoiceNumber);
89
+
90
+ return new Response(JSON.stringify({ status: 'SUCCESS' }), { status: 200 });
91
+ }
92
+
93
+ async function grantUserSubscription(invoiceNumber: string) {
94
+ // Safe business logic execution
95
+ }
96
+ ```
97
+
98
+ ## Orchestration & Integration
99
+ - Integrates with: `saas-billing`, `doku-payment-gateway`, `doku-mcp-server`, `async-queue-temporal-expert`, `database-orm-expert`.
100
+
101
+ ### Trigger Conditions
102
+ Active whenever the user is working on billing integration, payment checkout, webhook handling, or integrating platforms like PayPal, Stripe, Xendit, Midtrans, or DOKU SNAP BI.
103
+
104
+ ---
105
+
106
+ <a name="bahasa-indonesia"></a>
107
+ ## Bahasa Indonesia
108
+
109
+ ### Deskripsi
110
+ Panduan ahli untuk mengintegrasikan payment gateway utama (Stripe, PayPal, Xendit, Midtrans, DOKU SNAP BI) ke platform SaaS modern. Mencakup alur checkout, penanganan webhook raw-body aman, pencegahan race condition melalui atomic update, state machine langganan, dan sinkronisasi database lokal.
111
+
112
+ ### Prinsip Utama
113
+ - **Keamanan Utama**: Selalu validasi signature webhook menggunakan *raw request body* murni sebelum memproses event pembayaran. Jangan pernah mempercayai data dari sisi klien untuk harga atau status pembayaran. Untuk gateway Indonesia (DOKU, Midtrans, Xendit), terapkan **standar SNAP BI (HMAC-SHA512)** dan format timestamp ISO8601.
114
+ - **Idempotensi & Pencegahan Race Condition**: Implementasikan kunci idempotensi untuk semua pembuatan pembayaran. Pada penerimaan webhook, **JANGAN hanya mengandalkan pengecekan `findUnique`**, karena panggilan webhook paralel dari gateway dapat memicu race condition. Selalu gunakan **Atomic Update** (`UPDATE ... WHERE status = 'PENDING'`) atau database lock (`SELECT ... FOR UPDATE`).
115
+ - **Raw Body Webhook**: Verifikasi tanda tangan akan gagal jika JSON di-parse atau di-serialize ulang karena perubahan urutan key atau spasi. Ambil buffer teks mentah (`req.text()` pada Fetch API atau `express.raw({ type: 'application/json' })` di Express).
116
+ - **Balasan Cepat 200 OK**: Jika signature valid namun transaksi sudah berstatus lunas (webhook duplikat/retry), segera kembalikan HTTP `200 OK` agar payment gateway berhenti mengirimkan retry.
117
+ - **Sinkronisasi State**: Pastikan database lokal (PostgreSQL/Supabase via Drizzle/Prisma) diperbarui secara transaksional saat menerima webhook sukses.
118
+ - **Manajemen Langganan**: Petakan status langganan dari provider (`trialing`, `active`, `past_due`, `canceled`) secara akurat ke state machine internal SaaS.
119
+
120
+ ### Checklist Implementasi
121
+ - [ ] Buat endpoint Webhook raw khusus (misal: `/api/webhooks/stripe`, `/api/webhooks/doku`).
122
+ - [ ] Gunakan raw request body string untuk verifikasi signature (jangan parse JSON sebelum verifikasi).
123
+ - [ ] Verifikasi signature dengan algoritma yang tepat (HMAC-SHA256 untuk Stripe/PayPal; HMAC-SHA512 untuk SNAP BI).
124
+ - [ ] Terapkan Atomic Update (`WHERE status = 'PENDING'`) untuk mematikan peluang race condition.
125
+ - [ ] Balas webhook duplikat secara instan dengan HTTP `200 OK`.
126
+ - [ ] Lemparkan proses berat pasca-bayar (pembuatan invoice PDF, email, push notification) ke antrean latar belakang (BullMQ/Temporal).
127
+
128
+ ## Integrasi Orkestrasi
129
+ - Terintegrasi dengan: `saas-billing`, `doku-payment-gateway`, `doku-mcp-server`, `async-queue-temporal-expert`, `database-orm-expert`.
130
+
131
+ ### Kondisi Pemicu
132
+ Aktif setiap kali pengguna sedang mengerjakan integrasi billing, checkout pembayaran, penanganan webhook, atau mengintegrasikan platform seperti PayPal, Stripe, Xendit, Midtrans, atau DOKU SNAP BI.