contextos-agents 1.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/.agents/AGENTS.md +421 -0
- package/.agents/adapters/aider/export.js +137 -0
- package/.agents/adapters/claude/export.js +55 -0
- package/.agents/adapters/copilot/export.js +107 -0
- package/.agents/adapters/cursor/export.js +210 -0
- package/.agents/adapters/gemini/export.js +115 -0
- package/.agents/adapters/shared.js +119 -0
- package/.agents/adapters/zed/export.js +111 -0
- package/.agents/core/profiles/backend.yaml +47 -0
- package/.agents/core/profiles/enterprise.yaml +46 -0
- package/.agents/core/profiles/frontend.yaml +46 -0
- package/.agents/core/profiles/hackathon.yaml +45 -0
- package/.agents/core/profiles/mvp.yaml +43 -0
- package/.agents/core/profiles/startup.yaml +48 -0
- package/.agents/core/skills/adapters/EXAMPLES.md +19 -0
- package/.agents/core/skills/adapters/SKILL.md +105 -0
- package/.agents/core/skills/adapters/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/adapters/VALIDATION.json +12 -0
- package/.agents/core/skills/adapters/skill.yaml +10 -0
- package/.agents/core/skills/architecture-diagrams/SKILL.md +108 -0
- package/.agents/core/skills/architecture-diagrams/VALIDATION.json +12 -0
- package/.agents/core/skills/architecture-diagrams/skill.yaml +8 -0
- package/.agents/core/skills/brutalist-design/SKILL.md +150 -0
- package/.agents/core/skills/brutalist-design/VALIDATION.json +12 -0
- package/.agents/core/skills/brutalist-design/skill.yaml +8 -0
- package/.agents/core/skills/context-manager/EXAMPLES.md +19 -0
- package/.agents/core/skills/context-manager/SKILL.md +126 -0
- package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/context-manager/VALIDATION.json +12 -0
- package/.agents/core/skills/context-manager/skill.yaml +10 -0
- package/.agents/core/skills/context-os/EXAMPLES.md +21 -0
- package/.agents/core/skills/context-os/SKILL.md +169 -0
- package/.agents/core/skills/context-os/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/context-os/VALIDATION.json +12 -0
- package/.agents/core/skills/context-os/packs.yaml +59 -0
- package/.agents/core/skills/context-os/references/context-rules.md +68 -0
- package/.agents/core/skills/context-os/references/pipeline.md +119 -0
- package/.agents/core/skills/context-os/references/project-graph.md +103 -0
- package/.agents/core/skills/context-os/rules.yaml +135 -0
- package/.agents/core/skills/context-os/skill.yaml +10 -0
- package/.agents/core/skills/database/EXAMPLES.md +74 -0
- package/.agents/core/skills/database/SKILL.md +101 -0
- package/.agents/core/skills/database/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/database/VALIDATION.json +11 -0
- package/.agents/core/skills/database/skill.yaml +25 -0
- package/.agents/core/skills/ddd/EXAMPLES.md +42 -0
- package/.agents/core/skills/ddd/SKILL.md +247 -0
- package/.agents/core/skills/ddd/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ddd/VALIDATION.json +12 -0
- package/.agents/core/skills/ddd/ddd.md +178 -0
- package/.agents/core/skills/ddd/skill.yaml +10 -0
- package/.agents/core/skills/decisions/EXAMPLES.md +35 -0
- package/.agents/core/skills/decisions/SKILL.md +90 -0
- package/.agents/core/skills/decisions/TROUBLESHOOTING.md +13 -0
- package/.agents/core/skills/decisions/VALIDATION.json +12 -0
- package/.agents/core/skills/decisions/skill.yaml +10 -0
- package/.agents/core/skills/docker/EXAMPLES.md +56 -0
- package/.agents/core/skills/docker/SKILL.md +63 -0
- package/.agents/core/skills/docker/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/docker/VALIDATION.json +11 -0
- package/.agents/core/skills/docker/skill.yaml +23 -0
- package/.agents/core/skills/engineering-workflow/EXAMPLES.md +57 -0
- package/.agents/core/skills/engineering-workflow/SKILL.md +343 -0
- package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/engineering-workflow/VALIDATION.json +12 -0
- package/.agents/core/skills/engineering-workflow/skill.yaml +13 -0
- package/.agents/core/skills/fastapi/EXAMPLES.md +36 -0
- package/.agents/core/skills/fastapi/SKILL.md +148 -0
- package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/fastapi/VALIDATION.json +12 -0
- package/.agents/core/skills/fastapi/fastapi.md +112 -0
- package/.agents/core/skills/fastapi/skill.yaml +10 -0
- package/.agents/core/skills/gemini-precision/SKILL.md +169 -0
- package/.agents/core/skills/gemini-precision/VALIDATION.json +12 -0
- package/.agents/core/skills/gemini-precision/skill.yaml +9 -0
- package/.agents/core/skills/generators/EXAMPLES.md +19 -0
- package/.agents/core/skills/generators/SKILL.md +112 -0
- package/.agents/core/skills/generators/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/generators/VALIDATION.json +12 -0
- package/.agents/core/skills/generators/skill.yaml +10 -0
- package/.agents/core/skills/generators/templates/API.md +77 -0
- package/.agents/core/skills/generators/templates/ARCHITECTURE.md +70 -0
- package/.agents/core/skills/generators/templates/DATABASE.md +42 -0
- package/.agents/core/skills/generators/templates/DECISION.md +46 -0
- package/.agents/core/skills/generators/templates/PRD.md +67 -0
- package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +56 -0
- package/.agents/core/skills/generators/templates/ROADMAP.md +51 -0
- package/.agents/core/skills/generators/templates/TASKS.md +43 -0
- package/.agents/core/skills/generators/templates/UI.md +73 -0
- package/.agents/core/skills/graphify/EXAMPLES.md +73 -0
- package/.agents/core/skills/graphify/SKILL.md +130 -0
- package/.agents/core/skills/graphify/VALIDATION.json +12 -0
- package/.agents/core/skills/graphify/skill.yaml +13 -0
- package/.agents/core/skills/gstack-roles/EXAMPLES.md +23 -0
- package/.agents/core/skills/gstack-roles/SKILL.md +152 -0
- package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
- package/.agents/core/skills/gstack-roles/VALIDATION.json +12 -0
- package/.agents/core/skills/gstack-roles/skill.yaml +12 -0
- package/.agents/core/skills/impeccable-design/EXAMPLES.md +26 -0
- package/.agents/core/skills/impeccable-design/SKILL.md +201 -0
- package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/impeccable-design/VALIDATION.json +12 -0
- package/.agents/core/skills/impeccable-design/skill.yaml +14 -0
- package/.agents/core/skills/interview-me/SKILL.md +97 -0
- package/.agents/core/skills/interview-me/VALIDATION.json +12 -0
- package/.agents/core/skills/interview-me/skill.yaml +8 -0
- package/.agents/core/skills/microservices/EXAMPLES.md +38 -0
- package/.agents/core/skills/microservices/SKILL.md +164 -0
- package/.agents/core/skills/microservices/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/microservices/VALIDATION.json +12 -0
- package/.agents/core/skills/microservices/microservices.md +119 -0
- package/.agents/core/skills/microservices/skill.yaml +10 -0
- package/.agents/core/skills/minimalist-design/SKILL.md +113 -0
- package/.agents/core/skills/minimalist-design/VALIDATION.json +12 -0
- package/.agents/core/skills/minimalist-design/skill.yaml +8 -0
- package/.agents/core/skills/nestjs/EXAMPLES.md +40 -0
- package/.agents/core/skills/nestjs/SKILL.md +139 -0
- package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/nestjs/VALIDATION.json +12 -0
- package/.agents/core/skills/nestjs/nestjs.md +103 -0
- package/.agents/core/skills/nestjs/skill.yaml +10 -0
- package/.agents/core/skills/nextjs/EXAMPLES.md +40 -0
- package/.agents/core/skills/nextjs/SKILL.md +163 -0
- package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/nextjs/VALIDATION.json +12 -0
- package/.agents/core/skills/nextjs/nextjs.md +67 -0
- package/.agents/core/skills/nextjs/skill.yaml +10 -0
- package/.agents/core/skills/node/EXAMPLES.md +80 -0
- package/.agents/core/skills/node/SKILL.md +128 -0
- package/.agents/core/skills/node/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/node/VALIDATION.json +12 -0
- package/.agents/core/skills/node/node.md +87 -0
- package/.agents/core/skills/node/skill.yaml +10 -0
- package/.agents/core/skills/performance/EXAMPLES.md +30 -0
- package/.agents/core/skills/performance/SKILL.md +75 -0
- package/.agents/core/skills/performance/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/performance/VALIDATION.json +12 -0
- package/.agents/core/skills/performance/performance.md +52 -0
- package/.agents/core/skills/performance/skill.yaml +10 -0
- package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +45 -0
- package/.agents/core/skills/ponytail-mindset/SKILL.md +193 -0
- package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ponytail-mindset/VALIDATION.json +12 -0
- package/.agents/core/skills/ponytail-mindset/skill.yaml +14 -0
- package/.agents/core/skills/react/EXAMPLES.md +79 -0
- package/.agents/core/skills/react/SKILL.md +132 -0
- package/.agents/core/skills/react/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/react/VALIDATION.json +12 -0
- package/.agents/core/skills/react/react.md +93 -0
- package/.agents/core/skills/react/skill.yaml +10 -0
- package/.agents/core/skills/react-best-practices/SKILL.md +155 -0
- package/.agents/core/skills/react-best-practices/VALIDATION.json +12 -0
- package/.agents/core/skills/react-best-practices/skill.yaml +10 -0
- package/.agents/core/skills/redesign-audit/SKILL.md +117 -0
- package/.agents/core/skills/redesign-audit/VALIDATION.json +12 -0
- package/.agents/core/skills/redesign-audit/skill.yaml +8 -0
- package/.agents/core/skills/security/EXAMPLES.md +64 -0
- package/.agents/core/skills/security/SKILL.md +158 -0
- package/.agents/core/skills/security/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/security/VALIDATION.json +12 -0
- package/.agents/core/skills/security/security.md +106 -0
- package/.agents/core/skills/security/skill.yaml +10 -0
- package/.agents/core/skills/soft-design/SKILL.md +108 -0
- package/.agents/core/skills/soft-design/VALIDATION.json +12 -0
- package/.agents/core/skills/soft-design/skill.yaml +8 -0
- package/.agents/core/skills/state-management/EXAMPLES.md +56 -0
- package/.agents/core/skills/state-management/SKILL.md +48 -0
- package/.agents/core/skills/state-management/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/state-management/VALIDATION.json +11 -0
- package/.agents/core/skills/state-management/skill.yaml +22 -0
- package/.agents/core/skills/subagent-orchestrator/SKILL.md +100 -0
- package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +12 -0
- package/.agents/core/skills/subagent-orchestrator/skill.yaml +8 -0
- package/.agents/core/skills/system-design/EXAMPLES.md +75 -0
- package/.agents/core/skills/system-design/SKILL.md +419 -0
- package/.agents/core/skills/system-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/system-design/VALIDATION.json +12 -0
- package/.agents/core/skills/system-design/skill.yaml +13 -0
- package/.agents/core/skills/system-design/system-design.md +112 -0
- package/.agents/core/skills/testing/EXAMPLES.md +71 -0
- package/.agents/core/skills/testing/SKILL.md +70 -0
- package/.agents/core/skills/testing/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/testing/VALIDATION.json +11 -0
- package/.agents/core/skills/testing/skill.yaml +26 -0
- package/.agents/core/skills/typescript/EXAMPLES.md +64 -0
- package/.agents/core/skills/typescript/SKILL.md +112 -0
- package/.agents/core/skills/typescript/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/typescript/VALIDATION.json +12 -0
- package/.agents/core/skills/typescript/skill.yaml +10 -0
- package/.agents/core/skills/typescript/typescript.md +71 -0
- package/.agents/core/skills/ui-design/EXAMPLES.md +21 -0
- package/.agents/core/skills/ui-design/SKILL.md +124 -0
- package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ui-design/VALIDATION.json +12 -0
- package/.agents/core/skills/ui-design/skill.yaml +10 -0
- package/.agents/core/skills/ui-design/ui.md +88 -0
- package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +62 -0
- package/.agents/core/skills/ui-ux-pro/SKILL.md +375 -0
- package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ui-ux-pro/VALIDATION.json +12 -0
- package/.agents/core/skills/ui-ux-pro/skill.yaml +13 -0
- package/.agents/core/skills/ux-design/EXAMPLES.md +36 -0
- package/.agents/core/skills/ux-design/SKILL.md +116 -0
- package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ux-design/VALIDATION.json +12 -0
- package/.agents/core/skills/ux-design/skill.yaml +10 -0
- package/.agents/core/skills/ux-design/ux.md +80 -0
- package/.agents/core/skills/vercel-optimize/SKILL.md +83 -0
- package/.agents/core/skills/vercel-optimize/VALIDATION.json +12 -0
- package/.agents/core/skills/vercel-optimize/skill.yaml +10 -0
- package/.agents/core/skills/web-accessibility/EXAMPLES.md +39 -0
- package/.agents/core/skills/web-accessibility/SKILL.md +170 -0
- package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/web-accessibility/VALIDATION.json +12 -0
- package/.agents/core/skills/web-accessibility/accessibility.md +63 -0
- package/.agents/core/skills/web-accessibility/skill.yaml +10 -0
- package/.agents/ctx.js +370 -0
- package/.agents/generated/claude/skills/adapters/SKILL.md +126 -0
- package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +101 -0
- package/.agents/generated/claude/skills/brutalist-design/SKILL.md +145 -0
- package/.agents/generated/claude/skills/context-manager/SKILL.md +147 -0
- package/.agents/generated/claude/skills/context-os/SKILL.md +191 -0
- package/.agents/generated/claude/skills/database/SKILL.md +191 -0
- package/.agents/generated/claude/skills/ddd/SKILL.md +305 -0
- package/.agents/generated/claude/skills/decisions/SKILL.md +134 -0
- package/.agents/generated/claude/skills/docker/SKILL.md +135 -0
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +414 -0
- package/.agents/generated/claude/skills/fastapi/SKILL.md +200 -0
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +161 -0
- package/.agents/generated/claude/skills/generators/SKILL.md +133 -0
- package/.agents/generated/claude/skills/graphify/SKILL.md +198 -0
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +184 -0
- package/.agents/generated/claude/skills/impeccable-design/SKILL.md +241 -0
- package/.agents/generated/claude/skills/interview-me/SKILL.md +90 -0
- package/.agents/generated/claude/skills/microservices/SKILL.md +218 -0
- package/.agents/generated/claude/skills/minimalist-design/SKILL.md +108 -0
- package/.agents/generated/claude/skills/nestjs/SKILL.md +195 -0
- package/.agents/generated/claude/skills/nextjs/SKILL.md +219 -0
- package/.agents/generated/claude/skills/node/SKILL.md +224 -0
- package/.agents/generated/claude/skills/performance/SKILL.md +121 -0
- package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +252 -0
- package/.agents/generated/claude/skills/react/SKILL.md +227 -0
- package/.agents/generated/claude/skills/react-best-practices/SKILL.md +146 -0
- package/.agents/generated/claude/skills/redesign-audit/SKILL.md +112 -0
- package/.agents/generated/claude/skills/security/SKILL.md +237 -0
- package/.agents/generated/claude/skills/soft-design/SKILL.md +103 -0
- package/.agents/generated/claude/skills/state-management/SKILL.md +120 -0
- package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +93 -0
- package/.agents/generated/claude/skills/system-design/SKILL.md +507 -0
- package/.agents/generated/claude/skills/testing/SKILL.md +157 -0
- package/.agents/generated/claude/skills/typescript/SKILL.md +192 -0
- package/.agents/generated/claude/skills/ui-design/SKILL.md +161 -0
- package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +451 -0
- package/.agents/generated/claude/skills/ux-design/SKILL.md +168 -0
- package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +76 -0
- package/.agents/generated/claude/skills/web-accessibility/SKILL.md +225 -0
- package/.agents/generated/gemini/skills/adapters/SKILL.md +135 -0
- package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +107 -0
- package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +151 -0
- package/.agents/generated/gemini/skills/context-manager/SKILL.md +156 -0
- package/.agents/generated/gemini/skills/context-os/SKILL.md +200 -0
- package/.agents/generated/gemini/skills/database/SKILL.md +200 -0
- package/.agents/generated/gemini/skills/ddd/SKILL.md +314 -0
- package/.agents/generated/gemini/skills/decisions/SKILL.md +143 -0
- package/.agents/generated/gemini/skills/docker/SKILL.md +144 -0
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +423 -0
- package/.agents/generated/gemini/skills/fastapi/SKILL.md +209 -0
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +167 -0
- package/.agents/generated/gemini/skills/generators/SKILL.md +142 -0
- package/.agents/generated/gemini/skills/graphify/SKILL.md +205 -0
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +193 -0
- package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +250 -0
- package/.agents/generated/gemini/skills/interview-me/SKILL.md +96 -0
- package/.agents/generated/gemini/skills/microservices/SKILL.md +227 -0
- package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +114 -0
- package/.agents/generated/gemini/skills/nestjs/SKILL.md +204 -0
- package/.agents/generated/gemini/skills/nextjs/SKILL.md +298 -0
- package/.agents/generated/gemini/skills/node/SKILL.md +323 -0
- package/.agents/generated/gemini/skills/performance/SKILL.md +185 -0
- package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +261 -0
- package/.agents/generated/gemini/skills/react/SKILL.md +332 -0
- package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +152 -0
- package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +118 -0
- package/.agents/generated/gemini/skills/security/SKILL.md +355 -0
- package/.agents/generated/gemini/skills/soft-design/SKILL.md +109 -0
- package/.agents/generated/gemini/skills/state-management/SKILL.md +129 -0
- package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +99 -0
- package/.agents/generated/gemini/skills/system-design/SKILL.md +631 -0
- package/.agents/generated/gemini/skills/testing/SKILL.md +166 -0
- package/.agents/generated/gemini/skills/typescript/SKILL.md +275 -0
- package/.agents/generated/gemini/skills/ui-design/SKILL.md +170 -0
- package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +460 -0
- package/.agents/generated/gemini/skills/ux-design/SKILL.md +177 -0
- package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +82 -0
- package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +300 -0
- package/.agents/mcp/runtime.py +454 -0
- package/.agents/mcp/server.mjs +189373 -0
- package/.agents/plugins.js +574 -0
- package/.agents/profiles.js +267 -0
- package/.agents/resolver.js +336 -0
- package/.agents/skills-index.json +200 -0
- package/.agents/skills.json +6 -0
- package/.agents/validate.js +500 -0
- package/LICENSE +21 -0
- package/README.md +415 -0
- package/benchmarks/gemini-issues.js +533 -0
- package/bin/index.js +458 -0
- package/package.json +70 -0
- package/registry.json +53 -0
- package/registry.schema.json +32 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Microservices
|
|
3
|
+
description: >
|
|
4
|
+
ContextOS skill for Microservices
|
|
5
|
+
---
|
|
6
|
+
# Microservices
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Distributed systems architecture standard. Enforces bounded context isolation, asynchronous event-driven messaging (Kafka, RabbitMQ), Saga distributed transactions, API gateways, and outbox patterns.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Activate when decomposing monoliths into independent services, designing inter-service communications, or building scalable distributed systems.
|
|
15
|
+
|
|
16
|
+
## Rules & Patterns
|
|
17
|
+
<!-- Source: microservices.md -->
|
|
18
|
+
|
|
19
|
+
## Microservices — Architecture Guide
|
|
20
|
+
|
|
21
|
+
## When to Use Microservices
|
|
22
|
+
|
|
23
|
+
**Use when:**
|
|
24
|
+
|
|
25
|
+
- Team > 10 engineers working on the same product
|
|
26
|
+
- Independent deployment of components is critical
|
|
27
|
+
- Different components have different scaling needs
|
|
28
|
+
- Different components need different tech stacks
|
|
29
|
+
|
|
30
|
+
**Don't use when:**
|
|
31
|
+
|
|
32
|
+
- Small team (< 5 engineers)
|
|
33
|
+
- MVP or prototype
|
|
34
|
+
- No operational expertise (monitoring, tracing, deployment)
|
|
35
|
+
- Tight coupling between components
|
|
36
|
+
|
|
37
|
+
## Core Principles
|
|
38
|
+
|
|
39
|
+
### 1. Single Responsibility
|
|
40
|
+
|
|
41
|
+
Each service does ONE thing well.
|
|
42
|
+
|
|
43
|
+
### 2. Own Your Data
|
|
44
|
+
|
|
45
|
+
Each service has its own database. No shared databases.
|
|
46
|
+
|
|
47
|
+
### 3. API Contracts
|
|
48
|
+
|
|
49
|
+
Services communicate through well-defined APIs. Internal implementation is hidden.
|
|
50
|
+
|
|
51
|
+
### 4. Autonomous Deployment
|
|
52
|
+
|
|
53
|
+
Each service can be deployed independently.
|
|
54
|
+
|
|
55
|
+
## Communication Patterns
|
|
56
|
+
|
|
57
|
+
### Synchronous (REST/gRPC)
|
|
58
|
+
|
|
59
|
+
- **When**: Request needs immediate response
|
|
60
|
+
- **Tools**: REST (HTTP), gRPC (high-performance)
|
|
61
|
+
- **Risk**: Cascading failures, latency accumulation
|
|
62
|
+
|
|
63
|
+
### Asynchronous (Events/Messages)
|
|
64
|
+
|
|
65
|
+
- **When**: Eventual consistency is acceptable
|
|
66
|
+
- **Tools**: Kafka, RabbitMQ, Redis Streams, AWS SQS
|
|
67
|
+
- **Benefit**: Loose coupling, resilience
|
|
68
|
+
|
|
69
|
+
### Saga Pattern (Distributed Transactions)
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Order Service → Payment Service → Inventory Service → Shipping Service
|
|
73
|
+
↓ (failure)
|
|
74
|
+
Compensating transactions reverse each step
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
1. **Choreography (Event-Driven)**: Each service emits events, downstream services listen and react. Best for simple flows (≤ 3 steps) where a central coordinator adds unnecessary coupling.
|
|
78
|
+
2. **Orchestration (State Machine)**: A dedicated Saga Orchestrator controls the flow and explicitly triggers compensating transactions on failure (e.g., `RefundPayment`, `ReleaseInventoryReservation`). Mandatory for complex multi-step workflows.
|
|
79
|
+
|
|
80
|
+
### Dead Letter Queues (DLQ) & Poison Pill Handling
|
|
81
|
+
|
|
82
|
+
- **Never retry infinitely**: Set max retries (e.g. 3) with exponential backoff and jitter.
|
|
83
|
+
- After max retries, route failed messages to a **Dead Letter Queue (DLQ)** with error metadata.
|
|
84
|
+
- Provide alerting on DLQ depth and an admin CLI/script to replay DLQ messages.
|
|
85
|
+
|
|
86
|
+
## CQRS (Command Query Responsibility Segregation)
|
|
87
|
+
|
|
88
|
+
Separate read and write models:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Command (Write) → Write Model → Event Store → Projections → Read Model → Query (Read)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**When**: Read patterns differ significantly from write patterns.
|
|
95
|
+
|
|
96
|
+
## Event Sourcing
|
|
97
|
+
|
|
98
|
+
Store events, not state:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
UserCreated → EmailUpdated → RoleChanged → PasswordReset
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Current state = replay all events. Full audit trail.
|
|
105
|
+
|
|
106
|
+
## Service Boundaries
|
|
107
|
+
|
|
108
|
+
### Bounded Contexts (from DDD)
|
|
109
|
+
|
|
110
|
+
- Identify domain boundaries
|
|
111
|
+
- Each service maps to a bounded context
|
|
112
|
+
- Shared language within the context, translation at boundaries
|
|
113
|
+
|
|
114
|
+
### Anti-Corruption Layer
|
|
115
|
+
|
|
116
|
+
When integrating with legacy or external systems, create an adapter that translates between models.
|
|
117
|
+
|
|
118
|
+
## Operational Concerns
|
|
119
|
+
|
|
120
|
+
### Observability (The Three Pillars)
|
|
121
|
+
|
|
122
|
+
1. **Logs** — structured JSON, correlated by request ID
|
|
123
|
+
2. **Metrics** — latency, error rate, throughput (RED)
|
|
124
|
+
3. **Traces** — distributed tracing across services (Jaeger, Zipkin)
|
|
125
|
+
|
|
126
|
+
### Resilience
|
|
127
|
+
|
|
128
|
+
- **Circuit Breaker** — stop calling failing services
|
|
129
|
+
- **Retry with Backoff** — exponential backoff + jitter
|
|
130
|
+
- **Timeout** — every call has a timeout
|
|
131
|
+
- **Bulkhead** — isolate failures
|
|
132
|
+
|
|
133
|
+
### Deployment
|
|
134
|
+
|
|
135
|
+
- **Containers** — Docker for consistency
|
|
136
|
+
- **Orchestration** — Kubernetes for production
|
|
137
|
+
- **CI/CD** — independent pipelines per service
|
|
138
|
+
- **Blue-Green / Canary** — safe rollouts
|
|
139
|
+
|
|
140
|
+
## Anti-Patterns
|
|
141
|
+
|
|
142
|
+
- [FAIL] Distributed monolith — services that can't deploy independently
|
|
143
|
+
- [FAIL] Shared database — defeats the purpose
|
|
144
|
+
- [FAIL] Synchronous chains — A calls B calls C calls D
|
|
145
|
+
- [FAIL] No versioning — breaking API changes
|
|
146
|
+
- [FAIL] Premature microservices — start with a modular monolith
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## Code Examples
|
|
150
|
+
|
|
151
|
+
See `EXAMPLES.md` for detailed code examples.
|
|
152
|
+
|
|
153
|
+
## Validation Checklist
|
|
154
|
+
|
|
155
|
+
What to verify during the review phase before completing the task.
|
|
156
|
+
|
|
157
|
+
## Common Mistakes
|
|
158
|
+
|
|
159
|
+
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
160
|
+
|
|
161
|
+
## Integration Notes
|
|
162
|
+
|
|
163
|
+
How this skill interacts with other skills.
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<!-- Source: EXAMPLES.md -->
|
|
167
|
+
|
|
168
|
+
# microservices Examples — Anti-patterns vs ContextOS Standard
|
|
169
|
+
|
|
170
|
+
## Example 1: Inter-service Communication
|
|
171
|
+
|
|
172
|
+
### Anti-pattern: Synchronous HTTP Call Chains (The Distributed Monolith)
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
User -> OrderService (HTTP) -> InventoryService (HTTP) -> PaymentService (HTTP) -> EmailService (HTTP)
|
|
176
|
+
Problem: High latency, 99.9% availability compounding to 96% overall availability, cascading failure.
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Best practice: ContextOS Standard (Asynchronous Event Choreography)
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
User -> OrderService (creates order with status 'PENDING')
|
|
183
|
+
OrderService publishes 'OrderPlaced' event to Event Broker (Kafka/RabbitMQ)
|
|
184
|
+
├── InventoryService consumes 'OrderPlaced' -> Reserves stock
|
|
185
|
+
├── PaymentService consumes 'OrderPlaced' -> Charges customer
|
|
186
|
+
└── NotificationService consumes 'PaymentProcessed' -> Sends confirmation email
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Example 2: Database Architecture
|
|
192
|
+
|
|
193
|
+
### Anti-pattern: Shared Database Across Multiple Microservices
|
|
194
|
+
|
|
195
|
+
```text
|
|
196
|
+
BAD: OrderService and UserService both directly read and write to the same 'users' table.
|
|
197
|
+
Schema migrations in UserService immediately break OrderService.
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Best practice: ContextOS Standard (Database-per-Service)
|
|
201
|
+
|
|
202
|
+
```text
|
|
203
|
+
GOOD: UserService owns user data. OrderService maintains a local read-model (denormalized user info)
|
|
204
|
+
synchronized via 'UserUpdated' events. Each service can migrate and scale independently.
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
<!-- Source: TROUBLESHOOTING.md -->
|
|
208
|
+
|
|
209
|
+
# microservices Troubleshooting & Common Mistakes
|
|
210
|
+
|
|
211
|
+
## 1. Missing Consumer Idempotency
|
|
212
|
+
|
|
213
|
+
- **Symptom**: Users charged twice or duplicate records created when events are re-delivered.
|
|
214
|
+
- **Root Cause**: Message brokers guarantee at-least-once delivery; network retries re-send events.
|
|
215
|
+
- **Fix**: Store processed message/event IDs in a deduplication table with unique constraint.
|
|
216
|
+
|
|
217
|
+
## 2. Circular Service Dependencies
|
|
218
|
+
|
|
219
|
+
- **Symptom**: Service A cannot boot or operate without Service B, and Service B depends on Service A.
|
|
220
|
+
- **Root Cause**: Improper domain boundaries and coupled synchronous dependencies.
|
|
221
|
+
- **Fix**: Invert dependency using domain events or introduce a composite BFF/Orchestrator.
|
|
222
|
+
|
|
223
|
+
## 3. Distributed Tracing Blindness
|
|
224
|
+
|
|
225
|
+
- **Symptom**: Impossible to diagnose which downstream microservice caused a 500 error or latency spike.
|
|
226
|
+
- **Root Cause**: HTTP headers and event messages do not propagate correlation IDs.
|
|
227
|
+
- **Fix**: Propagate X-Correlation-ID / traceparent across all HTTP requests and event headers.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: minimalist-design
|
|
3
|
+
description: >
|
|
4
|
+
Clean editorial-style interfaces with warm monochrome palettes and flat bento grids.
|
|
5
|
+
---
|
|
6
|
+
# Protocol: Premium Utilitarian Minimalism UI Architect
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
An advanced frontend engineering directive for generating highly refined, ultra-minimalist, "document-style" web interfaces analogous to top-tier workspace platforms. This protocol strictly enforces a high-contrast warm monochrome palette, bespoke typographic hierarchies, meticulous structural macro-whitespace, bento-grid layouts, and an ultra-flat component architecture with deliberate muted pastel accents. It actively rejects standard generic SaaS design trends.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- When designing clean, editorial, or Notion-like document interfaces, workspaces, or notes apps.
|
|
15
|
+
- When creating minimalist SaaS dashboards, personal essays, portfolios, or agency landing pages.
|
|
16
|
+
- When asked for a "clean", "minimalist", "warm monochrome", or "flat bento-box" layout.
|
|
17
|
+
|
|
18
|
+
## Rules & Patterns
|
|
19
|
+
|
|
20
|
+
### 1. Absolute Negative Constraints (Banned Elements)
|
|
21
|
+
|
|
22
|
+
The AI must strictly avoid the following generic web development defaults:
|
|
23
|
+
|
|
24
|
+
- DO NOT use the "Inter", "Roboto", or "Open Sans" typefaces.
|
|
25
|
+
- DO NOT use generic, thin-line icon libraries like "Lucide", "Feather", or standard "Heroicons".
|
|
26
|
+
- DO NOT use Tailwind's default heavy drop shadows (e.g., `shadow-md`, `shadow-lg`, `shadow-xl`). Shadows must be practically non-existent or heavily customized to be ultra-diffuse and low opacity (< 0.05).
|
|
27
|
+
- DO NOT use primary colored backgrounds for large elements or sections (e.g., no bright blue, green, or red hero sections).
|
|
28
|
+
- DO NOT use gradients, neon colors, or 3D glassmorphism (beyond subtle navbar blurs).
|
|
29
|
+
- DO NOT use `rounded-full` (pill shapes) for large containers, cards, or primary buttons.
|
|
30
|
+
- DO NOT use emojis anywhere in code, markup, text content, headings, or alt text. Replace with proper icons or clean SVG primitives.
|
|
31
|
+
- DO NOT use generic placeholder names like "John Doe", "Acme Corp", or "Lorem Ipsum". Use realistic, contextual content.
|
|
32
|
+
- DO NOT use AI copywriting clichés: "Elevate", "Seamless", "Unleash", "Next-Gen", "Game-changer", "Delve". Write plain, specific language.
|
|
33
|
+
|
|
34
|
+
### 2. Typographic Architecture
|
|
35
|
+
|
|
36
|
+
The interface must rely on extreme typographic contrast and premium font selection to establish an editorial feel.
|
|
37
|
+
|
|
38
|
+
- **Primary Sans-Serif (Body, UI, Buttons):** Use clean, geometric, or system-native fonts with character (`'SF Pro Display', 'Geist Sans', 'Helvetica Neue', 'Switzer', sans-serif`).
|
|
39
|
+
- **Editorial Serif (Hero Headings & Quotes):** (`'Lyon Text', 'Newsreader', 'Playfair Display', 'Instrument Serif', serif`). Apply tight tracking (`-0.02em` to `-0.04em`) and tight line-height (`1.1`).
|
|
40
|
+
- **Monospace (Code, Keystrokes, Meta-data):** (`'Geist Mono', 'SF Mono', 'JetBrains Mono', monospace`).
|
|
41
|
+
- **Text Colors:** Body text must never be absolute black (`#000000`). Use off-black/charcoal (`#111111` or `#2F3437`) with a generous line-height of `1.6` for legibility. Secondary text should be muted gray (`#787774`).
|
|
42
|
+
|
|
43
|
+
### 3. Color Palette (Warm Monochrome + Spot Pastels)
|
|
44
|
+
|
|
45
|
+
Color is a scarce resource, utilized only for semantic meaning or subtle accents.
|
|
46
|
+
|
|
47
|
+
- **Canvas / Background:** Pure White `#FFFFFF` or Warm Bone/Off-White `#F7F6F3` / `#FBFBFA`.
|
|
48
|
+
- **Primary Surface (Cards):** `#FFFFFF` or `#F9F9F8`.
|
|
49
|
+
- **Structural Borders / Dividers:** Ultra-light gray `#EAEAEA` or `rgba(0,0,0,0.06)`.
|
|
50
|
+
- **Accent Colors:** Exclusively use highly desaturated, washed-out pastels for tags, inline code backgrounds, or subtle icon backgrounds:
|
|
51
|
+
- Pale Red: `#FDEBEC` (Text: `#9F2F2D`)
|
|
52
|
+
- Pale Blue: `#E1F3FE` (Text: `#1F6C9F`)
|
|
53
|
+
- Pale Green: `#EDF3EC` (Text: `#346538`)
|
|
54
|
+
- Pale Yellow: `#FBF3DB` (Text: `#956400`)
|
|
55
|
+
|
|
56
|
+
### 4. Component Specifications
|
|
57
|
+
|
|
58
|
+
- **Bento Box Feature Grids:** Asymmetrical CSS Grid layouts. Cards have `border: 1px solid #EAEAEA`, crisp border-radius (`8px` to `12px` max), and generous internal padding (`24px` to `40px`).
|
|
59
|
+
- **Primary Call-To-Action (Buttons):** Solid `#111111`, text `#FFFFFF`, radius `4px` to `6px`, no box-shadow. Micro-scale `transform: scale(0.98)` on active.
|
|
60
|
+
- **Tags & Status Badges:** Pill-shaped (`rounded-full`), small typography (`text-xs`), uppercase with wide tracking (`0.05em`), pastel background.
|
|
61
|
+
- **Accordions (FAQ):** Separated by `border-bottom: 1px solid #EAEAEA` without card boxes. Crisp `+` / `-` toggle icons.
|
|
62
|
+
- **Keystroke Micro-UIs:** `<kbd className="border border-[#EAEAEA] rounded bg-[#F7F6F3] font-mono px-1.5 py-0.5 text-xs">`.
|
|
63
|
+
|
|
64
|
+
### 5. Iconography & Imagery
|
|
65
|
+
|
|
66
|
+
- **System Icons:** Phosphor Icons (Bold/Fill) or Radix UI Icons for crisp, technical strokes.
|
|
67
|
+
- **Photography:** Desaturated images with warm tint and subtle grain overlay (`opacity: 0.04`).
|
|
68
|
+
- **Depth:** Subtle ambient gradients (`radial-gradient` with warm tones at `opacity: 0.03`) or minimal geometric line patterns.
|
|
69
|
+
|
|
70
|
+
### 6. Subtle Motion & Micro-Animations
|
|
71
|
+
|
|
72
|
+
- **Scroll Entry:** Fade-in + `translateY(12px)` over 600ms via `IntersectionObserver`.
|
|
73
|
+
- **Hover States:** Subtle card lift with ultra-diffuse shadow (`0 2px 8px rgba(0,0,0,0.04)`).
|
|
74
|
+
- **Staggered Reveals:** Cascading delay (`calc(var(--index) * 80ms)`).
|
|
75
|
+
|
|
76
|
+
## Code Examples
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
export function BentoFeatureCard({ title, description, badge, tagColor = "blue" }: { title: string; description: string; badge: string; tagColor?: string }) {
|
|
80
|
+
return (
|
|
81
|
+
<div className="bg-[#FFFFFF] border border-[#EAEAEA] rounded-xl p-8 hover:shadow-[0_2px_8px_rgba(0,0,0,0.04)] transition-all duration-200">
|
|
82
|
+
<div className="flex items-center justify-between mb-4">
|
|
83
|
+
<span className="text-xs uppercase tracking-wider font-mono font-medium px-2.5 py-0.5 rounded-full bg-[#E1F3FE] text-[#1F6C9F]">
|
|
84
|
+
{badge}
|
|
85
|
+
</span>
|
|
86
|
+
</div>
|
|
87
|
+
<h3 className="font-serif text-2xl tracking-tight text-[#111111] mb-2">{title}</h3>
|
|
88
|
+
<p className="text-sm text-[#787774] leading-relaxed">{description}</p>
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Validation Checklist
|
|
95
|
+
|
|
96
|
+
- [ ] Macro-whitespace established with generous vertical section padding (`py-24` to `py-32`).
|
|
97
|
+
- [ ] No pure black (`#000000`) for text or backgrounds.
|
|
98
|
+
- [ ] Borders use crisp `1px solid #EAEAEA` or `rgba(0,0,0,0.06)`.
|
|
99
|
+
- [ ] No generic AI buzzwords or emojis used in copy.
|
|
100
|
+
- [ ] Typography uses editorial serif headers paired with clean sans-serif body.
|
|
101
|
+
- [ ] Card corners constrained to crisp 8px-12px radius; no pill containers.
|
|
102
|
+
|
|
103
|
+
## Common Mistakes
|
|
104
|
+
|
|
105
|
+
- Using heavy saturated primary colors for hero backgrounds.
|
|
106
|
+
- Adding default Tailwind drop-shadows (`shadow-lg`).
|
|
107
|
+
- Cluttering interfaces with emojis instead of clean SVG icons.
|
|
108
|
+
- Using default Inter or Roboto fonts without editorial contrast.
|
|
109
|
+
|
|
110
|
+
## Integration Notes
|
|
111
|
+
|
|
112
|
+
- Complements `ui-ux-pro` for color tokens and accessibility.
|
|
113
|
+
- Integrates with `impeccable-design` for QA and anti-pattern enforcement.
|
|
114
|
+
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: NestJS
|
|
3
|
+
description: >
|
|
4
|
+
ContextOS skill for NestJS
|
|
5
|
+
---
|
|
6
|
+
# NestJS
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Enterprise Node.js architecture standard using NestJS, TypeScript, and RxJS. Enforces strict modularity, dependency injection, repository pattern, DTO validation via class-validator, and clean layered architecture.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Activate when building enterprise Node.js microservices, complex REST/GraphQL APIs, or scalable backends requiring strict architectural structure.
|
|
15
|
+
|
|
16
|
+
## Rules & Patterns
|
|
17
|
+
<!-- Source: nestjs.md -->
|
|
18
|
+
|
|
19
|
+
## NestJS — Best Practices
|
|
20
|
+
|
|
21
|
+
## Module Architecture
|
|
22
|
+
|
|
23
|
+
- **One module per domain** — `UsersModule`, `AuthModule`, `OrdersModule`
|
|
24
|
+
- **Feature modules** — encapsulate related controllers, services, repositories
|
|
25
|
+
- **Shared module** — for cross-cutting concerns (logging, config, utils)
|
|
26
|
+
- **Core module** — singleton services (database, auth guards)
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
src/
|
|
30
|
+
├── modules/
|
|
31
|
+
│ ├── users/
|
|
32
|
+
│ │ ├── users.module.ts
|
|
33
|
+
│ │ ├── users.controller.ts
|
|
34
|
+
│ │ ├── users.service.ts
|
|
35
|
+
│ │ ├── users.repository.ts
|
|
36
|
+
│ │ ├── dto/
|
|
37
|
+
│ │ │ ├── create-user.dto.ts
|
|
38
|
+
│ │ │ └── update-user.dto.ts
|
|
39
|
+
│ │ ├── entities/
|
|
40
|
+
│ │ │ └── user.entity.ts
|
|
41
|
+
│ │ └── users.spec.ts
|
|
42
|
+
│ └── auth/
|
|
43
|
+
├── shared/
|
|
44
|
+
│ ├── guards/
|
|
45
|
+
│ ├── interceptors/
|
|
46
|
+
│ ├── pipes/
|
|
47
|
+
│ └── filters/
|
|
48
|
+
├── config/
|
|
49
|
+
└── app.module.ts
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Dependency Injection
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
@Injectable()
|
|
56
|
+
export class UsersService {
|
|
57
|
+
constructor(
|
|
58
|
+
@InjectRepository(User) private readonly usersRepo: Repository<User>,
|
|
59
|
+
private readonly configService: ConfigService,
|
|
60
|
+
) {}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- Prefer constructor injection
|
|
65
|
+
- Use custom providers for complex setup
|
|
66
|
+
- Scope: default is Singleton, use REQUEST scope only when needed
|
|
67
|
+
|
|
68
|
+
## DTOs and Validation
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { IsEmail, IsString, MinLength } from 'class-validator';
|
|
72
|
+
|
|
73
|
+
export class CreateUserDto {
|
|
74
|
+
@IsEmail()
|
|
75
|
+
email: string;
|
|
76
|
+
|
|
77
|
+
@IsString()
|
|
78
|
+
@MinLength(2)
|
|
79
|
+
name: string;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- Always use DTOs for request validation
|
|
84
|
+
- Use `ValidationPipe` globally
|
|
85
|
+
- Separate Create/Update/Response DTOs
|
|
86
|
+
|
|
87
|
+
## Guards, Interceptors, Pipes
|
|
88
|
+
|
|
89
|
+
| Type | Purpose |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| **Guards** | Authentication, authorization |
|
|
92
|
+
| **Interceptors** | Logging, transformation, caching |
|
|
93
|
+
| **Pipes** | Validation, transformation |
|
|
94
|
+
| **Filters** | Exception handling |
|
|
95
|
+
|
|
96
|
+
Execution order: Guards → Interceptors → Pipes → Handler → Interceptors → Filters
|
|
97
|
+
|
|
98
|
+
## Error Handling
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
@Catch()
|
|
102
|
+
export class AllExceptionsFilter implements ExceptionFilter {
|
|
103
|
+
catch(exception: unknown, host: ArgumentsHost) {
|
|
104
|
+
// Transform to standard error format
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Testing
|
|
110
|
+
|
|
111
|
+
- **Unit tests** — mock dependencies with `Test.createTestingModule()`
|
|
112
|
+
- **E2E tests** — use `supertest` with a test module
|
|
113
|
+
- **Mock everything** — services should be testable in isolation
|
|
114
|
+
|
|
115
|
+
## Anti-Patterns
|
|
116
|
+
|
|
117
|
+
- [FAIL] Business logic in controllers — use services
|
|
118
|
+
- [FAIL] Direct database access in controllers — use repositories
|
|
119
|
+
- [FAIL] Circular dependencies — refactor module structure
|
|
120
|
+
- [FAIL] God modules — split large modules by domain
|
|
121
|
+
- [FAIL] Not using DTOs — always validate input
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Code Examples
|
|
125
|
+
|
|
126
|
+
See `EXAMPLES.md` for detailed code examples.
|
|
127
|
+
|
|
128
|
+
## Validation Checklist
|
|
129
|
+
|
|
130
|
+
What to verify during the review phase before completing the task.
|
|
131
|
+
|
|
132
|
+
## Common Mistakes
|
|
133
|
+
|
|
134
|
+
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
135
|
+
|
|
136
|
+
## Integration Notes
|
|
137
|
+
|
|
138
|
+
How this skill interacts with other skills.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<!-- Source: EXAMPLES.md -->
|
|
142
|
+
|
|
143
|
+
# nestjs Examples — Anti-patterns vs ContextOS Standard
|
|
144
|
+
|
|
145
|
+
## Example 1: Input Validation and DTOs
|
|
146
|
+
|
|
147
|
+
### Anti-pattern: Untyped Body or Manual Validation in Controller
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
// BAD: No runtime validation, controller stuffed with business rules
|
|
151
|
+
@Post('users')
|
|
152
|
+
async create(@Body() body: any) {
|
|
153
|
+
if (!body.email || !body.email.includes('@')) {
|
|
154
|
+
throw new BadRequestException('Invalid email');
|
|
155
|
+
}
|
|
156
|
+
return this.usersService.create(body);
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Best practice: ContextOS Standard (Class-Validator DTO + ValidationPipe)
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// GOOD: Declarative runtime validation with clean separation
|
|
164
|
+
export class CreateUserDto {
|
|
165
|
+
@IsEmail({}, { message: 'A valid email is required' })
|
|
166
|
+
email: string;
|
|
167
|
+
|
|
168
|
+
@IsString()
|
|
169
|
+
@MinLength(8, { message: 'Password must be at least 8 characters long' })
|
|
170
|
+
password: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@Controller('users')
|
|
174
|
+
export class UsersController {
|
|
175
|
+
constructor(private readonly usersService: UsersService) {}
|
|
176
|
+
|
|
177
|
+
@Post()
|
|
178
|
+
async create(@Body() dto: CreateUserDto) {
|
|
179
|
+
return this.usersService.create(dto);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
<!-- Source: TROUBLESHOOTING.md -->
|
|
185
|
+
|
|
186
|
+
# nestjs Troubleshooting & Common Mistakes
|
|
187
|
+
|
|
188
|
+
## 1. Circular Dependency Between Modules
|
|
189
|
+
|
|
190
|
+
- **Symptom**: "Nest cannot create the module instance. Often, this is caused by circular dependencies".
|
|
191
|
+
- **Root Cause**: Module A imports Module B, and Module B imports Module A.
|
|
192
|
+
- **Fix**: Use `forwardRef(() => ModuleB)` in imports and `@Inject(forwardRef(() => ServiceB))` in constructors, or refactor shared logic into a separate CommonModule.
|
|
193
|
+
|
|
194
|
+
## 2. Memory Leaks from REQUEST Scope
|
|
195
|
+
|
|
196
|
+
- **Symptom**: High memory usage and slow performance under load.
|
|
197
|
+
- **Root Cause**: Providers declared with Scope.REQUEST recreate instances on every HTTP request.
|
|
198
|
+
- **Fix**: Keep services as default Singletons whenever possible. Pass request-scoped parameters directly through method arguments.
|
|
199
|
+
|
|
200
|
+
## 3. Uncaught Domain Exceptions
|
|
201
|
+
|
|
202
|
+
- **Symptom**: Custom domain exceptions bypass formatting and return generic 500 errors.
|
|
203
|
+
- **Root Cause**: Missing custom Global Exception Filter.
|
|
204
|
+
- **Fix**: Implement an AllExceptionsFilter implementing ExceptionFilter and bind it globally in main.ts.
|