vibes-plug 2.11.0 → 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 (181) hide show
  1. package/.claude/rules/vibes-plug-core.md +5 -0
  2. package/.cursor/rules/vibes-plug-core.mdc +8 -3
  3. package/.cursorrules +9 -3
  4. package/AGENTS.md +25 -4
  5. package/CHANGELOG.md +151 -0
  6. package/CLAUDE.md +15 -8
  7. package/README.md +216 -641
  8. package/bin/vibes.mjs +1104 -0
  9. package/index.js +1 -1
  10. package/package.json +11 -3
  11. package/plugin.json +4 -3
  12. package/scripts/check-anti-slop.js +53 -0
  13. package/scripts/check-anti-slop.mjs +53 -0
  14. package/scripts/generate_swarm_gif.py +2 -2
  15. package/scripts/install.js +3 -1
  16. package/scripts/update_skills.js +1 -1
  17. package/scripts/update_skills.mjs +86 -0
  18. package/scripts/validate-skills.mjs +111 -0
  19. package/skills/accessibility-testing-expert/SKILL.md +117 -116
  20. package/skills/affective-computing-emotion-ai/SKILL.md +83 -0
  21. package/skills/agentic-coding-workflow-expert/SKILL.md +297 -0
  22. package/skills/agentic-memory-architect/SKILL.md +52 -0
  23. package/skills/agentic-micro-economy-architect/SKILL.md +92 -0
  24. package/skills/ai-llm-integration-expert/SKILL.md +330 -187
  25. package/skills/ai-media-generation-expert/SKILL.md +173 -172
  26. package/skills/ai-prompt-engineering-expert/SKILL.md +170 -50
  27. package/skills/ai-safety-governance-expert/SKILL.md +223 -0
  28. package/skills/angular-expert/SKILL.md +149 -148
  29. package/skills/anti-slop/SKILL.md +134 -0
  30. package/skills/api-design-expert/SKILL.md +4 -3
  31. package/skills/api-gateway-proxy-expert/SKILL.md +3 -2
  32. package/skills/app-analyzer-optimizer/SKILL.md +4 -3
  33. package/skills/apple-ecosystem-expert/SKILL.md +6 -5
  34. package/skills/astro-framework-expert/SKILL.md +201 -200
  35. package/skills/async-queue-temporal-expert/SKILL.md +218 -240
  36. package/skills/authentication-identity-expert/SKILL.md +79 -184
  37. package/skills/autonomous-red-teamer/SKILL.md +338 -203
  38. package/skills/autonomous-tdd-debugger/SKILL.md +6 -5
  39. package/skills/biome-linter-formatter-expert/SKILL.md +90 -89
  40. package/skills/blockchain-web3-expert/SKILL.md +116 -115
  41. package/skills/brainstorming/SKILL.md +392 -377
  42. package/skills/browser-automation-expert/SKILL.md +260 -222
  43. package/skills/bun-runtime-expert/SKILL.md +5 -4
  44. package/skills/chatbot-messaging-expert/SKILL.md +115 -114
  45. package/skills/ci-cd-devops-architect/SKILL.md +3 -2
  46. package/skills/cloud-hosting-expert/SKILL.md +5 -4
  47. package/skills/coderabbit/SKILL.md +5 -4
  48. package/skills/compliance-gdpr-privacy-expert/SKILL.md +3 -2
  49. package/skills/composable-mach-architect/SKILL.md +338 -0
  50. package/skills/cron-scheduler-expert/SKILL.md +5 -4
  51. package/skills/data-pipeline-etl-expert/SKILL.md +3 -2
  52. package/skills/data-telemetry-expert/SKILL.md +5 -4
  53. package/skills/data-visualization-expert/SKILL.md +155 -154
  54. package/skills/database-orm-expert/SKILL.md +102 -240
  55. package/skills/deep-research-analyst/SKILL.md +182 -0
  56. package/skills/dependency-upgrade-migrator/SKILL.md +11 -10
  57. package/skills/design-system-architect/SKILL.md +34 -3
  58. package/skills/desktop-electron-expert/SKILL.md +129 -128
  59. package/skills/documentation-site-expert/SKILL.md +60 -59
  60. package/skills/doku-mcp-server/SKILL.md +5 -4
  61. package/skills/doku-payment-gateway/SKILL.md +250 -232
  62. package/skills/domain-driven-design-expert/SKILL.md +3 -2
  63. package/skills/e2e-testing-expert/SKILL.md +5 -4
  64. package/skills/ecommerce-expert/SKILL.md +88 -87
  65. package/skills/email-notification-expert/SKILL.md +35 -7
  66. package/skills/ephemeral-generative-ui-architect/SKILL.md +88 -0
  67. package/skills/error-resilience-expert/SKILL.md +26 -4
  68. package/skills/event-driven-architect/SKILL.md +5 -4
  69. package/skills/feature-flag-analytics-expert/SKILL.md +3 -2
  70. package/skills/file-upload-media-expert/SKILL.md +5 -4
  71. package/skills/firebase-security-expert/SKILL.md +5 -4
  72. package/skills/form-validation-expert/SKILL.md +7 -6
  73. package/skills/frontier-ai-models-expert/SKILL.md +116 -0
  74. package/skills/fullstack-expert/SKILL.md +68 -144
  75. package/skills/gemini-agent-booster/SKILL.md +248 -172
  76. package/skills/geospatial-maps-expert/SKILL.md +81 -80
  77. package/skills/global-a11y-i18n-expert/SKILL.md +5 -4
  78. package/skills/glsl-shader-expert/SKILL.md +155 -71
  79. package/skills/go-programming-expert/SKILL.md +5 -4
  80. package/skills/graph-rag-knowledge-expert/SKILL.md +201 -159
  81. package/skills/graphql-apollo-expert/SKILL.md +5 -4
  82. package/skills/headless-cms-expert/SKILL.md +182 -181
  83. package/skills/hig/SKILL.md +5 -4
  84. package/skills/js-backend-expert/SKILL.md +219 -218
  85. package/skills/legacy-code-translator/SKILL.md +6 -5
  86. package/skills/llm-finops-router/SKILL.md +52 -0
  87. package/skills/local-slm-edge-ai-expert/SKILL.md +168 -167
  88. package/skills/logging-error-tracking-expert/SKILL.md +5 -4
  89. package/skills/mcp-server-architect/SKILL.md +316 -294
  90. package/skills/micro-frontend-architect/SKILL.md +5 -4
  91. package/skills/mobile-expo-expert/SKILL.md +5 -4
  92. package/skills/modern-css-native-expert/SKILL.md +190 -189
  93. package/skills/monorepo-architect/SKILL.md +5 -4
  94. package/skills/mpa-orchestrator/SKILL.md +41 -4
  95. package/skills/multi-agent-orchestration/SKILL.md +388 -254
  96. package/skills/mvc-expert/SKILL.md +5 -4
  97. package/skills/n8n-automation-expert/SKILL.md +90 -89
  98. package/skills/nextjs-app-router-expert/SKILL.md +3 -2
  99. package/skills/openapi-swagger-codegen-expert/SKILL.md +4 -3
  100. package/skills/payment-gateway-expert/SKILL.md +131 -128
  101. package/skills/pdf-document-generation-expert/SKILL.md +92 -91
  102. package/skills/performance-web-vitals/SKILL.md +5 -4
  103. package/skills/post-quantum-crypto-migrator/SKILL.md +3 -2
  104. package/skills/prd-architect/SKILL.md +85 -109
  105. package/skills/proactive-background-watcher/SKILL.md +5 -4
  106. package/skills/production-ready-hardener/SKILL.md +25 -27
  107. package/skills/pwa-offline-first-expert/SKILL.md +227 -185
  108. package/skills/pydantic-ai-expert/SKILL.md +162 -0
  109. package/skills/python-programming-expert/SKILL.md +5 -4
  110. package/skills/rate-limit-abuse-prevention/SKILL.md +5 -4
  111. package/skills/realtime-collaboration-expert/SKILL.md +3 -2
  112. package/skills/rich-text-editor-expert/SKILL.md +178 -177
  113. package/skills/rust-programming-expert/SKILL.md +5 -4
  114. package/skills/saas-architect/SKILL.md +155 -0
  115. package/skills/saas-billing/SKILL.md +394 -382
  116. package/skills/saas-multi-tenant/SKILL.md +7 -6
  117. package/skills/scalability-clean-code/SKILL.md +5 -4
  118. package/skills/search-engine-expert/SKILL.md +90 -89
  119. package/skills/self-healing-cloud-orchestrator/SKILL.md +3 -2
  120. package/skills/senior-frontend/SKILL.md +21 -18
  121. package/skills/senior-frontend/scripts/frontend_scaffolder.py +1 -1
  122. package/skills/seo/SKILL.md +4 -4
  123. package/skills/session-memory-manager/SKILL.md +129 -0
  124. package/skills/solidjs-expert/SKILL.md +81 -80
  125. package/skills/spa-orchestrator/SKILL.md +5 -4
  126. package/skills/sse-websocket-streaming-expert/SKILL.md +3 -2
  127. package/skills/state-management-expert/SKILL.md +5 -4
  128. package/skills/supabase-security-expert/SKILL.md +5 -4
  129. package/skills/svelte-sveltekit-expert/SKILL.md +92 -91
  130. package/skills/svg-animation-motion-expert/SKILL.md +3 -2
  131. package/skills/synthetic-data-finetuning-expert/SKILL.md +156 -0
  132. package/skills/tailwind-expert/SKILL.md +62 -5
  133. package/skills/tanstack-query-expert/SKILL.md +5 -4
  134. package/skills/tauri-expert/SKILL.md +5 -4
  135. package/skills/typescript-expert/SKILL.md +5 -4
  136. package/skills/ui-ux-pro-max/SKILL.md +7 -4
  137. package/skills/vector-db-rag-expert/SKILL.md +209 -208
  138. package/skills/vercel-ai-sdk-expert/SKILL.md +226 -0
  139. package/skills/voice-ai-realtime-agent/SKILL.md +243 -202
  140. package/skills/vue-frontend-expert/SKILL.md +5 -4
  141. package/skills/wasm-edge-computing-expert/SKILL.md +3 -2
  142. package/skills/web-3d-graphics-expert/SKILL.md +259 -82
  143. package/skills/web-game-engine-expert/SKILL.md +278 -50
  144. package/skills/web-scraper/SKILL.md +158 -157
  145. package/skills/website-design-cloner/SKILL.md +5 -4
  146. package/skills/webxr-ar-vr-expert/SKILL.md +105 -65
  147. package/skills/wordpress-headless-expert/SKILL.md +145 -144
  148. package/skills/zero-tech-debt-auditor/SKILL.md +115 -0
  149. package/skills/zero-to-prod-orchestrator/SKILL.md +281 -227
  150. package/skills/zero-trust-secret-vault/SKILL.md +3 -2
  151. package/BLUEPRINT.md +0 -309
  152. package/skills/ai-cost-token-optimizer/SKILL.md +0 -82
  153. package/skills/ai-evals-benchmark-expert/SKILL.md +0 -188
  154. package/skills/asisten-ramah/SKILL.md +0 -47
  155. package/skills/auto-doc-updater/SKILL.md +0 -220
  156. package/skills/autonomous-chaos-monkey/SKILL.md +0 -63
  157. package/skills/background-jobs-queue-expert/SKILL.md +0 -235
  158. package/skills/bootstrap-to-modern/SKILL.md +0 -94
  159. package/skills/database-migration-versioning-expert/SKILL.md +0 -90
  160. package/skills/edge-serverless-db-expert/SKILL.md +0 -99
  161. package/skills/mcp-client-orchestrator/SKILL.md +0 -76
  162. package/skills/mobile-push-notification-expert/SKILL.md +0 -71
  163. package/skills/monday-design-aesthetic/SKILL.md +0 -73
  164. package/skills/multiple-entry-points/SKILL.md +0 -91
  165. package/skills/project-context-mapper/SKILL.md +0 -85
  166. package/skills/saas-mvp-launcher/SKILL.md +0 -260
  167. package/skills/saas-transformer/SKILL.md +0 -500
  168. package/skills/saas-transformer/references/billing_integration_guide.md +0 -401
  169. package/skills/secure-fuzz-testing/SKILL.md +0 -207
  170. package/skills/self-evolving-memory-graph/SKILL.md +0 -91
  171. package/skills/session-context-loader/SKILL.md +0 -83
  172. package/skills/session-handoff-resume/SKILL.md +0 -164
  173. package/skills/skill-baru/SKILL.md +0 -178
  174. package/skills/supabase-migration/SKILL.md +0 -91
  175. package/skills/token-saver/SKILL.md +0 -119
  176. package/skills/ui-components-expert/SKILL.md +0 -166
  177. package/skills/vibe-code-gardener/SKILL.md +0 -181
  178. package/skills/visual-qa-vision-agent/SKILL.md +0 -71
  179. /package/skills/{saas-transformer → saas-architect}/references/feature_gating_patterns.md +0 -0
  180. /package/skills/{saas-transformer → saas-architect}/references/saas_transformation_checklist.md +0 -0
  181. /package/skills/{saas-transformer → saas-architect}/scripts/saas_transformation_scanner.py +0 -0
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  name: database-orm-expert
3
- description: "Expert guide for database schema design, ORM tools (Prisma 6, Drizzle ORM, TypeORM), migrations, query optimization, and type-safe SQL patterns in TypeScript / Panduan ahli untuk desain skema database, ORM tools (Prisma 6, Drizzle ORM, TypeORM), migrasi, optimasi query, dan pola SQL type-safe di TypeScript."
4
- author: "Roedy Rustam"
3
+ description: "Updated to be the unified database skill covering ORM, migrations, edge DBs, and Supabase CLI / Keahlian database terpadu untuk ORM, migrasi, edge DB, dan Supabase CLI."
4
+ author: "Roedy Rustam"
5
+ version: "3.0.0"
5
6
  ---
