contextos-agents 1.7.0 → 2.0.0-beta.3

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 (313) hide show
  1. package/.agents/AGENTS.md +16 -50
  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 +100 -104
  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 +537 -112
  26. package/.agents/customization-dx.js +282 -0
  27. package/.agents/doctor.js +855 -66
  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 +278 -64
  38. package/.agents/profiles.js +486 -51
  39. package/.agents/resolver/canonical-resolver.js +1348 -0
  40. package/.agents/resolver.js +50 -534
  41. package/.agents/rules/rule-catalog.js +525 -0
  42. package/.agents/schemas/attestation.review.v1.json +111 -0
  43. package/.agents/schemas/attestation.verification.v1.json +85 -0
  44. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  45. package/.agents/schemas/profile.v2.schema.json +114 -0
  46. package/.agents/schemas/runtime.thread.v1.json +192 -0
  47. package/.agents/schemas/skill.manifest.v2.json +177 -0
  48. package/.agents/schemas/verification.spec.v1.json +39 -0
  49. package/.agents/schemas/workspace.graph.schema.json +106 -0
  50. package/.agents/skills-index.json +6 -166
  51. package/.agents/stats.js +9 -9
  52. package/.agents/transaction-core/event-store.js +288 -0
  53. package/.agents/transaction-core/idempotency.js +129 -0
  54. package/.agents/transaction-core/ipc-lock.js +311 -0
  55. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  56. package/.agents/validate.js +44 -1
  57. package/.agents/watch.js +354 -102
  58. package/.agents/workspace/workspace-graph.js +778 -0
  59. package/README.md +59 -387
  60. package/benchmarks/v2/analysis/statistics.js +140 -0
  61. package/benchmarks/v2/analysis/stats.js +69 -0
  62. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  63. package/benchmarks/v2/dataset.schema.json +34 -0
  64. package/benchmarks/v2/evaluators/index.js +25 -0
  65. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  66. package/benchmarks/v2/harness/runner.js +88 -0
  67. package/benchmarks/v2/pilot-tasks.json +392 -0
  68. package/bin/commands/recover.js +88 -0
  69. package/bin/commands/update.js +80 -17
  70. package/bin/commands.js +62 -25
  71. package/bin/index.js +138 -81
  72. package/bin/lib/lockfile.js +5 -3
  73. package/bin/lib/safe-writer.js +34 -3
  74. package/package.json +87 -72
  75. package/registry.json +2 -2
  76. package/registry.v2.schema.json +86 -0
  77. package/.agents/core/profiles/backend.yaml +0 -47
  78. package/.agents/core/profiles/enterprise.yaml +0 -46
  79. package/.agents/core/profiles/frontend.yaml +0 -46
  80. package/.agents/core/profiles/hackathon.yaml +0 -45
  81. package/.agents/core/profiles/mvp.yaml +0 -44
  82. package/.agents/core/profiles/startup.yaml +0 -48
  83. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  84. package/.agents/core/skills/adapters/SKILL.md +0 -105
  85. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  86. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  87. package/.agents/core/skills/adapters/skill.yaml +0 -16
  88. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  89. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  90. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -12
  91. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  92. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  93. package/.agents/core/skills/brutalist-design/skill.yaml +0 -12
  94. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  95. package/.agents/core/skills/database/SKILL.md +0 -101
  96. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  97. package/.agents/core/skills/database/VALIDATION.json +0 -11
  98. package/.agents/core/skills/database/skill.yaml +0 -31
  99. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  100. package/.agents/core/skills/ddd/SKILL.md +0 -247
  101. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  102. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  103. package/.agents/core/skills/ddd/ddd.md +0 -178
  104. package/.agents/core/skills/ddd/skill.yaml +0 -17
  105. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  106. package/.agents/core/skills/decisions/SKILL.md +0 -90
  107. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  108. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  109. package/.agents/core/skills/decisions/skill.yaml +0 -16
  110. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  111. package/.agents/core/skills/docker/SKILL.md +0 -63
  112. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  113. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  114. package/.agents/core/skills/docker/skill.yaml +0 -29
  115. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  116. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  117. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  118. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  119. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  120. package/.agents/core/skills/fastapi/skill.yaml +0 -17
  121. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  122. package/.agents/core/skills/generators/SKILL.md +0 -112
  123. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  124. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  125. package/.agents/core/skills/generators/skill.yaml +0 -25
  126. package/.agents/core/skills/generators/templates/API.md +0 -77
  127. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  128. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  129. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  130. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  131. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  132. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  133. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  134. package/.agents/core/skills/generators/templates/UI.md +0 -73
  135. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  136. package/.agents/core/skills/graphify/SKILL.md +0 -130
  137. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  138. package/.agents/core/skills/graphify/skill.yaml +0 -18
  139. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  140. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  141. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  142. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  143. package/.agents/core/skills/impeccable-design/skill.yaml +0 -20
  144. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  145. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  146. package/.agents/core/skills/interview-me/skill.yaml +0 -12
  147. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  148. package/.agents/core/skills/microservices/SKILL.md +0 -164
  149. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  150. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  151. package/.agents/core/skills/microservices/microservices.md +0 -119
  152. package/.agents/core/skills/microservices/skill.yaml +0 -17
  153. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  154. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  155. package/.agents/core/skills/minimalist-design/skill.yaml +0 -12
  156. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  157. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  158. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  159. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  160. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  161. package/.agents/core/skills/nestjs/skill.yaml +0 -17
  162. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  163. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  164. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  165. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  166. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  167. package/.agents/core/skills/nextjs/skill.yaml +0 -17
  168. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  169. package/.agents/core/skills/node/SKILL.md +0 -128
  170. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  171. package/.agents/core/skills/node/VALIDATION.json +0 -12
  172. package/.agents/core/skills/node/node.md +0 -87
  173. package/.agents/core/skills/node/skill.yaml +0 -17
  174. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  175. package/.agents/core/skills/performance/SKILL.md +0 -75
  176. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  177. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  178. package/.agents/core/skills/performance/performance.md +0 -52
  179. package/.agents/core/skills/performance/skill.yaml +0 -17
  180. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  181. package/.agents/core/skills/react/SKILL.md +0 -132
  182. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  183. package/.agents/core/skills/react/VALIDATION.json +0 -12
  184. package/.agents/core/skills/react/react.md +0 -93
  185. package/.agents/core/skills/react/skill.yaml +0 -17
  186. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  187. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  188. package/.agents/core/skills/react-best-practices/skill.yaml +0 -14
  189. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  190. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  191. package/.agents/core/skills/redesign-audit/skill.yaml +0 -12
  192. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  193. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  194. package/.agents/core/skills/soft-design/skill.yaml +0 -12
  195. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  196. package/.agents/core/skills/state-management/SKILL.md +0 -48
  197. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  198. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  199. package/.agents/core/skills/state-management/skill.yaml +0 -28
  200. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -117
  201. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  202. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -12
  203. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  204. package/.agents/core/skills/system-design/SKILL.md +0 -419
  205. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  206. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  207. package/.agents/core/skills/system-design/skill.yaml +0 -20
  208. package/.agents/core/skills/system-design/system-design.md +0 -112
  209. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  210. package/.agents/core/skills/testing/SKILL.md +0 -70
  211. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  212. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  213. package/.agents/core/skills/testing/skill.yaml +0 -32
  214. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  215. package/.agents/core/skills/typescript/SKILL.md +0 -112
  216. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  217. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  218. package/.agents/core/skills/typescript/skill.yaml +0 -17
  219. package/.agents/core/skills/typescript/typescript.md +0 -71
  220. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  221. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  222. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  223. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  224. package/.agents/core/skills/ui-design/skill.yaml +0 -17
  225. package/.agents/core/skills/ui-design/ui.md +0 -88
  226. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  227. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  228. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  229. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  230. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -19
  231. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  232. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  233. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  234. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  235. package/.agents/core/skills/ux-design/skill.yaml +0 -17
  236. package/.agents/core/skills/ux-design/ux.md +0 -80
  237. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  238. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  239. package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +0 -131
  240. package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +0 -142
  241. package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +0 -143
  242. package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +0 -174
  243. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -18
  244. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  245. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  246. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  247. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  248. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  249. package/.agents/core/skills/web-accessibility/skill.yaml +0 -17
  250. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  251. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  252. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  253. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  254. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  255. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  256. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  257. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  258. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  259. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  260. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  261. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  262. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  263. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  264. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  265. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  266. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  267. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  268. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  269. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  270. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  271. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  272. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  273. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -110
  274. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  275. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  276. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  277. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  278. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  279. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  280. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  281. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  282. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  283. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  284. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  285. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  286. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  287. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  288. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  289. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  290. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  291. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  292. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  293. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  294. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  295. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  296. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  297. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  298. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  299. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  300. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  301. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  302. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  303. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  304. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  305. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -116
  306. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  307. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  308. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  309. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  310. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  311. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  312. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  313. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
