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,247 +0,0 @@
1
- ---
2
- name: Domain-Driven Design
3
- description: >
4
- ContextOS skill for Domain-Driven Design
5
- ---
6
-
7
- # Domain-Driven Design
8
-
9
- ## Overview
10
-
11
- Domain-Driven Design standard for robust business software. Enforces separation between domain logic (Entities, Value Objects, Aggregates, Domain Events) and infrastructure frameworks, preventing leaky abstractions.
12
-
13
- ## When to Use
14
-
15
- Activate when designing core business domain models, transactional consistency boundaries, enterprise APIs, or complex aggregate hierarchies.
16
-
17
- ## Rules & Patterns
18
- <!-- Source: ddd.md -->
19
-
20
- ## Domain-Driven Design — Patterns & Practices
21
-
22
- ## When to Use DDD
23
-
24
- **Use when:**
25
-
26
- - Complex business logic that goes beyond CRUD
27
- - Multiple domain experts with different vocabularies
28
- - The domain model is the competitive advantage
29
- - Enterprise-grade applications
30
-
31
- **Don't use when:**
32
-
33
- - Simple CRUD applications
34
- - Hackathon/MVP (overkill)
35
- - No domain expert available
36
-
37
- ## Strategic Design
38
-
39
- ### Bounded Contexts
40
-
41
- The single most important DDD concept. A Bounded Context is a boundary within which a particular model is defined and applicable.
42
-
43
- **Example — E-Commerce:**
44
-
45
- ```
46
- [Order Context] [Payment Context] [Shipping Context]
47
- - Order - Payment - Shipment
48
- - OrderItem - Transaction - TrackingNumber
49
- - Customer (ref) - Refund - Address
50
- - Address (value) - Invoice - Carrier
51
- ```
52
-
53
- `Customer` means different things in each context:
54
-
55
- - Order Context: name, email, shipping preference
56
- - Payment Context: billing info, payment methods
57
- - Support Context: ticket history, satisfaction score
58
-
59
- ### Context Map
60
-
61
- ```
62
- [Order] ←→ [Payment] # Partnership
63
- [Order] → [Shipping] # Customer-Supplier
64
- [Order] → [Legacy CRM] # Anti-Corruption Layer
65
- ```
66
-
67
- ## Tactical Design
68
-
69
- ### Entities
70
-
71
- Objects with identity. Two entities with the same attributes but different IDs are different.
72
-
73
- ```typescript
74
- class User {
75
- readonly id: UserId;
76
- name: string;
77
- email: Email; // Value Object
78
- }
79
- ```
80
-
81
- ### Value Objects
82
-
83
- Objects defined by their attributes, not identity. Immutable.
84
-
85
- ```typescript
86
- class Email {
87
- constructor(readonly value: string) {
88
- if (!isValidEmail(value)) throw new InvalidEmailError(value);
89
- }
90
- equals(other: Email): boolean {
91
- return this.value === other.value;
92
- }
93
- }
94
- ```
95
-
96
- ### Aggregates
97
-
98
- A cluster of entities and value objects with a single root entity (Aggregate Root). All access goes through the root.
99
-
100
- ```typescript
101
- class Order { // Aggregate Root
102
- private items: OrderItem[] = [];
103
-
104
- addItem(product: ProductRef, quantity: number): void {
105
- // Business logic HERE, not in a service
106
- if (quantity <= 0) throw new InvalidQuantityError();
107
- this.items.push(new OrderItem(product, quantity));
108
- }
109
-
110
- get total(): Money {
111
- return this.items.reduce((sum, item) => sum.add(item.subtotal), Money.zero());
112
- }
113
- }
114
- ```
115
-
116
- **Aggregate Rules:**
117
-
118
- 1. Reference other aggregates by ID only
119
- 2. One aggregate per transaction
120
- 3. Eventual consistency between aggregates
121
-
122
- ### Domain Events
123
-
124
- Something that happened in the domain that domain experts care about.
125
-
126
- ```typescript
127
- class OrderPlaced implements DomainEvent {
128
- constructor(
129
- readonly orderId: OrderId,
130
- readonly customerId: CustomerId,
131
- readonly total: Money,
132
- readonly occurredAt: Date
133
- ) {}
134
- }
135
- ```
136
-
137
- ### Domain Services
138
-
139
- Business logic that doesn't naturally belong to an entity or value object.
140
-
141
- ```typescript
142
- class PricingService {
143
- calculatePrice(order: Order, customer: Customer, promotions: Promotion[]): Money {
144
- // Complex pricing logic involving multiple aggregates
145
- }
146
- }
147
- ```
148
-
149
- ### Repositories
150
-
151
- Abstraction over data access. One repository per aggregate root.
152
-
153
- ```typescript
154
- interface OrderRepository {
155
- findById(id: OrderId): Promise<Order | null>;
156
- save(order: Order): Promise<void>;
157
- delete(id: OrderId): Promise<void>;
158
- }
159
- ```
160
-
161
- ## Directory Structure (DDD)
162
-
163
- ```
164
- src/
165
- ├── modules/
166
- │ └── orders/ # Bounded Context
167
- │ ├── domain/
168
- │ │ ├── entities/
169
- │ │ │ └── order.ts # Aggregate Root
170
- │ │ ├── value-objects/
171
- │ │ │ └── money.ts
172
- │ │ ├── events/
173
- │ │ │ └── order-placed.ts
174
- │ │ ├── services/
175
- │ │ │ └── pricing.ts
176
- │ │ └── repositories/
177
- │ │ └── order.repository.ts # Interface
178
- │ ├── application/
179
- │ │ ├── commands/
180
- │ │ │ └── place-order.ts
181
- │ │ ├── queries/
182
- │ │ │ └── get-order.ts
183
- │ │ └── handlers/
184
- │ │ └── place-order.handler.ts
185
- │ └── infrastructure/
186
- │ ├── persistence/
187
- │ │ └── order.repository.impl.ts # Implementation
188
- │ └── api/
189
- │ └── orders.controller.ts
190
- ```
191
-
192
- ### The Clean Architecture Dependency Rule
193
-
194
- In DDD, dependencies **MUST strictly point inward**:
195
-
196
- ```
197
- [ Frameworks & Drivers (Web, DB, UI) ]
198
- └──▶ [ Interface Adapters (Controllers, Gateways) ]
199
- └──▶ [ Application (Use Cases, CQRS Handlers) ]
200
- └──▶ [ Domain (Entities, Value Objects) ]
201
- ```
202
-
203
- - The **Domain layer** has ZERO dependencies on ORMs (Prisma, TypeORM), HTTP frameworks (Express, NestJS), or external SDKs.
204
- - Repositories are defined as interfaces in the domain/application layer and implemented in the infrastructure layer.
205
-
206
- ### Domain Events vs Integration Events
207
-
208
- 1. **Domain Events**: Represent state changes inside a single Bounded Context.
209
- - Raised directly inside the Aggregate Root (`order.addItem(...)` raises `OrderItemAdded`).
210
- - Dispatched in-process before transaction commit.
211
- 2. **Integration Events**: Published across Bounded Context boundaries to communicate with other services.
212
- - Dispatched via Transactional Outbox pattern to message brokers.
213
- - Must use backward-compatible schemas with versioning.
214
-
215
- ### Anti-Corruption Layer (ACL)
216
-
217
- When consuming data from an external bounded context or 3rd-party vendor API (e.g. Stripe, Salesforce):
218
-
219
- - NEVER import external domain models directly into your domain.
220
- - Create an **ACL Translator / Adapter** in the infrastructure layer to convert external DTOs into your own Value Objects and Entities.
221
-
222
- ---
223
-
224
- ## Anti-Patterns
225
-
226
- - [FAIL] Anemic domain model — entities with only getters/setters, all logic in services
227
- - [FAIL] Big aggregate — aggregates should be small, focused on invariants
228
- - [FAIL] Cross-aggregate transactions — use eventual consistency
229
- - [FAIL] DDD everywhere — use DDD only where complexity justifies it
230
- - [FAIL] ORM entities leaking into Domain — domain entities must not depend on `@Entity()` or ORM decorators
231
-
232
-
233
- ## Code Examples
234
-
235
- See `EXAMPLES.md` for detailed code examples.
236
-
237
- ## Validation Checklist
238
-
239
- What to verify during the review phase before completing the task.
240
-
241
- ## Common Mistakes
242
-
243
- Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
244
-
245
- ## Integration Notes
246
-
247
- How this skill interacts with other skills.
@@ -1,19 +0,0 @@
1
- # ddd Troubleshooting & Common Mistakes
2
-
3
- ## 1. God Aggregates
4
-
5
- - **Symptom**: Aggregate Root contains 20 child entities and loading it requires joining dozens of tables.
6
- - **Root Cause**: Treating ERD tables as aggregate boundaries rather than transactional consistency units.
7
- - **Fix**: Design small aggregates. Reference other aggregates by ID only, not by object reference.
8
-
9
- ## 2. Leaking Infrastructure into Domain Layer
10
-
11
- - **Symptom**: Domain entities import Prisma, TypeORM decorators, or Express Request objects.
12
- - **Root Cause**: Inverting Clean Architecture boundaries.
13
- - **Fix**: The Domain layer must be pure TypeScript with zero external framework dependencies.
14
-
15
- ## 3. Transaction Spanning Multiple Aggregates
16
-
17
- - **Symptom**: High database lock contention and deadlocks under concurrent transactions.
18
- - **Root Cause**: Modifying multiple aggregate roots within the same database transaction.
19
- - **Fix**: Rule of thumb: Exactly one Aggregate Root modified per transaction. Use Domain Events for eventual consistency across other aggregates.
@@ -1,12 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "type": "object",
4
- "properties": {
5
- "rules_followed": {
6
- "type": "boolean"
7
- }
8
- },
9
- "required": [
10
- "rules_followed"
11
- ]
12
- }
@@ -1,178 +0,0 @@
1
- # Domain-Driven Design — Patterns & Practices
2
-
3
- ## When to Use DDD
4
-
5
- **Use when:**
6
-
7
- - Complex business logic that goes beyond CRUD
8
- - Multiple domain experts with different vocabularies
9
- - The domain model is the competitive advantage
10
- - Enterprise-grade applications
11
-
12
- **Don't use when:**
13
-
14
- - Simple CRUD applications
15
- - Hackathon/MVP (overkill)
16
- - No domain expert available
17
-
18
- ## Strategic Design
19
-
20
- ### Bounded Contexts
21
-
22
- The single most important DDD concept. A Bounded Context is a boundary within which a particular model is defined and applicable.
23
-
24
- **Example — E-Commerce:**
25
-
26
- ```
27
- [Order Context] [Payment Context] [Shipping Context]
28
- - Order - Payment - Shipment
29
- - OrderItem - Transaction - TrackingNumber
30
- - Customer (ref) - Refund - Address
31
- - Address (value) - Invoice - Carrier
32
- ```
33
-
34
- `Customer` means different things in each context:
35
-
36
- - Order Context: name, email, shipping preference
37
- - Payment Context: billing info, payment methods
38
- - Support Context: ticket history, satisfaction score
39
-
40
- ### Context Map
41
-
42
- ```
43
- [Order] ←→ [Payment] # Partnership
44
- [Order] → [Shipping] # Customer-Supplier
45
- [Order] → [Legacy CRM] # Anti-Corruption Layer
46
- ```
47
-
48
- ## Tactical Design
49
-
50
- ### Entities
51
-
52
- Objects with identity. Two entities with the same attributes but different IDs are different.
53
-
54
- ```typescript
55
- class User {
56
- readonly id: UserId;
57
- name: string;
58
- email: Email; // Value Object
59
- }
60
- ```
61
-
62
- ### Value Objects
63
-
64
- Objects defined by their attributes, not identity. Immutable.
65
-
66
- ```typescript
67
- class Email {
68
- constructor(readonly value: string) {
69
- if (!isValidEmail(value)) throw new InvalidEmailError(value);
70
- }
71
- equals(other: Email): boolean {
72
- return this.value === other.value;
73
- }
74
- }
75
- ```
76
-
77
- ### Aggregates
78
-
79
- A cluster of entities and value objects with a single root entity (Aggregate Root). All access goes through the root.
80
-
81
- ```typescript
82
- class Order { // Aggregate Root
83
- private items: OrderItem[] = [];
84
-
85
- addItem(product: ProductRef, quantity: number): void {
86
- // Business logic HERE, not in a service
87
- if (quantity <= 0) throw new InvalidQuantityError();
88
- this.items.push(new OrderItem(product, quantity));
89
- }
90
-
91
- get total(): Money {
92
- return this.items.reduce((sum, item) => sum.add(item.subtotal), Money.zero());
93
- }
94
- }
95
- ```
96
-
97
- **Aggregate Rules:**
98
-
99
- 1. Reference other aggregates by ID only
100
- 2. One aggregate per transaction
101
- 3. Eventual consistency between aggregates
102
-
103
- ### Domain Events
104
-
105
- Something that happened in the domain that domain experts care about.
106
-
107
- ```typescript
108
- class OrderPlaced implements DomainEvent {
109
- constructor(
110
- readonly orderId: OrderId,
111
- readonly customerId: CustomerId,
112
- readonly total: Money,
113
- readonly occurredAt: Date
114
- ) {}
115
- }
116
- ```
117
-
118
- ### Domain Services
119
-
120
- Business logic that doesn't naturally belong to an entity or value object.
121
-
122
- ```typescript
123
- class PricingService {
124
- calculatePrice(order: Order, customer: Customer, promotions: Promotion[]): Money {
125
- // Complex pricing logic involving multiple aggregates
126
- }
127
- }
128
- ```
129
-
130
- ### Repositories
131
-
132
- Abstraction over data access. One repository per aggregate root.
133
-
134
- ```typescript
135
- interface OrderRepository {
136
- findById(id: OrderId): Promise<Order | null>;
137
- save(order: Order): Promise<void>;
138
- delete(id: OrderId): Promise<void>;
139
- }
140
- ```
141
-
142
- ## Directory Structure (DDD)
143
-
144
- ```
145
- src/
146
- ├── modules/
147
- │ └── orders/ # Bounded Context
148
- │ ├── domain/
149
- │ │ ├── entities/
150
- │ │ │ └── order.ts # Aggregate Root
151
- │ │ ├── value-objects/
152
- │ │ │ └── money.ts
153
- │ │ ├── events/
154
- │ │ │ └── order-placed.ts
155
- │ │ ├── services/
156
- │ │ │ └── pricing.ts
157
- │ │ └── repositories/
158
- │ │ └── order.repository.ts # Interface
159
- │ ├── application/
160
- │ │ ├── commands/
161
- │ │ │ └── place-order.ts
162
- │ │ ├── queries/
163
- │ │ │ └── get-order.ts
164
- │ │ └── handlers/
165
- │ │ └── place-order.handler.ts
166
- │ └── infrastructure/
167
- │ ├── persistence/
168
- │ │ └── order.repository.impl.ts # Implementation
169
- │ └── api/
170
- │ └── orders.controller.ts
171
- ```
172
-
173
- ## Anti-Patterns
174
-
175
- - [FAIL] Anemic domain model — entities with only getters/setters, all logic in services
176
- - [FAIL] Big aggregate — aggregates should be small, focused on invariants
177
- - [FAIL] Cross-aggregate transactions — use eventual consistency
178
- - [FAIL] DDD everywhere — use DDD only where complexity justifies it
@@ -1,17 +0,0 @@
1
- id: ddd
2
- name: Domain-Driven Design
3
- category: architecture
4
- type: instruction-only
5
- tags: [architecture, ddd, domain, bounded-context, aggregate]
6
- requires: []
7
- optional: [microservices, system-design]
8
- conflicts: []
9
- weight: 6
10
- documents:
11
- - ddd.md
12
- resources:
13
- - EXAMPLES.md
14
- - SKILL.md
15
- - TROUBLESHOOTING.md
16
- - VALIDATION.json
17
- - ddd.md
@@ -1,35 +0,0 @@
1
- # decisions Examples — Anti-patterns vs ContextOS Standard
2
-
3
- ## Example 1: Documenting Tech Choices
4
-
5
- ### Anti-pattern: Tribal Knowledge & Undocumented Decisions
6
-
7
- ```text
8
- "We switched to Redis for session storage last month because Dan said so on Slack."
9
- Three months later, Dan leaves and nobody knows why the config is set up this way.
10
- ```
11
-
12
- ### Best practice: ContextOS Standard (MADR Architecture Decision Record)
13
-
14
- ```markdown
15
- # ADR 0003: Use Redis for Distributed Session Storage
16
-
17
- ## Context and Problem Statement
18
- Our application is transitioning from a single server to horizontally auto-scaled instances.
19
- Sticky sessions on load balancer cause uneven distribution and drop sessions on node recycling.
20
-
21
- ## Considered Options
22
- 1. PostgreSQL session table
23
- 2. Redis cluster
24
- 3. JWT stateless tokens in cookies
25
-
26
- ## Decision Outcome
27
- Chosen option: "Redis cluster", because:
28
- - Sub-millisecond read/write latency compared to relational DB queries.
29
- - Built-in TTL automatically handles session expiration without cron cleanup.
30
- - Avoids security risks of client-stored JWT revocation.
31
-
32
- ## Consequences
33
- - Positive: Stateless web tier, zero session drops on deployment.
34
- - Negative: Adds operational dependency on Redis cluster infrastructure.
35
- ```
@@ -1,90 +0,0 @@
1
- ---
2
- name: decision-engine
3
- description: >
4
- Architecture Decision Records (ADR) management. Creates, tracks, and queries
5
- decisions so the AI agent understands WHY choices were made, not just WHAT was chosen.
6
- ---
7
-
8
- # decision-engine
9
-
10
- ## Overview
11
-
12
- Architecture Decision Record (ADR) system following Michael Nygard format. Captures context, options considered, tradeoffs, and consequences to prevent architectural regression and knowledge loss across AI sessions.
13
-
14
- ## When to Use
15
-
16
- Activate when choosing or switching database engines, authentication strategies, state libraries, or significant architectural patterns.
17
-
18
- ## Rules & Patterns
19
-
20
- You manage **Architecture Decision Records** (ADRs).
21
-
22
- ## Why Decisions Matter
23
-
24
- Without ADRs, the AI agent sees:
25
-
26
- - "Database: PostgreSQL" — but doesn't know WHY
27
- - "Auth: JWT" — but doesn't know what alternatives were considered
28
- - "Framework: Next.js" — but doesn't know the tradeoffs
29
-
30
- With ADRs, the agent understands the reasoning and won't accidentally contradict prior decisions.
31
-
32
- ## Commands
33
-
34
- ### Create a Decision
35
-
36
- When an architectural choice is made during any pipeline stage:
37
-
38
- 1. Auto-increment the decision number
39
- 2. Use the template from `generators/templates/DECISION.md`
40
- 3. Save to `docs/decisions/NNNN-decision-name.md`
41
- 4. Update the Project Graph if the decision affects modules
42
-
43
- **Naming convention:** `docs/decisions/0001-use-postgresql.md`
44
-
45
- ### Query Decisions
46
-
47
- Before making changes that touch architecture:
48
-
49
- 1. Check `docs/decisions/` for related decisions
50
- 2. If a decision exists, follow it
51
- 3. If a decision needs to change, create a new ADR that **supersedes** the old one
52
-
53
- ### Decision Lifecycle
54
-
55
- ```
56
- proposed → accepted → [deprecated | superseded]
57
- ```
58
-
59
- - **proposed**: Under discussion, not yet committed
60
- - **accepted**: The team agreed, this is the standard
61
- - **deprecated**: No longer relevant (project evolved)
62
- - **superseded**: Replaced by a newer decision (link to it)
63
-
64
- ## Auto-Detection
65
-
66
- The Decision Engine should suggest creating an ADR when it detects:
67
-
68
- - A new database/ORM is introduced
69
- - A new framework is added
70
- - Authentication strategy changes
71
- - API versioning approach is chosen
72
- - Deployment strategy is decided
73
- - A significant library is added (state management, testing framework, etc.)
74
-
75
-
76
- ## Code Examples
77
-
78
- See `EXAMPLES.md` for detailed code examples.
79
-
80
- ## Validation Checklist
81
-
82
- What to verify during the review phase before completing the task.
83
-
84
- ## Common Mistakes
85
-
86
- Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
87
-
88
- ## Integration Notes
89
-
90
- How this skill interacts with other skills.
@@ -1,13 +0,0 @@
1
- # decisions Troubleshooting & Common Mistakes
2
-
3
- ## 1. Post-Hoc Justifications
4
-
5
- - **Symptom**: ADR written weeks after code is merged, omitting all rejected options.
6
- - **Root Cause**: Treating ADRs as paperwork rather than decision-making tools.
7
- - **Fix**: Write the ADR during the PLAN phase _before_ implementing the decision.
8
-
9
- ## 2. Omitting Trade-offs
10
-
11
- - **Symptom**: ADR lists only benefits, claiming the chosen tech has zero downsides.
12
- - **Root Cause**: Confirmation bias.
13
- - **Fix**: Every architecture decision has costs. Explicitly document negative trade-offs and operational overhead.
@@ -1,12 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "type": "object",
4
- "properties": {
5
- "rules_followed": {
6
- "type": "boolean"
7
- }
8
- },
9
- "required": [
10
- "rules_followed"
11
- ]
12
- }
@@ -1,16 +0,0 @@
1
- name: decisions
2
- type: instruction-only
3
- description: >
4
- Architecture Decision Records (ADR) management. Creates, tracks, and queries
5
- architectural decisions so AI assistants understand why choices were made.
6
- tags:
7
- - architecture
8
- - adr
9
- - decisions
10
- - documentation
11
- version: 1.0.0
12
- resources:
13
- - EXAMPLES.md
14
- - SKILL.md
15
- - TROUBLESHOOTING.md
16
- - VALIDATION.json
@@ -1,56 +0,0 @@
1
- # Docker Examples — Anti-patterns vs ContextOS Standard
2
-
3
- ## Example 1: Multi-Stage Build & Layer Caching
4
-
5
- ### Anti-pattern: Anti-pattern (Fat single-stage image running as root)
6
-
7
- ```dockerfile
8
- # BAD: 1.2GB image, runs as root, breaks caching on every file edit
9
- FROM node:latest
10
- WORKDIR /app
11
- COPY . .
12
- RUN npm install
13
- RUN npm run build
14
- EXPOSE 3000
15
- CMD ["npm", "start"]
16
- ```
17
-
18
- ### Best practice: ContextOS Standard (Slim multi-stage build with non-root user)
19
-
20
- ```dockerfile
21
- # GOOD: 95MB image, non-root user, optimized layer caching
22
- FROM node:20.12.2-alpine3.19 AS builder
23
- WORKDIR /app
24
- COPY package.json package-lock.json ./
25
- RUN npm ci
26
- COPY . .
27
- RUN npm run build && npm prune --production
28
-
29
- FROM node:20.12.2-alpine3.19 AS runner
30
- WORKDIR /app
31
- ENV NODE_ENV=production
32
- RUN addgroup -S -g 1001 appgroup && adduser -S -u 1001 appuser -G appgroup
33
- COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
34
- COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
35
- USER appuser
36
- CMD ["node", "dist/main.js"]
37
- ```
38
-
39
- ---
40
-
41
- ## Example 2: Docker Ignore File (`.dockerignore`)
42
-
43
- ### Best practice: ContextOS Standard `.dockerignore`
44
-
45
- ```gitignore
46
- node_modules
47
- npm-debug.log
48
- .git
49
- .gitignore
50
- .env
51
- .env.*
52
- dist
53
- coverage
54
- .DS_Store
55
- *.md
56
- ```