contextos-agents 1.7.0 → 2.0.0-beta.2

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 (309) hide show
  1. package/.agents/AGENTS.md +1 -1
  2. package/.agents/adapters/aider/export.js +117 -99
  3. package/.agents/adapters/claude/export.js +68 -26
  4. package/.agents/adapters/copilot/export.js +90 -53
  5. package/.agents/adapters/cursor/export.js +80 -101
  6. package/.agents/adapters/drift-detector.js +196 -0
  7. package/.agents/adapters/gemini/export.js +76 -45
  8. package/.agents/adapters/pure-compiler.js +443 -0
  9. package/.agents/adapters/zed/export.js +104 -96
  10. package/.agents/compiled/registry.v2.json +504 -0
  11. package/.agents/compiled/registry.v2.sha256 +1 -0
  12. package/.agents/compiler/manifest-compiler.js +963 -0
  13. package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
  14. package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
  15. package/.agents/compiler/vendor/yaml.js +139 -0
  16. package/.agents/core/profiles/init.yaml +25 -0
  17. package/.agents/core/skills/context-manager/skill.yaml +3 -5
  18. package/.agents/core/skills/context-os/SKILL.md +3 -6
  19. package/.agents/core/skills/context-os/skill.yaml +3 -8
  20. package/.agents/core/skills/engineering-workflow/skill.yaml +1 -7
  21. package/.agents/core/skills/gemini-precision/skill.yaml +1 -6
  22. package/.agents/core/skills/gstack-roles/skill.yaml +3 -6
  23. package/.agents/core/skills/ponytail-mindset/skill.yaml +1 -7
  24. package/.agents/core/skills/security/skill.yaml +15 -3
  25. package/.agents/ctx.js +574 -111
  26. package/.agents/customization-dx.js +282 -0
  27. package/.agents/doctor.js +719 -64
  28. package/.agents/filesystem/index.js +71 -0
  29. package/.agents/filesystem/journaled-transaction.js +451 -0
  30. package/.agents/filesystem/lockfile-v2.js +275 -0
  31. package/.agents/filesystem/platform-hardening.js +222 -0
  32. package/.agents/filesystem/project-lock.js +218 -0
  33. package/.agents/filesystem/safe-path.js +256 -0
  34. package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
  35. package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
  36. package/.agents/plugins/contextos/plugin.json +1 -1
  37. package/.agents/plugins.js +259 -60
  38. package/.agents/profiles.js +486 -51
  39. package/.agents/resolver.js +50 -534
  40. package/.agents/schemas/attestation.review.v1.json +111 -0
  41. package/.agents/schemas/attestation.verification.v1.json +85 -0
  42. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  43. package/.agents/schemas/profile.v2.schema.json +114 -0
  44. package/.agents/schemas/runtime.thread.v1.json +192 -0
  45. package/.agents/schemas/skill.manifest.v2.json +177 -0
  46. package/.agents/schemas/verification.spec.v1.json +39 -0
  47. package/.agents/schemas/workspace.graph.schema.json +106 -0
  48. package/.agents/transaction-core/event-store.js +288 -0
  49. package/.agents/transaction-core/idempotency.js +129 -0
  50. package/.agents/transaction-core/ipc-lock.js +311 -0
  51. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  52. package/.agents/validate.js +44 -1
  53. package/.agents/watch.js +354 -102
  54. package/.agents/workspace/workspace-graph.js +778 -0
  55. package/README.md +59 -387
  56. package/benchmarks/v2/analysis/statistics.js +140 -0
  57. package/benchmarks/v2/analysis/stats.js +69 -0
  58. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  59. package/benchmarks/v2/dataset.schema.json +34 -0
  60. package/benchmarks/v2/evaluators/index.js +25 -0
  61. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  62. package/benchmarks/v2/harness/runner.js +88 -0
  63. package/benchmarks/v2/pilot-tasks.json +392 -0
  64. package/bin/commands/recover.js +88 -0
  65. package/bin/commands/update.js +80 -17
  66. package/bin/commands.js +62 -25
  67. package/bin/index.js +138 -81
  68. package/bin/lib/lockfile.js +5 -3
  69. package/bin/lib/safe-writer.js +34 -3
  70. package/package.json +85 -72
  71. package/registry.json +2 -2
  72. package/registry.v2.schema.json +86 -0
  73. package/.agents/core/profiles/backend.yaml +0 -47
  74. package/.agents/core/profiles/enterprise.yaml +0 -46
  75. package/.agents/core/profiles/frontend.yaml +0 -46
  76. package/.agents/core/profiles/hackathon.yaml +0 -45
  77. package/.agents/core/profiles/mvp.yaml +0 -44
  78. package/.agents/core/profiles/startup.yaml +0 -48
  79. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  80. package/.agents/core/skills/adapters/SKILL.md +0 -105
  81. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  82. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  83. package/.agents/core/skills/adapters/skill.yaml +0 -16
  84. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  85. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  86. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -12
  87. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  88. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  89. package/.agents/core/skills/brutalist-design/skill.yaml +0 -12
  90. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  91. package/.agents/core/skills/database/SKILL.md +0 -101
  92. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  93. package/.agents/core/skills/database/VALIDATION.json +0 -11
  94. package/.agents/core/skills/database/skill.yaml +0 -31
  95. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  96. package/.agents/core/skills/ddd/SKILL.md +0 -247
  97. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  98. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  99. package/.agents/core/skills/ddd/ddd.md +0 -178
  100. package/.agents/core/skills/ddd/skill.yaml +0 -17
  101. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  102. package/.agents/core/skills/decisions/SKILL.md +0 -90
  103. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  104. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  105. package/.agents/core/skills/decisions/skill.yaml +0 -16
  106. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  107. package/.agents/core/skills/docker/SKILL.md +0 -63
  108. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  109. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  110. package/.agents/core/skills/docker/skill.yaml +0 -29
  111. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  112. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  113. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  114. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  115. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  116. package/.agents/core/skills/fastapi/skill.yaml +0 -17
  117. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  118. package/.agents/core/skills/generators/SKILL.md +0 -112
  119. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  120. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  121. package/.agents/core/skills/generators/skill.yaml +0 -25
  122. package/.agents/core/skills/generators/templates/API.md +0 -77
  123. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  124. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  125. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  126. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  127. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  128. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  129. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  130. package/.agents/core/skills/generators/templates/UI.md +0 -73
  131. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  132. package/.agents/core/skills/graphify/SKILL.md +0 -130
  133. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  134. package/.agents/core/skills/graphify/skill.yaml +0 -18
  135. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  136. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  137. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  138. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  139. package/.agents/core/skills/impeccable-design/skill.yaml +0 -20
  140. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  141. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  142. package/.agents/core/skills/interview-me/skill.yaml +0 -12
  143. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  144. package/.agents/core/skills/microservices/SKILL.md +0 -164
  145. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  146. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  147. package/.agents/core/skills/microservices/microservices.md +0 -119
  148. package/.agents/core/skills/microservices/skill.yaml +0 -17
  149. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  150. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  151. package/.agents/core/skills/minimalist-design/skill.yaml +0 -12
  152. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  153. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  154. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  155. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  156. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  157. package/.agents/core/skills/nestjs/skill.yaml +0 -17
  158. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  159. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  160. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  161. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  162. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  163. package/.agents/core/skills/nextjs/skill.yaml +0 -17
  164. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  165. package/.agents/core/skills/node/SKILL.md +0 -128
  166. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  167. package/.agents/core/skills/node/VALIDATION.json +0 -12
  168. package/.agents/core/skills/node/node.md +0 -87
  169. package/.agents/core/skills/node/skill.yaml +0 -17
  170. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  171. package/.agents/core/skills/performance/SKILL.md +0 -75
  172. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  173. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  174. package/.agents/core/skills/performance/performance.md +0 -52
  175. package/.agents/core/skills/performance/skill.yaml +0 -17
  176. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  177. package/.agents/core/skills/react/SKILL.md +0 -132
  178. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  179. package/.agents/core/skills/react/VALIDATION.json +0 -12
  180. package/.agents/core/skills/react/react.md +0 -93
  181. package/.agents/core/skills/react/skill.yaml +0 -17
  182. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  183. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  184. package/.agents/core/skills/react-best-practices/skill.yaml +0 -14
  185. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  186. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  187. package/.agents/core/skills/redesign-audit/skill.yaml +0 -12
  188. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  189. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  190. package/.agents/core/skills/soft-design/skill.yaml +0 -12
  191. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  192. package/.agents/core/skills/state-management/SKILL.md +0 -48
  193. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  194. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  195. package/.agents/core/skills/state-management/skill.yaml +0 -28
  196. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -117
  197. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  198. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -12
  199. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  200. package/.agents/core/skills/system-design/SKILL.md +0 -419
  201. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  202. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  203. package/.agents/core/skills/system-design/skill.yaml +0 -20
  204. package/.agents/core/skills/system-design/system-design.md +0 -112
  205. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  206. package/.agents/core/skills/testing/SKILL.md +0 -70
  207. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  208. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  209. package/.agents/core/skills/testing/skill.yaml +0 -32
  210. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  211. package/.agents/core/skills/typescript/SKILL.md +0 -112
  212. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  213. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  214. package/.agents/core/skills/typescript/skill.yaml +0 -17
  215. package/.agents/core/skills/typescript/typescript.md +0 -71
  216. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  217. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  218. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  219. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  220. package/.agents/core/skills/ui-design/skill.yaml +0 -17
  221. package/.agents/core/skills/ui-design/ui.md +0 -88
  222. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  223. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  224. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  225. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  226. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -19
  227. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  228. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  229. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  230. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  231. package/.agents/core/skills/ux-design/skill.yaml +0 -17
  232. package/.agents/core/skills/ux-design/ux.md +0 -80
  233. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  234. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  235. package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +0 -131
  236. package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +0 -142
  237. package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +0 -143
  238. package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +0 -174
  239. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -18
  240. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  241. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  242. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  243. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  244. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  245. package/.agents/core/skills/web-accessibility/skill.yaml +0 -17
  246. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  247. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  248. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  249. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  250. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  251. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  252. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  253. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  254. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  255. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  256. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  257. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  258. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  259. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  260. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  261. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  262. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  263. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  264. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  265. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  266. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  267. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  268. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  269. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -110
  270. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  271. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  272. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  273. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  274. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  275. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  276. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  277. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  278. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  279. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  280. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  281. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  282. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  283. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  284. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  285. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  286. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  287. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  288. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  289. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  290. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  291. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  292. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  293. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  294. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  295. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  296. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  297. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  298. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  299. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  300. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  301. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -116
  302. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  303. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  304. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  305. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  306. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  307. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  308. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  309. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