@@ -1,323 +0,0 @@
1
- ---
2
- name: Node.js
3
- description: >
4
- ContextOS skill for Node.js
5
- ---
6
- # Node.js
7
-
8
- ## Overview
9
-
10
- 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.
11
-
12
- ## When to Use
13
-
14
- Activate when developing Node.js HTTP servers, Express/Fastify APIs, background workers, CLI tools, or stream-based data pipelines.
15
-
16
- ## Negative Constraints (What NOT to Do)
17
-
18
- 1. **NEVER execute synchronous filesystem/crypto calls in request handlers (`fs.readFileSync`)**: Always use async promises (`fs.promises.*`) to avoid blocking the event loop.
19
- 2. **NEVER leave uncaught promise rejections**: Every async route must use `express-async-errors` or wrap operations in try/catch calling `next(err)`.
20
- 3. **NEVER buffer large files/payloads entirely in memory (`fs.readFile`)**: Always use Streams or Pipelines (`stream.pipeline`) for processing large files.
21
- 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.
22
- 5. **NEVER ignore `SIGTERM` / `SIGINT` shutdown signals**: Always implement graceful shutdown to close open DB pools and drain active HTTP connections.
23
-
24
- ## Rules & Patterns
25
-
26
- ## Architecture
27
-
28
- - **Layered architecture**: Routes → Controllers → Services → Repositories
29
- - **Dependency injection** — don't import dependencies directly in services
30
- - **Config from environment** — never hardcode secrets, use env variables
31
- - **Graceful shutdown** — handle SIGTERM, close connections, drain requests
32
-
33
- ## Error Handling
34
-
35
- - **Never swallow errors** — always handle or re-throw
36
- - **Custom error classes** — extend Error with HTTP status codes
37
- - **Global error handler** — catch unhandled rejections and uncaught exceptions
38
- - **Structured logging** — JSON logs with request ID, timestamp, level
39
-
40
- ```typescript
41
- class AppError extends Error {
42
- constructor(
43
- public message: string,
44
- public statusCode: number = 500,
45
- public code: string = 'INTERNAL_ERROR'
46
- ) {
47
- super(message);
48
- this.name = 'AppError';
49
- }
50
- }
51
- ```
52
-
53
- ## API Design
54
-
55
- - **RESTful conventions** — GET (read), POST (create), PUT (full update), PATCH (partial), DELETE
56
- - **Consistent response format** — `{ data, error, pagination }`
57
- - **Validation at the edge** — validate request body/params with Zod or Joi
58
- - **Rate limiting** — protect against abuse
59
- - **CORS** — configure explicitly, never use `*` in production
60
-
61
- ## Security
62
-
63
- - **Helmet.js** — security headers
64
- - **Input validation** — never trust client input
65
- - **SQL injection** — always use parameterized queries
66
- - **XSS** — sanitize output, use Content-Security-Policy
67
- - **Authentication** — JWT with short expiry + refresh tokens
68
- - **Secrets** — environment variables, never in code
69
-
70
- ## Database
71
-
72
- - **Connection pooling** — don't create connections per request
73
- - **Migrations** — version-controlled schema changes
74
- - **Transactions** — for multi-step operations
75
- - **Indexes** — add indexes for frequently queried columns
76
-
77
- ## Performance
78
-
79
- - **Async/await** — never block the event loop
80
- - **Streaming** — for large files and data sets
81
- - **Caching** — Redis for frequently accessed data
82
- - **Clustering** — use PM2 or cluster module for multi-core
83
-
84
- ## Testing
85
-
86
- - **Unit tests** — services and utilities
87
- - **Integration tests** — API endpoints with test database
88
- - **Test isolation** — each test should be independent
89
- - **Fixtures** — use factories, not shared state
90
-
91
- ## File Structure
92
-
93
- ```
94
- src/
95
- ├── config/ # Configuration
96
- ├── modules/ # Feature modules
97
- │ └── users/
98
- │ ├── users.controller.ts
99
- │ ├── users.service.ts
100
- │ ├── users.repository.ts
101
- │ ├── users.routes.ts
102
- │ ├── users.types.ts
103
- │ └── users.test.ts
104
- ├── shared/ # Shared utilities
105
- │ ├── middleware/
106
- │ ├── errors/
107
- │ └── utils/
108
- ├── types/ # Global types
109
- └── app.ts # App entry point
110
- ```
111
-
112
-
113
- ## Code Examples
114
-
115
- See `EXAMPLES.md` for detailed code examples.
116
-
117
- ## Validation Checklist
118
-
119
- What to verify during the review phase before completing the task.
120
-
121
- ## Common Mistakes
122
-
123
- Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
124
-
125
- ## Integration Notes
126
-
127
- How this skill interacts with other skills.
128
-
129
-
130
- <!-- Source: node.md -->
131
-
132
- # Node.js — Best Practices
133
-
134
- ## Architecture
135
-
136
- - **Layered architecture**: Routes → Controllers → Services → Repositories
137
- - **Dependency injection** — don't import dependencies directly in services
138
- - **Config from environment** — never hardcode secrets, use env variables
139
- - **Graceful shutdown** — handle SIGTERM, close connections, drain requests
140
-
141
- ## Error Handling
142
-
143
- - **Never swallow errors** — always handle or re-throw
144
- - **Custom error classes** — extend Error with HTTP status codes
145
- - **Global error handler** — catch unhandled rejections and uncaught exceptions
146
- - **Structured logging** — JSON logs with request ID, timestamp, level
147
-
148
- ```typescript
149
- class AppError extends Error {
150
- constructor(
151
- public message: string,
152
- public statusCode: number = 500,
153
- public code: string = 'INTERNAL_ERROR'
154
- ) {
155
- super(message);
156
- this.name = 'AppError';
157
- }
158
- }
159
- ```
160
-
161
- ## API Design
162
-
163
- - **RESTful conventions** — GET (read), POST (create), PUT (full update), PATCH (partial), DELETE
164
- - **Consistent response format** — `{ data, error, pagination }`
165
- - **Validation at the edge** — validate request body/params with Zod or Joi
166
- - **Rate limiting** — protect against abuse
167
- - **CORS** — configure explicitly, never use `*` in production
168
-
169
- ## Security
170
-
171
- - **Helmet.js** — security headers
172
- - **Input validation** — never trust client input
173
- - **SQL injection** — always use parameterized queries
174
- - **XSS** — sanitize output, use Content-Security-Policy
175
- - **Authentication** — JWT with short expiry + refresh tokens
176
- - **Secrets** — environment variables, never in code
177
-
178
- ## Database
179
-
180
- - **Connection pooling** — don't create connections per request
181
- - **Migrations** — version-controlled schema changes
182
- - **Transactions** — for multi-step operations
183
- - **Indexes** — add indexes for frequently queried columns
184
-
185
- ## Performance
186
-
187
- - **Async/await** — never block the event loop
188
- - **Streaming** — for large files and data sets
189
- - **Caching** — Redis for frequently accessed data
190
- - **Clustering** — use PM2 or cluster module for multi-core
191
-
192
- ## Testing
193
-
194
- - **Unit tests** — services and utilities
195
- - **Integration tests** — API endpoints with test database
196
- - **Test isolation** — each test should be independent
197
- - **Fixtures** — use factories, not shared state
198
-
199
- ## File Structure
200
-
201
- ```
202
- src/
203
- ├── config/ # Configuration
204
- ├── modules/ # Feature modules
205
- │ └── users/
206
- │ ├── users.controller.ts
207
- │ ├── users.service.ts
208
- │ ├── users.repository.ts
209
- │ ├── users.routes.ts
210
- │ ├── users.types.ts
211
- │ └── users.test.ts
212
- ├── shared/ # Shared utilities
213
- │ ├── middleware/
214
- │ ├── errors/
215
- │ └── utils/
216
- ├── types/ # Global types
217
- └── app.ts # App entry point
218
- ```
219
-
220
- <!-- Source: EXAMPLES.md -->
221
-
222
- # Node.js Examples — Anti-patterns vs ContextOS Standard
223
-
224
- ## Example 1: Graceful Process Shutdown
225
-
226
- ### Anti-pattern: Anti-pattern (Abruptly killing process and dropping in-flight requests)
227
-
228
- ```javascript
229
- // BAD: drops active database transactions and in-flight HTTP connections
230
- process.on('SIGTERM', () => {
231
- process.exit(0);
232
- });
233
- ```
234
-
235
- ### Best practice: ContextOS Standard (Graceful connection draining)
236
-
237
- ```typescript
238
- // GOOD: drains active requests, closes database connections, and exits safely
239
- import http from 'http';
240
- import { prisma } from './db';
241
- import { logger } from './logger';
242
-
243
- export function setupGracefulShutdown(server: http.Server) {
244
- const shutdown = async (signal: string) => {
245
- logger.info(`Received ${signal}. Starting graceful shutdown...`);
246
-
247
- server.close(async () => {
248
- logger.info('HTTP server closed.');
249
- try {
250
- await prisma.$disconnect();
251
- logger.info('Database pool closed.');
252
- process.exit(0);
253
- } catch (err) {
254
- logger.error('Error during database disconnect:', err);
255
- process.exit(1);
256
- }
257
- });
258
-
259
- // Force shutdown after timeout if connections hang
260
- setTimeout(() => {
261
- logger.error('Forceful shutdown timeout reached.');
262
- process.exit(1);
263
- }, 10_000).unref();
264
- };
265
-
266
- process.on('SIGTERM', () => shutdown('SIGTERM'));
267
- process.on('SIGINT', () => shutdown('SIGINT'));
268
- }
269
- ```
270
-
271
- ---
272
-
273
- ## Example 2: Stream-based File Processing
274
-
275
- ### Anti-pattern: Anti-pattern (Loading entire 500MB file into buffer)
276
-
277
- ```typescript
278
- // BAD: easily causes Out Of Memory (OOM) crashes under concurrency
279
- app.get('/download/:file', async (req, res) => {
280
- const data = await fs.promises.readFile(`/uploads/${req.params.file}`);
281
- res.send(data);
282
- });
283
- ```
284
-
285
- ### Best practice: ContextOS Standard (Piping read stream with pipeline)
286
-
287
- ```typescript
288
- // GOOD: constant memory usage (O(1) RAM) regardless of file size
289
- import fs from 'fs';
290
- import { pipeline } from 'stream/promises';
291
-
292
- app.get('/download/:file', async (req, res, next) => {
293
- try {
294
- const filePath = `/uploads/${req.params.file}`;
295
- const readStream = fs.createReadStream(filePath);
296
- await pipeline(readStream, res);
297
- } catch (err) {
298
- next(err);
299
- }
300
- });
301
- ```
302
-
303
- <!-- Source: TROUBLESHOOTING.md -->
304
-
305
- # node Troubleshooting & Common Mistakes
306
-
307
- ## 1. Unhandled Promise Rejections Crashing the Process
308
-
309
- - **Symptom**: Node process crashes abruptly without clear stack trace in production.
310
- - **Root Cause**: Missing `process.on('unhandledRejection')` handler in Node.js >= 15.
311
- - **Fix**: Always register top-level unhandledRejection and uncaughtException logging before exiting cleanly.
312
-
313
- ## 2. Event Loop Starvation
314
-
315
- - **Symptom**: API endpoints stop responding or latency spikes to 10+ seconds.
316
- - **Root Cause**: Heavy synchronous operations (`JSON.parse` on a 50MB file, sync bcrypt hashing, or regex catastrophic backtracking).
317
- - **Fix**: Offload CPU-heavy tasks to Worker Threads or use async worker queues.
318
-
319
- ## 3. Memory Leaks in Event Emitters
320
-
321
- - **Symptom**: "MaxListenersExceededWarning: Possible EventEmitter memory leak detected".
322
- - **Root Cause**: Adding listeners inside request handlers without removing them on close.
323
- - **Fix**: Remove listeners in cleanup callbacks or use `AbortController` signals.
@@ -1,185 +0,0 @@
1
- ---
2
- name: Web Performance
3
- description: >
4
- ContextOS skill for Web Performance
5
- ---
6
- # Web Performance & Core Web Vitals
7
-
8
- ## Overview
9
-
10
- Enforces high-efficiency frontend and full-stack performance standards to achieve exceptional Core Web Vitals: Largest Contentful Paint (LCP < 2.5s), Interaction to Next Paint (INP < 200ms), and Cumulative Layout Shift (CLS < 0.1).
11
-
12
- ## When to Use
13
-
14
- Activate whenever analyzing, profiling, writing, or optimizing page loading speeds, network waterfalls, script bundling, animation frame rates, or data caching.
15
-
16
- ## Negative Constraints (What NOT to Do)
17
-
18
- 1. **NEVER introduce async waterfalls**: Do not chain sequential `await` calls when requests can be executed concurrently via `Promise.all()`.
19
- 2. **NEVER import large full libraries when only a utility is needed**: Never `import _ from 'lodash'`; use `import debounce from 'lodash/debounce'` or native alternatives.
20
- 3. **NEVER render images or videos without explicit aspect ratios**: Always provide `width` and `height` or `aspect-ratio` to avoid Cumulative Layout Shift (CLS).
21
- 4. **NEVER trigger synchronous layout thrashing**: Do not alternate between reading layout properties (`offsetHeight`, `getBoundingClientRect`) and writing styles in loops.
22
- 5. **NEVER animate non-composited properties**: Animate only GPU-composited CSS properties (`transform`, `opacity`). Never animate `width`, `height`, `top`, `left`, or `margin`.
23
-
24
- ## Rules & Patterns
25
-
26
- ### 1. Vercel Optimization Hierarchy by Impact
27
-
28
- | Priority | Category | Key Optimization Target | Expected Impact |
29
- |:---|:---|:---|:---|
30
- | **1. CRITICAL** | **Eliminating Waterfalls** | Parallel data fetching (`Promise.all`), Suspense streaming | **30–60% faster LCP** |
31
- | **2. CRITICAL** | **Bundle Size Optimization** | Direct submodule imports, `next/dynamic`, deferring 3rd party scripts | **40–70% smaller initial JS** |
32
- | **3. HIGH** | **Server-Side & RSC Caching** | `React.cache()` request deduplication, edge SSR caching | **Lower TTFB & DB load** |
33
- | **4. MEDIUM-HIGH** | **Client Query Optimization** | SWR / TanStack Query stale-while-revalidate, deduplication | **Zero redundant network calls** |
34
- | **5. MEDIUM** | **Render & DOM Optimization** | Virtualization for large lists, state colocation, `:focus-visible` | **Smooth 60 FPS / INP < 100ms** |
35
-
36
- ### 2. Eliminating Network Waterfalls
37
-
38
- ```ts
39
- // [GOOD] Parallel execution
40
- const [user, notifications] = await Promise.all([
41
- fetchUser(),
42
- fetchNotifications(),
43
- ]);
44
- const posts = await fetchPosts(user.id);
45
- ```
46
-
47
- ### 3. Layout Shift & Visual Stability (CLS < 0.1)
48
-
49
- - **Images & Video**: Always supply `width`, `height`, and `sizes` or CSS `aspect-ratio: 16 / 9`.
50
- - **Dynamic Content**: Reserve layout space for dynamically loaded widgets with min-height placeholders or skeletons.
51
- - **Tabular Numbers**: Use `font-feature-settings: "tnum"` / `font-variant-numeric: tabular-nums` for counters, clocks, and tables to prevent number width jitter.
52
-
53
- ## Code Examples
54
-
55
- See `EXAMPLES.md` for detailed performance patterns and benchmark snippets.
56
-
57
- ## Validation Checklist
58
-
59
- - [ ] LCP target is < 2.5s with preloaded critical fonts and LCP image `priority`.
60
- - [ ] No sequential `await` waterfalls in API routes or Server Components.
61
- - [ ] All animated elements use only `transform` and `opacity`.
62
- - [ ] `prefers-reduced-motion` media queries are respected.
63
- - [ ] Large tables / lists (> 100 items) utilize virtualization.
64
-
65
- ## Common Mistakes
66
-
67
- - Chaining independent async requests instead of using `Promise.all`.
68
- - Animating layout-triggering properties (`height`, `width`, `top`) causing jank.
69
- - Missing image dimensions causing layout shift when images finish loading.
70
-
71
- ## Integration Notes
72
-
73
- - Pairs with `nextjs` and `react` for App Router caching and component lifecycle tuning.
74
- - Pairs with `ui-ux-pro` for smooth animations and responsive design tokens.
75
-
76
-
77
- <!-- Source: performance.md -->
78
-
79
- # Web Performance — Best Practices
80
-
81
- ## Core Web Vitals
82
-
83
- | Metric | Target | What it measures |
84
- | --- | --- | --- |
85
- | LCP (Largest Contentful Paint) | < 2.5s | Loading performance |
86
- | INP (Interaction to Next Paint) | < 200ms | Responsiveness |
87
- | CLS (Cumulative Layout Shift) | < 0.1 | Visual stability |
88
-
89
- ## Loading Performance
90
-
91
- - **Code splitting** — split by route, lazy load non-critical components
92
- - **Tree shaking** — use ES modules, avoid side-effect imports
93
- - **Image optimization** — WebP/AVIF, responsive srcset, lazy loading
94
- - **Font loading** — `font-display: swap`, preload critical fonts
95
- - **Critical CSS** — inline above-the-fold styles
96
- - **Preconnect** — `<link rel="preconnect">` for third-party origins
97
-
98
- ## Runtime Performance
99
-
100
- - **Avoid layout thrashing** — batch DOM reads and writes
101
- - **Debounce/throttle** — expensive event handlers (scroll, resize, input)
102
- - **Web Workers** — offload heavy computation
103
- - **Virtualize long lists** — render only visible items
104
- - **Avoid synchronous operations** — use async/await, requestIdleCallback
105
-
106
- ## Bundle Optimization
107
-
108
- - **Analyze bundle** — use webpack-bundle-analyzer or similar
109
- - **Dynamic imports** — `import()` for heavy libraries
110
- - **Avoid barrel exports** — they prevent tree shaking
111
- - **Vendor splitting** — separate vendor chunks for caching
112
- - **Compression** — Brotli > gzip
113
-
114
- ## Caching Strategy
115
-
116
- | Asset | Cache | Strategy |
117
- | --- | --- | --- |
118
- | HTML | Short (5min) | Revalidate |
119
- | JS/CSS (hashed) | Long (1 year) | Immutable |
120
- | Images | Long (1 year) | Immutable |
121
- | API responses | Depends | stale-while-revalidate |
122
- | Fonts | Long (1 year) | Immutable |
123
-
124
- ## Anti-Patterns
125
-
126
- - [FAIL] Importing entire libraries (`import _ from 'lodash'`)
127
- - [FAIL] Unoptimized images (PNG > 500KB)
128
- - [FAIL] Blocking scripts in `<head>` without `defer`
129
- - [FAIL] Layout shifts from dynamic content (no dimensions on images)
130
- - [FAIL] Premature optimization — measure first, optimize second
131
-
132
- <!-- Source: EXAMPLES.md -->
133
-
134
- # performance Examples — Anti-patterns vs ContextOS Standard
135
-
136
- ## Example 1: Dynamic Imports for Heavy Libraries
137
-
138
- ### Anti-pattern: Static Import of Heavy Visualizers in Initial Bundle
139
-
140
- ```typescript
141
- // BAD: Adds 800KB (Monaco editor or Three.js) to the critical first-paint bundle!
142
- import { CodeEditor } from '@/components/CodeEditor';
143
-
144
- export default function Page() {
145
- return <div><CodeEditor /></div>;
146
- }
147
- ```
148
-
149
- ### Best practice: ContextOS Standard (Lazy Load on Demand)
150
-
151
- ```typescript
152
- // GOOD: Dynamic import splits chunk, only downloads when component renders
153
- import dynamic from 'next/dynamic';
154
-
155
- const CodeEditor = dynamic(
156
- () => import('@/components/CodeEditor'),
157
- { loading: () => <EditorSkeleton />, ssr: false }
158
- );
159
-
160
- export default function Page() {
161
- return <div><CodeEditor /></div>;
162
- }
163
- ```
164
-
165
- <!-- Source: TROUBLESHOOTING.md -->
166
-
167
- # performance Troubleshooting & Common Mistakes
168
-
169
- ## 1. Cumulative Layout Shift (CLS) from Images & Fonts
170
-
171
- - **Symptom**: Page content jumps around as images and custom fonts load.
172
- - **Root Cause**: Missing width and height attributes on image tags and FOUT (Flash of Unstyled Text).
173
- - **Fix**: Always specify aspect-ratio or width/height on images, and use next/font to preload web fonts with fallback sizing.
174
-
175
- ## 2. High Interaction to Next Paint (INP)
176
-
177
- - **Symptom**: User clicks a button and the UI freezes for 200ms+ before responding.
178
- - **Root Cause**: Long task blocking the main thread during event dispatch.
179
- - **Fix**: Defer non-critical state updates using startTransition() or split heavy computation with Web Workers.
180
-
181
- ## 3. Unoptimized SVG / Icon Overload
182
-
183
- - **Symptom**: Huge DOM node count and slow initial render times.
184
- - **Root Cause**: Rendering 500 inline SVG icons with complex paths.
185
- - **Fix**: Use SVG sprite sheets, dynamic icon loaders, or lightweight canvas rendering for dense data visualizations.