contextos-agents 1.7.0 → 2.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/.agents/AGENTS.md +16 -50
  2. package/.agents/adapters/aider/export.js +117 -99
  3. package/.agents/adapters/claude/export.js +68 -26
  4. package/.agents/adapters/copilot/export.js +90 -53
  5. package/.agents/adapters/cursor/export.js +100 -104
  6. package/.agents/adapters/drift-detector.js +196 -0
  7. package/.agents/adapters/gemini/export.js +76 -45
  8. package/.agents/adapters/pure-compiler.js +443 -0
  9. package/.agents/adapters/zed/export.js +104 -96
  10. package/.agents/compiled/registry.v2.json +504 -0
  11. package/.agents/compiled/registry.v2.sha256 +1 -0
  12. package/.agents/compiler/manifest-compiler.js +963 -0
  13. package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
  14. package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
  15. package/.agents/compiler/vendor/yaml.js +139 -0
  16. package/.agents/core/profiles/init.yaml +25 -0
  17. package/.agents/core/skills/context-manager/skill.yaml +3 -5
  18. package/.agents/core/skills/context-os/SKILL.md +3 -6
  19. package/.agents/core/skills/context-os/skill.yaml +3 -8
  20. package/.agents/core/skills/engineering-workflow/skill.yaml +1 -7
  21. package/.agents/core/skills/gemini-precision/skill.yaml +1 -6
  22. package/.agents/core/skills/gstack-roles/skill.yaml +3 -6
  23. package/.agents/core/skills/ponytail-mindset/skill.yaml +1 -7
  24. package/.agents/core/skills/security/skill.yaml +15 -3
  25. package/.agents/ctx.js +537 -112
  26. package/.agents/customization-dx.js +282 -0
  27. package/.agents/doctor.js +855 -66
  28. package/.agents/filesystem/index.js +71 -0
  29. package/.agents/filesystem/journaled-transaction.js +451 -0
  30. package/.agents/filesystem/lockfile-v2.js +275 -0
  31. package/.agents/filesystem/platform-hardening.js +222 -0
  32. package/.agents/filesystem/project-lock.js +218 -0
  33. package/.agents/filesystem/safe-path.js +256 -0
  34. package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
  35. package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
  36. package/.agents/plugins/contextos/plugin.json +1 -1
  37. package/.agents/plugins.js +278 -64
  38. package/.agents/profiles.js +486 -51
  39. package/.agents/resolver/canonical-resolver.js +1348 -0
  40. package/.agents/resolver.js +50 -534
  41. package/.agents/rules/rule-catalog.js +525 -0
  42. package/.agents/schemas/attestation.review.v1.json +111 -0
  43. package/.agents/schemas/attestation.verification.v1.json +85 -0
  44. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  45. package/.agents/schemas/profile.v2.schema.json +114 -0
  46. package/.agents/schemas/runtime.thread.v1.json +192 -0
  47. package/.agents/schemas/skill.manifest.v2.json +177 -0
  48. package/.agents/schemas/verification.spec.v1.json +39 -0
  49. package/.agents/schemas/workspace.graph.schema.json +106 -0
  50. package/.agents/skills-index.json +6 -166
  51. package/.agents/stats.js +9 -9
  52. package/.agents/transaction-core/event-store.js +288 -0
  53. package/.agents/transaction-core/idempotency.js +129 -0
  54. package/.agents/transaction-core/ipc-lock.js +311 -0
  55. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  56. package/.agents/validate.js +44 -1
  57. package/.agents/watch.js +354 -102
  58. package/.agents/workspace/workspace-graph.js +778 -0
  59. package/README.md +59 -387
  60. package/benchmarks/v2/analysis/statistics.js +140 -0
  61. package/benchmarks/v2/analysis/stats.js +69 -0
  62. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  63. package/benchmarks/v2/dataset.schema.json +34 -0
  64. package/benchmarks/v2/evaluators/index.js +25 -0
  65. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  66. package/benchmarks/v2/harness/runner.js +88 -0
  67. package/benchmarks/v2/pilot-tasks.json +392 -0
  68. package/bin/commands/recover.js +88 -0
  69. package/bin/commands/update.js +80 -17
  70. package/bin/commands.js +62 -25
  71. package/bin/index.js +138 -81
  72. package/bin/lib/lockfile.js +5 -3
  73. package/bin/lib/safe-writer.js +34 -3
  74. package/package.json +87 -72
  75. package/registry.json +2 -2
  76. package/registry.v2.schema.json +86 -0
  77. package/.agents/core/profiles/backend.yaml +0 -47
  78. package/.agents/core/profiles/enterprise.yaml +0 -46
  79. package/.agents/core/profiles/frontend.yaml +0 -46
  80. package/.agents/core/profiles/hackathon.yaml +0 -45
  81. package/.agents/core/profiles/mvp.yaml +0 -44
  82. package/.agents/core/profiles/startup.yaml +0 -48
  83. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  84. package/.agents/core/skills/adapters/SKILL.md +0 -105
  85. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  86. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  87. package/.agents/core/skills/adapters/skill.yaml +0 -16
  88. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  89. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  90. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -12
  91. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  92. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  93. package/.agents/core/skills/brutalist-design/skill.yaml +0 -12
  94. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  95. package/.agents/core/skills/database/SKILL.md +0 -101
  96. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  97. package/.agents/core/skills/database/VALIDATION.json +0 -11
  98. package/.agents/core/skills/database/skill.yaml +0 -31
  99. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  100. package/.agents/core/skills/ddd/SKILL.md +0 -247
  101. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  102. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  103. package/.agents/core/skills/ddd/ddd.md +0 -178
  104. package/.agents/core/skills/ddd/skill.yaml +0 -17
  105. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  106. package/.agents/core/skills/decisions/SKILL.md +0 -90
  107. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  108. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  109. package/.agents/core/skills/decisions/skill.yaml +0 -16
  110. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  111. package/.agents/core/skills/docker/SKILL.md +0 -63
  112. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  113. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  114. package/.agents/core/skills/docker/skill.yaml +0 -29
  115. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  116. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  117. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  118. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  119. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  120. package/.agents/core/skills/fastapi/skill.yaml +0 -17
  121. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  122. package/.agents/core/skills/generators/SKILL.md +0 -112
  123. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  124. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  125. package/.agents/core/skills/generators/skill.yaml +0 -25
  126. package/.agents/core/skills/generators/templates/API.md +0 -77
  127. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  128. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  129. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  130. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  131. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  132. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  133. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  134. package/.agents/core/skills/generators/templates/UI.md +0 -73
  135. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  136. package/.agents/core/skills/graphify/SKILL.md +0 -130
  137. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  138. package/.agents/core/skills/graphify/skill.yaml +0 -18
  139. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  140. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  141. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  142. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  143. package/.agents/core/skills/impeccable-design/skill.yaml +0 -20
  144. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  145. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  146. package/.agents/core/skills/interview-me/skill.yaml +0 -12
  147. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  148. package/.agents/core/skills/microservices/SKILL.md +0 -164
  149. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  150. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  151. package/.agents/core/skills/microservices/microservices.md +0 -119
  152. package/.agents/core/skills/microservices/skill.yaml +0 -17
  153. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  154. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  155. package/.agents/core/skills/minimalist-design/skill.yaml +0 -12
  156. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  157. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  158. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  159. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  160. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  161. package/.agents/core/skills/nestjs/skill.yaml +0 -17
  162. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  163. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  164. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  165. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  166. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  167. package/.agents/core/skills/nextjs/skill.yaml +0 -17
  168. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  169. package/.agents/core/skills/node/SKILL.md +0 -128
  170. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  171. package/.agents/core/skills/node/VALIDATION.json +0 -12
  172. package/.agents/core/skills/node/node.md +0 -87
  173. package/.agents/core/skills/node/skill.yaml +0 -17
  174. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  175. package/.agents/core/skills/performance/SKILL.md +0 -75
  176. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  177. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  178. package/.agents/core/skills/performance/performance.md +0 -52
  179. package/.agents/core/skills/performance/skill.yaml +0 -17
  180. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  181. package/.agents/core/skills/react/SKILL.md +0 -132
  182. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  183. package/.agents/core/skills/react/VALIDATION.json +0 -12
  184. package/.agents/core/skills/react/react.md +0 -93
  185. package/.agents/core/skills/react/skill.yaml +0 -17
  186. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  187. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  188. package/.agents/core/skills/react-best-practices/skill.yaml +0 -14
  189. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  190. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  191. package/.agents/core/skills/redesign-audit/skill.yaml +0 -12
  192. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  193. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  194. package/.agents/core/skills/soft-design/skill.yaml +0 -12
  195. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  196. package/.agents/core/skills/state-management/SKILL.md +0 -48
  197. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  198. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  199. package/.agents/core/skills/state-management/skill.yaml +0 -28
  200. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -117
  201. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  202. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -12
  203. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  204. package/.agents/core/skills/system-design/SKILL.md +0 -419
  205. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  206. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  207. package/.agents/core/skills/system-design/skill.yaml +0 -20
  208. package/.agents/core/skills/system-design/system-design.md +0 -112
  209. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  210. package/.agents/core/skills/testing/SKILL.md +0 -70
  211. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  212. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  213. package/.agents/core/skills/testing/skill.yaml +0 -32
  214. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  215. package/.agents/core/skills/typescript/SKILL.md +0 -112
  216. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  217. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  218. package/.agents/core/skills/typescript/skill.yaml +0 -17
  219. package/.agents/core/skills/typescript/typescript.md +0 -71
  220. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  221. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  222. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  223. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  224. package/.agents/core/skills/ui-design/skill.yaml +0 -17
  225. package/.agents/core/skills/ui-design/ui.md +0 -88
  226. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  227. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  228. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  229. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  230. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -19
  231. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  232. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  233. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  234. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  235. package/.agents/core/skills/ux-design/skill.yaml +0 -17
  236. package/.agents/core/skills/ux-design/ux.md +0 -80
  237. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  238. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  239. package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +0 -131
  240. package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +0 -142
  241. package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +0 -143
  242. package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +0 -174
  243. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -18
  244. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  245. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  246. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  247. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  248. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  249. package/.agents/core/skills/web-accessibility/skill.yaml +0 -17
  250. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  251. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  252. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  253. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  254. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  255. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  256. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  257. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  258. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  259. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  260. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  261. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  262. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  263. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  264. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  265. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  266. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  267. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  268. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  269. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  270. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  271. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  272. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  273. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -110
  274. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  275. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  276. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  277. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  278. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  279. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  280. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  281. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  282. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  283. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  284. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  285. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  286. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  287. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  288. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  289. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  290. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  291. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  292. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  293. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  294. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  295. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  296. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  297. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  298. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  299. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  300. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  301. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  302. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  303. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  304. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  305. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -116
  306. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  307. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  308. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  309. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  310. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  311. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  312. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  313. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