@@ -1,204 +0,0 @@
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.
@@ -1,298 +0,0 @@
1
- ---
2
- name: Next.js
3
- description: >
4
- ContextOS skill for Next.js
5
- ---
6
- # Next.js App Router Best Practices
7
-
8
- ## Overview
9
-
10
- 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.
11
-
12
- ## When to Use
13
-
14
- Activate whenever building, refactoring, or reviewing Next.js pages, layouts, Route Handlers (`app/api`), Server Actions, or components in the `app/` directory.
15
-
16
- ## Negative Constraints (What NOT to Do)
17
-
18
- 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.
19
- 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.
20
- 3. **NEVER introduce sequential `await` waterfalls for independent data**: Always use `Promise.all()` or parallel streaming `<Suspense>` boundaries.
21
- 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`).
22
- 5. **NEVER use `useEffect` for data fetching**: Fetch directly in Server Components or use TanStack Query / SWR for client-side queries.
23
- 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.
24
-
25
- ## Rules & Patterns
26
-
27
- ### 1. Eliminating Async Waterfalls (Critical)
28
-
29
- - **Parallel Fetching**: Fetch independent data concurrently at the top of the route or component.
30
- - **Granular Streaming**: Wrap slow, non-critical subtrees in `<Suspense fallback={<Skeleton />}>` so critical above-the-fold content streams immediately.
31
- - **Defer Awaits**: Check cheap synchronous conditions before awaiting remote resources.
32
-
33
- ### 2. Request Deduplication & Caching (`server-cache-react`)
34
-
35
- - Use `React.cache()` to deduplicate identical database or service calls across multiple components rendered in the same server request lifecycle.
36
-
37
- ```tsx
38
- import { cache } from 'react';
39
- import { db } from '@/lib/db';
40
-
41
- export const getCurrentUser = cache(async (userId: string) => {
42
- return await db.user.findUnique({
43
- where: { id: userId },
44
- select: { id: true, name: true, role: true, email: true }
45
- });
46
- });
47
- ```
48
-
49
- ### 3. Secure Server Actions (`server-auth-actions`)
50
-
51
- - Treat every Server Action as a public HTTP endpoint. Always validate session, authorization, and input schema with Zod.
52
-
53
- ```tsx
54
- 'use server';
55
-
56
- import { z } from 'zod';
57
- import { auth } from '@/lib/auth';
58
- import { db } from '@/lib/db';
59
- import { revalidatePath } from 'next/cache';
60
-
61
- const UpdateProfileSchema = z.object({
62
- name: z.string().min(2).max(50),
63
- });
64
-
65
- export async function updateProfile(formData: FormData) {
66
- const session = await auth();
67
- if (!session?.userId) throw new Error('Unauthorized');
68
-
69
- const result = UpdateProfileSchema.safeParse({ name: formData.get('name') });
70
- if (!result.success) return { error: 'Invalid input', issues: result.error.flatten() };
71
-
72
- await db.user.update({
73
- where: { id: session.userId },
74
- data: { name: result.data.name },
75
- });
76
-
77
- revalidatePath('/settings');
78
- return { success: true };
79
- }
80
- ```
81
-
82
- ### 4. Bundle Optimization & Dynamic Imports (`bundle-dynamic-imports`)
83
-
84
- - Heavy interactive client components (charts, rich-text editors, video players) must be dynamically loaded with `next/dynamic`.
85
-
86
- ```tsx
87
- import dynamic from 'next/dynamic';
88
-
89
- const AnalyticsChart = dynamic(
90
- () => import('@/components/analytics/chart').then(mod => mod.AnalyticsChart),
91
- {
92
- loading: () => <div className="h-64 animate-pulse bg-muted rounded-lg" />,
93
- ssr: false,
94
- }
95
- );
96
- ```
97
-
98
- ### 5. Next.js 15+ Async Request APIs (`async-params`)
99
-
100
- In Next.js 15+, `params`, `searchParams`, `cookies()`, and `headers()` are asynchronous and must be awaited:
101
-
102
- ```tsx
103
- // [GOOD] Next.js 15+ Page Component
104
- interface PageProps {
105
- params: Promise<{ id: string }>;
106
- searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
107
- }
108
-
109
- export default async function UserPage({ params, searchParams }: PageProps) {
110
- const { id } = await params;
111
- const { tab } = await searchParams;
112
- const user = await getUser(id);
113
-
114
- return <UserProfile user={user} activeTab={tab as string} />;
115
- }
116
- ```
117
-
118
- ### 6. Non-Blocking Background Tasks with `after()`
119
-
120
- To execute logging, analytics, or cache priming without delaying the user's HTTP response:
121
-
122
- ```typescript
123
- import { after } from 'next/server';
124
-
125
- export async function POST(request: Request) {
126
- const data = await request.json();
127
- const result = await processOrder(data);
128
-
129
- // Executes asynchronously AFTER the response stream has completed
130
- after(async () => {
131
- await sendSlackNotification(result);
132
- await indexOrderInSearch(result.id);
133
- });
134
-
135
- return Response.json({ success: true, orderId: result.id });
136
- }
137
- ```
138
-
139
- ---
140
-
141
- ## Code Examples
142
-
143
- See `EXAMPLES.md` for detailed code examples and component templates.
144
-
145
- ## Validation Checklist
146
-
147
- - [ ] All database queries in RSC layers use `React.cache()` if called across multiple components.
148
- - [ ] No barrel imports (`from '@/components'`); all imports point to exact component modules.
149
- - [ ] Server Actions have explicit auth checks and Zod input validation.
150
- - [ ] Heavy client widgets (charts, editors) use `next/dynamic`.
151
- - [ ] Images use `next/image` with explicit `sizes` and `priority` on LCP elements.
152
-
153
- ## Common Mistakes
154
-
155
- - Using `'use client'` at page level instead of leaf components.
156
- - Relying on client-side authentication checks for Server Actions without server-side validation.
157
- - Chaining sequential awaits for independent data models.
158
-
159
- ## Integration Notes
160
-
161
- - Pairs with `react` and `ui-ux-pro` for component design and state management.
162
- - Pairs with `security` for session authorization and input sanitization.
163
-
164
-
165
- <!-- Source: nextjs.md -->
166
-
167
- # Next.js — Best Practices (App Router)
168
-
169
- ## Routing
170
-
171
- - Use **App Router** (`app/` directory) — not Pages Router
172
- - **Layouts** — shared UI in `layout.tsx`, nested layouts for sections
173
- - **Loading states** — `loading.tsx` for Suspense boundaries
174
- - **Error handling** — `error.tsx` for error boundaries per route
175
- - **Not found** — `not-found.tsx` for 404 pages
176
-
177
- ## Server vs Client Components
178
-
179
- - **Default to Server Components** — they're server by default
180
- - **Use `'use client'`** only when you need: event handlers, useState, useEffect, browser APIs
181
- - **Push client boundaries down** — keep as much as possible on the server
182
- - **Don't pass functions** from Server to Client components
183
-
184
- ## Data Fetching
185
-
186
- - **Server Components** — fetch directly, no useEffect
187
- - **Server Actions** — for mutations (`'use server'`)
188
- - **Route Handlers** — `app/api/` for REST endpoints
189
- - **Parallel fetching** — use Promise.all for independent requests
190
- - **Caching** — leverage Next.js cache, revalidate strategically
191
-
192
- ```tsx
193
- // Server Component — direct fetch
194
- async function UserProfile({ id }: { id: string }) {
195
- const user = await getUser(id); // No useEffect needed
196
- return <div>{user.name}</div>;
197
- }
198
- ```
199
-
200
- ## File Structure
201
-
202
- ```
203
- app/
204
- ├── layout.tsx # Root layout
205
- ├── page.tsx # Home page
206
- ├── globals.css
207
- ├── (auth)/ # Route group (no URL impact)
208
- │ ├── login/page.tsx
209
- │ └── register/page.tsx
210
- ├── dashboard/
211
- │ ├── layout.tsx # Dashboard layout
212
- │ ├── page.tsx # Dashboard home
213
- │ └── settings/page.tsx
214
- ├── api/
215
- │ └── users/route.ts # API route
216
- └── components/ # Shared components
217
- ```
218
-
219
- ## Performance
220
-
221
- - **Image optimization** — always use `next/image`
222
- - **Font optimization** — use `next/font`
223
- - **Metadata** — export metadata object from pages
224
- - **Static generation** — prefer SSG over SSR when possible
225
- - **Edge runtime** — for latency-sensitive routes
226
-
227
- ## Anti-Patterns
228
-
229
- - [FAIL] Using `useEffect` for data fetching in Server Components
230
- - [FAIL] Making everything a Client Component
231
- - [FAIL] Not using `loading.tsx` and `error.tsx`
232
- - [FAIL] Importing server-only code in Client Components
233
- - [FAIL] Not leveraging caching and revalidation
234
-
235
- <!-- Source: EXAMPLES.md -->
236
-
237
- # nextjs Examples — Anti-patterns vs ContextOS Standard
238
-
239
- ## Example 1: Server Components vs Client Components
240
-
241
- ### Anti-pattern: Marking the Entire Page as Client Component
242
-
243
- ```tsx
244
- // BAD: app/dashboard/page.tsx with 'use client' at top
245
- // Bloats client bundle, loses SEO benefits, eliminates direct DB access
246
- 'use client';
247
-
248
- export default function DashboardPage() {
249
- const [data, setData] = useState(null);
250
- useEffect(() => { fetch('/api/dashboard').then(...) }, []);
251
- return <div>...</div>;
252
- }
253
- ```
254
-
255
- ### Best practice: ContextOS Standard (RSC by Default, Client Leaf Nodes)
256
-
257
- ```tsx
258
- // GOOD: Server Component fetches data directly with zero bundle cost
259
- // app/dashboard/page.tsx (Server Component)
260
- import { Suspense } from 'react';
261
- import { db } from '@/lib/db';
262
- import { InteractiveChart } from './InteractiveChart'; // 'use client' leaf component
263
-
264
- export default async function DashboardPage() {
265
- const stats = await db.analytics.getStats();
266
- return (
267
- <main>
268
- <h1>Dashboard</h1>
269
- <p>Total Revenue: {stats.revenue}</p>
270
- <Suspense fallback={<ChartSkeleton />}>
271
- <InteractiveChart initialData={stats.chartData} />
272
- </Suspense>
273
- </main>
274
- );
275
- }
276
- ```
277
-
278
- <!-- Source: TROUBLESHOOTING.md -->
279
-
280
- # nextjs Troubleshooting & Common Mistakes
281
-
282
- ## 1. Hydration Mismatch Errors
283
-
284
- - **Symptom**: "Text content does not match server-rendered HTML".
285
- - **Root Cause**: Rendering dates, window dimensions, or local storage data that differs between server render and client hydration.
286
- - **Fix**: Use suppressHydrationWarning on localized timestamps or load client-only state inside a useEffect after mount.
287
-
288
- ## 2. Accidental Server Code Bundled to Client
289
-
290
- - **Symptom**: "Module not found: Can't resolve 'fs' or 'pg' in client bundle".
291
- - **Root Cause**: Client component importing a utility that transitively imports server-only database code.
292
- - **Fix**: Separate server utilities into *.server.ts and install import 'server-only'; at the top of server files.
293
-
294
- ## 3. Waterfall Fetches in Server Components
295
-
296
- - **Symptom**: Page takes 3 seconds to load due to sequential await statements.
297
- - **Root Cause**: Awaiting independent data sources one after another.
298
- - **Fix**: Use Promise.all([fetchUsers(), fetchProducts()]) or separate into nested <Suspense> boundaries.