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.
Files changed (310) hide show
  1. package/.agents/AGENTS.md +421 -0
  2. package/.agents/adapters/aider/export.js +137 -0
  3. package/.agents/adapters/claude/export.js +55 -0
  4. package/.agents/adapters/copilot/export.js +107 -0
  5. package/.agents/adapters/cursor/export.js +210 -0
  6. package/.agents/adapters/gemini/export.js +115 -0
  7. package/.agents/adapters/shared.js +119 -0
  8. package/.agents/adapters/zed/export.js +111 -0
  9. package/.agents/core/profiles/backend.yaml +47 -0
  10. package/.agents/core/profiles/enterprise.yaml +46 -0
  11. package/.agents/core/profiles/frontend.yaml +46 -0
  12. package/.agents/core/profiles/hackathon.yaml +45 -0
  13. package/.agents/core/profiles/mvp.yaml +43 -0
  14. package/.agents/core/profiles/startup.yaml +48 -0
  15. package/.agents/core/skills/adapters/EXAMPLES.md +19 -0
  16. package/.agents/core/skills/adapters/SKILL.md +105 -0
  17. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +7 -0
  18. package/.agents/core/skills/adapters/VALIDATION.json +12 -0
  19. package/.agents/core/skills/adapters/skill.yaml +10 -0
  20. package/.agents/core/skills/architecture-diagrams/SKILL.md +108 -0
  21. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +12 -0
  22. package/.agents/core/skills/architecture-diagrams/skill.yaml +8 -0
  23. package/.agents/core/skills/brutalist-design/SKILL.md +150 -0
  24. package/.agents/core/skills/brutalist-design/VALIDATION.json +12 -0
  25. package/.agents/core/skills/brutalist-design/skill.yaml +8 -0
  26. package/.agents/core/skills/context-manager/EXAMPLES.md +19 -0
  27. package/.agents/core/skills/context-manager/SKILL.md +126 -0
  28. package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +7 -0
  29. package/.agents/core/skills/context-manager/VALIDATION.json +12 -0
  30. package/.agents/core/skills/context-manager/skill.yaml +10 -0
  31. package/.agents/core/skills/context-os/EXAMPLES.md +21 -0
  32. package/.agents/core/skills/context-os/SKILL.md +169 -0
  33. package/.agents/core/skills/context-os/TROUBLESHOOTING.md +7 -0
  34. package/.agents/core/skills/context-os/VALIDATION.json +12 -0
  35. package/.agents/core/skills/context-os/packs.yaml +59 -0
  36. package/.agents/core/skills/context-os/references/context-rules.md +68 -0
  37. package/.agents/core/skills/context-os/references/pipeline.md +119 -0
  38. package/.agents/core/skills/context-os/references/project-graph.md +103 -0
  39. package/.agents/core/skills/context-os/rules.yaml +135 -0
  40. package/.agents/core/skills/context-os/skill.yaml +10 -0
  41. package/.agents/core/skills/database/EXAMPLES.md +74 -0
  42. package/.agents/core/skills/database/SKILL.md +101 -0
  43. package/.agents/core/skills/database/TROUBLESHOOTING.md +18 -0
  44. package/.agents/core/skills/database/VALIDATION.json +11 -0
  45. package/.agents/core/skills/database/skill.yaml +25 -0
  46. package/.agents/core/skills/ddd/EXAMPLES.md +42 -0
  47. package/.agents/core/skills/ddd/SKILL.md +247 -0
  48. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +19 -0
  49. package/.agents/core/skills/ddd/VALIDATION.json +12 -0
  50. package/.agents/core/skills/ddd/ddd.md +178 -0
  51. package/.agents/core/skills/ddd/skill.yaml +10 -0
  52. package/.agents/core/skills/decisions/EXAMPLES.md +35 -0
  53. package/.agents/core/skills/decisions/SKILL.md +90 -0
  54. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +13 -0
  55. package/.agents/core/skills/decisions/VALIDATION.json +12 -0
  56. package/.agents/core/skills/decisions/skill.yaml +10 -0
  57. package/.agents/core/skills/docker/EXAMPLES.md +56 -0
  58. package/.agents/core/skills/docker/SKILL.md +63 -0
  59. package/.agents/core/skills/docker/TROUBLESHOOTING.md +18 -0
  60. package/.agents/core/skills/docker/VALIDATION.json +11 -0
  61. package/.agents/core/skills/docker/skill.yaml +23 -0
  62. package/.agents/core/skills/engineering-workflow/EXAMPLES.md +57 -0
  63. package/.agents/core/skills/engineering-workflow/SKILL.md +343 -0
  64. package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
  65. package/.agents/core/skills/engineering-workflow/VALIDATION.json +12 -0
  66. package/.agents/core/skills/engineering-workflow/skill.yaml +13 -0
  67. package/.agents/core/skills/fastapi/EXAMPLES.md +36 -0
  68. package/.agents/core/skills/fastapi/SKILL.md +148 -0
  69. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +19 -0
  70. package/.agents/core/skills/fastapi/VALIDATION.json +12 -0
  71. package/.agents/core/skills/fastapi/fastapi.md +112 -0
  72. package/.agents/core/skills/fastapi/skill.yaml +10 -0
  73. package/.agents/core/skills/gemini-precision/SKILL.md +169 -0
  74. package/.agents/core/skills/gemini-precision/VALIDATION.json +12 -0
  75. package/.agents/core/skills/gemini-precision/skill.yaml +9 -0
  76. package/.agents/core/skills/generators/EXAMPLES.md +19 -0
  77. package/.agents/core/skills/generators/SKILL.md +112 -0
  78. package/.agents/core/skills/generators/TROUBLESHOOTING.md +7 -0
  79. package/.agents/core/skills/generators/VALIDATION.json +12 -0
  80. package/.agents/core/skills/generators/skill.yaml +10 -0
  81. package/.agents/core/skills/generators/templates/API.md +77 -0
  82. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +70 -0
  83. package/.agents/core/skills/generators/templates/DATABASE.md +42 -0
  84. package/.agents/core/skills/generators/templates/DECISION.md +46 -0
  85. package/.agents/core/skills/generators/templates/PRD.md +67 -0
  86. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +56 -0
  87. package/.agents/core/skills/generators/templates/ROADMAP.md +51 -0
  88. package/.agents/core/skills/generators/templates/TASKS.md +43 -0
  89. package/.agents/core/skills/generators/templates/UI.md +73 -0
  90. package/.agents/core/skills/graphify/EXAMPLES.md +73 -0
  91. package/.agents/core/skills/graphify/SKILL.md +130 -0
  92. package/.agents/core/skills/graphify/VALIDATION.json +12 -0
  93. package/.agents/core/skills/graphify/skill.yaml +13 -0
  94. package/.agents/core/skills/gstack-roles/EXAMPLES.md +23 -0
  95. package/.agents/core/skills/gstack-roles/SKILL.md +152 -0
  96. package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
  97. package/.agents/core/skills/gstack-roles/VALIDATION.json +12 -0
  98. package/.agents/core/skills/gstack-roles/skill.yaml +12 -0
  99. package/.agents/core/skills/impeccable-design/EXAMPLES.md +26 -0
  100. package/.agents/core/skills/impeccable-design/SKILL.md +201 -0
  101. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +19 -0
  102. package/.agents/core/skills/impeccable-design/VALIDATION.json +12 -0
  103. package/.agents/core/skills/impeccable-design/skill.yaml +14 -0
  104. package/.agents/core/skills/interview-me/SKILL.md +97 -0
  105. package/.agents/core/skills/interview-me/VALIDATION.json +12 -0
  106. package/.agents/core/skills/interview-me/skill.yaml +8 -0
  107. package/.agents/core/skills/microservices/EXAMPLES.md +38 -0
  108. package/.agents/core/skills/microservices/SKILL.md +164 -0
  109. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +19 -0
  110. package/.agents/core/skills/microservices/VALIDATION.json +12 -0
  111. package/.agents/core/skills/microservices/microservices.md +119 -0
  112. package/.agents/core/skills/microservices/skill.yaml +10 -0
  113. package/.agents/core/skills/minimalist-design/SKILL.md +113 -0
  114. package/.agents/core/skills/minimalist-design/VALIDATION.json +12 -0
  115. package/.agents/core/skills/minimalist-design/skill.yaml +8 -0
  116. package/.agents/core/skills/nestjs/EXAMPLES.md +40 -0
  117. package/.agents/core/skills/nestjs/SKILL.md +139 -0
  118. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +19 -0
  119. package/.agents/core/skills/nestjs/VALIDATION.json +12 -0
  120. package/.agents/core/skills/nestjs/nestjs.md +103 -0
  121. package/.agents/core/skills/nestjs/skill.yaml +10 -0
  122. package/.agents/core/skills/nextjs/EXAMPLES.md +40 -0
  123. package/.agents/core/skills/nextjs/SKILL.md +163 -0
  124. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +19 -0
  125. package/.agents/core/skills/nextjs/VALIDATION.json +12 -0
  126. package/.agents/core/skills/nextjs/nextjs.md +67 -0
  127. package/.agents/core/skills/nextjs/skill.yaml +10 -0
  128. package/.agents/core/skills/node/EXAMPLES.md +80 -0
  129. package/.agents/core/skills/node/SKILL.md +128 -0
  130. package/.agents/core/skills/node/TROUBLESHOOTING.md +19 -0
  131. package/.agents/core/skills/node/VALIDATION.json +12 -0
  132. package/.agents/core/skills/node/node.md +87 -0
  133. package/.agents/core/skills/node/skill.yaml +10 -0
  134. package/.agents/core/skills/performance/EXAMPLES.md +30 -0
  135. package/.agents/core/skills/performance/SKILL.md +75 -0
  136. package/.agents/core/skills/performance/TROUBLESHOOTING.md +19 -0
  137. package/.agents/core/skills/performance/VALIDATION.json +12 -0
  138. package/.agents/core/skills/performance/performance.md +52 -0
  139. package/.agents/core/skills/performance/skill.yaml +10 -0
  140. package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +45 -0
  141. package/.agents/core/skills/ponytail-mindset/SKILL.md +193 -0
  142. package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
  143. package/.agents/core/skills/ponytail-mindset/VALIDATION.json +12 -0
  144. package/.agents/core/skills/ponytail-mindset/skill.yaml +14 -0
  145. package/.agents/core/skills/react/EXAMPLES.md +79 -0
  146. package/.agents/core/skills/react/SKILL.md +132 -0
  147. package/.agents/core/skills/react/TROUBLESHOOTING.md +19 -0
  148. package/.agents/core/skills/react/VALIDATION.json +12 -0
  149. package/.agents/core/skills/react/react.md +93 -0
  150. package/.agents/core/skills/react/skill.yaml +10 -0
  151. package/.agents/core/skills/react-best-practices/SKILL.md +155 -0
  152. package/.agents/core/skills/react-best-practices/VALIDATION.json +12 -0
  153. package/.agents/core/skills/react-best-practices/skill.yaml +10 -0
  154. package/.agents/core/skills/redesign-audit/SKILL.md +117 -0
  155. package/.agents/core/skills/redesign-audit/VALIDATION.json +12 -0
  156. package/.agents/core/skills/redesign-audit/skill.yaml +8 -0
  157. package/.agents/core/skills/security/EXAMPLES.md +64 -0
  158. package/.agents/core/skills/security/SKILL.md +158 -0
  159. package/.agents/core/skills/security/TROUBLESHOOTING.md +19 -0
  160. package/.agents/core/skills/security/VALIDATION.json +12 -0
  161. package/.agents/core/skills/security/security.md +106 -0
  162. package/.agents/core/skills/security/skill.yaml +10 -0
  163. package/.agents/core/skills/soft-design/SKILL.md +108 -0
  164. package/.agents/core/skills/soft-design/VALIDATION.json +12 -0
  165. package/.agents/core/skills/soft-design/skill.yaml +8 -0
  166. package/.agents/core/skills/state-management/EXAMPLES.md +56 -0
  167. package/.agents/core/skills/state-management/SKILL.md +48 -0
  168. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +18 -0
  169. package/.agents/core/skills/state-management/VALIDATION.json +11 -0
  170. package/.agents/core/skills/state-management/skill.yaml +22 -0
  171. package/.agents/core/skills/subagent-orchestrator/SKILL.md +100 -0
  172. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +12 -0
  173. package/.agents/core/skills/subagent-orchestrator/skill.yaml +8 -0
  174. package/.agents/core/skills/system-design/EXAMPLES.md +75 -0
  175. package/.agents/core/skills/system-design/SKILL.md +419 -0
  176. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +19 -0
  177. package/.agents/core/skills/system-design/VALIDATION.json +12 -0
  178. package/.agents/core/skills/system-design/skill.yaml +13 -0
  179. package/.agents/core/skills/system-design/system-design.md +112 -0
  180. package/.agents/core/skills/testing/EXAMPLES.md +71 -0
  181. package/.agents/core/skills/testing/SKILL.md +70 -0
  182. package/.agents/core/skills/testing/TROUBLESHOOTING.md +18 -0
  183. package/.agents/core/skills/testing/VALIDATION.json +11 -0
  184. package/.agents/core/skills/testing/skill.yaml +26 -0
  185. package/.agents/core/skills/typescript/EXAMPLES.md +64 -0
  186. package/.agents/core/skills/typescript/SKILL.md +112 -0
  187. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +19 -0
  188. package/.agents/core/skills/typescript/VALIDATION.json +12 -0
  189. package/.agents/core/skills/typescript/skill.yaml +10 -0
  190. package/.agents/core/skills/typescript/typescript.md +71 -0
  191. package/.agents/core/skills/ui-design/EXAMPLES.md +21 -0
  192. package/.agents/core/skills/ui-design/SKILL.md +124 -0
  193. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +19 -0
  194. package/.agents/core/skills/ui-design/VALIDATION.json +12 -0
  195. package/.agents/core/skills/ui-design/skill.yaml +10 -0
  196. package/.agents/core/skills/ui-design/ui.md +88 -0
  197. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +62 -0
  198. package/.agents/core/skills/ui-ux-pro/SKILL.md +375 -0
  199. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +19 -0
  200. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +12 -0
  201. package/.agents/core/skills/ui-ux-pro/skill.yaml +13 -0
  202. package/.agents/core/skills/ux-design/EXAMPLES.md +36 -0
  203. package/.agents/core/skills/ux-design/SKILL.md +116 -0
  204. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +19 -0
  205. package/.agents/core/skills/ux-design/VALIDATION.json +12 -0
  206. package/.agents/core/skills/ux-design/skill.yaml +10 -0
  207. package/.agents/core/skills/ux-design/ux.md +80 -0
  208. package/.agents/core/skills/vercel-optimize/SKILL.md +83 -0
  209. package/.agents/core/skills/vercel-optimize/VALIDATION.json +12 -0
  210. package/.agents/core/skills/vercel-optimize/skill.yaml +10 -0
  211. package/.agents/core/skills/web-accessibility/EXAMPLES.md +39 -0
  212. package/.agents/core/skills/web-accessibility/SKILL.md +170 -0
  213. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +19 -0
  214. package/.agents/core/skills/web-accessibility/VALIDATION.json +12 -0
  215. package/.agents/core/skills/web-accessibility/accessibility.md +63 -0
  216. package/.agents/core/skills/web-accessibility/skill.yaml +10 -0
  217. package/.agents/ctx.js +370 -0
  218. package/.agents/generated/claude/skills/adapters/SKILL.md +126 -0
  219. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +101 -0
  220. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +145 -0
  221. package/.agents/generated/claude/skills/context-manager/SKILL.md +147 -0
  222. package/.agents/generated/claude/skills/context-os/SKILL.md +191 -0
  223. package/.agents/generated/claude/skills/database/SKILL.md +191 -0
  224. package/.agents/generated/claude/skills/ddd/SKILL.md +305 -0
  225. package/.agents/generated/claude/skills/decisions/SKILL.md +134 -0
  226. package/.agents/generated/claude/skills/docker/SKILL.md +135 -0
  227. package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +414 -0
  228. package/.agents/generated/claude/skills/fastapi/SKILL.md +200 -0
  229. package/.agents/generated/claude/skills/gemini-precision/SKILL.md +161 -0
  230. package/.agents/generated/claude/skills/generators/SKILL.md +133 -0
  231. package/.agents/generated/claude/skills/graphify/SKILL.md +198 -0
  232. package/.agents/generated/claude/skills/gstack-roles/SKILL.md +184 -0
  233. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +241 -0
  234. package/.agents/generated/claude/skills/interview-me/SKILL.md +90 -0
  235. package/.agents/generated/claude/skills/microservices/SKILL.md +218 -0
  236. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +108 -0
  237. package/.agents/generated/claude/skills/nestjs/SKILL.md +195 -0
  238. package/.agents/generated/claude/skills/nextjs/SKILL.md +219 -0
  239. package/.agents/generated/claude/skills/node/SKILL.md +224 -0
  240. package/.agents/generated/claude/skills/performance/SKILL.md +121 -0
  241. package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +252 -0
  242. package/.agents/generated/claude/skills/react/SKILL.md +227 -0
  243. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +146 -0
  244. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +112 -0
  245. package/.agents/generated/claude/skills/security/SKILL.md +237 -0
  246. package/.agents/generated/claude/skills/soft-design/SKILL.md +103 -0
  247. package/.agents/generated/claude/skills/state-management/SKILL.md +120 -0
  248. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +93 -0
  249. package/.agents/generated/claude/skills/system-design/SKILL.md +507 -0
  250. package/.agents/generated/claude/skills/testing/SKILL.md +157 -0
  251. package/.agents/generated/claude/skills/typescript/SKILL.md +192 -0
  252. package/.agents/generated/claude/skills/ui-design/SKILL.md +161 -0
  253. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +451 -0
  254. package/.agents/generated/claude/skills/ux-design/SKILL.md +168 -0
  255. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +76 -0
  256. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +225 -0
  257. package/.agents/generated/gemini/skills/adapters/SKILL.md +135 -0
  258. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +107 -0
  259. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +151 -0
  260. package/.agents/generated/gemini/skills/context-manager/SKILL.md +156 -0
  261. package/.agents/generated/gemini/skills/context-os/SKILL.md +200 -0
  262. package/.agents/generated/gemini/skills/database/SKILL.md +200 -0
  263. package/.agents/generated/gemini/skills/ddd/SKILL.md +314 -0
  264. package/.agents/generated/gemini/skills/decisions/SKILL.md +143 -0
  265. package/.agents/generated/gemini/skills/docker/SKILL.md +144 -0
  266. package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +423 -0
  267. package/.agents/generated/gemini/skills/fastapi/SKILL.md +209 -0
  268. package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +167 -0
  269. package/.agents/generated/gemini/skills/generators/SKILL.md +142 -0
  270. package/.agents/generated/gemini/skills/graphify/SKILL.md +205 -0
  271. package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +193 -0
  272. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +250 -0
  273. package/.agents/generated/gemini/skills/interview-me/SKILL.md +96 -0
  274. package/.agents/generated/gemini/skills/microservices/SKILL.md +227 -0
  275. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +114 -0
  276. package/.agents/generated/gemini/skills/nestjs/SKILL.md +204 -0
  277. package/.agents/generated/gemini/skills/nextjs/SKILL.md +298 -0
  278. package/.agents/generated/gemini/skills/node/SKILL.md +323 -0
  279. package/.agents/generated/gemini/skills/performance/SKILL.md +185 -0
  280. package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +261 -0
  281. package/.agents/generated/gemini/skills/react/SKILL.md +332 -0
  282. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +152 -0
  283. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +118 -0
  284. package/.agents/generated/gemini/skills/security/SKILL.md +355 -0
  285. package/.agents/generated/gemini/skills/soft-design/SKILL.md +109 -0
  286. package/.agents/generated/gemini/skills/state-management/SKILL.md +129 -0
  287. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +99 -0
  288. package/.agents/generated/gemini/skills/system-design/SKILL.md +631 -0
  289. package/.agents/generated/gemini/skills/testing/SKILL.md +166 -0
  290. package/.agents/generated/gemini/skills/typescript/SKILL.md +275 -0
  291. package/.agents/generated/gemini/skills/ui-design/SKILL.md +170 -0
  292. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +460 -0
  293. package/.agents/generated/gemini/skills/ux-design/SKILL.md +177 -0
  294. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +82 -0
  295. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +300 -0
  296. package/.agents/mcp/runtime.py +454 -0
  297. package/.agents/mcp/server.mjs +189373 -0
  298. package/.agents/plugins.js +574 -0
  299. package/.agents/profiles.js +267 -0
  300. package/.agents/resolver.js +336 -0
  301. package/.agents/skills-index.json +200 -0
  302. package/.agents/skills.json +6 -0
  303. package/.agents/validate.js +500 -0
  304. package/LICENSE +21 -0
  305. package/README.md +415 -0
  306. package/benchmarks/gemini-issues.js +533 -0
  307. package/bin/index.js +458 -0
  308. package/package.json +70 -0
  309. package/registry.json +53 -0
  310. package/registry.schema.json +32 -0