@@ -1,200 +0,0 @@
1
- # FastAPI
2
-
3
- ## Overview
4
-
5
- High-performance Python backend engineering using FastAPI, Pydantic v2, and async SQLAlchemy/Tortoise ORM. Enforces type-driven request validation, OpenAPI contracts, and async non-blocking endpoints.
6
-
7
- ## When to Use
8
-
9
- Activate when building Python REST APIs, microservices, asynchronous background jobs, or integrating Python ML services into web backends.
10
-
11
- ## Rules & Patterns
12
- <!-- Source: fastapi.md -->
13
-
14
- ## FastAPI — Best Practices
15
-
16
- ## Project Structure
17
-
18
- ```
19
- app/
20
- ├── main.py # App entry, CORS, middleware
21
- ├── config.py # Settings with Pydantic BaseSettings
22
- ├── database.py # Database session, engine
23
- ├── models/ # SQLAlchemy models
24
- │ ├── __init__.py
25
- │ └── user.py
26
- ├── schemas/ # Pydantic schemas (request/response)
27
- │ ├── __init__.py
28
- │ └── user.py
29
- ├── api/ # Route handlers
30
- │ ├── __init__.py
31
- │ ├── deps.py # Dependency injection
32
- │ └── v1/
33
- │ ├── __init__.py
34
- │ └── users.py
35
- ├── services/ # Business logic
36
- │ └── user_service.py
37
- ├── repositories/ # Database access
38
- │ └── user_repo.py
39
- └── tests/
40
- └── test_users.py
41
- ```
42
-
43
- ## Pydantic Models
44
-
45
- ```python
46
- from pydantic import BaseModel, EmailStr, Field
47
-
48
- class UserCreate(BaseModel):
49
- email: EmailStr
50
- name: str = Field(..., min_length=1, max_length=100)
51
-
52
- class UserResponse(BaseModel):
53
- id: int
54
- email: str
55
- name: str
56
-
57
- model_config = ConfigDict(from_attributes=True)
58
- ```
59
-
60
- ## Dependency Injection
61
-
62
- ```python
63
- from fastapi import Depends
64
- from sqlalchemy.ext.asyncio import AsyncSession
65
-
66
- async def get_db() -> AsyncGenerator[AsyncSession, None]:
67
- async with async_session() as session:
68
- yield session
69
-
70
- async def get_current_user(
71
- token: str = Depends(oauth2_scheme),
72
- db: AsyncSession = Depends(get_db)
73
- ) -> User:
74
- # Verify token, return user
75
- ...
76
- ```
77
-
78
- ## Async
79
-
80
- - **Use async** for all I/O operations (database, HTTP calls, file I/O)
81
- - **Never block the event loop** — no sync I/O in async endpoints
82
- - **Use `asyncio.gather`** for parallel async operations
83
- - **Background tasks** — `BackgroundTasks` for non-critical work
84
-
85
- ## Error Handling
86
-
87
- ```python
88
- from fastapi import HTTPException
89
-
90
- class AppException(HTTPException):
91
- def __init__(self, status_code: int, detail: str, code: str):
92
- super().__init__(status_code=status_code, detail=detail)
93
- self.code = code
94
- ```
95
-
96
- ## Security
97
-
98
- - **OAuth2 with JWT** — use `python-jose`
99
- - **Password hashing** — bcrypt via `passlib`
100
- - **CORS** — configure explicitly
101
- - **Rate limiting** — use `slowapi`
102
- - **Input validation** — Pydantic handles this automatically
103
-
104
- ## Testing
105
-
106
- ```python
107
- import pytest
108
- from httpx import AsyncClient
109
-
110
- @pytest.mark.asyncio
111
- async def test_create_user(client: AsyncClient):
112
- response = await client.post("/api/v1/users", json={
113
- "email": "test@example.com",
114
- "name": "Test User"
115
- })
116
- assert response.status_code == 201
117
- ```
118
-
119
- ## Anti-Patterns
120
-
121
- - [FAIL] Business logic in route handlers — use services
122
- - [FAIL] Raw SQL without ORM — use SQLAlchemy
123
- - [FAIL] Sync database calls — use async drivers
124
- - [FAIL] Hardcoded settings — use Pydantic BaseSettings
125
- - [FAIL] No schema validation — always use Pydantic models
126
-
127
-
128
- ## Code Examples
129
-
130
- See `EXAMPLES.md` for detailed code examples.
131
-
132
- ## Validation Checklist
133
-
134
- What to verify during the review phase before completing the task.
135
-
136
- ## Common Mistakes
137
-
138
- Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
139
-
140
- ## Integration Notes
141
-
142
- How this skill interacts with other skills.
143
-
144
-
145
- # fastapi Examples — Anti-patterns vs ContextOS Standard
146
-
147
- ## Example 1: Asynchronous Route Handlers
148
-
149
- ### Anti-pattern: Blocking I/O inside `async def`
150
-
151
- ```python
152
- # BAD: time.sleep or synchronous requests blocks the entire asyncio event loop!
153
- import time
154
- import requests
155
-
156
- @app.get("/slow")
157
- async def slow_route():
158
- time.sleep(5) # BLOCKS ALL CONCURRENT USERS!
159
- return {"status": "done"}
160
- ```
161
-
162
- ### Best practice: ContextOS Standard (Non-blocking Async or Def Offload)
163
-
164
- ```python
165
- # GOOD: Use async non-blocking client (httpx) or standard def for sync CPU work
166
- import asyncio
167
- import httpx
168
-
169
- @app.get("/fast")
170
- async def fast_route():
171
- async with httpx.AsyncClient() as client:
172
- response = await client.get("https://api.example.com/data")
173
- return response.json()
174
-
175
- # Or standard def (FastAPI automatically runs it in a background threadpool):
176
- @app.get("/sync-worker")
177
- def sync_worker():
178
- time.sleep(5) # Runs in worker thread without blocking event loop
179
- return {"status": "done"}
180
- ```
181
-
182
- # fastapi Troubleshooting & Common Mistakes
183
-
184
- ## 1. Pydantic v1 vs v2 Deprecations
185
-
186
- - **Symptom**: Warnings or crashes regarding @validator or .dict() methods.
187
- - **Root Cause**: FastAPI projects upgrading to Pydantic v2.
188
- - **Fix**: Use @field_validator instead of @validator, and .model_dump() instead of .dict().
189
-
190
- ## 2. Database Session Leaks
191
-
192
- - **Symptom**: Database pool runs out of connections after a few requests.
193
- - **Root Cause**: Database sessions opened manually without proper try...finally or dependency injection.
194
- - **Fix**: Always provide database sessions via Depends(get_db) with a yield block.
195
-
196
- ## 3. Unhandled Validation Errors Returning Inconsistent JSON
197
-
198
- - **Symptom**: Frontend receives raw 422 arrays without matching standard API error response envelope.
199
- - **Root Cause**: Missing custom RequestValidationError handler.
200
- - **Fix**: Register an app-level exception handler for RequestValidationError that normalizes error shapes.
@@ -1,133 +0,0 @@
1
- # document-generator
2
-
3
- ## Overview
4
-
5
- Automated technical documentation generator. Transforms initial project ideas and specs into comprehensive PRDs, architecture schemas, API contracts, database ERDs, and roadmap task breakdowns.
6
-
7
- ## When to Use
8
-
9
- Activate during project kickoff (ctx init), new service scaffolding, or when generating baseline technical specs from high-level user requirements.
10
-
11
- ## Rules & Patterns
12
-
13
- You generate project documentation from a user's idea. Use the templates in `templates/` as the structure for each document.
14
-
15
- ## Commands
16
-
17
- ### `ctx init`
18
-
19
- Full project initialization. From one user prompt, generate ALL documents:
20
-
21
- 1. Ask clarifying questions (see Context OS SKILL.md)
22
- 2. Select profile and skill pack
23
- 3. Generate documents in this order:
24
- - `docs/PRD.md` — Product Requirements (from template)
25
- - `docs/ARCHITECTURE.md` — System Architecture
26
- - `docs/DATABASE.md` — Database Schema
27
- - `docs/API.md` — API Specification
28
- - `docs/UI.md` — UI/UX Specification
29
- - `docs/ROADMAP.md` — Development Roadmap
30
- - `docs/TASKS.md` — Task Breakdown
31
- - `docs/PROJECT_GRAPH.md` — Project Graph
32
- 4. Create `docs/decisions/` directory for future ADRs
33
- 5. Generate agent config via Adapters skill
34
-
35
- ### `ctx update`
36
-
37
- Incremental update. When requirements change:
38
-
39
- 1. Identify which documents are affected
40
- 2. Update only affected documents
41
- 3. Show diff of changes
42
- 4. Ask user to confirm
43
- 5. Update Project Graph if structure changed
44
-
45
- ### `ctx plan`
46
-
47
- Generate development plan from existing PRD:
48
-
49
- 1. Read `docs/PRD.md`
50
- 2. Break into modules (Project Graph)
51
- 3. Break modules into features
52
- 4. Break features into tasks
53
- 5. Estimate complexity (S/M/L/XL)
54
- 6. Output to `docs/TASKS.md`
55
-
56
- ## Template Usage
57
-
58
- Each template contains:
59
-
60
- - **Section headers** — required sections for the document
61
- - **Placeholder prompts** — `{{description}}` markers that guide content generation
62
- - **Examples** — sample content to illustrate the expected format
63
- - **Validation rules** — what must be present for the document to be valid
64
-
65
- When generating a document:
66
-
67
- 1. Read the template
68
- 2. Fill in each section based on the user's idea and clarifying answers
69
- 3. Replace all `{{placeholders}}` with real content
70
- 4. Remove the template comments (lines starting with `<!-- -->`)
71
- 5. Validate: ensure all required sections are present
72
-
73
- ## Document Dependencies
74
-
75
- ```
76
- PRD.md
77
- ├── ARCHITECTURE.md
78
- │ ├── DATABASE.md
79
- │ ├── API.md
80
- │ └── DEPLOYMENT.md
81
- ├── UI.md
82
- ├── ROADMAP.md
83
- │ └── TASKS.md
84
- └── PROJECT_GRAPH.md
85
- ```
86
-
87
- When updating a parent document, check if child documents need updates too.
88
-
89
-
90
- ## Code Examples
91
-
92
- See `EXAMPLES.md` for detailed code examples.
93
-
94
- ## Validation Checklist
95
-
96
- What to verify during the review phase before completing the task.
97
-
98
- ## Common Mistakes
99
-
100
- Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
101
-
102
- ## Integration Notes
103
-
104
- How this skill interacts with other skills.
105
-
106
-
107
- # generators Examples — Anti-patterns vs ContextOS Standard
108
-
109
- ## Example 1: Technical Documentation Generation
110
-
111
- ### Anti-pattern: Scaffolding from Scratch Without Templates
112
-
113
- ```text
114
- Agent drafts a 2-paragraph "architecture overview" missing databases, security, and hosting models.
115
- ```
116
-
117
- ### Best practice: ContextOS Standard (ctx init Template Generation)
118
-
119
- ```text
120
- Generates complete engineering suite:
121
- - PRD.md (User personas, in-scope, out-of-scope, acceptance criteria)
122
- - ARCHITECTURE.md (C4 model, data flow, scaling boundaries)
123
- - DATABASE.md (ERD, indexing strategy, migration plans)
124
- - API.md (OpenAPI 3.1 endpoints, error codes, authentication)
125
- ```
126
-
127
- # generators Troubleshooting & Common Mistakes
128
-
129
- ## 1. Generic Boilerplate Generation
130
-
131
- - **Symptom**: Generated documentation contains placeholders like [Insert DB Name here].
132
- - **Root Cause**: Generating docs before clarifying core project constraints.
133
- - **Fix**: Run the interview-me protocol before generating technical documentation.
@@ -1,198 +0,0 @@
1
- # graphify
2
-
3
- ## Overview
4
-
5
- **Graphify** is an instruction-only codebase mapping and context optimization guide. Instead of feeding raw directory trees or entire source files into an agent's context window, Graphify instructs agents on how to construct a deterministic, queryable knowledge graph (`graph.json`, `GRAPH_REPORT.md`, `graph.html`) using external companion analyzers (such as the TypeScript AST analyzer in `contextos-mcp` or the external `graphifyy` CLI), keeping the core package 100% zero-dependency without bundled native Tree-sitter binaries.
6
-
7
- This skill instructs agents how to build, query, and maintain codebase graphs to navigate complex architectures with near-zero token overhead.
8
-
9
- ## When to Use
10
-
11
- Activate whenever:
12
-
13
- - Working in large repositories (10k+ LOC) where full-file reads cause context overflow.
14
- - Performing cross-module refactorings and needing to determine exact dependency **blast radius**.
15
- - Onboarding onto an unfamiliar codebase or mapping legacy service boundaries.
16
- - The user asks to "map the codebase", "show dependency graph", "find central components", or "run graphify".
17
- - Working alongside `context-manager` to supply an automated `PROJECT_GRAPH.md` / `graph.json`.
18
-
19
- ## Rules & Patterns
20
-
21
- ### 1. The Graph-First Navigation Protocol
22
-
23
- Before opening and reading arbitrary source files in a large project:
24
-
25
- 1. **Check for Existing Artifacts**:
26
- - Inspect if `graph.json` or `GRAPH_REPORT.md` exists in the project root or `.graphify/`.
27
- - If present, query `graph.json` or read `GRAPH_REPORT.md` first to locate target modules.
28
- 2. **Deterministic CLI Execution**:
29
- - If missing or stale, generate the graph using the Python package (`pip install graphifyy`):
30
-
31
- ```bash
32
- graphify run .
33
- ```
34
-
35
- - For live development sessions, run in watch mode:
36
-
37
- ```bash
38
- graphify watch .
39
- ```
40
-
41
- 3. **Inspect God Nodes**:
42
- - Always check the "God Nodes" section of `GRAPH_REPORT.md`. These represent high-centrality modules (e.g., core configs, base models, central dispatchers). Changes to god nodes have the highest blast radius.
43
-
44
- ### 2. Context Safety Rules
45
-
46
- - **Never load `graph.html` into agent context**: `graph.html` is an interactive visualization for humans in the browser; reading it burns tokens needlessly.
47
- - **Selective JSON Querying**: Do not dump the entire `graph.json` into prompt context if it exceeds 50KB. Use targeted grep/jq queries to extract specific node neighbors.
48
- - **Git Hygiene**: Add `graph.html` and `.graphify/cache` to `.gitignore`. Keep `GRAPH_REPORT.md` committed only if the team uses it as shared documentation.
49
-
50
- ### 3. Blast Radius Verification
51
-
52
- When modifying a function, class, or interface:
53
-
54
- 1. Locate the symbol's node in `graph.json`.
55
- 2. Extract all inbound edges (`dependents` / `callers`).
56
- 3. Formulate the verification plan specifically around those dependent call sites.
57
-
58
- ---
59
-
60
- ## Code Examples
61
-
62
- ### Installing and Running Graphify
63
-
64
- ```bash
65
- # Install graphify CLI (package name is graphifyy on PyPI)
66
- pip install graphifyy
67
-
68
- # Generate knowledge graph and markdown architectural report
69
- graphify run ./src --output .graphify/
70
-
71
- # View interactive visualization locally
72
- open .graphify/graph.html
73
- ```
74
-
75
- ### Querying Node Dependencies via Shell
76
-
77
- ```bash
78
- # Find dependents of a critical module in graph.json without loading entire file
79
- node -e "
80
- const g = require('./.graphify/graph.json');
81
- const target = 'UserService';
82
- const inbound = g.edges.filter(e => e.target === target).map(e => e.source);
83
- console.log('Modules dependent on ' + target + ':', inbound);
84
- "
85
- ```
86
-
87
- ### Git Pre-Commit Hook Integration
88
-
89
- ```bash
90
- #!/bin/sh
91
- # .git/hooks/pre-commit: ensure GRAPH_REPORT.md remains fresh
92
- if command -v graphify >/dev/null 2>&1; then
93
- graphify run . --report-only
94
- git add GRAPH_REPORT.md
95
- fi
96
- ```
97
-
98
- ---
99
-
100
- ## Validation Checklist
101
-
102
- - [ ] `graph.json` and `GRAPH_REPORT.md` are generated without syntax errors.
103
- - [ ] Central "God Nodes" are identified and accounted for in the implementation plan.
104
- - [ ] No heavy visualization artifacts (`graph.html`, raw SVG dumps) are ingested into agent prompt context.
105
- - [ ] Inbound dependencies (callers) are checked before modifying exported signatures.
106
- - [ ] `.gitignore` properly excludes local graph caches and visualization outputs.
107
-
108
- ---
109
-
110
- ## Common Mistakes
111
-
112
- - **Context Window Flooding**: Ingesting the complete `graph.json` of a 500k LOC repository into agent context instead of slicing target subgraphs.
113
- - **Stale Graph Fallacy**: Assuming `graph.json` is up to date after heavy code refactorings without re-running `graphify run` or using `--watch`.
114
- - **Ignoring Semantic Non-Code Files**: Neglecting SQL migrations, OpenAPI specs, and docker configs during graph extraction.
115
- - **Mistaking Package Name**: Trying to install `pip install graphify` instead of the official PyPI package `graphifyy`.
116
-
117
- ---
118
-
119
- ## Integration Notes
120
-
121
- - **Synergy with `context-manager`**: Graphify serves as the automated backend engine for `context-manager`. Instead of manually maintaining `docs/PROJECT_GRAPH.md`, run Graphify to keep `graph.json` current.
122
- - **Synergy with `system-design`**: Use `GRAPH_REPORT.md` to ground architectural proposals in actual codebase topology.
123
- - **Synergy with `architecture-diagrams`**: The nodes and edges extracted in `graph.json` can be directly mapped into animated SVG C4 architecture diagrams.
124
-
125
-
126
- # Graphify Examples — Anti-patterns vs ContextOS Standard
127
-
128
- ## Example 1: Codebase Exploration & Architecture Mapping
129
-
130
- ### Anti-pattern: Context Window Flooding (Dumping source directories into prompt)
131
-
132
- ```bash
133
- # BAD: Reading 150 TypeScript files into context to understand system architecture.
134
- # Burns 200k+ tokens, causes model hallucinations, and loses attention span.
135
- cat src/**/*.ts | llm "explain the architecture and component connections"
136
- ```
137
-
138
- ### Best practice: ContextOS Standard (Deterministic Tree-sitter AST Graph)
139
-
140
- ```bash
141
- # GOOD: Generate queryable AST knowledge graph and compact architecture summary
142
- graphify run ./src --output .graphify/
143
-
144
- # Inspect high-level architecture and god nodes with minimal tokens (<2k tokens)
145
- cat .graphify/GRAPH_REPORT.md
146
- ```
147
-
148
- ---
149
-
150
- ## Example 2: Refactoring Blast-Radius Analysis
151
-
152
- ### Anti-pattern: String Grep Guesswork
153
-
154
- ```bash
155
- # BAD: Grepping for common symbol names returns hundreds of false positives (comments, logs, unrelated types)
156
- grep -rn "PaymentService" src/
157
- ```
158
-
159
- ### Best practice: ContextOS Standard (Inbound Dependency Traversal via graph.json)
160
-
161
- ```javascript
162
- // GOOD: Precise AST-level callers extracted directly from knowledge graph edges
163
- const fs = require('fs');
164
- const graph = JSON.parse(fs.readFileSync('.graphify/graph.json', 'utf8'));
165
-
166
- const targetNode = 'PaymentService';
167
- const dependents = graph.edges
168
- .filter(edge => edge.target === targetNode && edge.type === 'imports')
169
- .map(edge => edge.source);
170
-
171
- console.log(`Modules directly broken by modifying ${targetNode}:`, dependents);
172
- ```
173
-
174
- ---
175
-
176
- ## Example 3: Keeping Graph Fresh in CI / Pre-commit
177
-
178
- ### Anti-pattern: Relying on Outdated Graphs
179
-
180
- ```bash
181
- # BAD: Developing against a graph generated two months ago.
182
- # Dependencies drift, leading to false safety assumptions.
183
- ```
184
-
185
- ### Best practice: ContextOS Standard (Git Hook & Automated Watch)
186
-
187
- ```bash
188
- # Option A: Active development in watch mode
189
- graphify watch ./src --output .graphify/
190
-
191
- # Option B: Pre-commit hook to verify fresh GRAPH_REPORT.md
192
- #!/bin/sh
193
- # .git/hooks/pre-commit
194
- if command -v graphify >/dev/null 2>&1; then
195
- graphify run ./src --report-only
196
- git add GRAPH_REPORT.md
197
- fi
198
- ```