6
7
 
7
- # Database ORM Expert (Prisma 6 + Drizzle ORM Edition)
8
+ # Unified Database & ORM Expert
8
9
 
9
10
  [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
11
 
@@ -14,26 +15,28 @@ author: "Roedy Rustam"
14
15
  ## English
15
16
 
16
17
  ### Description
17
- Design schemas, select ORMs, execute migrations, optimize queries, and implement type-safe SQL patterns. Prioritize **Prisma 6** and **Drizzle ORM**. Implement connection pooling for production workloads.
18
+ Design schemas, select ORMs, execute zero-downtime migrations, optimize queries, and implement edge serverless databases. Covers Prisma 6, Drizzle ORM, TypeORM, Supabase CLI workflows, and Edge DBs (Neon, Cloudflare D1, Turso, Upstash).
18
19
 
19
20
  ### Trigger Conditions
20
- - Designing or migrating a database schema.
21
+ - Designing or migrating a production schema (blue-green, canary).
21
22
  - Choosing between Prisma, Drizzle ORM, or TypeORM.
22
23
  - Writing complex queries with joins, aggregations, or pagination.
23
24
  - Optimizing slow queries or N+1 problems.
24
- - Setting up database migrations in CI/CD pipelines.
25
- - Implementing Row Level Security (RLS) patterns.
26
- - Working with PostgreSQL, MySQL, SQLite, or PlanetScale.
25
+ - Building edge-compatible serverless database connections.
26
+ - Executing Supabase migrations and RLS patterns.
27
+ - Managing backward-compatible massive data backfills.
27
28
 
28
29
  ## Orchestration & Integration
29
30
  - `js-backend-expert`: For Node/Bun/Deno backend implementations integrating these ORMs.
30
- - `edge-serverless-db-expert`: For edge/serverless connections (e.g., Supabase, Neon, Turso).
31
- - `database-migration-versioning-expert`: For advanced migration strategies and CI/CD pipelines.
31
+ - `ci-cd-devops-architect`: For automated migration deployment steps.
32
+ - `supabase-security-expert`: For Supabase RLS and security.
33
+ - `cloud-hosting-expert`: For infrastructure integration.
32
34
 
33
35
  ---
34
36
 
35
- ### ORM Selection Guide
37
+ ### Core ORM & Query Strategies
36
38
 
39
+ #### ORM Selection Guide
37
40
  | Criteria | Prisma 6 | Drizzle ORM | TypeORM |
38
41
  |---|---|---|---|
39
42
  | **Type Safety** | Schema-generated types | SQL-like, inferred types | Decorator-based |
@@ -41,222 +44,80 @@ Design schemas, select ORMs, execute migrations, optimize queries, and implement
41
44
  | **Query Style** | Fluent ORM API | SQL-first, composable | ActiveRecord / QueryBuilder |
42
45
  | **Edge Runtime** | Prisma Accelerate needed | Native edge support | No |
43
46
  | **Migrations** | `prisma migrate dev` | `drizzle-kit push/migrate` | `synchronize` (dev only) |
44
- | **Best For** | Rapid prototyping, teams | Production edge, monorepos | Legacy NestJS projects |
45
47
 
46
- **Recommendation**: Use **Drizzle ORM** for edge-compatible apps and performance-critical systems. Use **Prisma 6** for teams that prefer a schema-first DX and rich Studio tooling.
48
+ **Recommendation**: Use **Drizzle ORM** for edge-compatible apps and performance-critical systems. Use **Prisma 6** for teams preferring a schema-first DX.
47
49
 
48
- ---
49
-
50
- ### Prisma 6 — Best Practices
51
-
52
- #### Schema Design
53
- ```prisma
54
- // schema.prisma
55
- generator client {
56
- provider = "prisma-client-js"
57
- previewFeatures = ["relationJoins", "nativeDistinct"]
58
- }
50
+ #### Prisma 6 Best Practices
51
+ - Use `$transaction` for atomic operations.
52
+ - Avoid N+1 queries by using `select` and `include` (with Prisma 5.7+ relationJoins preview) rather than looping over `findMany`.
59
53
 
60
- datasource db {
61
- provider = "postgresql"
62
- url = env("DATABASE_URL")
63
- directUrl = env("DIRECT_URL") // for Supabase Pooler
64
- }
54
+ #### Drizzle ORM Best Practices
55
+ - Use `drizzle-kit generate` for generating SQL and `drizzle-kit migrate` for deployment.
56
+ - Utilize native edge support and type-safe query builders with `drizzle-orm`.
65
57
 
66
- model User {
67
- id String @id @default(cuid())
68
- email String @unique
69
- name String?
70
- role Role @default(USER)
71
- posts Post[]
72
- createdAt DateTime @default(now())
73
- updatedAt DateTime @updatedAt
74
-
75
- @@index([email])
76
- @@map("users")
77
- }
58
+ #### Query Optimization Principles
59
+ 1. **Always index foreign keys** and columns used in `WHERE`, `ORDER BY`, and `JOIN`.
60
+ 2. **Use `EXPLAIN ANALYZE`** to detect sequential scans.
61
+ 3. **Cursor-based pagination** over offset for large datasets.
62
+ 4. **Avoid `SELECT *`**. Batch inserts where possible.
63
+ 5. **Connection Pooling**: Use PgBouncer, Supabase's built-in pooler, or Prisma Accelerate for standard TCP to avoid exhausting connection limits. Alternatively, use HTTP/WebSocket drivers for edge queries.
78
64
 
79
- model Post {
80
- id String @id @default(cuid())
81
- title String
82
- content String?
83
- published Boolean @default(false)
84
- authorId String
85
- author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
86
- publishedAt DateTime?
87
-
88
- @@index([authorId, published])
89
- @@map("posts")
90
- }
65
+ ---
91
66
 
92
- enum Role {
93
- USER
94
- ADMIN
95
- SUPER_ADMIN
96
- }
97
- ```
67
+ ### Zero-Downtime Migrations & Versioning
98
68
 
99
- #### Avoiding N+1 with `include` vs `select`
100
- ```typescript
101
- // BAD: triggers N+1 queries
102
- const users = await prisma.user.findMany();
103
- for (const user of users) {
104
- const posts = await prisma.post.findMany({ where: { authorId: user.id } });
105
- }
69
+ #### 1. Zero-Downtime Migration Pattern (Expand and Contract)
70
+ Never make breaking changes in a single deployment.
71
+ - **Phase 1 (Expand)**: Add the new schema element (column, table) without removing the old one.
72
+ - **Phase 2 (Migrate)**: Update app to write to *both* and read from the new element (with fallback).
73
+ - **Phase 3 (Backfill)**: Run background script to backfill data to new element.
74
+ - **Phase 4 (Contract)**: Remove old application code.
75
+ - **Phase 5 (Cleanup)**: Drop old schema element in next deployment.
106
76
 
107
- // GOOD: single query with JOIN (Prisma 5.7+ relationJoins preview)
108
- const users = await prisma.user.findMany({
109
- select: {
110
- id: true,
111
- name: true,
112
- email: true,
113
- _count: { select: { posts: true } },
114
- posts: {
115
- where: { published: true },
116
- select: { id: true, title: true },
117
- take: 5,
118
- orderBy: { publishedAt: 'desc' },
119
- },
120
- },
121
- });
122
- ```
77
+ #### 2. Backward Compatibility Rules
78
+ - **Never `DROP` or `RENAME`** a column/table in active use.
79
+ - **Add `DEFAULT` values** to new `NOT NULL` columns.
123
80
 
124
- #### Optimistic Transactions
125
- ```typescript
126
- // Use $transaction for atomic operations
127
- const [updatedUser, newPost] = await prisma.$transaction([
128
- prisma.user.update({ where: { id }, data: { name } }),
129
- prisma.post.create({ data: { title, authorId: id } }),
130
- ]);
131
-
132
- // Interactive transaction for complex logic
133
- const result = await prisma.$transaction(async (tx) => {
134
- const user = await tx.user.findUniqueOrThrow({ where: { id } });
135
- if (user.role !== 'ADMIN') throw new Error('Unauthorized');
136
- return tx.post.updateMany({ where: { authorId: id }, data: { published: true } });
137
- });
138
- ```
81
+ #### 3. Migration Mechanics & Safe Data Backfilling
82
+ - **Never run `prisma db push` or `synchronize: true`** in production. Always use immutable version-controlled scripts (e.g., `20260814_add_user_status.sql`).
83
+ - Write idempotent scripts (`CREATE TABLE IF NOT EXISTS`).
84
+ - **Chunking**: For large tables, perform updates in batches (using `LIMIT` and sleep intervals) to prevent table locking. Use background jobs (BullMQ/Inngest).
139
85
 
140
86
  ---
141
87
 
142
- ### Drizzle ORM — Best Practices
88
+ ### Edge & Serverless Drivers
143
89
 
144
- #### Schema Definition (PostgreSQL)
90
+ Exploit serverless DBs for ultra-low latency:
91
+ - **Neon & Cloudflare D1**: Serverless autoscaling Postgres with instant branching; Distributed edge SQLite.
92
+ - **Embedded Replicas**: Sync edge SQLite read-replicas with central cloud DBs.
93
+ - **HTTP/WebSocket Proxy Pooling**: Use `neon-http` or similar when querying databases from Edge Workers/Functions.
94
+ - **Upstash Redis Edge Caching**:
145
95
  ```typescript
146
- // src/db/schema.ts
147
- import { pgTable, text, boolean, timestamp, pgEnum, index } from 'drizzle-orm/pg-core';
148
- import { createId } from '@paralleldrive/cuid2';
149
- import { relations } from 'drizzle-orm';
150
-
151
- export const roleEnum = pgEnum('role', ['USER', 'ADMIN', 'SUPER_ADMIN']);
152
-
153
- export const users = pgTable('users', {
154
- id: text('id').primaryKey().$defaultFn(() => createId()),
155
- email: text('email').notNull().unique(),
156
- name: text('name'),
157
- role: roleEnum('role').default('USER').notNull(),
158
- createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
159
- updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull().$onUpdateFn(() => new Date()),
160
- }, (t) => [
161
- index('users_email_idx').on(t.email),
162
- ]);
163
-
164
- export const posts = pgTable('posts', {
165
- id: text('id').primaryKey().$defaultFn(() => createId()),
166
- title: text('title').notNull(),
167
- content: text('content'),
168
- published: boolean('published').default(false).notNull(),
169
- authorId: text('author_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
170
- publishedAt: timestamp('published_at', { withTimezone: true }),
171
- }, (t) => [
172
- index('posts_author_published_idx').on(t.authorId, t.published),
173
- ]);
174
-
175
- export const usersRelations = relations(users, ({ many }) => ({
176
- posts: many(posts),
177
- }));
178
-
179
- export const postsRelations = relations(posts, ({ one }) => ({
180
- author: one(users, { fields: [posts.authorId], references: [users.id] }),
181
- }));
182
- ```
183
-
184
- #### Type-safe Queries with Drizzle
185
- ```typescript
186
- // src/db/index.ts
187
- import { drizzle } from 'drizzle-orm/postgres-js';
188
- import postgres from 'postgres';
189
- import * as schema from './schema';
190
-
191
- const client = postgres(process.env.DATABASE_URL!);
192
- export const db = drizzle(client, { schema });
193
-
194
- // Type-safe query with joins
195
- import { eq, and, desc, count } from 'drizzle-orm';
196
-
197
- const usersWithPosts = await db.query.users.findMany({
198
- with: {
199
- posts: {
200
- where: eq(posts.published, true),
201
- orderBy: desc(posts.publishedAt),
202
- limit: 5,
203
- },
204
- },
205
- extras: {
206
- postCount: db.$count(posts, eq(posts.authorId, users.id)).as('post_count'),
207
- },
208
- });
209
-
210
- // Paginated query
211
- async function getPaginatedPosts(page: number, pageSize = 20) {
212
- const offset = (page - 1) * pageSize;
213
- const [items, [{ total }]] = await Promise.all([
214
- db.select().from(posts).where(eq(posts.published, true))
215
- .orderBy(desc(posts.publishedAt))
216
- .limit(pageSize)
217
- .offset(offset),
218
- db.select({ total: count() }).from(posts).where(eq(posts.published, true)),
219
- ]);
220
- return { items, total, pages: Math.ceil(total / pageSize) };
96
+ import { Redis } from '@upstash/redis';
97
+ const redis = new Redis({ url: process.env.UPSTASH_REDIS_REST_URL!, token: process.env.UPSTASH_REDIS_REST_TOKEN! });
98
+ export async function getCachedData(key: string) {
99
+ let data = await redis.get(key);
100
+ if (!data) {
101
+ data = await fetchFromDB();
102
+ await redis.set(key, data, { ex: 3600 });
103
+ }
104
+ return data;
221
105
  }
222
106
  ```
223
107
 
224
- #### Drizzle Migration Workflow
225
- ```bash
226
- # drizzle.config.ts defines connection + schema path
227
- npx drizzle-kit generate # generate migration SQL files
228
- npx drizzle-kit migrate # apply migrations to database
229
- npx drizzle-kit push # push schema directly (dev only)
230
- npx drizzle-kit studio # open Drizzle Studio GUI
231
- ```
232
-
233
- ---
234
-
235
- ### Query Optimization Principles
236
-
237
- 1. **Always index foreign keys** and columns used in `WHERE`, `ORDER BY`, and `JOIN`.
238
- 2. **Use `EXPLAIN ANALYZE`** to detect sequential scans and missing indexes.
239
- 3. **Cursor-based pagination** over offset for large datasets:
240
- ```typescript
241
- // Cursor pagination with Drizzle
242
- const items = await db.select().from(posts)
243
- .where(cursor ? lt(posts.createdAt, cursor) : undefined)
244
- .orderBy(desc(posts.createdAt))
245
- .limit(pageSize);
246
- ```
247
- 4. **Connection pooling**: Use PgBouncer or Supabase's built-in pooler. Set `DIRECT_URL` for migrations and `DATABASE_URL` for pooled reads/writes.
248
- 5. **Avoid `SELECT *`**: Always select only the columns you need.
249
- 6. **Batch inserts**: Use `db.insert(table).values([...items])` instead of looping.
250
-
251
108
  ---
252
109
 
253
- ### Migration Best Practices
110
+ ### Supabase CLI & MCP Workflow
254
111
 
255
- - **Never use `synchronize: true`** in production (TypeORM).
256
- - **Never run `prisma db push`** in production — always use `prisma migrate deploy`.
257
- - Store migration files in version control.
258
- - Run migrations as a separate step before deploying new app versions.
259
- - Use **advisory locks** or migration tools to prevent concurrent migration runs.
112
+ 1. **Check Environment**: Ensure `supabase/migrations` directory exists.
113
+ 2. **Review Available MCP Commands**:
114
+ - List existing migrations: `mcp_supabase-mcp-server_list_migrations` with `project_id`.
115
+ - Confirm SQL before executing via server directly.
116
+ 3. **Execute Command**:
117
+ - Write SQL script locally: `npx supabase migration new [name]` -> writes to `supabase/migrations/<timestamp>_[name].sql`.
118
+ - Test locally: `npx supabase migration up` or `npx supabase db reset`.
119
+ - Apply remote: `npx supabase db push` (or use remote MCP `apply_migration`).
120
+ 4. **Final Step**: If using RLS, explicitly add policies to new tables. Confirm completion with user.
260
121
 
261
122
  ---
262
123
 
@@ -264,41 +125,42 @@ npx drizzle-kit studio # open Drizzle Studio GUI
264
125
  ## Bahasa Indonesia
265
126
 
266
127
  ### Deskripsi
267
- Rancang skema, pilih ORM, eksekusi migrasi, optimalkan query, dan implementasikan pola SQL type-safe. Prioritaskan **Prisma 6** dan **Drizzle ORM**. Implementasikan connection pooling untuk beban kerja produksi.
128
+ Rancang skema, pilih ORM, eksekusi migrasi tanpa downtime, optimalkan query, dan implementasikan edge serverless DB. Mencakup Prisma 6, Drizzle, TypeORM, Supabase CLI, dan Edge DBs (Neon, Cloudflare D1, Turso, Upstash).
268
129
 
269
130
  ### Kondisi Pemicu
270
- - Merancang atau memigrasikan skema database.
271
- - Memilih antara Prisma, Drizzle ORM, atau TypeORM.
272
- - Menulis query kompleks dengan join, agregasi, atau paginasi.
131
+ - Merancang atau memigrasikan skema produksi (blue-green, canary).
132
+ - Memilih antara Prisma, Drizzle, atau TypeORM.
273
133
  - Mengoptimalkan query lambat atau masalah N+1.
274
- - Menyiapkan migrasi database dalam pipeline CI/CD.
275
- - Mengimplementasikan pola Row Level Security (RLS).
276
- - Bekerja dengan PostgreSQL, MySQL, SQLite, atau PlanetScale.
134
+ - Membuat koneksi serverless kompatibel dengan edge.
135
+ - Mengeksekusi migrasi Supabase dan pola RLS.
136
+ - Mengelola backfill data besar secara backward-compatible.
277
137
 
278
138
  ## Integrasi Orkestrasi
279
- - `js-backend-expert`: Untuk implementasi backend Node/Bun/Deno yang menggunakan ORM ini.
280
- - `edge-serverless-db-expert`: Untuk koneksi edge/serverless (mis. Supabase, Neon, Turso).
281
- - `database-migration-versioning-expert`: Untuk strategi migrasi lanjutan dan pipeline CI/CD.
282
-
283
- ### Panduan Pemilihan ORM
284
-
285
- Gunakan tabel di atas (lihat bagian English) sebagai referensi pemilihan ORM. Rekomendasi singkat:
286
- - **Drizzle ORM**: Untuk aplikasi edge-compatible dan sistem kritis performa.
287
- - **Prisma 6**: Untuk tim yang lebih menyukai DX schema-first dan tooling Studio yang kaya.
288
- - **TypeORM**: Hanya untuk proyek lama (legacy) berbasis NestJS.
289
-
290
- ### Prinsip Utama
291
-
292
- 1. **Selalu index foreign key** dan kolom yang digunakan di `WHERE`, `ORDER BY`, dan `JOIN`.
293
- 2. **Gunakan `EXPLAIN ANALYZE`** untuk mendeteksi sequential scan dan index yang hilang.
294
- 3. **Cursor-based pagination** lebih baik dari offset untuk dataset besar.
295
- 4. **Connection pooling**: Gunakan PgBouncer atau Supabase pooler bawaan.
296
- 5. **Hindari `SELECT *`**: Selalu pilih hanya kolom yang dibutuhkan.
297
- 6. **Batch insert**: Gunakan insert massal, bukan looping satu per satu.
298
-
299
- ### Prinsip Migrasi
300
-
301
- - Jangan gunakan `synchronize: true` di produksi (TypeORM).
302
- - Jangan jalankan `prisma db push` di produksi — selalu gunakan `prisma migrate deploy`.
303
- - Simpan file migrasi di version control.
304
- - Jalankan migrasi sebagai langkah terpisah sebelum deploy versi aplikasi baru.
139
+ - `js-backend-expert`: Untuk implementasi Node/Bun/Deno.
140
+ - `ci-cd-devops-architect`: Untuk otomatisasi langkah deployment migrasi.
141
+ - `supabase-security-expert`: Untuk RLS dan keamanan Supabase.
142
+ - `cloud-hosting-expert`: Untuk integrasi infrastruktur.
143
+
144
+ ### Strategi Inti ORM & Query
145
+ - **Drizzle ORM** direkomendasikan untuk aplikasi edge, **Prisma 6** untuk DX schema-first.
146
+ - Gunakan `$transaction` dan batasi `SELECT *`.
147
+ - Selalu indeks foreign key dan gunakan pagination berbasis cursor (Cursor-based pagination).
148
+ - **Connection Pooling**: Gunakan pooler bawaan Supabase, PgBouncer, Prisma Accelerate, atau driver HTTP (seperti `neon-http`) untuk request edge.
149
+
150
+ ### Migrasi Tanpa Downtime & Versioning
151
+ - **Pola Expand and Contract**: Jangan pernah melakukan breaking change dalam satu rilis. Tambah kolom baru, update kode untuk memakai keduanya, backfill data, hapus kode lama, lalu drop kolom lama.
152
+ - Jangan gunakan `DROP` atau `RENAME` pada kolom aktif. Kolom `NOT NULL` baru harus memiliki nilai `DEFAULT`.
153
+ - **Jangan jalankan `prisma db push` atau `synchronize: true`** di produksi. Gunakan skrip migrasi bertahap (idempoten).
154
+ - **Backfill Aman**: Gunakan pemrosesan batch/chunking dengan background job untuk tabel raksasa agar tidak menyebabkan table lock.
155
+
156
+ ### Driver Edge & Serverless
157
+ - Manfaatkan Neon Serverless Postgres, Cloudflare D1, Turso, atau Upstash Redis (caching).
158
+ - Gunakan driver berbasis HTTP/WebSocket di lingkungan Edge Workers untuk mencegah habisnya batas koneksi TCP.
159
+
160
+ ### Alur Kerja Supabase CLI & MCP
161
+ 1. Pastikan folder `supabase/migrations` ada.
162
+ 2. Periksa migrasi dengan `mcp_supabase-mcp-server_list_migrations`.
163
+ 3. Buat file migrasi lokal dengan `npx supabase migration new [nama]`.
164
+ 4. Uji lokal dengan `npx supabase migration up`.
165
+ 5. Deploy remote dengan `npx supabase db push` atau melalui MCP.
166
+ 6. Tambahkan kebijakan RLS jika diperlukan. Konfirmasikan sukses ke pengguna.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: deep-research-analyst
3
+ description: "Expert guide for autonomous deep research, iterative web search, citation verification, evidence graph synthesis, and hallucination mitigation / Panduan ahli riset mendalam otonom, pencarian web iteratif, verifikasi sitasi, dan mitigasi halusinasi."
4
+ author: vibes-plug-swarm
5
+ version: "3.0.0"
6
+ ---
7
+
8
+ # Deep Research Analyst (2026 Autonomous Research Edition)
9
+
10
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
11
+
12
+ ---
13
+
14
+ <a name="english"></a>
15
+ ## English
16
+
17
+ ### Orchestration & Integration
18
+ Connects and orchestrates with relevant domain skills like `brainstorming`, `prd-architect`, `web-scraper`, `browser-automation-expert`, `session-memory-manager`, and `multi-agent-orchestration` to form an evidence-backed intelligence swarm.
19
+
20
+ ### Description
21
+ Production guide for architecting and executing autonomous **Deep Research** pipelines. Unlike simple one-shot retrieval (RAG), Deep Research operates as a goal-directed autonomous loop: decomposing queries into multi-perspective sub-questions, crawling and scraping academic/technical sources, scoring source credibility, cross-verifying facts across multiple independent citations, constructing an evidence graph, and synthesizing comprehensive, citation-grounded intelligence briefs.
22
+
23
+ **Swarm Synergy:** Within the **Fan-Out / Fan-In Research Swarm**, this skill acts as the Lead Intelligence Subagent. It is deployed in Phase 1 (Discovery & PRD) to gather ground truth, audit competitor architectures, and resolve high-risk technical unknowns before code is written.
24
+
25
+ ### Trigger Conditions
26
+ - Requiring deep, multi-source investigation before architectural decision-making.
27
+ - Benchmarking libraries, database engines, or cloud architectures with empirical data.
28
+ - Building autonomous research agents, competitive intelligence scrapers, or literature synthesis tools.
29
+ - Eliminating LLM hallucinations in high-stakes technical or business documentation.
30
+ - Synthesizing complex multi-page web information into structured, cited intelligence reports.
31
+
32
+ ### Deep Research Operational Workflow
33
+
34
+ ```
35
+ 1. QUERY DECOMPOSITION & HYPOTHESIS FORMULATION
36
+ [User Objective] ──► [Query Expander] ──┬──► Sub-query A (Technical Specs)
37
+ ├──► Sub-query B (Benchmarks & Limitations)
38
+ └──► Sub-query C (Community Issues & Regressions)
39
+
40
+ 2. RECURSIVE SOURCE DISCOVERY & CRAWLING
41
+ [Sub-queries] ──► [Crawl4AI / Firecrawl / SerpAPI] ──► Raw Markdown / HTML Sources
42
+
43
+ 3. SOURCE CREDIBILITY & FACT TRIANGULATION
44
+ Raw Documents ──► [Evidence Evaluator] ──► Triangulate Facts (>= 2 Independent Sources)
45
+ ──► Discard Low-Trust / SEO-Spam Content
46
+
47
+ 4. EVIDENCE GRAPH SYNTHESIS & REPORTING
48
+ Verified Facts ──► [Synthesizer Node] ──► Structured Report with Clickable Markdown Citations
49
+ ```
50
+
51
+ ### Core Implementation Guidelines
52
+
53
+ #### 1. Recursive Query Decomposer (Python / TypeScript)
54
+ Break high-level user requests into diverse search vectors targeting technical documentation, GitHub issues, and benchmarks:
55
+ ```typescript
56
+ import { generateObject } from 'ai';
57
+ import { z } from 'zod';
58
+
59
+ interface ResearchPlan {
60
+ coreObjective: string;
61
+ subQueries: Array<{
62
+ query: string;
63
+ focus: 'architecture' | 'benchmarks' | 'security' | 'pitfalls';
64
+ expectedSourceType: 'docs' | 'github_repo' | 'benchmark_paper';
65
+ }>;
66
+ }
67
+
68
+ export async function decomposeResearchQuery(userPrompt: string): Promise<ResearchPlan> {
69
+ const { object } = await generateObject({
70
+ model: customModel('gemini-3.8-flash'),
71
+ schema: z.object({
72
+ coreObjective: z.string(),
73
+ subQueries: z.array(z.object({
74
+ query: z.string().describe('Precise keyword search query with technical operators'),
75
+ focus: z.enum(['architecture', 'benchmarks', 'security', 'pitfalls']),
76
+ expectedSourceType: z.enum(['docs', 'github_repo', 'benchmark_paper']),
77
+ })).min(3).max(6),
78
+ }),
79
+ prompt: `Analyze the following research objective and decompose it into 4-6 targeted, non-overlapping search vectors: "${userPrompt}"`,
80
+ });
81
+
82
+ return object;
83
+ }
84
+ ```
85
+
86
+ #### 2. Python Implementation: Autonomous Extraction
87
+ ```python
88
+ from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, CacheMode
89
+ from pydantic import BaseModel, Field
90
+ from pydantic_ai import Agent
91
+
92
+ class ResearchFinding(BaseModel):
93
+ claim: str = Field(description="Technical claim extracted")
94
+ confidence: float = Field(ge=0, le=1, description="Confidence score")
95
+ source_url: str = Field(description="Source URL")
96
+ corroborating_sources: list[str] = Field(default_factory=list)
97
+
98
+ research_agent = Agent(
99
+ 'google:gemini-3.8-flash',
100
+ result_type=list[ResearchFinding],
101
+ system_prompt="Extract and verify technical claims with confidence scores."
102
+ )
103
+
104
+ async def deep_research(query: str) -> list[ResearchFinding]:
105
+ config = CrawlerRunConfig(cache_mode=CacheMode.BYPASS)
106
+ async with AsyncWebCrawler() as crawler:
107
+ result = await crawler.arun(url=f"https://search-url/{query}", config=config)
108
+ findings = await research_agent.run(result.markdown)
109
+ return findings.data
110
+ ```
111
+
112
+ #### 3. Vector Store Caching for Intermediate Results
113
+ Caching intermediate research results in vector stores prevents redundant crawling and accelerates knowledge retrieval:
114
+ - **Storage:** Use `pgvector` or local `FAISS` for caching crawled page embeddings.
115
+ - **Deduplication:** Deduplicate sources via cosine similarity before processing.
116
+ - **Invalidation:** Implement TTL-based cache invalidation for time-sensitive research (e.g., fast-moving API docs).
117
+ - **Example Flow:**
118
+ ```python
119
+ # Store page chunks in vector store
120
+ vector_store.add_texts(chunks, metadata=[{"url": url, "timestamp": now}])
121
+ # Retrieve similar past findings
122
+ cached = vector_store.similarity_search(query, k=3, filter={"ttl_valid": True})
123
+ ```
124
+
125
+ #### 4. Episodic Research Memory
126
+ Maintain research memory across sessions to build continuous intelligence:
127
+ - **Storage:** Store research dossiers as episodic memories in `session-memory-manager`.
128
+ - **Knowledge Graphs:** Build cumulative knowledge graphs from multiple research sessions, linking related concepts over time.
129
+ - **Cross-referencing:** Cross-reference past findings with new queries to compound understanding without starting from scratch.
130
+
131
+ #### 5. Source Credibility & Fact Triangulation Protocol
132
+ Never accept a claim from a single unverified blog post. Require citation triangulation:
133
+ - **Tier 1 (Highest Confidence):** Official documentation, source code repositories, peer-reviewed benchmarks, RFCs.
134
+ - **Tier 2 (Medium Confidence):** Production engineering blogs (Uber, Netflix, Cloudflare), maintainer posts.
135
+ - **Tier 3 (Verify Required):** Forum discussions, social threads, unverified community tutorials.
136
+ - **Rule of Triangulation:** Any non-trivial technical claim must be confirmed by at least two independent sources or verified against raw benchmark code.
137
+
138
+ #### 6. Structured Evidence Graph Output
139
+ Every research brief produced by this skill must adhere to the following markdown template:
140
+ ```markdown
141
+ # [Topic] — Deep Research & Evidence Dossier
142
+
143
+ ## Executive Summary
144
+ - Concise 3-5 bullet takeaway synthesis.
145
+
146
+ ## Evidence Matrix
147
+ | Technical Claim | Verified Status | Confidence (0-100%) | Primary Source | Corroborating Source |
148
+ |---|---|---|---|---|
149
+ | Claim Description | Confirmed / Disputed | 95% | [Source A](url) | [Source B](url) |
150
+
151
+ ## Trade-off Analysis & Key Risks
152
+ - Concrete architectural trade-offs, cold-start latencies, memory footprint, or pricing cliff.
153
+
154
+ ## Recommended Architectural Decision
155
+ - Prescriptive guidance for implementation swarms with justification.
156
+ ```
157
+
158
+ ---
159
+
160
+ <a name="bahasa-indonesia"></a>
161
+ ## Bahasa Indonesia
162
+
163
+ ### Integrasi Orkestrasi
164
+ Terhubung dan mengorkestrasi skill domain yang relevan seperti `brainstorming`, `prd-architect`, `web-scraper`, `browser-automation-expert`, `session-memory-manager`, dan `multi-agent-orchestration` untuk membentuk swarm intelijen berbasis bukti empiris.
165
+
166
+ ### Deskripsi
167
+ Panduan produksi untuk merancang dan mengeksekusi pipeline **Riset Mendalam Otonom (Deep Research)**. Berbeda dari retrieval sederhana (RAG satu langkah), Deep Research beroperasi sebagai siklus otonom terarah: memecah pertanyaan menjadi sub-vektor dari berbagai sudut pandang, merayapi dan mengekstrak sumber teknis/akademis, menilai kredibilitas sumber, memvalidasi silang fakta (*fact triangulation*) di minimal 2 sumber independen, membangun graf bukti, dan menyusun laporan intelijen komprehensif berlandaskan sitasi yang valid.
168
+
169
+ **Sinergi Swarm:** Dalam topologi **Fan-Out / Fan-In Research Swarm**, skill ini berperan sebagai Sub-agen Analis Utama. Diterapkan pada Fase 1 (Discovery & PRD) untuk mengumpulkan fakta objektif, mengaudit arsitektur kompetitor, dan mengeliminasi ketidakpastian teknis berisiko tinggi sebelum penulisan kode dimulai.
170
+
171
+ ### Kondisi Pemicu
172
+ - Membutuhkan penyelidikan multi-sumber yang mendalam sebelum membuat keputusan arsitektur.
173
+ - Melakukan benchmark komparatif library, database engine, atau infrastruktur cloud berbasis data empiris.
174
+ - Membangun agen riset otonom, alat pemantau kompetitor, atau sintesis literatur otomatis.
175
+ - Mengeliminasi halusinasi LLM pada dokumen teknis atau strategi bisnis berisiko tinggi.
176
+ - Merangkum informasi web yang rumit dan tersebar menjadi dokumen ringkasan terstruktur dengan sitasi klik langsung.
177
+
178
+ ### Protokol Triangulasi Fakta & Skor Keyakinan
179
+ 1. **Tier 1 (Otoritatif):** Dokumentasi resmi, repositori kode sumber terbuka, RFC/spesifikasi teknis, laporan audit resmi.
180
+ 2. **Tier 2 (Dapat Diandalkan):** Blog teknik produksi resmi (Netflix, Cloudflare, Uber), analisis tim pengembang inti.
181
+ 3. **Tier 3 (Perlu Verifikasi Lanjutan):** Thread diskusi komunitas, tutorial umum.
182
+ 4. **Aturan Triangulasi:** Setiap klaim teknis penting wajib diverifikasi silang oleh sekurang-kurangnya 2 sumber independen sebelum dimasukkan ke dalam blueprint arsitektur.