@@ -0,0 +1,195 @@
1
+ # NestJS
2
+
3
+ ## Overview
4
+
5
+ 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.
6
+
7
+ ## When to Use
8
+
9
+ Activate when building enterprise Node.js microservices, complex REST/GraphQL APIs, or scalable backends requiring strict architectural structure.
10
+
11
+ ## Rules & Patterns
12
+ <!-- Source: nestjs.md -->
13
+
14
+ ## NestJS — Best Practices
15
+
16
+ ## Module Architecture
17
+
18
+ - **One module per domain** — `UsersModule`, `AuthModule`, `OrdersModule`
19
+ - **Feature modules** — encapsulate related controllers, services, repositories
20
+ - **Shared module** — for cross-cutting concerns (logging, config, utils)
21
+ - **Core module** — singleton services (database, auth guards)
22
+
23
+ ```
24
+ src/
25
+ ├── modules/
26
+ │ ├── users/
27
+ │ │ ├── users.module.ts
28
+ │ │ ├── users.controller.ts
29
+ │ │ ├── users.service.ts
30
+ │ │ ├── users.repository.ts
31
+ │ │ ├── dto/
32
+ │ │ │ ├── create-user.dto.ts
33
+ │ │ │ └── update-user.dto.ts
34
+ │ │ ├── entities/
35
+ │ │ │ └── user.entity.ts
36
+ │ │ └── users.spec.ts
37
+ │ └── auth/
38
+ ├── shared/
39
+ │ ├── guards/
40
+ │ ├── interceptors/
41
+ │ ├── pipes/
42
+ │ └── filters/
43
+ ├── config/
44
+ └── app.module.ts
45
+ ```
46
+
47
+ ## Dependency Injection
48
+
49
+ ```typescript
50
+ @Injectable()
51
+ export class UsersService {
52
+ constructor(
53
+ @InjectRepository(User) private readonly usersRepo: Repository<User>,
54
+ private readonly configService: ConfigService,
55
+ ) {}
56
+ }
57
+ ```
58
+
59
+ - Prefer constructor injection
60
+ - Use custom providers for complex setup
61
+ - Scope: default is Singleton, use REQUEST scope only when needed
62
+
63
+ ## DTOs and Validation
64
+
65
+ ```typescript
66
+ import { IsEmail, IsString, MinLength } from 'class-validator';
67
+
68
+ export class CreateUserDto {
69
+ @IsEmail()
70
+ email: string;
71
+
72
+ @IsString()
73
+ @MinLength(2)
74
+ name: string;
75
+ }
76
+ ```
77
+
78
+ - Always use DTOs for request validation
79
+ - Use `ValidationPipe` globally
80
+ - Separate Create/Update/Response DTOs
81
+
82
+ ## Guards, Interceptors, Pipes
83
+
84
+ | Type | Purpose |
85
+ | --- | --- |
86
+ | **Guards** | Authentication, authorization |
87
+ | **Interceptors** | Logging, transformation, caching |
88
+ | **Pipes** | Validation, transformation |
89
+ | **Filters** | Exception handling |
90
+
91
+ Execution order: Guards → Interceptors → Pipes → Handler → Interceptors → Filters
92
+
93
+ ## Error Handling
94
+
95
+ ```typescript
96
+ @Catch()
97
+ export class AllExceptionsFilter implements ExceptionFilter {
98
+ catch(exception: unknown, host: ArgumentsHost) {
99
+ // Transform to standard error format
100
+ }
101
+ }
102
+ ```
103
+
104
+ ## Testing
105
+
106
+ - **Unit tests** — mock dependencies with `Test.createTestingModule()`
107
+ - **E2E tests** — use `supertest` with a test module
108
+ - **Mock everything** — services should be testable in isolation
109
+
110
+ ## Anti-Patterns
111
+
112
+ - [FAIL] Business logic in controllers — use services
113
+ - [FAIL] Direct database access in controllers — use repositories
114
+ - [FAIL] Circular dependencies — refactor module structure
115
+ - [FAIL] God modules — split large modules by domain
116
+ - [FAIL] Not using DTOs — always validate input
117
+
118
+
119
+ ## Code Examples
120
+
121
+ See `EXAMPLES.md` for detailed code examples.
122
+
123
+ ## Validation Checklist
124
+
125
+ What to verify during the review phase before completing the task.
126
+
127
+ ## Common Mistakes
128
+
129
+ Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
130
+
131
+ ## Integration Notes
132
+
133
+ How this skill interacts with other skills.
134
+
135
+
136
+ # nestjs Examples — Anti-patterns vs ContextOS Standard
137
+
138
+ ## Example 1: Input Validation and DTOs
139
+
140
+ ### Anti-pattern: Untyped Body or Manual Validation in Controller
141
+
142
+ ```typescript
143
+ // BAD: No runtime validation, controller stuffed with business rules
144
+ @Post('users')
145
+ async create(@Body() body: any) {
146
+ if (!body.email || !body.email.includes('@')) {
147
+ throw new BadRequestException('Invalid email');
148
+ }
149
+ return this.usersService.create(body);
150
+ }
151
+ ```
152
+
153
+ ### Best practice: ContextOS Standard (Class-Validator DTO + ValidationPipe)
154
+
155
+ ```typescript
156
+ // GOOD: Declarative runtime validation with clean separation
157
+ export class CreateUserDto {
158
+ @IsEmail({}, { message: 'A valid email is required' })
159
+ email: string;
160
+
161
+ @IsString()
162
+ @MinLength(8, { message: 'Password must be at least 8 characters long' })
163
+ password: string;
164
+ }
165
+
166
+ @Controller('users')
167
+ export class UsersController {
168
+ constructor(private readonly usersService: UsersService) {}
169
+
170
+ @Post()
171
+ async create(@Body() dto: CreateUserDto) {
172
+ return this.usersService.create(dto);
173
+ }
174
+ }
175
+ ```
176
+
177
+ # nestjs Troubleshooting & Common Mistakes
178
+
179
+ ## 1. Circular Dependency Between Modules
180
+
181
+ - **Symptom**: "Nest cannot create the module instance. Often, this is caused by circular dependencies".
182
+ - **Root Cause**: Module A imports Module B, and Module B imports Module A.
183
+ - **Fix**: Use `forwardRef(() => ModuleB)` in imports and `@Inject(forwardRef(() => ServiceB))` in constructors, or refactor shared logic into a separate CommonModule.
184
+
185
+ ## 2. Memory Leaks from REQUEST Scope
186
+
187
+ - **Symptom**: High memory usage and slow performance under load.
188
+ - **Root Cause**: Providers declared with Scope.REQUEST recreate instances on every HTTP request.
189
+ - **Fix**: Keep services as default Singletons whenever possible. Pass request-scoped parameters directly through method arguments.
190
+
191
+ ## 3. Uncaught Domain Exceptions
192
+
193
+ - **Symptom**: Custom domain exceptions bypass formatting and return generic 500 errors.
194
+ - **Root Cause**: Missing custom Global Exception Filter.
195
+ - **Fix**: Implement an AllExceptionsFilter implementing ExceptionFilter and bind it globally in main.ts.
@@ -0,0 +1,219 @@
1
+ # Next.js App Router Best Practices
2
+
3
+ ## Overview
4
+
5
+ Enforces high-performance architectural patterns for Next.js App Router based on Vercel Engineering guidelines: React Server Components (RSC), zero-waterfall async pipelines, request deduplication via `React.cache()`, bundle optimization, and secure Server Actions.
6
+
7
+ ## When to Use
8
+
9
+ Activate whenever building, refactoring, or reviewing Next.js pages, layouts, Route Handlers (`app/api`), Server Actions, or components in the `app/` directory.
10
+
11
+ ## Negative Constraints (What NOT to Do)
12
+
13
+ 1. **NEVER use barrel imports for UI libraries**: Avoid `import { Button, Dialog } from '@/components'`. Import directly from the exact file (`import { Button } from '@/components/ui/button'`) to prevent bundler tree-shaking failures and trace bloat.
14
+ 2. **NEVER trust client-provided data or session state in Server Actions**: Always authenticate session and authorize tenant ownership inside the Server Action handler itself before mutating data.
15
+ 3. **NEVER introduce sequential `await` waterfalls for independent data**: Always use `Promise.all()` or parallel streaming `<Suspense>` boundaries.
16
+ 4. **NEVER pass large unneeded serialized data from Server to Client Components**: Only pass the specific primitive fields required by the client component (`server-dedup-props`).
17
+ 5. **NEVER use `useEffect` for data fetching**: Fetch directly in Server Components or use TanStack Query / SWR for client-side queries.
18
+ 6. **NEVER import server-only modules in client components**: Use the `server-only` package in data access layers to catch accidental client imports at build time.
19
+
20
+ ## Rules & Patterns
21
+
22
+ ### 1. Eliminating Async Waterfalls (Critical)
23
+
24
+ - **Parallel Fetching**: Fetch independent data concurrently at the top of the route or component.
25
+ - **Granular Streaming**: Wrap slow, non-critical subtrees in `<Suspense fallback={<Skeleton />}>` so critical above-the-fold content streams immediately.
26
+ - **Defer Awaits**: Check cheap synchronous conditions before awaiting remote resources.
27
+
28
+ ### 2. Request Deduplication & Caching (`server-cache-react`)
29
+
30
+ - Use `React.cache()` to deduplicate identical database or service calls across multiple components rendered in the same server request lifecycle.
31
+
32
+ ```tsx
33
+ import { cache } from 'react';
34
+ import { db } from '@/lib/db';
35
+
36
+ export const getCurrentUser = cache(async (userId: string) => {
37
+ return await db.user.findUnique({
38
+ where: { id: userId },
39
+ select: { id: true, name: true, role: true, email: true }
40
+ });
41
+ });
42
+ ```
43
+
44
+ ### 3. Secure Server Actions (`server-auth-actions`)
45
+
46
+ - Treat every Server Action as a public HTTP endpoint. Always validate session, authorization, and input schema with Zod.
47
+
48
+ ```tsx
49
+ 'use server';
50
+
51
+ import { z } from 'zod';
52
+ import { auth } from '@/lib/auth';
53
+ import { db } from '@/lib/db';
54
+ import { revalidatePath } from 'next/cache';
55
+
56
+ const UpdateProfileSchema = z.object({
57
+ name: z.string().min(2).max(50),
58
+ });
59
+
60
+ export async function updateProfile(formData: FormData) {
61
+ const session = await auth();
62
+ if (!session?.userId) throw new Error('Unauthorized');
63
+
64
+ const result = UpdateProfileSchema.safeParse({ name: formData.get('name') });
65
+ if (!result.success) return { error: 'Invalid input', issues: result.error.flatten() };
66
+
67
+ await db.user.update({
68
+ where: { id: session.userId },
69
+ data: { name: result.data.name },
70
+ });
71
+
72
+ revalidatePath('/settings');
73
+ return { success: true };
74
+ }
75
+ ```
76
+
77
+ ### 4. Bundle Optimization & Dynamic Imports (`bundle-dynamic-imports`)
78
+
79
+ - Heavy interactive client components (charts, rich-text editors, video players) must be dynamically loaded with `next/dynamic`.
80
+
81
+ ```tsx
82
+ import dynamic from 'next/dynamic';
83
+
84
+ const AnalyticsChart = dynamic(
85
+ () => import('@/components/analytics/chart').then(mod => mod.AnalyticsChart),
86
+ {
87
+ loading: () => <div className="h-64 animate-pulse bg-muted rounded-lg" />,
88
+ ssr: false,
89
+ }
90
+ );
91
+ ```
92
+
93
+ ### 5. Next.js 15+ Async Request APIs (`async-params`)
94
+
95
+ In Next.js 15+, `params`, `searchParams`, `cookies()`, and `headers()` are asynchronous and must be awaited:
96
+
97
+ ```tsx
98
+ // [GOOD] Next.js 15+ Page Component
99
+ interface PageProps {
100
+ params: Promise<{ id: string }>;
101
+ searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
102
+ }
103
+
104
+ export default async function UserPage({ params, searchParams }: PageProps) {
105
+ const { id } = await params;
106
+ const { tab } = await searchParams;
107
+ const user = await getUser(id);
108
+
109
+ return <UserProfile user={user} activeTab={tab as string} />;
110
+ }
111
+ ```
112
+
113
+ ### 6. Non-Blocking Background Tasks with `after()`
114
+
115
+ To execute logging, analytics, or cache priming without delaying the user's HTTP response:
116
+
117
+ ```typescript
118
+ import { after } from 'next/server';
119
+
120
+ export async function POST(request: Request) {
121
+ const data = await request.json();
122
+ const result = await processOrder(data);
123
+
124
+ // Executes asynchronously AFTER the response stream has completed
125
+ after(async () => {
126
+ await sendSlackNotification(result);
127
+ await indexOrderInSearch(result.id);
128
+ });
129
+
130
+ return Response.json({ success: true, orderId: result.id });
131
+ }
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Code Examples
137
+
138
+ See `EXAMPLES.md` for detailed code examples and component templates.
139
+
140
+ ## Validation Checklist
141
+
142
+ - [ ] All database queries in RSC layers use `React.cache()` if called across multiple components.
143
+ - [ ] No barrel imports (`from '@/components'`); all imports point to exact component modules.
144
+ - [ ] Server Actions have explicit auth checks and Zod input validation.
145
+ - [ ] Heavy client widgets (charts, editors) use `next/dynamic`.
146
+ - [ ] Images use `next/image` with explicit `sizes` and `priority` on LCP elements.
147
+
148
+ ## Common Mistakes
149
+
150
+ - Using `'use client'` at page level instead of leaf components.
151
+ - Relying on client-side authentication checks for Server Actions without server-side validation.
152
+ - Chaining sequential awaits for independent data models.
153
+
154
+ ## Integration Notes
155
+
156
+ - Pairs with `react` and `ui-ux-pro` for component design and state management.
157
+ - Pairs with `security` for session authorization and input sanitization.
158
+
159
+
160
+ # nextjs Examples — Anti-patterns vs ContextOS Standard
161
+
162
+ ## Example 1: Server Components vs Client Components
163
+
164
+ ### Anti-pattern: Marking the Entire Page as Client Component
165
+
166
+ ```tsx
167
+ // BAD: app/dashboard/page.tsx with 'use client' at top
168
+ // Bloats client bundle, loses SEO benefits, eliminates direct DB access
169
+ 'use client';
170
+
171
+ export default function DashboardPage() {
172
+ const [data, setData] = useState(null);
173
+ useEffect(() => { fetch('/api/dashboard').then(...) }, []);
174
+ return <div>...</div>;
175
+ }
176
+ ```
177
+
178
+ ### Best practice: ContextOS Standard (RSC by Default, Client Leaf Nodes)
179
+
180
+ ```tsx
181
+ // GOOD: Server Component fetches data directly with zero bundle cost
182
+ // app/dashboard/page.tsx (Server Component)
183
+ import { Suspense } from 'react';
184
+ import { db } from '@/lib/db';
185
+ import { InteractiveChart } from './InteractiveChart'; // 'use client' leaf component
186
+
187
+ export default async function DashboardPage() {
188
+ const stats = await db.analytics.getStats();
189
+ return (
190
+ <main>
191
+ <h1>Dashboard</h1>
192
+ <p>Total Revenue: {stats.revenue}</p>
193
+ <Suspense fallback={<ChartSkeleton />}>
194
+ <InteractiveChart initialData={stats.chartData} />
195
+ </Suspense>
196
+ </main>
197
+ );
198
+ }
199
+ ```
200
+
201
+ # nextjs Troubleshooting & Common Mistakes
202
+
203
+ ## 1. Hydration Mismatch Errors
204
+
205
+ - **Symptom**: "Text content does not match server-rendered HTML".
206
+ - **Root Cause**: Rendering dates, window dimensions, or local storage data that differs between server render and client hydration.
207
+ - **Fix**: Use suppressHydrationWarning on localized timestamps or load client-only state inside a useEffect after mount.
208
+
209
+ ## 2. Accidental Server Code Bundled to Client
210
+
211
+ - **Symptom**: "Module not found: Can't resolve 'fs' or 'pg' in client bundle".
212
+ - **Root Cause**: Client component importing a utility that transitively imports server-only database code.
213
+ - **Fix**: Separate server utilities into *.server.ts and install import 'server-only'; at the top of server files.
214
+
215
+ ## 3. Waterfall Fetches in Server Components
216
+
217
+ - **Symptom**: Page takes 3 seconds to load due to sequential await statements.
218
+ - **Root Cause**: Awaiting independent data sources one after another.
219
+ - **Fix**: Use Promise.all([fetchUsers(), fetchProducts()]) or separate into nested <Suspense> boundaries.
@@ -0,0 +1,224 @@
1
+ # Node.js
2
+
3
+ ## Overview
4
+
5
+ Production-grade Node.js runtime and server standard. Enforces async event loop non-blocking hygiene, graceful shutdown, structured JSON logging with correlation IDs, and unhandled rejection guards.
6
+
7
+ ## When to Use
8
+
9
+ Activate when developing Node.js HTTP servers, Express/Fastify APIs, background workers, CLI tools, or stream-based data pipelines.
10
+
11
+ ## Negative Constraints (What NOT to Do)
12
+
13
+ 1. **NEVER execute synchronous filesystem/crypto calls in request handlers (`fs.readFileSync`)**: Always use async promises (`fs.promises.*`) to avoid blocking the event loop.
14
+ 2. **NEVER leave uncaught promise rejections**: Every async route must use `express-async-errors` or wrap operations in try/catch calling `next(err)`.
15
+ 3. **NEVER buffer large files/payloads entirely in memory (`fs.readFile`)**: Always use Streams or Pipelines (`stream.pipeline`) for processing large files.
16
+ 4. **NEVER store in-memory session or user state on a single process instance**: Use Redis or an external state store to allow multi-instance scaling.
17
+ 5. **NEVER ignore `SIGTERM` / `SIGINT` shutdown signals**: Always implement graceful shutdown to close open DB pools and drain active HTTP connections.
18
+
19
+ ## Rules & Patterns
20
+
21
+ ## Architecture
22
+
23
+ - **Layered architecture**: Routes → Controllers → Services → Repositories
24
+ - **Dependency injection** — don't import dependencies directly in services
25
+ - **Config from environment** — never hardcode secrets, use env variables
26
+ - **Graceful shutdown** — handle SIGTERM, close connections, drain requests
27
+
28
+ ## Error Handling
29
+
30
+ - **Never swallow errors** — always handle or re-throw
31
+ - **Custom error classes** — extend Error with HTTP status codes
32
+ - **Global error handler** — catch unhandled rejections and uncaught exceptions
33
+ - **Structured logging** — JSON logs with request ID, timestamp, level
34
+
35
+ ```typescript
36
+ class AppError extends Error {
37
+ constructor(
38
+ public message: string,
39
+ public statusCode: number = 500,
40
+ public code: string = 'INTERNAL_ERROR'
41
+ ) {
42
+ super(message);
43
+ this.name = 'AppError';
44
+ }
45
+ }
46
+ ```
47
+
48
+ ## API Design
49
+
50
+ - **RESTful conventions** — GET (read), POST (create), PUT (full update), PATCH (partial), DELETE
51
+ - **Consistent response format** — `{ data, error, pagination }`
52
+ - **Validation at the edge** — validate request body/params with Zod or Joi
53
+ - **Rate limiting** — protect against abuse
54
+ - **CORS** — configure explicitly, never use `*` in production
55
+
56
+ ## Security
57
+
58
+ - **Helmet.js** — security headers
59
+ - **Input validation** — never trust client input
60
+ - **SQL injection** — always use parameterized queries
61
+ - **XSS** — sanitize output, use Content-Security-Policy
62
+ - **Authentication** — JWT with short expiry + refresh tokens
63
+ - **Secrets** — environment variables, never in code
64
+
65
+ ## Database
66
+
67
+ - **Connection pooling** — don't create connections per request
68
+ - **Migrations** — version-controlled schema changes
69
+ - **Transactions** — for multi-step operations
70
+ - **Indexes** — add indexes for frequently queried columns
71
+
72
+ ## Performance
73
+
74
+ - **Async/await** — never block the event loop
75
+ - **Streaming** — for large files and data sets
76
+ - **Caching** — Redis for frequently accessed data
77
+ - **Clustering** — use PM2 or cluster module for multi-core
78
+
79
+ ## Testing
80
+
81
+ - **Unit tests** — services and utilities
82
+ - **Integration tests** — API endpoints with test database
83
+ - **Test isolation** — each test should be independent
84
+ - **Fixtures** — use factories, not shared state
85
+
86
+ ## File Structure
87
+
88
+ ```
89
+ src/
90
+ ├── config/ # Configuration
91
+ ├── modules/ # Feature modules
92
+ │ └── users/
93
+ │ ├── users.controller.ts
94
+ │ ├── users.service.ts
95
+ │ ├── users.repository.ts
96
+ │ ├── users.routes.ts
97
+ │ ├── users.types.ts
98
+ │ └── users.test.ts
99
+ ├── shared/ # Shared utilities
100
+ │ ├── middleware/
101
+ │ ├── errors/
102
+ │ └── utils/
103
+ ├── types/ # Global types
104
+ └── app.ts # App entry point
105
+ ```
106
+
107
+
108
+ ## Code Examples
109
+
110
+ See `EXAMPLES.md` for detailed code examples.
111
+
112
+ ## Validation Checklist
113
+
114
+ What to verify during the review phase before completing the task.
115
+
116
+ ## Common Mistakes
117
+
118
+ Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
119
+
120
+ ## Integration Notes
121
+
122
+ How this skill interacts with other skills.
123
+
124
+
125
+ # Node.js Examples — Anti-patterns vs ContextOS Standard
126
+
127
+ ## Example 1: Graceful Process Shutdown
128
+
129
+ ### Anti-pattern: Anti-pattern (Abruptly killing process and dropping in-flight requests)
130
+
131
+ ```javascript
132
+ // BAD: drops active database transactions and in-flight HTTP connections
133
+ process.on('SIGTERM', () => {
134
+ process.exit(0);
135
+ });
136
+ ```
137
+
138
+ ### Best practice: ContextOS Standard (Graceful connection draining)
139
+
140
+ ```typescript
141
+ // GOOD: drains active requests, closes database connections, and exits safely
142
+ import http from 'http';
143
+ import { prisma } from './db';
144
+ import { logger } from './logger';
145
+
146
+ export function setupGracefulShutdown(server: http.Server) {
147
+ const shutdown = async (signal: string) => {
148
+ logger.info(`Received ${signal}. Starting graceful shutdown...`);
149
+
150
+ server.close(async () => {
151
+ logger.info('HTTP server closed.');
152
+ try {
153
+ await prisma.$disconnect();
154
+ logger.info('Database pool closed.');
155
+ process.exit(0);
156
+ } catch (err) {
157
+ logger.error('Error during database disconnect:', err);
158
+ process.exit(1);
159
+ }
160
+ });
161
+
162
+ // Force shutdown after timeout if connections hang
163
+ setTimeout(() => {
164
+ logger.error('Forceful shutdown timeout reached.');
165
+ process.exit(1);
166
+ }, 10_000).unref();
167
+ };
168
+
169
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
170
+ process.on('SIGINT', () => shutdown('SIGINT'));
171
+ }
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Example 2: Stream-based File Processing
177
+
178
+ ### Anti-pattern: Anti-pattern (Loading entire 500MB file into buffer)
179
+
180
+ ```typescript
181
+ // BAD: easily causes Out Of Memory (OOM) crashes under concurrency
182
+ app.get('/download/:file', async (req, res) => {
183
+ const data = await fs.promises.readFile(`/uploads/${req.params.file}`);
184
+ res.send(data);
185
+ });
186
+ ```
187
+
188
+ ### Best practice: ContextOS Standard (Piping read stream with pipeline)
189
+
190
+ ```typescript
191
+ // GOOD: constant memory usage (O(1) RAM) regardless of file size
192
+ import fs from 'fs';
193
+ import { pipeline } from 'stream/promises';
194
+
195
+ app.get('/download/:file', async (req, res, next) => {
196
+ try {
197
+ const filePath = `/uploads/${req.params.file}`;
198
+ const readStream = fs.createReadStream(filePath);
199
+ await pipeline(readStream, res);
200
+ } catch (err) {
201
+ next(err);
202
+ }
203
+ });
204
+ ```
205
+
206
+ # node Troubleshooting & Common Mistakes
207
+
208
+ ## 1. Unhandled Promise Rejections Crashing the Process
209
+
210
+ - **Symptom**: Node process crashes abruptly without clear stack trace in production.
211
+ - **Root Cause**: Missing `process.on('unhandledRejection')` handler in Node.js >= 15.
212
+ - **Fix**: Always register top-level unhandledRejection and uncaughtException logging before exiting cleanly.
213
+
214
+ ## 2. Event Loop Starvation
215
+
216
+ - **Symptom**: API endpoints stop responding or latency spikes to 10+ seconds.
217
+ - **Root Cause**: Heavy synchronous operations (`JSON.parse` on a 50MB file, sync bcrypt hashing, or regex catastrophic backtracking).
218
+ - **Fix**: Offload CPU-heavy tasks to Worker Threads or use async worker queues.
219
+
220
+ ## 3. Memory Leaks in Event Emitters
221
+
222
+ - **Symptom**: "MaxListenersExceededWarning: Possible EventEmitter memory leak detected".
223
+ - **Root Cause**: Adding listeners inside request handlers without removing them on close.
224
+ - **Fix**: Remove listeners in cleanup callbacks or use `AbortController` signals.