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,145 @@
1
+ # SKILL: Industrial Brutalism & Tactical Telemetry UI
2
+
3
+ ## Overview
4
+
5
+ Advanced proficiency in architecting web interfaces that synthesize mid-century Swiss Typographic design, industrial manufacturing manuals, and retro-futuristic aerospace/military terminal interfaces. This discipline requires absolute mastery over rigid modular grids, extreme typographic scale contrast, purely utilitarian color palettes, and the programmatic simulation of analog degradation (halftones, CRT scanlines, bitmap dithering). The objective is to construct digital environments that project raw functionality, mechanical precision, and high data density, deliberately discarding conventional consumer UI patterns.
6
+
7
+ ## When to Use
8
+
9
+ - When building data-heavy telemetry dashboards, analytics monitors, trading systems, or developer command centers.
10
+ - When creating editorial portfolios, archival indexes, or technical documentation sites requiring an industrial blueprint aesthetic.
11
+ - When explicitly prompted for "brutalist", "tactical", "terminal", "Swiss print", or "mechanical" aesthetics.
12
+
13
+ ## Rules & Patterns
14
+
15
+ ### 1. Visual Archetypes
16
+
17
+ Pick ONE per project and commit to it. Do not alternate or mix both modes within the same interface.
18
+
19
+ #### 1.1 Swiss Industrial Print
20
+
21
+ Derived from 1960s corporate identity systems and heavy machinery blueprints.
22
+
23
+ - **Characteristics:** High-contrast light modes (newsprint/off-white substrates). Reliance on monolithic, heavy sans-serif typography. Unforgiving structural grids outlined by visible dividing lines. Aggressive, asymmetric use of negative space punctuated by oversized, viewport-bleeding numerals or letterforms. Heavy use of primary red as an alert/accent color.
24
+
25
+ #### 1.2 Tactical Telemetry & CRT Terminal
26
+
27
+ Derived from classified military databases, legacy mainframes, and aerospace Heads-Up Displays (HUDs).
28
+
29
+ - **Characteristics:** Dark mode exclusivity. High-density tabular data presentation. Absolute dominance of monospaced typography. Integration of technical framing devices (ASCII brackets, crosshairs). Application of simulated hardware limitations (phosphor glow, scanlines, low bit-depth rendering).
30
+
31
+ ### 2. Typographic Architecture
32
+
33
+ Typography is the primary structural and decorative infrastructure. Imagery is secondary. The system demands extreme variance in scale, weight, and spacing.
34
+
35
+ #### 2.1 Macro-Typography (Structural Headers)
36
+
37
+ - **Classification:** Neo-Grotesque / Heavy Sans-Serif.
38
+ - **Optimal Web Fonts:** Neue Haas Grotesk (Black), Inter (Extra Bold/Black), Archivo Black, Roboto Flex (Heavy), Monument Extended.
39
+ - **Scale:** Deployed at massive scales using fluid typography (e.g., `clamp(4rem, 10vw, 15rem)`).
40
+ - **Tracking (Letter-spacing):** Extremely tight, often negative (`-0.03em` to `-0.06em`), forcing glyphs to form solid architectural blocks.
41
+ - **Leading (Line-height):** Highly compressed (`0.85` to `0.95`).
42
+ - **Casing:** Exclusively uppercase for structural impact.
43
+
44
+ #### 2.2 Micro-Typography (Data & Telemetry)
45
+
46
+ - **Classification:** Monospace / Technical Sans.
47
+ - **Optimal Web Fonts:** JetBrains Mono, IBM Plex Mono, Space Mono, VT323, Courier Prime.
48
+ - **Scale:** Fixed and small (`10px` to `14px` / `0.7rem` to `0.875rem`).
49
+ - **Tracking:** Generous (`0.05em` to `0.1em`) to simulate mechanical typewriter spacing or terminal matrices.
50
+ - **Leading:** Standard to tight (`1.2` to `1.4`).
51
+ - **Casing:** Exclusively uppercase. Used for all metadata, navigation, unit IDs, and coordinates.
52
+
53
+ #### 2.3 Textural Contrast (Artistic Disruption)
54
+
55
+ - **Classification:** High-Contrast Serif.
56
+ - **Optimal Web Fonts:** Playfair Display, EB Garamond, Times New Roman.
57
+ - **Implementation Parameters:** Used exceedingly sparingly. Must be subjected to heavy post-processing (halftone filters, 1-bit dithering) to degrade vector perfection and create textural juxtaposition against the clean sans-serifs.
58
+
59
+ ### 3. Color System
60
+
61
+ The color architecture is uncompromising. Gradients, soft drop shadows, and modern translucency are strictly prohibited. Colors simulate physical media or primitive emissive displays.
62
+
63
+ **CRITICAL: Choose ONE substrate palette per project and use it consistently. Never mix light and dark substrates within the same interface.**
64
+
65
+ #### Swiss Industrial Print Light Substrate
66
+
67
+ - **Background:** `#F4F4F0` or `#EAE8E3` (Matte, unbleached documentation paper).
68
+ - **Foreground:** `#050505` to `#111111` (Carbon Ink).
69
+ - **Accent:** `#E61919` or `#FF2A2A` (Aviation/Hazard Red). This is the ONLY accent color. Used for strike-throughs, thick structural dividing lines, or vital data highlights.
70
+
71
+ #### Tactical Telemetry Dark Substrate
72
+
73
+ - **Background:** `#0A0A0A` or `#121212` (Deactivated CRT. Avoid pure `#000000`).
74
+ - **Foreground:** `#EAEAEA` (White phosphor). This is the primary text color.
75
+ - **Accent:** `#E61919` or `#FF2A2A` (Aviation/Hazard Red). Same red, same rules.
76
+ - **Terminal Green (`#4AF626`):** Optional. Use ONLY for a single specific UI element (e.g., one status indicator or one data readout) — never as a general text color. If it doesn't serve a clear purpose, omit it entirely.
77
+
78
+ ### 4. Layout and Spatial Engineering
79
+
80
+ - **The Blueprint Grid:** Strict adherence to CSS Grid architectures. Elements do not float; they are anchored precisely to grid tracks and intersections.
81
+ - **Visible Compartmentalization:** Extensive utilization of solid borders (`1px` or `2px solid`) to delineate distinct zones of information. Horizontal rules (`<hr>`) frequently span the entire container width to segregate operational units.
82
+ - **Bimodal Density:** Layouts oscillate between extreme data density (tightly packed monospace metadata clustered together) and vast expanses of calculated negative space framing macro-typography.
83
+ - **Geometry:** Absolute rejection of `border-radius`. All corners must be exactly 90 degrees to enforce mechanical rigidity.
84
+
85
+ ### 5. UI Components and Symbology
86
+
87
+ - **Syntax Decoration:** Utilization of ASCII characters to frame data points (`[ DELIVERY SYSTEMS ]`, `< RE-IND >`, `>>>`, `///`).
88
+ - **Industrial Markers:** Prominent integration of registration (`®`), copyright (`©`), and trademark (`™`) symbols functioning as structural geometric elements rather than legal text.
89
+ - **Technical Assets:** Integration of crosshairs (`+`) at grid intersections, repeating vertical lines (barcodes), thick horizontal warning stripes, and randomized string data (`REV 2.6`, `UNIT / D-01`) to simulate active mechanical processes.
90
+
91
+ ### 6. Textural and Post-Processing Effects
92
+
93
+ - **Halftone and 1-Bit Dithering:** Dot-matrix effects via `mix-blend-mode: multiply` overlays combined with SVG radial dot patterns.
94
+ - **CRT Scanlines:** `repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px)` on terminal backgrounds.
95
+ - **Mechanical Noise:** Low-opacity SVG static filter on the DOM root to introduce physical grain.
96
+
97
+ ### 7. Web Engineering Directives
98
+
99
+ 1. **Grid Determinism:** Utilize `display: grid; gap: 1px;` with contrasting parent/child background colors to generate mathematically perfect, razor-thin dividing lines without complex border declarations.
100
+ 2. **Semantic Rigidity:** Construct the DOM using precise semantic tags (`<data>`, `<samp>`, `<kbd>`, `<output>`, `<dl>`) to accurately reflect the technical nature of the telemetry.
101
+ 3. **Typography Clamping:** Implement CSS `clamp()` functions exclusively for macro-typography to ensure massive text scales aggressively while maintaining structural integrity across viewports.
102
+
103
+ ## Code Examples
104
+
105
+ ```tsx
106
+ export function TelemetryModule({ unitId, status, metrics }: { unitId: string; status: string; metrics: { label: string; val: string }[] }) {
107
+ return (
108
+ <div className="border-2 border-black dark:border-white bg-[#F4F4F0] dark:bg-[#0A0A0A] font-mono p-4 rounded-none">
109
+ <div className="flex justify-between border-b border-black/30 dark:border-white/30 pb-2 mb-4 text-xs tracking-widest uppercase">
110
+ <span>[ UNIT // {unitId} ]</span>
111
+ <span className="text-[#E61919] font-bold">&lt; STATUS: {status} &gt;</span>
112
+ </div>
113
+ <div className="grid grid-cols-2 gap-px bg-black/20 dark:bg-white/20">
114
+ {metrics.map(m => (
115
+ <div key={m.label} className="bg-[#F4F4F0] dark:bg-[#0A0A0A] p-2">
116
+ <div className="text-[10px] text-black/60 dark:text-white/60 tracking-wider">{m.label}</div>
117
+ <div className="text-sm font-bold tracking-tight">{m.val}</div>
118
+ </div>
119
+ ))}
120
+ </div>
121
+ </div>
122
+ );
123
+ }
124
+ ```
125
+
126
+ ## Validation Checklist
127
+
128
+ - [ ] Strict rejection of `border-radius` (all corners 0px / 90 degrees).
129
+ - [ ] Substrate consistency: 100% committed to either Swiss Light or Tactical CRT Dark.
130
+ - [ ] Pure black (`#000000`) avoided for backgrounds.
131
+ - [ ] Monospace typography used for all telemetry, coordinates, and metadata labels.
132
+ - [ ] Dividing lines engineered using solid borders or 1px grid track gaps.
133
+ - [ ] No soft gradients, standard drop shadows, or floating cards.
134
+
135
+ ## Common Mistakes
136
+
137
+ - Mixing Swiss Industrial Print and Tactical Telemetry substrates within the same view.
138
+ - Introducing rounded corners (`rounded-md`, `rounded-full`) or pill buttons.
139
+ - Using generic body typefaces without tracking adjustments.
140
+ - Applying subtle pastel colors instead of raw carbon ink, off-white, and hazard red.
141
+
142
+ ## Integration Notes
143
+
144
+ - Complements `impeccable-design` for QA checks on contrast and typography.
145
+ - Pairs with `web-accessibility` to guarantee high-contrast readability (AAA ratio).
@@ -0,0 +1,147 @@
1
+ # context-manager
2
+
3
+ ## Overview
4
+
5
+ Deterministic context window optimizer. Analyzes user task intent and queries project dependency graphs to inject minimal relevant files and skills, preventing LLM attention loss and context pollution.
6
+
7
+ ## When to Use
8
+
9
+ Activate during multi-file investigations, large refactorings, or complex tasks where dumping entire directory trees would blow past context budgets.
10
+
11
+ ## Rules & Patterns
12
+
13
+ You are the **Context Manager**. Your job is to prevent context overload.
14
+
15
+ ## How It Works
16
+
17
+ When given a task:
18
+
19
+ ### Step 1: Classify the task
20
+
21
+ ```yaml
22
+ task:
23
+ type: [frontend | backend | fullstack | architecture | bugfix | refactor | deploy | review]
24
+ scope: [module | feature | file | project-wide]
25
+ module: {{module_name from Project Graph}}
26
+ ```
27
+
28
+ ### Step 2: Consult the Project Graph
29
+
30
+ If `docs/PROJECT_GRAPH.md` or `.graphify/graph.json` exists (or activate `graphify` skill to extract AST dependencies):
31
+
32
+ 1. Find the module this task belongs to
33
+ 2. Get the module's dependencies
34
+ 3. Get the module's required skills
35
+ 4. Get the files this task will likely touch
36
+
37
+ ### Step 3: Apply Context Rules
38
+
39
+ Load `references/context-rules.md` and apply the task type → document mapping.
40
+
41
+ ### Step 4: Return Context Package
42
+
43
+ Output a context package:
44
+
45
+ ```yaml
46
+ context:
47
+ documents:
48
+ required:
49
+ - docs/API.md # sections: [appointments]
50
+ - docs/ARCHITECTURE.md # sections: [backend, api-layer]
51
+ optional:
52
+ - docs/decisions/0003-postgres.md
53
+ skipped:
54
+ - docs/UI.md # reason: backend task
55
+ - docs/DATABASE.md # reason: no schema change
56
+
57
+ skills:
58
+ loaded: [typescript, node, postgres, testing]
59
+ skipped: [react, tailwind] # reason: backend task
60
+
61
+ project_graph:
62
+ module: appointments
63
+ dependencies: [auth, patients]
64
+ affected_files:
65
+ - src/modules/appointments/api/**
66
+ - src/modules/appointments/services/**
67
+ ```
68
+
69
+ ### Step 5: Validate Budget
70
+
71
+ Check total token count. If over budget (see context-rules.md):
72
+
73
+ 1. Trim Level 1 docs to summaries
74
+ 2. Load only affected sections of Level 2 docs
75
+ 3. Keep Level 3 (skills) at full detail
76
+
77
+ ## Context Caching
78
+
79
+ After first compilation for a module, cache the result:
80
+
81
+ ```
82
+ .cache/
83
+ frontend.context.yaml
84
+ backend.context.yaml
85
+ appointments.context.yaml
86
+ ```
87
+
88
+ Invalidate cache when:
89
+
90
+ - A document is updated
91
+ - A skill is added/removed
92
+ - The Project Graph changes
93
+ - A Decision Record is added
94
+
95
+ ## Questions the Context Manager Can Answer
96
+
97
+ - "What documents do I need for this task?"
98
+ - "Which skills should be loaded?"
99
+ - "What modules are affected by this change?"
100
+ - "Is this context package within budget?"
101
+ - "Why was this document skipped?"
102
+
103
+
104
+ ## Code Examples
105
+
106
+ See `EXAMPLES.md` for detailed code examples.
107
+
108
+ ## Validation Checklist
109
+
110
+ What to verify during the review phase before completing the task.
111
+
112
+ ## Common Mistakes
113
+
114
+ Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
115
+
116
+ ## Integration Notes
117
+
118
+ How this skill interacts with other skills.
119
+
120
+
121
+ # context-manager Examples — Anti-patterns vs ContextOS Standard
122
+
123
+ ## Example 1: Context Selection
124
+
125
+ ### Anti-pattern: Context Window Dumping
126
+
127
+ ```text
128
+ Agent reads all 180 files in src/ into context to debug a single button click handler.
129
+ Result: Exhausts 150k tokens, reaches rate limits, and forgets user instructions.
130
+ ```
131
+
132
+ ### Best practice: ContextOS Standard (Targeted AST Traversal)
133
+
134
+ ```text
135
+ 1. Inspect package.json and AGENTS.md.
136
+ 2. Grep for target symbol: grep_search for 'SubmitButton'.
137
+ 3. Read ONLY components/SubmitButton.tsx and its direct import types/button.ts.
138
+ Total tokens used: <1,500 tokens. Fast, accurate, zero hallucinations.
139
+ ```
140
+
141
+ # context-manager Troubleshooting & Common Mistakes
142
+
143
+ ## 1. Token Budget Blowout
144
+
145
+ - **Symptom**: Model performance drops significantly, losing earlier conversational context.
146
+ - **Root Cause**: Loading large JSON mocks, lockfiles, or build directories into prompt.
147
+ - **Fix**: Never read package-lock.json, dist/, or build artifacts unless explicitly debugging bundle outputs.
@@ -0,0 +1,191 @@
1
+ # context-os
2
+
3
+ ## Overview
4
+
5
+ Operating system and context orchestration layer for AI coding assistants. Standardizes software engineering workflows across requirements, architecture, atomic task planning, implementation, verification, and release.
6
+
7
+ ## When to Use
8
+
9
+ Activate as the root meta-orchestrator across all development phases to ensure role consistency, quality gates, and structured execution.
10
+
11
+ ## Rules & Patterns
12
+
13
+ You are the **Context Compiler**. Your job is NOT to know everything. Your job is to **assemble the minimum context** needed for the current task.
14
+
15
+ ## Pipeline
16
+
17
+ When a user gives you a task, follow this pipeline:
18
+
19
+ ### Stage 1: Intent Analysis
20
+
21
+ Analyze the user's prompt and determine:
22
+
23
+ ```yaml
24
+ intent:
25
+ project_type: [webapp, api, mobile, cli, library, saas, crm, ecommerce]
26
+ industry: [healthcare, fintech, education, social, general]
27
+ layers:
28
+ frontend: true/false
29
+ backend: true/false
30
+ database: true/false
31
+ auth: true/false
32
+ ai: true/false
33
+ payments: true/false
34
+ realtime: true/false
35
+ scope: [new_project, feature, bugfix, refactor, architecture]
36
+ ```
37
+
38
+ ### Stage 2: Dependency Resolution
39
+
40
+ For each required layer, load the skill graph:
41
+
42
+ 1. Read `skill.yaml` from each relevant skill directory
43
+ 2. Resolve `requires` — load mandatory dependencies
44
+ 3. Check `conflicts` — ensure no incompatible skills are loaded
45
+ 4. Apply `optional` — suggest but don't force
46
+ 5. Respect project profile (if set) — apply rules from `profiles/`
47
+
48
+ **Dependency resolution example:**
49
+
50
+ ```
51
+ Need: nextjs
52
+ → requires: react, typescript
53
+ → react requires: typescript (already loaded)
54
+ → optional: tailwind, prisma, next-auth
55
+
56
+ Loaded: [nextjs, react, typescript]
57
+ Suggested: [tailwind, prisma, next-auth]
58
+ ```
59
+
60
+ ### Stage 3: Context Compilation
61
+
62
+ Assemble context from three levels:
63
+
64
+ **Level 1 — Vision (always available):**
65
+
66
+ - `docs/PRD.md` — what are we building
67
+ - `docs/ROADMAP.md` — where are we going
68
+ - `docs/PROJECT_GRAPH.md` — project structure
69
+
70
+ **Level 2 — Architecture (load when needed):**
71
+
72
+ - `docs/ARCHITECTURE.md` — system design
73
+ - `docs/DATABASE.md` — data model
74
+ - `docs/API.md` — API contracts
75
+ - `docs/decisions/` — prior decisions
76
+
77
+ **Level 3 — Development (load per task):**
78
+
79
+ - Relevant skill `.md` files
80
+ - `docs/UI.md` — for frontend tasks
81
+ - `docs/TASKS.md` — current sprint
82
+
83
+ **Context Filtering Rules:**
84
+ See `references/context-rules.md` for the full mapping of task types to required documents.
85
+
86
+ ### Stage 4: Prompt Optimization
87
+
88
+ Before sending to the AI agent:
89
+
90
+ 1. Remove sections not relevant to the current task
91
+ 2. Prioritize: current task context > architecture > vision
92
+ 3. Include recent Decision Records that affect the current task
93
+ 4. Add coding rules from the loaded skills
94
+
95
+ ## Commands
96
+
97
+ | Command | Action |
98
+ | --- | --- |
99
+ | `ctx init` | Analyze project idea, generate all docs |
100
+ | `ctx plan` | Generate development plan from PRD |
101
+ | `ctx compile` | Compile context for a specific task |
102
+ | `ctx update` | Update changed documents |
103
+ | `ctx graph` | Show/update Project Graph |
104
+ | `ctx doctor` | Validate skill dependencies, check for conflicts |
105
+ | `ctx explain` | Explain why specific context was loaded |
106
+
107
+ ## Project Initialization Flow
108
+
109
+ When user says something like "Сделай CRM для стоматологии" or "Build a Trello clone":
110
+
111
+ 1. **Analyze intent** (Stage 1)
112
+ 2. **Ask clarifying questions:**
113
+ - Users and roles?
114
+ - Tech stack preference?
115
+ - Mobile app needed?
116
+ - AI features?
117
+ - Authentication type?
118
+ - Expected load?
119
+ - MVP or Production?
120
+ 3. **Select profile** (startup/enterprise/mvp/hackathon)
121
+ 4. **Resolve skills** (Stage 2)
122
+ 5. **Generate all documents** using `generators/` skill
123
+ 6. **Create Project Graph** — the master map of modules → features → tasks → files → skills
124
+ 7. **Output agent config** using `adapters/` skill
125
+
126
+ ## Skill Discovery
127
+
128
+ Skills are discovered by scanning `.agents/skills/*/skill.yaml`. Each `skill.yaml` defines:
129
+
130
+ ```yaml
131
+ id: react
132
+ name: React
133
+ category: frontend
134
+ tags: [frontend, spa, jsx, components]
135
+ requires: [typescript]
136
+ optional: [tailwind, next-auth, react-query]
137
+ conflicts: [vue, angular, svelte]
138
+ weight: 8
139
+ documents:
140
+ - react.md
141
+ ```
142
+
143
+ The compiler builds a dependency graph from all discovered skills and resolves it for each task.
144
+
145
+
146
+ ## Code Examples
147
+
148
+ See `EXAMPLES.md` for detailed code examples.
149
+
150
+ ## Validation Checklist
151
+
152
+ What to verify during the review phase before completing the task.
153
+
154
+ ## Common Mistakes
155
+
156
+ Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
157
+
158
+ ## Integration Notes
159
+
160
+ How this skill interacts with other skills.
161
+
162
+
163
+ # context-os Examples — Anti-patterns vs ContextOS Standard
164
+
165
+ ## Example 1: Project Lifecycle Management
166
+
167
+ ### Anti-pattern: Ad-hoc Unstructured Development
168
+
169
+ ```text
170
+ Coding -> Modifying DB -> Debugging -> Redesigning UI -> Changing Architecture
171
+ All in one unstructured stream of consciousness.
172
+ ```
173
+
174
+ ### Best practice: ContextOS Standard (Phase-Gated Development)
175
+
176
+ ```text
177
+ Phase 1: DEFINE (PRD & Requirements)
178
+ Phase 2: PLAN (Atomic Tasks & ADRs)
179
+ Phase 3: BUILD (TDD & Minimalist Implementation)
180
+ Phase 4: VERIFY (Automated Test Proof)
181
+ Phase 5: REVIEW (Design QA & Code Review)
182
+ Phase 6: SHIP (Production Release)
183
+ ```
184
+
185
+ # context-os Troubleshooting & Common Mistakes
186
+
187
+ ## 1. Stale Compiled Artifacts
188
+
189
+ - **Symptom**: Editor rules don't reflect newly updated skills.
190
+ - **Root Cause**: Modifying .agents/core/skills/ without recompiling exports.
191
+ - **Fix**: Run node .agents/ctx.js export all whenever source skills are updated.
@@ -0,0 +1,191 @@
1
+ # database
2
+
3
+ ## Overview
4
+
5
+ Relational database design, query optimization, migration safety, connection pooling in serverless environments, and ORM usage across PostgreSQL, Prisma, and Drizzle.
6
+
7
+ ## When to Use
8
+
9
+ Activate for tasks involving database schema design, migrations, indexing, relational models, ORM queries, transactions, or query performance tuning.
10
+
11
+ ## Rules & Patterns
12
+
13
+ ### Negative Constraints (What NOT to Do)
14
+
15
+ 1. **NEVER do `SELECT *` in production**: Always select explicit columns required by the caller to minimize memory bandwidth and lock footprint.
16
+ 2. **NEVER run destructive migrations without backward compatibility**: Always follow expand-and-contract (Phase 1: add new column as nullable; Phase 2: backfill; Phase 3: make non-nullable & remove old column).
17
+ 3. **NEVER execute queries in loops (The N+1 Anti-Pattern)**: Always use batch loading (`inArray`, `DataLoader`, or relational `include` / `JOIN`).
18
+ 4. **NEVER leave foreign keys without indexes**: In PostgreSQL/MySQL, child foreign key columns must always have an index to prevent table-level locking on cascade deletes.
19
+ 5. **NEVER perform multi-entity writes without a database transaction**: Any operation touching multiple records must use `prisma.$transaction` or `db.transaction`.
20
+ 6. **NEVER open unpooled database connections in Serverless / Edge functions**: Serverless scale-outs will instantly exhaust PostgreSQL's `max_connections`.
21
+
22
+ ---
23
+
24
+ ### Zero-Downtime Migrations (Expand-and-Contract)
25
+
26
+ When modifying schemas with zero downtime:
27
+
28
+ 1. **Phase 1 (Expand)**: Add the new column as `NULLABLE` (or with a default value). Deploy the application code that reads from old column and writes to both old and new.
29
+ 2. **Phase 2 (Backfill)**: Run an asynchronous batch migration job in chunks (e.g. 1000 rows at a time) to populate data from old column to new column.
30
+ 3. **Phase 3 (Contract)**: Update application code to read and write exclusively from the new column.
31
+ 4. **Phase 4 (Cleanup)**: Once traffic is fully shifted, remove the old column and mark the new column as `NOT NULL` in a separate migration.
32
+
33
+ ---
34
+
35
+ ### Serverless & Edge Connection Pooling
36
+
37
+ In serverless environments (AWS Lambda, Vercel Functions):
38
+
39
+ - Always connect via a connection pooler:
40
+ - **Prisma**: Use Prisma Accelerate or configure transaction mode connection URLs.
41
+ - **Drizzle / Node-Postgres**: Use `@neondatabase/serverless` or connect to PgBouncer pooler port (`6543`) with `max: 1` per serverless container.
42
+ - Set strict statement timeouts (e.g. `statement_timeout = '5000'`) to prevent hanging queries from exhausting pool capacity.
43
+
44
+ ---
45
+
46
+ ### Indexing & Performance Rules
47
+
48
+ - **B-Tree Indexes**: For high-cardinality filters (`status`, `user_id`, `created_at`).
49
+ - **Composite Indexes**: When querying multiple columns together (`WHERE organization_id = ? AND status = ?`), order columns in index by equality first, range second.
50
+ - **Partial Indexes**: For sparse boolean flags (`WHERE is_processed = false`).
51
+ - **Covering Indexes**: Include frequently selected columns (`INCLUDE (title, created_at)`) to enable index-only scans without table heap access.
52
+
53
+ ---
54
+
55
+ ## Code Examples
56
+
57
+ ### Zero-Downtime Column Rename (Drizzle ORM)
58
+
59
+ ```typescript
60
+ // Step 1 (Expand): Keep old column, add new column
61
+ export const users = pgTable('users', {
62
+ id: uuid('id').primaryKey().defaultRandom(),
63
+ fullName: varchar('full_name', { length: 255 }), // new column
64
+ name: varchar('name', { length: 255 }), // old column kept during transition
65
+ });
66
+
67
+ // App write logic during transition:
68
+ await db.insert(users).values({
69
+ name: input.name,
70
+ fullName: input.name
71
+ });
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Validation Checklist
77
+
78
+ - [ ] All database queries select explicit required columns (no `SELECT *`).
79
+ - [ ] Foreign keys have matching indexes on child tables.
80
+ - [ ] Multi-table writes wrapped in ACID transactions.
81
+ - [ ] No N+1 queries in loops.
82
+ - [ ] Schema migrations tested against expand-and-contract pattern.
83
+ - [ ] Serverless database connection string uses pooling proxy.
84
+
85
+ ---
86
+
87
+ ## Common Mistakes
88
+
89
+ - **Missing pagination limits**: Unbounded `findMany()` calls leading to Out-Of-Memory crashes under production volume.
90
+ - **Locking entire tables**: Adding `NOT NULL` columns with heavy compute defaults in PostgreSQL without concurrent index creation.
91
+
92
+ ---
93
+
94
+ ## Integration Notes
95
+
96
+ - Interacts with `system-design`, `ddd`, and `security` (multi-tenant tenantId scoping).
97
+
98
+
99
+ # Database Examples — Anti-patterns vs ContextOS Standard
100
+
101
+ ## Example 1: Solving the N+1 Query Problem
102
+
103
+ ### Anti-pattern: Anti-pattern (N+1 database queries in a loop)
104
+
105
+ ```typescript
106
+ // BAD: 1 query for users + N queries for posts!
107
+ const users = await prisma.user.findMany();
108
+ const usersWithPosts = [];
109
+ for (const user of users) {
110
+ const posts = await prisma.post.findMany({ where: { userId: user.id } }); // N queries!
111
+ usersWithPosts.push({ ...user, posts });
112
+ }
113
+ ```
114
+
115
+ ### Best practice: ContextOS Standard (Batch query or relational include)
116
+
117
+ ```typescript
118
+ // GOOD: 1 single optimized batch query
119
+ const usersWithPosts = await prisma.user.findMany({
120
+ where: { isActive: true },
121
+ select: {
122
+ id: true,
123
+ name: true,
124
+ email: true,
125
+ posts: {
126
+ where: { published: true },
127
+ select: { id: true, title: true, createdAt: true },
128
+ take: 5
129
+ }
130
+ }
131
+ });
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Example 2: Safe Atomic Transactions with Locking
137
+
138
+ ### Anti-pattern: Anti-pattern (Unprotected read-modify-write race condition)
139
+
140
+ ```typescript
141
+ // BAD: race condition between reading balance and updating
142
+ const account = await prisma.account.findUnique({ where: { id } });
143
+ if (account.balance >= amount) {
144
+ await prisma.account.update({
145
+ where: { id },
146
+ data: { balance: account.balance - amount }
147
+ });
148
+ }
149
+ ```
150
+
151
+ ### Best practice: ContextOS Standard (Atomic conditional update in transaction)
152
+
153
+ ```typescript
154
+ // GOOD: atomic database transaction with invariant check
155
+ export async function deductBalance(accountId: string, amount: number) {
156
+ return await prisma.$transaction(async (tx) => {
157
+ const updated = await tx.account.updateMany({
158
+ where: {
159
+ id: accountId,
160
+ balance: { gte: amount }
161
+ },
162
+ data: {
163
+ balance: { decrement: amount }
164
+ }
165
+ });
166
+
167
+ if (updated.count === 0) {
168
+ throw new InsufficientFundsError(accountId);
169
+ }
170
+ });
171
+ }
172
+ ```
173
+
174
+ # Database Troubleshooting Guide
175
+
176
+ ## Common Issues & Fixes
177
+
178
+ ### 1. Connection Pool Exhaustion in Serverless / Edge
179
+
180
+ - **Cause**: Creating a new PrismaClient / DB connection instance on every serverless function invocation.
181
+ - **Fix**: Declare PrismaClient as a global singleton across warm lambdas, and enable PgBouncer or Prisma Accelerate.
182
+
183
+ ### 2. Slow Queries on Large Tables
184
+
185
+ - **Cause**: Missing composite index on filtered and ordered columns.
186
+ - **Fix**: Run `EXPLAIN ANALYZE <query>` and add targeted indexes matching the WHERE and ORDER BY columns.
187
+
188
+ ### 3. Database Deadlocks during Concurrent Transactions
189
+
190
+ - **Cause**: Different transactions updating resources in different orders.
191
+ - **Fix**: Always acquire locks and update entities in a deterministic alphabetical or ID-ordered sequence.