vibes-plug 1.0.0 → 2.5.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.
- package/.github/workflows/publish.yml +20 -0
- package/AGENTS.md +66 -0
- package/BLUEPRINT.md +152 -60
- package/CHANGELOG.md +50 -0
- package/README.md +346 -194
- package/package.json +25 -25
- package/plugin.json +1 -1
- package/skills/ai-cost-token-optimizer/SKILL.md +52 -0
- package/skills/ai-llm-integration-expert/SKILL.md +180 -162
- package/skills/api-design-expert/SKILL.md +314 -310
- package/skills/app-analyzer-optimizer/SKILL.md +193 -189
- package/skills/apple-ecosystem-expert/SKILL.md +142 -0
- package/skills/async-queue-temporal-expert/SKILL.md +54 -0
- package/skills/authentication-identity-expert/SKILL.md +251 -20
- package/skills/auto-doc-updater/SKILL.md +214 -204
- package/skills/autonomous-chaos-monkey/SKILL.md +63 -0
- package/skills/autonomous-red-teamer/SKILL.md +59 -0
- package/skills/autonomous-swarm-director/SKILL.md +69 -0
- package/skills/autonomous-tdd-debugger/SKILL.md +65 -0
- package/skills/bootstrap-to-modern/SKILL.md +90 -86
- package/skills/brainstorming/SKILL.md +373 -353
- package/skills/browser-automation-expert/SKILL.md +46 -0
- package/skills/ci-cd-devops-architect/SKILL.md +72 -45
- package/skills/cloud-hosting-expert/SKILL.md +244 -244
- package/skills/coderabbit/SKILL.md +192 -192
- package/skills/cron-scheduler-expert/SKILL.md +298 -0
- package/skills/data-telemetry-expert/SKILL.md +213 -213
- package/skills/database-orm-expert/SKILL.md +294 -294
- package/skills/dependency-upgrade-migrator/SKILL.md +295 -0
- package/skills/design-system-architect/SKILL.md +27 -10
- package/skills/doku-mcp-server/SKILL.md +251 -0
- package/skills/doku-payment-gateway/SKILL.md +227 -0
- package/skills/e2e-testing-expert/SKILL.md +315 -315
- package/skills/edge-serverless-db-expert/SKILL.md +43 -0
- package/skills/email-notification-expert/SKILL.md +362 -0
- package/skills/error-resilience-expert/SKILL.md +480 -0
- package/skills/event-driven-architect/SKILL.md +81 -81
- package/skills/feature-flag-analytics-expert/SKILL.md +46 -0
- package/skills/file-upload-media-expert/SKILL.md +431 -0
- package/skills/form-validation-expert/SKILL.md +401 -0
- package/skills/fullstack-expert/SKILL.md +202 -202
- package/skills/fullstack-expert/references/api_design_guide.md +466 -466
- package/skills/fullstack-expert/references/multi_language_backend.md +528 -528
- package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -253
- package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -326
- package/skills/gemini-agent-booster/SKILL.md +135 -135
- package/skills/global-a11y-i18n-expert/SKILL.md +81 -81
- package/skills/glsl-shader-expert/SKILL.md +101 -0
- package/skills/go-programming-expert/SKILL.md +295 -295
- package/skills/graphql-apollo-expert/SKILL.md +108 -0
- package/skills/hig/SKILL.md +188 -188
- package/skills/hyper-context-synthesizer/SKILL.md +55 -0
- package/skills/js-backend-expert/SKILL.md +34 -9
- package/skills/legacy-code-translator/SKILL.md +65 -0
- package/skills/llm-cost-arbitrage-router/SKILL.md +59 -0
- package/skills/logging-error-tracking-expert/SKILL.md +338 -0
- package/skills/mcp-client-orchestrator/SKILL.md +70 -0
- package/skills/mcp-server-architect/SKILL.md +194 -194
- package/skills/micro-frontend-architect/SKILL.md +106 -0
- package/skills/mobile-expo-expert/SKILL.md +186 -186
- package/skills/mobile-push-notification-expert/SKILL.md +51 -0
- package/skills/monday-design-aesthetic/SKILL.md +67 -67
- package/skills/monorepo-architect/SKILL.md +227 -227
- package/skills/mpa-orchestrator/SKILL.md +101 -101
- package/skills/multi-agent-orchestration/SKILL.md +234 -234
- package/skills/multiple-entry-points/SKILL.md +55 -55
- package/skills/mvc-expert/SKILL.md +231 -231
- package/skills/payment-gateway-expert/SKILL.md +45 -45
- package/skills/performance-web-vitals/SKILL.md +332 -332
- package/skills/post-quantum-crypto-migrator/SKILL.md +57 -0
- package/skills/prd-architect/SKILL.md +201 -191
- package/skills/proactive-background-watcher/SKILL.md +62 -0
- package/skills/production-ready-hardener/PRODUCTION_READINESS_REPORT.md +67 -0
- package/skills/production-ready-hardener/SKILL.md +173 -186
- package/skills/production-ready-hardener/references/production_checklist.md +161 -161
- package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +881 -875
- package/skills/project-context-mapper/SKILL.md +79 -0
- package/skills/python-programming-expert/SKILL.md +263 -132
- package/skills/rate-limit-abuse-prevention/SKILL.md +371 -0
- package/skills/realtime-collaboration-expert/SKILL.md +45 -45
- package/skills/rust-programming-expert/SKILL.md +235 -235
- package/skills/saas-billing/SKILL.md +377 -377
- package/skills/saas-multi-tenant/SKILL.md +251 -237
- package/skills/saas-mvp-launcher/SKILL.md +10 -0
- package/skills/saas-transformer/SKILL.md +187 -144
- package/skills/saas-transformer/references/billing_integration_guide.md +401 -401
- package/skills/saas-transformer/references/feature_gating_patterns.md +137 -137
- package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -121
- package/skills/saas-transformer/scripts/saas_transformation_scanner.py +39 -29
- package/skills/scalability-clean-code/SKILL.md +229 -229
- package/skills/self-evolving-memory-graph/SKILL.md +75 -0
- package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -0
- package/skills/senior-frontend/SKILL.md +161 -161
- package/skills/senior-fullstack/SKILL.md +167 -167
- package/skills/seo/SKILL.md +235 -225
- package/skills/seo-geo/SKILL.md +188 -188
- package/skills/session-context-loader/SKILL.md +77 -0
- package/skills/session-handoff-resume/SKILL.md +158 -158
- package/skills/skill_baru/SKILL.md +172 -147
- package/skills/spa-orchestrator/SKILL.md +288 -288
- package/skills/state-management-expert/SKILL.md +272 -272
- package/skills/supabase-security-expert/SKILL.md +243 -243
- package/skills/tailwind-expert/SKILL.md +188 -188
- package/skills/tanstack-query-expert/SKILL.md +199 -199
- package/skills/token-saver/SKILL.md +119 -111
- package/skills/typescript-expert/SKILL.md +324 -279
- package/skills/ui-components-expert/SKILL.md +263 -46
- package/skills/ui-ux-pro-max/SKILL.md +202 -201
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
- package/skills/ui_ux_expert/SKILL.md +17 -6
- package/skills/vector-db-rag-expert/SKILL.md +52 -0
- package/skills/vibe-code-gardener/SKILL.md +181 -173
- package/skills/visual-qa-vision-agent/SKILL.md +65 -0
- package/skills/vue-frontend-expert/SKILL.md +126 -0
- package/skills/web-3d-graphics-expert/SKILL.md +131 -0
- package/skills/web-game-engine-expert/SKILL.md +96 -0
- package/skills/web-scraper/SKILL.md +207 -205
- package/skills/website-design-cloner/SKILL.md +174 -0
- package/skills/webxr-ar-vr-expert/SKILL.md +117 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +206 -180
- package/skills/zero-trust-secret-vault/SKILL.md +40 -0
- package/vibes-swarm-demo.gif +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legacy-code-translator
|
|
3
|
+
description: "Methodological guide for the AI Agent to safely and systematically translate, refactor, and modernize giant legacy codebases (PHP, Python 2, old React) into modern stacks."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Legacy Code Translator (Refactoring Engine)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
A rigid methodology for the AI agent to reverse-engineer and translate legacy codebases into modern architectures without losing business logic. This gives the agent the "superpower" to handle massive enterprise migrations safely, avoiding the common hallucination trap of rewriting everything at once.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
Activate this skill when the user says:
|
|
21
|
+
- "Migrate this old PHP codebase to Next.js."
|
|
22
|
+
- "Translate this Python script to Rust."
|
|
23
|
+
- "Refactor this giant React class component into hooks."
|
|
24
|
+
|
|
25
|
+
### Core Concepts
|
|
26
|
+
|
|
27
|
+
#### 1. The 4-Step Migration Protocol
|
|
28
|
+
The agent MUST follow this exact sequence:
|
|
29
|
+
1. **Understand (AST Map):** Map out the legacy code's inputs, outputs, and side effects. Document this in an artifact (`migration_plan.md`).
|
|
30
|
+
2. **Isolate Logic:** Separate the core business rules from the legacy framework bindings (e.g., separate the tax calculation logic from the WordPress hook).
|
|
31
|
+
3. **Translate:** Write the modernized code in the new language/framework.
|
|
32
|
+
4. **Verify (Shadow Testing):** Compare the output of the new code against the old code using identical inputs.
|
|
33
|
+
|
|
34
|
+
#### 2. Agent Constraints
|
|
35
|
+
- **NEVER overwrite the legacy file directly.** Always create the new file side-by-side (e.g., `User.legacy.php` and `user.service.ts`).
|
|
36
|
+
- **NEVER attempt to translate a 2000-line file in one shot.** Break it down by functions or modules to prevent context window exhaustion and token truncation.
|
|
37
|
+
- **Preserve quirks:** Sometimes legacy bugs are actually relied-upon business logic. Document suspicious logic before fixing it.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Integration with Other Skills (MANDATORY)
|
|
42
|
+
- `prd-architect` — To document the extracted business rules before writing modern code.
|
|
43
|
+
- `project-context-mapper` — To understand how the legacy files intertwine before pulling them apart.
|
|
44
|
+
- `autonomous-tdd-debugger` — To write tests against the old code, ensuring the new code passes the exact same tests.
|
|
45
|
+
|
|
46
|
+
### Referenced By Orchestrators (MANDATORY)
|
|
47
|
+
- `brainstorming` — Add to "Architecture & Scale".
|
|
48
|
+
- `zero-to-prod-orchestrator` — Phase 2 (Foundation / Refactoring).
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
<a name="bahasa-indonesia"></a>
|
|
53
|
+
## Bahasa Indonesia
|
|
54
|
+
|
|
55
|
+
### Deskripsi
|
|
56
|
+
Panduan metodologis ketat bagi Agen AI untuk membongkar, menerjemahkan, dan memodernisasi *codebase* warisan (legacy) berskala raksasa (seperti PHP 5 atau React lawas) ke arsitektur modern tanpa kehilangan atau merusak *business logic* yang ada.
|
|
57
|
+
|
|
58
|
+
### Kondisi Pemicu
|
|
59
|
+
- Saat diminta memigrasikan sistem lama ke framework baru.
|
|
60
|
+
- Saat harus menerjemahkan kode antar bahasa pemrograman (misal: Python ke Rust, atau PHP ke Go).
|
|
61
|
+
|
|
62
|
+
### Panduan Singkat
|
|
63
|
+
- **Jangan Langsung Timpa:** Jangan pernah menulis ulang kode lama di file yang sama. Buat file baru bersisian (`old_logic.js` -> `new_logic.ts`), lalu perlahan pindahkan impornya.
|
|
64
|
+
- **Pecah Skala Raksasa:** LLM akan berhalusinasi jika diminta menerjemahkan 2000 baris kode sekaligus. Pecah tugas tersebut menjadi level fungsi (function-by-function).
|
|
65
|
+
- **Pemetaan Input/Output:** Sebelum menulis kode baru, agen wajib mendaftar semua *input* (argumen, variabel global, request DB) dan *output* (return, modifikasi state, update DB) dari fungsi lama ke dalam dokumen artefak.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: llm-cost-arbitrage-router
|
|
3
|
+
description: "Dynamically routes LLM calls based on cost/latency and builds semantic caching layers to reduce token burn / Mengarahkan pemanggilan LLM secara dinamis berdasarkan biaya/latensi dan membangun lapisan semantic cache untuk menekan pengeluaran token."
|
|
4
|
+
author: vibes-plug-swarm
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Predictive LLM Cost Arbitrage Router (FinOps AI Agent)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
An advanced FinOps architectural skill designed to prevent API cost overruns in AI applications. Instead of hardcoding a single model (e.g., GPT-4 or Claude 3.5 Sonnet) for every task, this agent builds an intelligent routing layer. It evaluates incoming prompts for complexity and dynamically routes simple queries to cheaper, faster models (e.g., Llama 3 8B, Gemini Flash) and complex reasoning tasks to frontier models. Additionally, it implements Semantic Caching (e.g., with Redis or Upstash) to serve identical or semantically similar queries without hitting the LLM provider, slashing token costs by up to 90%.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
- When building AI-native applications, chatbots, or RAG systems.
|
|
21
|
+
- During Phase 4 (Backend Architecture) when implementing external API layers.
|
|
22
|
+
- When explicitly requested by the user to "optimize AI costs" or "reduce token usage."
|
|
23
|
+
|
|
24
|
+
### Operating Protocol
|
|
25
|
+
1. **Model Fallback & Routing**: Sets up an abstraction layer (like LiteLLM or Vercel AI SDK Core) to support multiple providers.
|
|
26
|
+
2. **Complexity Scoring**: Implements heuristics (prompt length, required JSON schema, keyword analysis) to route to the cheapest capable model.
|
|
27
|
+
3. **Semantic Caching Integration**: Implements a Vector DB or Redis caching layer. Before routing to an LLM, it embeddings the user prompt and checks if a semantically similar query was answered recently.
|
|
28
|
+
4. **Token Budgeting**: Sets hard limits and alerts for daily API consumption per tenant/user.
|
|
29
|
+
|
|
30
|
+
## Orchestration & Integration
|
|
31
|
+
- Enhances `ai-llm-integration-expert` with enterprise-grade cost controls.
|
|
32
|
+
- Connects to `edge-serverless-db-expert` (Upstash/Redis) for fast semantic caching.
|
|
33
|
+
- Collaborates with `vector-db-rag-expert` for similarity scoring during cache retrieval.
|
|
34
|
+
- Feeds billing metrics into `saas-billing` for usage-based AI pricing models.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
<a name="bahasa-indonesia"></a>
|
|
39
|
+
## Bahasa Indonesia
|
|
40
|
+
|
|
41
|
+
### Deskripsi
|
|
42
|
+
Keterampilan arsitektur *FinOps* canggih yang dirancang untuk mencegah pembengkakan biaya API pada aplikasi berbasis AI. Alih-alih menetapkan satu model secara kaku (misalnya GPT-4 atau Claude 3.5 Sonnet) untuk semua tugas, agen ini membangun lapisan *routing* yang cerdas. Agen akan mengevaluasi tingkat kerumitan setiap prompt yang masuk dan mengarahkan *query* sederhana ke model yang lebih murah dan cepat (mis. Llama 3 8B, Gemini Flash), sementara tugas penalaran kompleks diarahkan ke model raksasa (*frontier*). Selain itu, agen ini mengimplementasikan *Semantic Caching* (misal dengan Redis atau Upstash) untuk menyajikan jawaban pada *query* yang identik atau mirip secara semantik tanpa harus menghubungi penyedia LLM, memangkas biaya token hingga 90%.
|
|
43
|
+
|
|
44
|
+
### Kondisi Pemicu
|
|
45
|
+
- Saat membangun aplikasi AI-native, chatbot, atau sistem RAG.
|
|
46
|
+
- Selama Fase 4 (Arsitektur Backend) saat mengimplementasikan lapisan API eksternal.
|
|
47
|
+
- Ketika diminta secara eksplisit oleh pengguna untuk "mengoptimalkan biaya AI" atau "mengurangi penggunaan token".
|
|
48
|
+
|
|
49
|
+
### Protokol Operasi
|
|
50
|
+
1. **Routing & Fallback Model**: Menyiapkan lapisan abstraksi (seperti LiteLLM atau Vercel AI SDK Core) untuk mendukung berbagai penyedia model.
|
|
51
|
+
2. **Penilaian Kompleksitas**: Mengimplementasikan heuristik (panjang prompt, kebutuhan skema JSON, analisis kata kunci) untuk mengarahkan prompt ke model termurah yang mampu menyelesaikannya.
|
|
52
|
+
3. **Integrasi Semantic Caching**: Mengimplementasikan lapisan *cache* Vector DB atau Redis. Sebelum mengirim ke LLM, prompt pengguna diubah menjadi vektor (*embedding*) untuk mengecek apakah pertanyaan serupa pernah dijawab baru-baru ini.
|
|
53
|
+
4. **Penganggaran Token**: Menetapkan batas maksimal dan notifikasi untuk konsumsi API harian per pengguna/tenant.
|
|
54
|
+
|
|
55
|
+
## Integrasi Orkestrasi
|
|
56
|
+
- Memperkuat `ai-llm-integration-expert` dengan kontrol biaya skala *enterprise*.
|
|
57
|
+
- Terhubung dengan `edge-serverless-db-expert` (Upstash/Redis) untuk *semantic caching* secepat kilat.
|
|
58
|
+
- Berkolaborasi dengan `vector-db-rag-expert` untuk perhitungan kemiripan saat pencarian *cache*.
|
|
59
|
+
- Memasok metrik penagihan ke `saas-billing` untuk model bisnis AI berbasis penggunaan (*usage-based pricing*).
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: logging-error-tracking-expert
|
|
3
|
+
description: "Expert guide for structured logging (Pino, Winston), error tracking (Sentry), log aggregation (Axiom, Datadog), request correlation, and GDPR-compliant log management / Panduan ahli untuk logging terstruktur (Pino, Winston), pelacakan error (Sentry), agregasi log, korelasi request, dan manajemen log sesuai GDPR."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Logging & Error Tracking Expert (2026 Edition)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
Production-grade guide for implementing structured logging, error tracking, and application monitoring. Covers **Pino** (high-performance JSON logging), **Sentry** SDK integration (React, Node.js, Next.js), **source map upload** for production errors, **request ID correlation** across microservices, **log aggregation** (Axiom, Datadog, Logflare), **alert rules**, **GDPR-compliant log redaction** (PII masking), and **OpenTelemetry integration**.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
Activate this skill when:
|
|
21
|
+
- Setting up structured logging for Node.js/Bun backend services.
|
|
22
|
+
- Integrating Sentry for error tracking in React/Next.js apps.
|
|
23
|
+
- Implementing request ID correlation across microservices.
|
|
24
|
+
- Setting up log aggregation and search (Axiom, Datadog, Grafana Loki).
|
|
25
|
+
- Configuring alerting rules for production errors.
|
|
26
|
+
- Implementing GDPR-compliant log management (PII redaction).
|
|
27
|
+
- Setting up source map uploads for production debugging.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Logging Library Selection Guide
|
|
32
|
+
|
|
33
|
+
| Library | Best For | Performance | Output Format |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| **Pino** | High-throughput Node.js services | ⭐⭐⭐⭐⭐ (fastest) | JSON (structured) |
|
|
36
|
+
| **Winston** | Enterprise, multiple transports | ⭐⭐⭐ | Configurable |
|
|
37
|
+
| **Bunyan** | Legacy projects | ⭐⭐⭐⭐ | JSON |
|
|
38
|
+
| **console.log** | Never in production | ❌ | Unstructured |
|
|
39
|
+
|
|
40
|
+
**Recommendation**: Use **Pino** for all production services (10x faster than Winston, native JSON).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### 1. Structured Logging with Pino
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// lib/logger.ts
|
|
48
|
+
import pino from 'pino';
|
|
49
|
+
|
|
50
|
+
export const logger = pino({
|
|
51
|
+
level: process.env.LOG_LEVEL ?? 'info',
|
|
52
|
+
// Redact sensitive fields (GDPR/PII)
|
|
53
|
+
redact: {
|
|
54
|
+
paths: ['req.headers.authorization', 'req.headers.cookie', '*.password', '*.token', '*.ssn', '*.creditCard'],
|
|
55
|
+
censor: '[REDACTED]',
|
|
56
|
+
},
|
|
57
|
+
// Standardized format
|
|
58
|
+
formatters: {
|
|
59
|
+
level: (label) => ({ level: label }),
|
|
60
|
+
bindings: (bindings) => ({
|
|
61
|
+
service: process.env.SERVICE_NAME ?? 'app',
|
|
62
|
+
environment: process.env.NODE_ENV,
|
|
63
|
+
version: process.env.APP_VERSION,
|
|
64
|
+
pid: bindings.pid,
|
|
65
|
+
hostname: bindings.hostname,
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Child logger for specific domain
|
|
72
|
+
export const dbLogger = logger.child({ module: 'database' });
|
|
73
|
+
export const authLogger = logger.child({ module: 'auth' });
|
|
74
|
+
export const paymentLogger = logger.child({ module: 'payment' });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Log Level Strategy
|
|
78
|
+
```typescript
|
|
79
|
+
// When to use each level:
|
|
80
|
+
logger.fatal('Application cannot start — exiting'); // Process crash
|
|
81
|
+
logger.error({ err }, 'Payment processing failed'); // Failed operations (needs attention)
|
|
82
|
+
logger.warn('Rate limit threshold at 80%'); // Degraded state, approaching limits
|
|
83
|
+
logger.info({ userId, action: 'login' }, 'User logged in'); // Business events, audit trail
|
|
84
|
+
logger.debug({ query, params }, 'Database query executed'); // Development troubleshooting
|
|
85
|
+
logger.trace({ request }, 'Incoming request'); // Extreme detail (rarely enabled)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### 2. Request ID Correlation
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// middleware/request-id.ts
|
|
94
|
+
import { randomUUID } from 'crypto';
|
|
95
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
96
|
+
|
|
97
|
+
// Async context for request correlation
|
|
98
|
+
export const requestContext = new AsyncLocalStorage<{ requestId: string }>();
|
|
99
|
+
|
|
100
|
+
export function requestIdMiddleware(req: Request): string {
|
|
101
|
+
// Use incoming header or generate new ID
|
|
102
|
+
const requestId = req.headers.get('x-request-id') ?? randomUUID();
|
|
103
|
+
|
|
104
|
+
// Propagate to downstream services
|
|
105
|
+
return requestId;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Usage with Pino child logger
|
|
109
|
+
export function getRequestLogger() {
|
|
110
|
+
const ctx = requestContext.getStore();
|
|
111
|
+
return ctx ? logger.child({ requestId: ctx.requestId }) : logger;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// In API route
|
|
115
|
+
export async function GET(request: Request) {
|
|
116
|
+
const requestId = requestIdMiddleware(request);
|
|
117
|
+
|
|
118
|
+
return requestContext.run({ requestId }, async () => {
|
|
119
|
+
const log = getRequestLogger();
|
|
120
|
+
log.info('Processing request');
|
|
121
|
+
|
|
122
|
+
// All downstream log calls include requestId automatically
|
|
123
|
+
const result = await fetchData(log);
|
|
124
|
+
return Response.json(result);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### 3. Sentry Integration (Next.js)
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// sentry.client.config.ts
|
|
135
|
+
import * as Sentry from '@sentry/nextjs';
|
|
136
|
+
|
|
137
|
+
Sentry.init({
|
|
138
|
+
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
|
139
|
+
environment: process.env.NODE_ENV,
|
|
140
|
+
release: process.env.SENTRY_RELEASE,
|
|
141
|
+
|
|
142
|
+
// Performance monitoring
|
|
143
|
+
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
|
|
144
|
+
|
|
145
|
+
// Session replay for debugging
|
|
146
|
+
replaysSessionSampleRate: 0.01, // 1% of sessions
|
|
147
|
+
replaysOnErrorSampleRate: 1.0, // 100% of error sessions
|
|
148
|
+
|
|
149
|
+
integrations: [
|
|
150
|
+
Sentry.replayIntegration({ maskAllText: false, blockAllMedia: false }),
|
|
151
|
+
],
|
|
152
|
+
|
|
153
|
+
// Filter noise
|
|
154
|
+
ignoreErrors: [
|
|
155
|
+
'ResizeObserver loop',
|
|
156
|
+
'Non-Error promise rejection',
|
|
157
|
+
/Loading chunk \d+ failed/,
|
|
158
|
+
],
|
|
159
|
+
|
|
160
|
+
// Scrub PII before sending
|
|
161
|
+
beforeSend(event) {
|
|
162
|
+
if (event.user) {
|
|
163
|
+
delete event.user.ip_address;
|
|
164
|
+
delete event.user.email; // Or hash it
|
|
165
|
+
}
|
|
166
|
+
return event;
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
// sentry.server.config.ts
|
|
173
|
+
import * as Sentry from '@sentry/nextjs';
|
|
174
|
+
|
|
175
|
+
Sentry.init({
|
|
176
|
+
dsn: process.env.SENTRY_DSN,
|
|
177
|
+
tracesSampleRate: 0.1,
|
|
178
|
+
|
|
179
|
+
// Capture unhandled promise rejections
|
|
180
|
+
integrations: [
|
|
181
|
+
Sentry.prismaIntegration(), // Auto-track Prisma queries
|
|
182
|
+
],
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### Source Map Upload (CI/CD)
|
|
187
|
+
```yaml
|
|
188
|
+
# .github/workflows/deploy.yml
|
|
189
|
+
- name: Upload Source Maps to Sentry
|
|
190
|
+
env:
|
|
191
|
+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
192
|
+
SENTRY_ORG: your-org
|
|
193
|
+
SENTRY_PROJECT: your-project
|
|
194
|
+
run: |
|
|
195
|
+
npx @sentry/cli sourcemaps upload \
|
|
196
|
+
--release=${{ github.sha }} \
|
|
197
|
+
.next/static
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### 4. Log Aggregation Setup (Axiom)
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
// lib/axiom-transport.ts
|
|
206
|
+
import { pino } from 'pino';
|
|
207
|
+
|
|
208
|
+
// Pino transport for Axiom (or any HTTP log service)
|
|
209
|
+
const transport = pino.transport({
|
|
210
|
+
targets: [
|
|
211
|
+
// Console output (development)
|
|
212
|
+
{ target: 'pino-pretty', level: 'debug' },
|
|
213
|
+
// Axiom (production)
|
|
214
|
+
{
|
|
215
|
+
target: '@axiomhq/pino',
|
|
216
|
+
level: 'info',
|
|
217
|
+
options: {
|
|
218
|
+
dataset: process.env.AXIOM_DATASET,
|
|
219
|
+
token: process.env.AXIOM_TOKEN,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
export const logger = pino(transport);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### 5. Alert Rules Configuration
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
// Example alert conditions to configure in your monitoring tool
|
|
234
|
+
const ALERT_RULES = {
|
|
235
|
+
criticalErrors: {
|
|
236
|
+
condition: 'error count > 50 in 5 minutes',
|
|
237
|
+
severity: 'critical',
|
|
238
|
+
notification: ['pagerduty', 'slack'],
|
|
239
|
+
},
|
|
240
|
+
highErrorRate: {
|
|
241
|
+
condition: 'error rate > 5% of total requests',
|
|
242
|
+
severity: 'high',
|
|
243
|
+
notification: ['slack'],
|
|
244
|
+
},
|
|
245
|
+
slowResponses: {
|
|
246
|
+
condition: 'p99 response time > 3000ms for 10 minutes',
|
|
247
|
+
severity: 'medium',
|
|
248
|
+
notification: ['slack'],
|
|
249
|
+
},
|
|
250
|
+
diskSpace: {
|
|
251
|
+
condition: 'disk usage > 85%',
|
|
252
|
+
severity: 'warning',
|
|
253
|
+
notification: ['email'],
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
### 6. GDPR-Compliant Log Management
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
// lib/pii-redactor.ts
|
|
264
|
+
|
|
265
|
+
/** Fields that must be redacted in logs */
|
|
266
|
+
const PII_PATTERNS = [
|
|
267
|
+
/\b\d{3}-\d{2}-\d{4}\b/g, // SSN
|
|
268
|
+
/\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g, // Credit card
|
|
269
|
+
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g, // Email
|
|
270
|
+
];
|
|
271
|
+
|
|
272
|
+
export function redactPII(text: string): string {
|
|
273
|
+
let result = text;
|
|
274
|
+
for (const pattern of PII_PATTERNS) {
|
|
275
|
+
result = result.replace(pattern, '[REDACTED]');
|
|
276
|
+
}
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Log retention policy
|
|
281
|
+
const LOG_RETENTION = {
|
|
282
|
+
debug: '7 days',
|
|
283
|
+
info: '30 days',
|
|
284
|
+
warn: '90 days',
|
|
285
|
+
error: '365 days',
|
|
286
|
+
audit: '7 years', // Compliance requirement
|
|
287
|
+
};
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
### Common Pitfalls to Avoid
|
|
293
|
+
|
|
294
|
+
| Anti-Pattern | Problem | Correct Approach |
|
|
295
|
+
|---|---|---|
|
|
296
|
+
| `console.log` in production | Unstructured, no levels, no rotation | Use Pino with JSON output |
|
|
297
|
+
| Logging PII (emails, passwords) | GDPR violation, security risk | Use Pino `redact` option |
|
|
298
|
+
| No request correlation ID | Can't trace requests across services | Propagate `x-request-id` header |
|
|
299
|
+
| Logging everything at `info` level | Log noise, storage waste | Use appropriate levels (debug/info/warn/error) |
|
|
300
|
+
| No source maps in production errors | "Minified React error #xxx" | Upload source maps to Sentry |
|
|
301
|
+
| No log rotation/retention policy | Disk fills up, storage costs grow | Set TTL per level, archive old logs |
|
|
302
|
+
| Alerting on every error | Alert fatigue | Set meaningful thresholds and severity levels |
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### Integration with Other Skills
|
|
307
|
+
|
|
308
|
+
- `data-telemetry-expert` — OpenTelemetry spans + log correlation
|
|
309
|
+
- `error-resilience-expert` — Error tracking and monitoring setup
|
|
310
|
+
- `js-backend-expert` — Server-side logging middleware (Fastify/Hono/Express)
|
|
311
|
+
- `ci-cd-devops-architect` — Source map upload in CI/CD pipeline
|
|
312
|
+
- `production-ready-hardener` — Pre-launch logging and monitoring audit
|
|
313
|
+
- `zero-trust-secret-vault` — Secure logging of secret access patterns
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
<a name="bahasa-indonesia"></a>
|
|
318
|
+
## Bahasa Indonesia
|
|
319
|
+
|
|
320
|
+
### Deskripsi
|
|
321
|
+
Panduan tingkat produksi untuk mengimplementasikan logging terstruktur, pelacakan error, dan pemantauan aplikasi. Mencakup **Pino** (logging JSON berkinerja tinggi), integrasi SDK **Sentry** (React, Node.js, Next.js), **upload source map** untuk error produksi, **korelasi request ID** lintas microservice, **agregasi log** (Axiom, Datadog, Logflare), **aturan alerting**, **redaksi log sesuai GDPR** (masking PII), dan integrasi **OpenTelemetry**.
|
|
322
|
+
|
|
323
|
+
### Kondisi Pemicu
|
|
324
|
+
Aktifkan skill ini ketika:
|
|
325
|
+
- Menyiapkan logging terstruktur untuk layanan backend Node.js/Bun.
|
|
326
|
+
- Mengintegrasikan Sentry untuk pelacakan error di aplikasi React/Next.js.
|
|
327
|
+
- Mengimplementasikan korelasi request ID lintas microservice.
|
|
328
|
+
- Menyiapkan agregasi dan pencarian log (Axiom, Datadog, Grafana Loki).
|
|
329
|
+
- Mengonfigurasi aturan alerting untuk error produksi.
|
|
330
|
+
- Mengimplementasikan manajemen log sesuai GDPR (redaksi PII).
|
|
331
|
+
|
|
332
|
+
### Integrasi dengan Skill Lain
|
|
333
|
+
|
|
334
|
+
- `data-telemetry-expert` — Span OpenTelemetry + korelasi log
|
|
335
|
+
- `error-resilience-expert` — Setup pelacakan error dan monitoring
|
|
336
|
+
- `js-backend-expert` — Middleware logging sisi server (Fastify/Hono/Express)
|
|
337
|
+
- `ci-cd-devops-architect` — Upload source map dalam pipeline CI/CD
|
|
338
|
+
- `production-ready-hardener` — Audit logging dan monitoring pra-peluncuran
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp-client-orchestrator
|
|
3
|
+
description: "Expert guide for the AI Agent to dynamically orchestrate and consume external MCP (Model Context Protocol) servers, giving it real-time superpowers over databases, GitHub, Slack, and local files."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MCP Client Orchestrator
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
While `mcp-server-architect` teaches the agent how to *build* servers, this skill teaches the agent how to **consume** them as an MCP Client. This grants the agent "superpowers" by securely interacting with local PostgreSQL databases, GitHub repos, Figma APIs, and Slack channels in real-time, autonomously, using available MCP tool sets.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
Activate this skill when:
|
|
21
|
+
- The user asks the agent to query the database, but the agent doesn't have a direct SQL tool.
|
|
22
|
+
- The user needs real-time context from an external system (e.g., "Read the latest Slack messages about this bug").
|
|
23
|
+
- The user wants the agent to orchestrate multiple tools across different domains simultaneously.
|
|
24
|
+
|
|
25
|
+
### Core Concepts
|
|
26
|
+
|
|
27
|
+
#### 1. MCP Resource & Tool Discovery
|
|
28
|
+
Before assuming a capability doesn't exist, the agent should dynamically inspect available tools.
|
|
29
|
+
- Use `list_resources` or check `mcp_config.json` to see what servers are running.
|
|
30
|
+
- Understand that MCP tools proxy capabilities securely. If there's a `postgres_mcp`, the agent can execute `execute_sql` through it.
|
|
31
|
+
|
|
32
|
+
#### 2. Workflow Orchestration
|
|
33
|
+
Example: "Find the bug reported on GitHub and fix it."
|
|
34
|
+
1. Use the GitHub MCP to `search_issues`.
|
|
35
|
+
2. Extract the stack trace from the issue comment.
|
|
36
|
+
3. Use `grep_search` to find the failing code.
|
|
37
|
+
4. Use `autonomous-tdd-debugger` to fix and test it.
|
|
38
|
+
5. Use the GitHub MCP to `create_pull_request`.
|
|
39
|
+
|
|
40
|
+
### Best Practices
|
|
41
|
+
- **Never guess schema:** Always use MCP tools like `list_tables` or `get_schema` before writing a query.
|
|
42
|
+
- **Respect Rate Limits:** If calling external APIs via MCP, avoid looping rapidly without timeouts.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### Integration with Other Skills (MANDATORY)
|
|
47
|
+
- `doku-mcp-server` — An example of a specific MCP server the agent can orchestrate.
|
|
48
|
+
- `ai-llm-integration-expert` — Provides context on how MCP fits into the broader LangGraph/AI landscape.
|
|
49
|
+
- `multi-agent-orchestration` — Used when delegating different MCP tool calls to specialized subagents.
|
|
50
|
+
|
|
51
|
+
### Referenced By Orchestrators (MANDATORY)
|
|
52
|
+
- `brainstorming` — Add to "AI & LLM Integration".
|
|
53
|
+
- `zero-to-prod-orchestrator` — Phase 4 (AI Agents).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<a name="bahasa-indonesia"></a>
|
|
58
|
+
## Bahasa Indonesia
|
|
59
|
+
|
|
60
|
+
### Deskripsi
|
|
61
|
+
Skill yang memandu Agen AI tentang cara menggunakan (consume) server Model Context Protocol (MCP) eksternal, memberikan kekuatan *real-time* untuk berinteraksi dengan Database, GitHub, Slack, dan sistem lainnya secara otonom.
|
|
62
|
+
|
|
63
|
+
### Kondisi Pemicu
|
|
64
|
+
- Saat Anda (sebagai agen) perlu mengeksekusi SQL ke database lokal/remote namun tidak memiliki akses terminal langsung.
|
|
65
|
+
- Saat Anda perlu membaca data *live* dari platform eksternal (Figma, GitHub, dll).
|
|
66
|
+
|
|
67
|
+
### Panduan Singkat
|
|
68
|
+
- **Eksplorasi Tool:** Selalu periksa tool MCP yang tersedia di sistem (misal `list_tables` atau `read_issue`). Jangan berasumsi Anda buta terhadap dunia luar jika server MCP-nya aktif.
|
|
69
|
+
- **Orkestrasi Lintas Platform:** Anda dapat membaca pesan error di Slack via MCP, mencari kode yang relevan di *file system*, memperbaikinya, dan membuat Pull Request di GitHub via MCP secara otomatis. Ini adalah definisi sebenarnya dari Agen Otonom.
|
|
70
|
+
- **Validasi Skema:** Jangan pernah menebak nama tabel. Selalu gunakan tool MCP untuk mengambil skema database terlebih dahulu sebelum menjalankan kueri `execute_sql`.
|