@djm204/agent-skills 1.0.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 (392) hide show
  1. package/README.md +597 -0
  2. package/bin/cli.js +8 -0
  3. package/package.json +55 -0
  4. package/src/index.js +1817 -0
  5. package/src/index.test.js +1264 -0
  6. package/templates/_shared/code-quality.mdc +52 -0
  7. package/templates/_shared/communication.mdc +43 -0
  8. package/templates/_shared/core-principles.mdc +67 -0
  9. package/templates/_shared/git-workflow.mdc +48 -0
  10. package/templates/_shared/security-fundamentals.mdc +41 -0
  11. package/templates/agents/utility-agent/.cursor/rules/action-control.mdc +71 -0
  12. package/templates/agents/utility-agent/.cursor/rules/context-management.mdc +61 -0
  13. package/templates/agents/utility-agent/.cursor/rules/hallucination-prevention.mdc +58 -0
  14. package/templates/agents/utility-agent/.cursor/rules/overview.mdc +34 -0
  15. package/templates/agents/utility-agent/.cursor/rules/token-optimization.mdc +71 -0
  16. package/templates/agents/utility-agent/CLAUDE.md +513 -0
  17. package/templates/business/market-intelligence/.cursor/rules/data-sources.mdc +62 -0
  18. package/templates/business/market-intelligence/.cursor/rules/overview.mdc +55 -0
  19. package/templates/business/market-intelligence/.cursor/rules/reporting.mdc +59 -0
  20. package/templates/business/market-intelligence/.cursor/rules/risk-signals.mdc +63 -0
  21. package/templates/business/market-intelligence/.cursor/rules/sentiment-analysis.mdc +70 -0
  22. package/templates/business/market-intelligence/.cursor/rules/trend-detection.mdc +72 -0
  23. package/templates/business/market-intelligence/CLAUDE.md +371 -0
  24. package/templates/business/marketing-expert/.cursor/rules/brand-strategy.mdc +74 -0
  25. package/templates/business/marketing-expert/.cursor/rules/campaign-planning.mdc +60 -0
  26. package/templates/business/marketing-expert/.cursor/rules/growth-frameworks.mdc +69 -0
  27. package/templates/business/marketing-expert/.cursor/rules/market-analysis.mdc +70 -0
  28. package/templates/business/marketing-expert/.cursor/rules/marketing-analytics.mdc +71 -0
  29. package/templates/business/marketing-expert/.cursor/rules/overview.mdc +56 -0
  30. package/templates/business/marketing-expert/CLAUDE.md +567 -0
  31. package/templates/business/predictive-maintenance/.cursor/rules/alerting.mdc +56 -0
  32. package/templates/business/predictive-maintenance/.cursor/rules/asset-lifecycle.mdc +71 -0
  33. package/templates/business/predictive-maintenance/.cursor/rules/failure-prediction.mdc +65 -0
  34. package/templates/business/predictive-maintenance/.cursor/rules/maintenance-scheduling.mdc +61 -0
  35. package/templates/business/predictive-maintenance/.cursor/rules/overview.mdc +55 -0
  36. package/templates/business/predictive-maintenance/.cursor/rules/sensor-analytics.mdc +66 -0
  37. package/templates/business/predictive-maintenance/CLAUDE.md +529 -0
  38. package/templates/business/product-manager/.cursor/rules/communication.mdc +77 -0
  39. package/templates/business/product-manager/.cursor/rules/discovery.mdc +79 -0
  40. package/templates/business/product-manager/.cursor/rules/metrics.mdc +75 -0
  41. package/templates/business/product-manager/.cursor/rules/overview.mdc +47 -0
  42. package/templates/business/product-manager/.cursor/rules/prioritization.mdc +66 -0
  43. package/templates/business/product-manager/.cursor/rules/requirements.mdc +79 -0
  44. package/templates/business/product-manager/CLAUDE.md +593 -0
  45. package/templates/business/project-manager/.cursor/rules/overview.mdc +53 -0
  46. package/templates/business/project-manager/.cursor/rules/reporting.mdc +68 -0
  47. package/templates/business/project-manager/.cursor/rules/risk-management.mdc +71 -0
  48. package/templates/business/project-manager/.cursor/rules/scheduling.mdc +67 -0
  49. package/templates/business/project-manager/.cursor/rules/scope-management.mdc +66 -0
  50. package/templates/business/project-manager/.cursor/rules/stakeholder-management.mdc +70 -0
  51. package/templates/business/project-manager/CLAUDE.md +540 -0
  52. package/templates/business/regulatory-sentinel/.cursor/rules/compliance-tracking.mdc +74 -0
  53. package/templates/business/regulatory-sentinel/.cursor/rules/impact-assessment.mdc +62 -0
  54. package/templates/business/regulatory-sentinel/.cursor/rules/monitoring.mdc +67 -0
  55. package/templates/business/regulatory-sentinel/.cursor/rules/overview.mdc +55 -0
  56. package/templates/business/regulatory-sentinel/.cursor/rules/reporting.mdc +61 -0
  57. package/templates/business/regulatory-sentinel/.cursor/rules/risk-classification.mdc +73 -0
  58. package/templates/business/regulatory-sentinel/CLAUDE.md +572 -0
  59. package/templates/business/resource-allocator/.cursor/rules/capacity-modeling.mdc +65 -0
  60. package/templates/business/resource-allocator/.cursor/rules/coordination.mdc +67 -0
  61. package/templates/business/resource-allocator/.cursor/rules/crisis-management.mdc +64 -0
  62. package/templates/business/resource-allocator/.cursor/rules/demand-prediction.mdc +52 -0
  63. package/templates/business/resource-allocator/.cursor/rules/overview.mdc +76 -0
  64. package/templates/business/resource-allocator/.cursor/rules/scheduling.mdc +63 -0
  65. package/templates/business/resource-allocator/CLAUDE.md +525 -0
  66. package/templates/business/strategic-negotiator/.cursor/rules/contract-analysis.mdc +60 -0
  67. package/templates/business/strategic-negotiator/.cursor/rules/deal-structuring.mdc +66 -0
  68. package/templates/business/strategic-negotiator/.cursor/rules/game-theory.mdc +64 -0
  69. package/templates/business/strategic-negotiator/.cursor/rules/overview.mdc +55 -0
  70. package/templates/business/strategic-negotiator/.cursor/rules/preparation.mdc +79 -0
  71. package/templates/business/strategic-negotiator/.cursor/rules/scenario-modeling.mdc +66 -0
  72. package/templates/business/strategic-negotiator/CLAUDE.md +640 -0
  73. package/templates/business/supply-chain/.cursor/rules/cost-modeling.mdc +67 -0
  74. package/templates/business/supply-chain/.cursor/rules/demand-forecasting.mdc +67 -0
  75. package/templates/business/supply-chain/.cursor/rules/inventory-management.mdc +69 -0
  76. package/templates/business/supply-chain/.cursor/rules/logistics.mdc +61 -0
  77. package/templates/business/supply-chain/.cursor/rules/overview.mdc +64 -0
  78. package/templates/business/supply-chain/.cursor/rules/supplier-evaluation.mdc +66 -0
  79. package/templates/business/supply-chain/CLAUDE.md +590 -0
  80. package/templates/business/supply-chain-harmonizer/.cursor/rules/disruption-response.mdc +67 -0
  81. package/templates/business/supply-chain-harmonizer/.cursor/rules/inventory-rebalancing.mdc +63 -0
  82. package/templates/business/supply-chain-harmonizer/.cursor/rules/overview.mdc +65 -0
  83. package/templates/business/supply-chain-harmonizer/.cursor/rules/rerouting.mdc +64 -0
  84. package/templates/business/supply-chain-harmonizer/.cursor/rules/scenario-simulation.mdc +68 -0
  85. package/templates/business/supply-chain-harmonizer/.cursor/rules/stakeholder-notifications.mdc +61 -0
  86. package/templates/business/supply-chain-harmonizer/CLAUDE.md +600 -0
  87. package/templates/creative/brand-guardian/.cursor/rules/brand-voice.mdc +64 -0
  88. package/templates/creative/brand-guardian/.cursor/rules/content-review.mdc +47 -0
  89. package/templates/creative/brand-guardian/.cursor/rules/ethical-guidelines.mdc +47 -0
  90. package/templates/creative/brand-guardian/.cursor/rules/multi-channel.mdc +49 -0
  91. package/templates/creative/brand-guardian/.cursor/rules/overview.mdc +58 -0
  92. package/templates/creative/brand-guardian/.cursor/rules/visual-identity.mdc +64 -0
  93. package/templates/creative/brand-guardian/CLAUDE.md +634 -0
  94. package/templates/creative/content-creation-expert/.cursor/rules/content-strategy.mdc +65 -0
  95. package/templates/creative/content-creation-expert/.cursor/rules/copywriting.mdc +59 -0
  96. package/templates/creative/content-creation-expert/.cursor/rules/editorial-operations.mdc +65 -0
  97. package/templates/creative/content-creation-expert/.cursor/rules/multimedia-production.mdc +64 -0
  98. package/templates/creative/content-creation-expert/.cursor/rules/overview.mdc +58 -0
  99. package/templates/creative/content-creation-expert/.cursor/rules/seo-content.mdc +75 -0
  100. package/templates/creative/content-creation-expert/CLAUDE.md +568 -0
  101. package/templates/creative/narrative-architect/.cursor/rules/collaboration.mdc +62 -0
  102. package/templates/creative/narrative-architect/.cursor/rules/continuity-tracking.mdc +56 -0
  103. package/templates/creative/narrative-architect/.cursor/rules/overview.mdc +68 -0
  104. package/templates/creative/narrative-architect/.cursor/rules/story-bible.mdc +77 -0
  105. package/templates/creative/narrative-architect/.cursor/rules/timeline-management.mdc +60 -0
  106. package/templates/creative/narrative-architect/.cursor/rules/world-building.mdc +78 -0
  107. package/templates/creative/narrative-architect/CLAUDE.md +737 -0
  108. package/templates/creative/social-media-expert/.cursor/rules/audience-growth.mdc +62 -0
  109. package/templates/creative/social-media-expert/.cursor/rules/community-management.mdc +67 -0
  110. package/templates/creative/social-media-expert/.cursor/rules/content-strategy.mdc +60 -0
  111. package/templates/creative/social-media-expert/.cursor/rules/overview.mdc +48 -0
  112. package/templates/creative/social-media-expert/.cursor/rules/platform-strategy.mdc +64 -0
  113. package/templates/creative/social-media-expert/.cursor/rules/social-analytics.mdc +64 -0
  114. package/templates/creative/social-media-expert/CLAUDE.md +624 -0
  115. package/templates/creative/trend-forecaster/.cursor/rules/cultural-analysis.mdc +59 -0
  116. package/templates/creative/trend-forecaster/.cursor/rules/forecasting-methods.mdc +63 -0
  117. package/templates/creative/trend-forecaster/.cursor/rules/overview.mdc +58 -0
  118. package/templates/creative/trend-forecaster/.cursor/rules/reporting.mdc +61 -0
  119. package/templates/creative/trend-forecaster/.cursor/rules/signal-analysis.mdc +74 -0
  120. package/templates/creative/trend-forecaster/.cursor/rules/trend-lifecycle.mdc +75 -0
  121. package/templates/creative/trend-forecaster/CLAUDE.md +717 -0
  122. package/templates/creative/ux-designer/.cursor/rules/accessibility.mdc +69 -0
  123. package/templates/creative/ux-designer/.cursor/rules/emotional-design.mdc +59 -0
  124. package/templates/creative/ux-designer/.cursor/rules/handoff.mdc +73 -0
  125. package/templates/creative/ux-designer/.cursor/rules/information-architecture.mdc +62 -0
  126. package/templates/creative/ux-designer/.cursor/rules/interaction-design.mdc +66 -0
  127. package/templates/creative/ux-designer/.cursor/rules/overview.mdc +61 -0
  128. package/templates/creative/ux-designer/.cursor/rules/research.mdc +61 -0
  129. package/templates/creative/ux-designer/.cursor/rules/visual-design.mdc +68 -0
  130. package/templates/creative/ux-designer/CLAUDE.md +124 -0
  131. package/templates/dogfood/project-overview.mdc +12 -0
  132. package/templates/dogfood/project-structure.mdc +82 -0
  133. package/templates/dogfood/rules-creation-best-practices.mdc +45 -0
  134. package/templates/education/educator/.cursor/rules/accessibility.mdc +67 -0
  135. package/templates/education/educator/.cursor/rules/assessment.mdc +68 -0
  136. package/templates/education/educator/.cursor/rules/curriculum.mdc +57 -0
  137. package/templates/education/educator/.cursor/rules/engagement.mdc +65 -0
  138. package/templates/education/educator/.cursor/rules/instructional-design.mdc +69 -0
  139. package/templates/education/educator/.cursor/rules/overview.mdc +57 -0
  140. package/templates/education/educator/.cursor/rules/retention.mdc +64 -0
  141. package/templates/education/educator/CLAUDE.md +338 -0
  142. package/templates/engineering/blockchain/.cursor/rules/defi-patterns.mdc +48 -0
  143. package/templates/engineering/blockchain/.cursor/rules/gas-optimization.mdc +77 -0
  144. package/templates/engineering/blockchain/.cursor/rules/overview.mdc +41 -0
  145. package/templates/engineering/blockchain/.cursor/rules/security.mdc +61 -0
  146. package/templates/engineering/blockchain/.cursor/rules/smart-contracts.mdc +64 -0
  147. package/templates/engineering/blockchain/.cursor/rules/testing.mdc +77 -0
  148. package/templates/engineering/blockchain/.cursor/rules/web3-integration.mdc +47 -0
  149. package/templates/engineering/blockchain/CLAUDE.md +389 -0
  150. package/templates/engineering/cli-tools/.cursor/rules/architecture.mdc +76 -0
  151. package/templates/engineering/cli-tools/.cursor/rules/arguments.mdc +65 -0
  152. package/templates/engineering/cli-tools/.cursor/rules/distribution.mdc +40 -0
  153. package/templates/engineering/cli-tools/.cursor/rules/error-handling.mdc +67 -0
  154. package/templates/engineering/cli-tools/.cursor/rules/overview.mdc +58 -0
  155. package/templates/engineering/cli-tools/.cursor/rules/testing.mdc +42 -0
  156. package/templates/engineering/cli-tools/.cursor/rules/user-experience.mdc +43 -0
  157. package/templates/engineering/cli-tools/CLAUDE.md +356 -0
  158. package/templates/engineering/data-engineering/.cursor/rules/data-modeling.mdc +71 -0
  159. package/templates/engineering/data-engineering/.cursor/rules/data-quality.mdc +78 -0
  160. package/templates/engineering/data-engineering/.cursor/rules/overview.mdc +49 -0
  161. package/templates/engineering/data-engineering/.cursor/rules/performance.mdc +71 -0
  162. package/templates/engineering/data-engineering/.cursor/rules/pipeline-design.mdc +79 -0
  163. package/templates/engineering/data-engineering/.cursor/rules/security.mdc +79 -0
  164. package/templates/engineering/data-engineering/.cursor/rules/testing.mdc +75 -0
  165. package/templates/engineering/data-engineering/CLAUDE.md +974 -0
  166. package/templates/engineering/devops-sre/.cursor/rules/capacity-planning.mdc +49 -0
  167. package/templates/engineering/devops-sre/.cursor/rules/change-management.mdc +51 -0
  168. package/templates/engineering/devops-sre/.cursor/rules/chaos-engineering.mdc +50 -0
  169. package/templates/engineering/devops-sre/.cursor/rules/disaster-recovery.mdc +54 -0
  170. package/templates/engineering/devops-sre/.cursor/rules/incident-management.mdc +56 -0
  171. package/templates/engineering/devops-sre/.cursor/rules/observability.mdc +50 -0
  172. package/templates/engineering/devops-sre/.cursor/rules/overview.mdc +76 -0
  173. package/templates/engineering/devops-sre/.cursor/rules/postmortems.mdc +49 -0
  174. package/templates/engineering/devops-sre/.cursor/rules/runbooks.mdc +49 -0
  175. package/templates/engineering/devops-sre/.cursor/rules/slo-sli.mdc +46 -0
  176. package/templates/engineering/devops-sre/.cursor/rules/toil-reduction.mdc +52 -0
  177. package/templates/engineering/devops-sre/CLAUDE.md +1007 -0
  178. package/templates/engineering/fullstack/.cursor/rules/api-contracts.mdc +79 -0
  179. package/templates/engineering/fullstack/.cursor/rules/architecture.mdc +79 -0
  180. package/templates/engineering/fullstack/.cursor/rules/overview.mdc +61 -0
  181. package/templates/engineering/fullstack/.cursor/rules/shared-types.mdc +77 -0
  182. package/templates/engineering/fullstack/.cursor/rules/testing.mdc +72 -0
  183. package/templates/engineering/fullstack/CLAUDE.md +349 -0
  184. package/templates/engineering/ml-ai/.cursor/rules/data-engineering.mdc +71 -0
  185. package/templates/engineering/ml-ai/.cursor/rules/deployment.mdc +43 -0
  186. package/templates/engineering/ml-ai/.cursor/rules/model-development.mdc +44 -0
  187. package/templates/engineering/ml-ai/.cursor/rules/monitoring.mdc +45 -0
  188. package/templates/engineering/ml-ai/.cursor/rules/overview.mdc +42 -0
  189. package/templates/engineering/ml-ai/.cursor/rules/security.mdc +51 -0
  190. package/templates/engineering/ml-ai/.cursor/rules/testing.mdc +44 -0
  191. package/templates/engineering/ml-ai/CLAUDE.md +1136 -0
  192. package/templates/engineering/mobile/.cursor/rules/navigation.mdc +75 -0
  193. package/templates/engineering/mobile/.cursor/rules/offline-first.mdc +68 -0
  194. package/templates/engineering/mobile/.cursor/rules/overview.mdc +76 -0
  195. package/templates/engineering/mobile/.cursor/rules/performance.mdc +78 -0
  196. package/templates/engineering/mobile/.cursor/rules/testing.mdc +77 -0
  197. package/templates/engineering/mobile/CLAUDE.md +233 -0
  198. package/templates/engineering/platform-engineering/.cursor/rules/ci-cd.mdc +51 -0
  199. package/templates/engineering/platform-engineering/.cursor/rules/developer-experience.mdc +48 -0
  200. package/templates/engineering/platform-engineering/.cursor/rules/infrastructure-as-code.mdc +62 -0
  201. package/templates/engineering/platform-engineering/.cursor/rules/kubernetes.mdc +51 -0
  202. package/templates/engineering/platform-engineering/.cursor/rules/observability.mdc +52 -0
  203. package/templates/engineering/platform-engineering/.cursor/rules/overview.mdc +44 -0
  204. package/templates/engineering/platform-engineering/.cursor/rules/security.mdc +74 -0
  205. package/templates/engineering/platform-engineering/.cursor/rules/testing.mdc +59 -0
  206. package/templates/engineering/platform-engineering/CLAUDE.md +850 -0
  207. package/templates/engineering/qa-engineering/.cursor/rules/automation.mdc +71 -0
  208. package/templates/engineering/qa-engineering/.cursor/rules/metrics.mdc +68 -0
  209. package/templates/engineering/qa-engineering/.cursor/rules/overview.mdc +45 -0
  210. package/templates/engineering/qa-engineering/.cursor/rules/quality-gates.mdc +54 -0
  211. package/templates/engineering/qa-engineering/.cursor/rules/test-design.mdc +59 -0
  212. package/templates/engineering/qa-engineering/.cursor/rules/test-strategy.mdc +62 -0
  213. package/templates/engineering/qa-engineering/CLAUDE.md +726 -0
  214. package/templates/engineering/testing/.cursor/rules/advanced-techniques.mdc +44 -0
  215. package/templates/engineering/testing/.cursor/rules/ci-cd-integration.mdc +43 -0
  216. package/templates/engineering/testing/.cursor/rules/overview.mdc +61 -0
  217. package/templates/engineering/testing/.cursor/rules/performance-testing.mdc +39 -0
  218. package/templates/engineering/testing/.cursor/rules/quality-metrics.mdc +74 -0
  219. package/templates/engineering/testing/.cursor/rules/reliability.mdc +39 -0
  220. package/templates/engineering/testing/.cursor/rules/tdd-methodology.mdc +52 -0
  221. package/templates/engineering/testing/.cursor/rules/test-data.mdc +46 -0
  222. package/templates/engineering/testing/.cursor/rules/test-design.mdc +45 -0
  223. package/templates/engineering/testing/.cursor/rules/test-types.mdc +71 -0
  224. package/templates/engineering/testing/CLAUDE.md +1134 -0
  225. package/templates/engineering/unity-dev-expert/.cursor/rules/csharp-architecture.mdc +61 -0
  226. package/templates/engineering/unity-dev-expert/.cursor/rules/multiplayer-networking.mdc +67 -0
  227. package/templates/engineering/unity-dev-expert/.cursor/rules/overview.mdc +56 -0
  228. package/templates/engineering/unity-dev-expert/.cursor/rules/performance-optimization.mdc +76 -0
  229. package/templates/engineering/unity-dev-expert/.cursor/rules/physics-rendering.mdc +59 -0
  230. package/templates/engineering/unity-dev-expert/.cursor/rules/ui-systems.mdc +59 -0
  231. package/templates/engineering/unity-dev-expert/CLAUDE.md +534 -0
  232. package/templates/engineering/web-backend/.cursor/rules/api-design.mdc +64 -0
  233. package/templates/engineering/web-backend/.cursor/rules/authentication.mdc +69 -0
  234. package/templates/engineering/web-backend/.cursor/rules/database-patterns.mdc +73 -0
  235. package/templates/engineering/web-backend/.cursor/rules/error-handling.mdc +66 -0
  236. package/templates/engineering/web-backend/.cursor/rules/overview.mdc +74 -0
  237. package/templates/engineering/web-backend/.cursor/rules/security.mdc +60 -0
  238. package/templates/engineering/web-backend/.cursor/rules/testing.mdc +74 -0
  239. package/templates/engineering/web-backend/CLAUDE.md +366 -0
  240. package/templates/engineering/web-frontend/.cursor/rules/accessibility.mdc +75 -0
  241. package/templates/engineering/web-frontend/.cursor/rules/component-patterns.mdc +76 -0
  242. package/templates/engineering/web-frontend/.cursor/rules/overview.mdc +77 -0
  243. package/templates/engineering/web-frontend/.cursor/rules/performance.mdc +73 -0
  244. package/templates/engineering/web-frontend/.cursor/rules/state-management.mdc +71 -0
  245. package/templates/engineering/web-frontend/.cursor/rules/styling.mdc +69 -0
  246. package/templates/engineering/web-frontend/.cursor/rules/testing.mdc +75 -0
  247. package/templates/engineering/web-frontend/CLAUDE.md +399 -0
  248. package/templates/languages/cpp-expert/.cursor/rules/concurrency.mdc +68 -0
  249. package/templates/languages/cpp-expert/.cursor/rules/error-handling.mdc +65 -0
  250. package/templates/languages/cpp-expert/.cursor/rules/memory-and-ownership.mdc +68 -0
  251. package/templates/languages/cpp-expert/.cursor/rules/modern-cpp.mdc +75 -0
  252. package/templates/languages/cpp-expert/.cursor/rules/overview.mdc +37 -0
  253. package/templates/languages/cpp-expert/.cursor/rules/performance.mdc +74 -0
  254. package/templates/languages/cpp-expert/.cursor/rules/testing.mdc +70 -0
  255. package/templates/languages/cpp-expert/.cursor/rules/tooling.mdc +77 -0
  256. package/templates/languages/cpp-expert/CLAUDE.md +242 -0
  257. package/templates/languages/csharp-expert/.cursor/rules/aspnet-core.mdc +78 -0
  258. package/templates/languages/csharp-expert/.cursor/rules/async-patterns.mdc +71 -0
  259. package/templates/languages/csharp-expert/.cursor/rules/dependency-injection.mdc +76 -0
  260. package/templates/languages/csharp-expert/.cursor/rules/error-handling.mdc +65 -0
  261. package/templates/languages/csharp-expert/.cursor/rules/language-features.mdc +74 -0
  262. package/templates/languages/csharp-expert/.cursor/rules/overview.mdc +47 -0
  263. package/templates/languages/csharp-expert/.cursor/rules/performance.mdc +66 -0
  264. package/templates/languages/csharp-expert/.cursor/rules/testing.mdc +78 -0
  265. package/templates/languages/csharp-expert/.cursor/rules/tooling.mdc +78 -0
  266. package/templates/languages/csharp-expert/CLAUDE.md +360 -0
  267. package/templates/languages/golang-expert/.cursor/rules/concurrency.mdc +79 -0
  268. package/templates/languages/golang-expert/.cursor/rules/error-handling.mdc +77 -0
  269. package/templates/languages/golang-expert/.cursor/rules/interfaces-and-types.mdc +77 -0
  270. package/templates/languages/golang-expert/.cursor/rules/overview.mdc +74 -0
  271. package/templates/languages/golang-expert/.cursor/rules/performance.mdc +76 -0
  272. package/templates/languages/golang-expert/.cursor/rules/production-patterns.mdc +76 -0
  273. package/templates/languages/golang-expert/.cursor/rules/stdlib-and-tooling.mdc +68 -0
  274. package/templates/languages/golang-expert/.cursor/rules/testing.mdc +77 -0
  275. package/templates/languages/golang-expert/CLAUDE.md +361 -0
  276. package/templates/languages/java-expert/.cursor/rules/concurrency.mdc +69 -0
  277. package/templates/languages/java-expert/.cursor/rules/error-handling.mdc +70 -0
  278. package/templates/languages/java-expert/.cursor/rules/modern-java.mdc +74 -0
  279. package/templates/languages/java-expert/.cursor/rules/overview.mdc +42 -0
  280. package/templates/languages/java-expert/.cursor/rules/performance.mdc +69 -0
  281. package/templates/languages/java-expert/.cursor/rules/persistence.mdc +74 -0
  282. package/templates/languages/java-expert/.cursor/rules/spring-boot.mdc +73 -0
  283. package/templates/languages/java-expert/.cursor/rules/testing.mdc +79 -0
  284. package/templates/languages/java-expert/.cursor/rules/tooling.mdc +76 -0
  285. package/templates/languages/java-expert/CLAUDE.md +325 -0
  286. package/templates/languages/javascript-expert/.cursor/rules/language-deep-dive.mdc +74 -0
  287. package/templates/languages/javascript-expert/.cursor/rules/node-patterns.mdc +77 -0
  288. package/templates/languages/javascript-expert/.cursor/rules/overview.mdc +66 -0
  289. package/templates/languages/javascript-expert/.cursor/rules/performance.mdc +64 -0
  290. package/templates/languages/javascript-expert/.cursor/rules/react-patterns.mdc +70 -0
  291. package/templates/languages/javascript-expert/.cursor/rules/testing.mdc +76 -0
  292. package/templates/languages/javascript-expert/.cursor/rules/tooling.mdc +72 -0
  293. package/templates/languages/javascript-expert/.cursor/rules/typescript-deep-dive.mdc +77 -0
  294. package/templates/languages/javascript-expert/CLAUDE.md +479 -0
  295. package/templates/languages/kotlin-expert/.cursor/rules/coroutines.mdc +75 -0
  296. package/templates/languages/kotlin-expert/.cursor/rules/error-handling.mdc +69 -0
  297. package/templates/languages/kotlin-expert/.cursor/rules/frameworks.mdc +76 -0
  298. package/templates/languages/kotlin-expert/.cursor/rules/language-features.mdc +78 -0
  299. package/templates/languages/kotlin-expert/.cursor/rules/overview.mdc +38 -0
  300. package/templates/languages/kotlin-expert/.cursor/rules/performance.mdc +73 -0
  301. package/templates/languages/kotlin-expert/.cursor/rules/testing.mdc +70 -0
  302. package/templates/languages/kotlin-expert/.cursor/rules/tooling.mdc +67 -0
  303. package/templates/languages/kotlin-expert/CLAUDE.md +276 -0
  304. package/templates/languages/python-expert/.cursor/rules/async-python.mdc +71 -0
  305. package/templates/languages/python-expert/.cursor/rules/overview.mdc +76 -0
  306. package/templates/languages/python-expert/.cursor/rules/patterns-and-idioms.mdc +77 -0
  307. package/templates/languages/python-expert/.cursor/rules/performance.mdc +74 -0
  308. package/templates/languages/python-expert/.cursor/rules/testing.mdc +77 -0
  309. package/templates/languages/python-expert/.cursor/rules/tooling.mdc +77 -0
  310. package/templates/languages/python-expert/.cursor/rules/type-system.mdc +77 -0
  311. package/templates/languages/python-expert/.cursor/rules/web-and-apis.mdc +76 -0
  312. package/templates/languages/python-expert/CLAUDE.md +264 -0
  313. package/templates/languages/ruby-expert/.cursor/rules/concurrency-and-threading.mdc +65 -0
  314. package/templates/languages/ruby-expert/.cursor/rules/error-handling.mdc +69 -0
  315. package/templates/languages/ruby-expert/.cursor/rules/idioms-and-style.mdc +76 -0
  316. package/templates/languages/ruby-expert/.cursor/rules/overview.mdc +60 -0
  317. package/templates/languages/ruby-expert/.cursor/rules/performance.mdc +68 -0
  318. package/templates/languages/ruby-expert/.cursor/rules/rails-and-frameworks.mdc +60 -0
  319. package/templates/languages/ruby-expert/.cursor/rules/testing.mdc +56 -0
  320. package/templates/languages/ruby-expert/.cursor/rules/tooling.mdc +52 -0
  321. package/templates/languages/ruby-expert/CLAUDE.md +102 -0
  322. package/templates/languages/rust-expert/.cursor/rules/concurrency.mdc +69 -0
  323. package/templates/languages/rust-expert/.cursor/rules/ecosystem-and-tooling.mdc +76 -0
  324. package/templates/languages/rust-expert/.cursor/rules/error-handling.mdc +76 -0
  325. package/templates/languages/rust-expert/.cursor/rules/overview.mdc +62 -0
  326. package/templates/languages/rust-expert/.cursor/rules/ownership-and-borrowing.mdc +70 -0
  327. package/templates/languages/rust-expert/.cursor/rules/performance-and-unsafe.mdc +70 -0
  328. package/templates/languages/rust-expert/.cursor/rules/testing.mdc +73 -0
  329. package/templates/languages/rust-expert/.cursor/rules/traits-and-generics.mdc +76 -0
  330. package/templates/languages/rust-expert/CLAUDE.md +283 -0
  331. package/templates/languages/swift-expert/.cursor/rules/concurrency.mdc +77 -0
  332. package/templates/languages/swift-expert/.cursor/rules/error-handling.mdc +76 -0
  333. package/templates/languages/swift-expert/.cursor/rules/language-features.mdc +78 -0
  334. package/templates/languages/swift-expert/.cursor/rules/overview.mdc +46 -0
  335. package/templates/languages/swift-expert/.cursor/rules/performance.mdc +69 -0
  336. package/templates/languages/swift-expert/.cursor/rules/swiftui.mdc +77 -0
  337. package/templates/languages/swift-expert/.cursor/rules/testing.mdc +75 -0
  338. package/templates/languages/swift-expert/.cursor/rules/tooling.mdc +77 -0
  339. package/templates/languages/swift-expert/CLAUDE.md +275 -0
  340. package/templates/professional/documentation/.cursor/rules/adr.mdc +65 -0
  341. package/templates/professional/documentation/.cursor/rules/api-documentation.mdc +64 -0
  342. package/templates/professional/documentation/.cursor/rules/code-comments.mdc +75 -0
  343. package/templates/professional/documentation/.cursor/rules/maintenance.mdc +58 -0
  344. package/templates/professional/documentation/.cursor/rules/overview.mdc +48 -0
  345. package/templates/professional/documentation/.cursor/rules/readme-standards.mdc +70 -0
  346. package/templates/professional/documentation/CLAUDE.md +120 -0
  347. package/templates/professional/executive-assistant/.cursor/rules/calendar.mdc +51 -0
  348. package/templates/professional/executive-assistant/.cursor/rules/confidentiality.mdc +53 -0
  349. package/templates/professional/executive-assistant/.cursor/rules/email.mdc +49 -0
  350. package/templates/professional/executive-assistant/.cursor/rules/meetings.mdc +39 -0
  351. package/templates/professional/executive-assistant/.cursor/rules/overview.mdc +42 -0
  352. package/templates/professional/executive-assistant/.cursor/rules/prioritization.mdc +48 -0
  353. package/templates/professional/executive-assistant/.cursor/rules/stakeholder-management.mdc +50 -0
  354. package/templates/professional/executive-assistant/.cursor/rules/travel.mdc +43 -0
  355. package/templates/professional/executive-assistant/CLAUDE.md +620 -0
  356. package/templates/professional/grant-writer/.cursor/rules/budgets.mdc +55 -0
  357. package/templates/professional/grant-writer/.cursor/rules/compliance.mdc +47 -0
  358. package/templates/professional/grant-writer/.cursor/rules/funding-research.mdc +47 -0
  359. package/templates/professional/grant-writer/.cursor/rules/narrative.mdc +58 -0
  360. package/templates/professional/grant-writer/.cursor/rules/overview.mdc +68 -0
  361. package/templates/professional/grant-writer/.cursor/rules/post-award.mdc +59 -0
  362. package/templates/professional/grant-writer/.cursor/rules/review-criteria.mdc +51 -0
  363. package/templates/professional/grant-writer/.cursor/rules/sustainability.mdc +48 -0
  364. package/templates/professional/grant-writer/CLAUDE.md +577 -0
  365. package/templates/professional/knowledge-synthesis/.cursor/rules/document-management.mdc +51 -0
  366. package/templates/professional/knowledge-synthesis/.cursor/rules/knowledge-graphs.mdc +63 -0
  367. package/templates/professional/knowledge-synthesis/.cursor/rules/overview.mdc +74 -0
  368. package/templates/professional/knowledge-synthesis/.cursor/rules/research-workflow.mdc +50 -0
  369. package/templates/professional/knowledge-synthesis/.cursor/rules/search-retrieval.mdc +62 -0
  370. package/templates/professional/knowledge-synthesis/.cursor/rules/summarization.mdc +61 -0
  371. package/templates/professional/knowledge-synthesis/CLAUDE.md +593 -0
  372. package/templates/professional/life-logistics/.cursor/rules/financial-optimization.mdc +78 -0
  373. package/templates/professional/life-logistics/.cursor/rules/negotiation.mdc +68 -0
  374. package/templates/professional/life-logistics/.cursor/rules/overview.mdc +75 -0
  375. package/templates/professional/life-logistics/.cursor/rules/research-methodology.mdc +76 -0
  376. package/templates/professional/life-logistics/.cursor/rules/scheduling.mdc +68 -0
  377. package/templates/professional/life-logistics/.cursor/rules/task-management.mdc +47 -0
  378. package/templates/professional/life-logistics/CLAUDE.md +601 -0
  379. package/templates/professional/research-assistant/.cursor/rules/citation-attribution.mdc +61 -0
  380. package/templates/professional/research-assistant/.cursor/rules/information-synthesis.mdc +65 -0
  381. package/templates/professional/research-assistant/.cursor/rules/overview.mdc +56 -0
  382. package/templates/professional/research-assistant/.cursor/rules/research-methodologies.mdc +54 -0
  383. package/templates/professional/research-assistant/.cursor/rules/search-strategies.mdc +57 -0
  384. package/templates/professional/research-assistant/.cursor/rules/source-evaluation.mdc +59 -0
  385. package/templates/professional/research-assistant/CLAUDE.md +318 -0
  386. package/templates/professional/wellness-orchestrator/.cursor/rules/adaptive-planning.mdc +69 -0
  387. package/templates/professional/wellness-orchestrator/.cursor/rules/data-integration.mdc +60 -0
  388. package/templates/professional/wellness-orchestrator/.cursor/rules/fitness-programming.mdc +66 -0
  389. package/templates/professional/wellness-orchestrator/.cursor/rules/nutrition-planning.mdc +57 -0
  390. package/templates/professional/wellness-orchestrator/.cursor/rules/overview.mdc +76 -0
  391. package/templates/professional/wellness-orchestrator/.cursor/rules/sleep-optimization.mdc +68 -0
  392. package/templates/professional/wellness-orchestrator/CLAUDE.md +573 -0
@@ -0,0 +1,276 @@
1
+ # Kotlin Expert Development Guide
2
+
3
+ Principal-level guidelines for Kotlin engineering. Deep language mastery, coroutines, multiplatform, and idiomatic patterns.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ This guide applies to:
10
+ - Backend services (Ktor, Spring Boot, Quarkus)
11
+ - Android applications (Jetpack Compose, Architecture Components)
12
+ - Kotlin Multiplatform (KMP) — shared code across platforms
13
+ - CLI tools and scripting
14
+ - Libraries and Maven/Gradle artifacts
15
+ - Data processing and streaming
16
+
17
+ ### Core Philosophy
18
+
19
+ Kotlin is a pragmatic language. It gives you safety, expressiveness, and interoperability — use all three.
20
+
21
+ - **Null safety is the foundation.** The type system distinguishes nullable from non-nullable. No `!!` without proof.
22
+ - **Immutability by default.** `val` over `var`, immutable collections, data classes.
23
+ - **Conciseness without cleverness.** Less code doesn't mean unreadable code.
24
+ - **Coroutines are structured.** Every coroutine has a scope, every scope has a lifecycle.
25
+ - **Interop is a feature.** Use Java libraries freely, but write Kotlin idiomatically.
26
+ - **If you don't know, say so.** Admitting uncertainty is professional.
27
+
28
+ ### Key Principles
29
+
30
+ 1. **Null Safety Is Non-Negotiable** — No `!!` without justification. Safe calls, elvis, smart casts
31
+ 2. **Immutability by Default** — `val`, `List` (not `MutableList`), data classes, `copy()`
32
+ 3. **Structured Concurrency** — Every coroutine in a scope. No `GlobalScope`
33
+ 4. **Extension Functions Over Utility Classes** — Extend types at the call site
34
+ 5. **Sealed Types for State Modeling** — Exhaustive `when`, impossible states are compile errors
35
+
36
+ ### Project Structure
37
+
38
+ ```
39
+ project/
40
+ ├── src/main/kotlin/com/example/myapp/
41
+ │ ├── Application.kt
42
+ │ ├── config/
43
+ │ ├── domain/
44
+ │ │ ├── model/
45
+ │ │ ├── service/
46
+ │ │ └── event/
47
+ │ ├── application/
48
+ │ ├── infrastructure/
49
+ │ └── api/
50
+ ├── src/test/kotlin/
51
+ ├── build.gradle.kts
52
+ └── Dockerfile
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Language Features
58
+
59
+ ### Null Safety
60
+
61
+ ```kotlin
62
+ val displayName = user?.name ?: "Anonymous"
63
+ val userId = request.userId ?: throw IllegalArgumentException("userId required")
64
+ // Never: user!!.name — use requireNotNull() with a message
65
+ ```
66
+
67
+ ### Data Classes and Value Classes
68
+
69
+ ```kotlin
70
+ data class Order(val id: OrderId, val items: List<OrderItem>, val status: OrderStatus)
71
+ val updated = order.copy(status = OrderStatus.SHIPPED)
72
+
73
+ @JvmInline
74
+ value class UserId(val value: String) // Zero-overhead type safety
75
+ ```
76
+
77
+ ### Sealed Types
78
+
79
+ ```kotlin
80
+ sealed interface Result<out T> {
81
+ data class Success<T>(val value: T) : Result<T>
82
+ data class Failure(val error: AppError) : Result<Nothing>
83
+ }
84
+
85
+ fun describe(result: Result<User>): String = when (result) {
86
+ is Result.Success -> "User: ${result.value.name}"
87
+ is Result.Failure -> "Error: ${result.error}"
88
+ // Exhaustive — compiler enforces all cases
89
+ }
90
+ ```
91
+
92
+ ### Extension Functions and Scope Functions
93
+
94
+ ```kotlin
95
+ fun String.toSlug(): String = lowercase().replace(Regex("[^a-z0-9\\s-]"), "").replace(Regex("\\s+"), "-")
96
+
97
+ val connection = HttpClient().apply { timeout = 30.seconds; retries = 3 }
98
+ val user = createUser(request).also { logger.info("Created: ${it.id}") }
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Coroutines
104
+
105
+ ### Structured Concurrency
106
+
107
+ ```kotlin
108
+ suspend fun loadDashboard(userId: UserId): Dashboard = coroutineScope {
109
+ val user = async { userService.findById(userId) }
110
+ val orders = async { orderService.findRecent(userId) }
111
+ Dashboard(user = user.await(), orders = orders.await())
112
+ }
113
+ // If any async fails, ALL are cancelled
114
+ ```
115
+
116
+ ### Flow
117
+
118
+ ```kotlin
119
+ val state: StateFlow<UiState> = _state.asStateFlow()
120
+
121
+ fun observeUsers(): Flow<List<User>> = flow {
122
+ while (true) {
123
+ emit(userRepository.findAll())
124
+ delay(5.seconds)
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### Rules
130
+
131
+ - No `GlobalScope` — use lifecycle-bound scopes
132
+ - No `runBlocking` in production (except `main()` and tests)
133
+ - No `Thread.sleep()` — use `delay()`
134
+ - Always rethrow `CancellationException`
135
+ - Use `supervisorScope` when child failures should be independent
136
+
137
+ ---
138
+
139
+ ## Error Handling
140
+
141
+ ### Sealed Result Types
142
+
143
+ ```kotlin
144
+ when (val result = userService.register(request)) {
145
+ is Result.Success -> call.respond(HttpStatusCode.Created, result.value)
146
+ is Result.Failure -> when (result.error) {
147
+ is AppError.Validation -> call.respond(HttpStatusCode.BadRequest, result.error)
148
+ is AppError.Conflict -> call.respond(HttpStatusCode.Conflict, result.error)
149
+ is AppError.NotFound -> call.respond(HttpStatusCode.NotFound, result.error)
150
+ }
151
+ }
152
+ ```
153
+
154
+ ### Validation
155
+
156
+ ```kotlin
157
+ require(customerId.isNotBlank()) { "customerId must not be blank" }
158
+ check(order.status == OrderStatus.PAID) { "Can only ship paid orders" }
159
+ val user = requireNotNull(userRepo.findById(id)) { "User $id must exist" }
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Frameworks
165
+
166
+ ### Ktor
167
+
168
+ ```kotlin
169
+ fun Route.userRoutes() {
170
+ route("/users") {
171
+ get("/{id}") {
172
+ val id = UserId(call.parameters["id"] ?: return@get call.respond(HttpStatusCode.BadRequest))
173
+ // ...
174
+ }
175
+ post { val request = call.receive<CreateUserRequest>(); /* ... */ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### Spring Boot
181
+
182
+ ```kotlin
183
+ @RestController
184
+ @RequestMapping("/api/v1/orders")
185
+ class OrderController(private val orderService: OrderService) {
186
+ @GetMapping("/{id}")
187
+ suspend fun getById(@PathVariable id: UUID): ResponseEntity<OrderResponse> { /* ... */ }
188
+ }
189
+ ```
190
+
191
+ ### Exposed (SQL)
192
+
193
+ ```kotlin
194
+ object Users : Table("users") {
195
+ val id = uuid("id").autoGenerate()
196
+ val name = varchar("name", 200)
197
+ val email = varchar("email", 255).uniqueIndex()
198
+ }
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Testing
204
+
205
+ ### Framework Stack
206
+
207
+ | Tool | Purpose |
208
+ |------|---------|
209
+ | JUnit 5 / Kotest | Test framework |
210
+ | MockK | Kotlin-native mocking |
211
+ | kotlinx-coroutines-test | Coroutine testing |
212
+ | Testcontainers | Real databases/services |
213
+ | Ktor Test | HTTP endpoint testing |
214
+
215
+ ### Test Structure
216
+
217
+ ```kotlin
218
+ @Test
219
+ fun `create with valid items returns success`() = runTest {
220
+ coEvery { inventoryClient.checkAvailability("SKU-001", 2) } returns true
221
+ val result = sut.create(request)
222
+ assertThat(result).isInstanceOf(Result.Success::class.java)
223
+ }
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Performance
229
+
230
+ ### Key Patterns
231
+
232
+ - `inline` functions for higher-order function hot paths
233
+ - `value class` for zero-overhead type wrappers
234
+ - Sequences for large collection chains (lazy evaluation)
235
+ - Pre-size collections with `HashMap(expectedSize)`
236
+ - `buildList`/`buildString` for single-allocation construction
237
+ - Buffered channels for coroutine throughput
238
+
239
+ ---
240
+
241
+ ## Tooling
242
+
243
+ ### Essential Stack
244
+
245
+ | Tool | Purpose |
246
+ |------|---------|
247
+ | Gradle (Kotlin DSL) | Build system |
248
+ | Detekt | Static analysis |
249
+ | ktlint | Code formatting |
250
+ | kotlinx.serialization | Compile-time serialization |
251
+ | kotlin-logging | Structured logging |
252
+ | Koin | Dependency injection |
253
+
254
+ ### CI Essentials
255
+
256
+ ```bash
257
+ ./gradlew check # Build + test + analysis
258
+ ./gradlew detekt # Static analysis
259
+ ```
260
+
261
+ ---
262
+
263
+ ## Definition of Done
264
+
265
+ A Kotlin feature is complete when:
266
+
267
+ - [ ] Compiles with zero warnings (`allWarningsAsErrors = true`)
268
+ - [ ] All tests pass
269
+ - [ ] No `!!` without documented justification
270
+ - [ ] No `var` where `val` suffices
271
+ - [ ] No `MutableList`/`MutableMap` exposed in public APIs
272
+ - [ ] Coroutines use structured concurrency (no `GlobalScope`)
273
+ - [ ] Nullable types handled explicitly
274
+ - [ ] Detekt reports zero findings
275
+ - [ ] No `TODO` without an associated issue
276
+ - [ ] Code reviewed and approved
@@ -0,0 +1,71 @@
1
+ ---
2
+ description: Async Python
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Async Python
7
+
8
+ `asyncio` enables concurrent I/O on a single thread. Understand the event loop, coroutines, and task lifecycle.
9
+
10
+ ## Coroutines and Tasks
11
+
12
+ ```python
13
+ async def fetch_data(url: str) -> bytes:
14
+ async with aiohttp.ClientSession() as session:
15
+ async with session.get(url) as response:
16
+ return await response.read()
17
+
18
+ # Tasks run concurrently on the event loop
19
+ async def fetch_all(urls: list[str]) -> list[bytes]:
20
+ tasks = [asyncio.create_task(fetch_data(url)) for url in urls]
21
+ return await asyncio.gather(*tasks)
22
+ ```
23
+
24
+ ## gather vs TaskGroup
25
+
26
+ ```python
27
+ # gather — returns results in order
28
+ users, posts = await asyncio.gather(fetch_users(), fetch_posts())
29
+
30
+ # TaskGroup (3.11+) — structured concurrency, cancels all on first failure
31
+ async with asyncio.TaskGroup() as tg:
32
+ user_task = tg.create_task(fetch_users())
33
+ post_task = tg.create_task(fetch_posts())
34
+ users, posts = user_task.result(), post_task.result()
35
+ ```
36
+
37
+ ## Timeouts and Bounded Concurrency
38
+
39
+ ```python
40
+ # Timeout (3.11+)
41
+ async with asyncio.timeout(5.0):
42
+ data = await fetch_data(url)
43
+
44
+ # Semaphore for bounding concurrency
45
+ semaphore = asyncio.Semaphore(10)
46
+ async def bounded_fetch(url: str) -> Response:
47
+ async with semaphore:
48
+ return await fetch(url)
49
+ ```
50
+
51
+ ## Key Rules
52
+
53
+ - Use `run_in_executor` for blocking/CPU-bound work in async context
54
+ - Async generators (`async for`) for streaming large result sets
55
+ - Every spawned task needs error handling and a cancellation strategy
56
+
57
+ ## Anti-Patterns
58
+
59
+ ```python
60
+ # Never: Blocking calls in async code
61
+ async def bad():
62
+ requests.get(url) # Blocks event loop — use aiohttp
63
+ time.sleep(1) # Blocks event loop — use asyncio.sleep()
64
+
65
+ # Never: Fire-and-forget without error handling
66
+ asyncio.create_task(work()) # Who catches exceptions?
67
+
68
+ # Never: Unbounded task spawning — use semaphore
69
+ for item in million_items:
70
+ asyncio.create_task(process(item)) # OOM risk
71
+ ```
@@ -0,0 +1,76 @@
1
+ ---
2
+ description: Python Expert
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Python Expert
7
+
8
+ Idiomatic Python, production systems, and deep interpreter knowledge.
9
+
10
+ ## Scope
11
+
12
+ - Web services and APIs (Django, FastAPI, Flask)
13
+ - CLI tools, automation, data processing, ETL pipelines
14
+ - Libraries/packages, ML infrastructure, async services
15
+
16
+ ## Core Philosophy
17
+
18
+ - **Readability counts.** The Zen of Python is the engineering standard
19
+ - **Explicit is better than implicit.** Type hints, clear names, no magic
20
+ - **Errors should never pass silently.** Bare `except:` is a bug
21
+ - **The standard library is rich — use it.** `collections`, `itertools`, `pathlib`, `dataclasses`, `contextlib`
22
+
23
+ ## Key Principles
24
+
25
+ ### Type Hints Are Not Optional
26
+
27
+ ```python
28
+ # Good: Fully typed
29
+ def fetch_users(db: Database, *, limit: int = 100) -> list[User]: ...
30
+ type Handler = Callable[[Request], Awaitable[Response]]
31
+
32
+ # Bad: No type information
33
+ def fetch_users(db, limit=100): ... # What does this return?
34
+ ```
35
+
36
+ ### Dataclasses and Pydantic Over Raw Dicts
37
+
38
+ ```python
39
+ @dataclass(frozen=True, slots=True)
40
+ class User:
41
+ id: str
42
+ email: str
43
+ name: str
44
+ created_at: datetime = field(default_factory=datetime.now)
45
+
46
+ # Bad: user = {"id": "123", "email": "a@b.com"} # No validation, no safety
47
+ ```
48
+
49
+ ### EAFP Over LBYL
50
+
51
+ ```python
52
+ # Good: Try it and handle the exception
53
+ try:
54
+ value = mapping[key]
55
+ except KeyError:
56
+ value = default
57
+
58
+ # Bad: if key in mapping → double lookup, race conditions
59
+ ```
60
+
61
+ ### Context Managers for Resources
62
+
63
+ ```python
64
+ with open("data.json") as f:
65
+ data = json.load(f)
66
+
67
+ async with aiohttp.ClientSession() as session:
68
+ response = await session.get(url)
69
+ ```
70
+
71
+ ## Definition of Done
72
+
73
+ - [ ] `mypy --strict` passes with zero errors
74
+ - [ ] `ruff check` and `ruff format --check` pass
75
+ - [ ] `pytest` passes; error cases tested
76
+ - [ ] No bare `except:`, no mutable defaults, no `# type: ignore` without explanation
@@ -0,0 +1,77 @@
1
+ ---
2
+ description: Python Patterns and Idioms
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Python Patterns and Idioms
7
+
8
+ Idiomatic Python leverages generators, decorators, context managers, and the data model. Write Pythonic code, not Java-in-Python.
9
+
10
+ ## Data Model
11
+
12
+ Use `@dataclass(frozen=True, slots=True)` for immutable value objects. Implement `__repr__`, `__eq__`, `__hash__` automatically. Use `@total_ordering` for comparison.
13
+
14
+ ## Generators
15
+
16
+ ```python
17
+ # Lazy evaluation — process one item at a time
18
+ def read_large_file(path: Path) -> Iterator[str]:
19
+ with open(path) as f:
20
+ for line in f:
21
+ yield line.strip()
22
+
23
+ # Generator expressions over list comprehensions when iterating once
24
+ total = sum(order.total for order in orders)
25
+
26
+ # itertools for complex iteration
27
+ for batch in batched(items, 100): # 3.12+
28
+ process_batch(batch)
29
+ ```
30
+
31
+ ## Decorators
32
+
33
+ ```python
34
+ from functools import wraps
35
+ from typing import ParamSpec, TypeVar
36
+
37
+ P = ParamSpec("P")
38
+ R = TypeVar("R")
39
+
40
+ def retry(max_attempts: int = 3):
41
+ def decorator(func: Callable[P, R]) -> Callable[P, R]:
42
+ @wraps(func)
43
+ def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
44
+ for attempt in range(max_attempts):
45
+ try: return func(*args, **kwargs)
46
+ except Exception:
47
+ if attempt == max_attempts - 1: raise
48
+ return wrapper
49
+ return decorator
50
+ ```
51
+
52
+ ## Context Managers
53
+
54
+ ```python
55
+ @contextmanager
56
+ def timed_operation(name: str) -> Iterator[None]:
57
+ start = time.monotonic()
58
+ try: yield
59
+ finally: logger.info(f"{name} took {time.monotonic() - start:.3f}s")
60
+
61
+ # contextlib.suppress for intentionally ignored exceptions
62
+ with suppress(FileNotFoundError):
63
+ os.remove(temp_file)
64
+ ```
65
+
66
+ ## Anti-Patterns
67
+
68
+ ```python
69
+ # Never: Mutable default arguments
70
+ def append(item, target=[]): # Shared across all calls!
71
+ target.append(item)
72
+ # Never: Bare except — catches KeyboardInterrupt, SystemExit
73
+ try: risky()
74
+ except: pass
75
+ # Never: Star imports — pollutes namespace, hides origins
76
+ from os.path import *
77
+ ```
@@ -0,0 +1,74 @@
1
+ ---
2
+ description: Python Performance
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Python Performance
7
+
8
+ Profile before optimizing. Reach for the right tool when raw speed matters.
9
+
10
+ ## Profile First
11
+
12
+ ```bash
13
+ py-spy record -o profile.svg -- python myapp.py # Production profiling
14
+ python -m cProfile -s cumulative script.py # Function-level
15
+ # line_profiler for line-by-line, memory_profiler for memory
16
+ ```
17
+
18
+ ## Data Structures
19
+
20
+ - `dict` — O(1) lookup, insertion, deletion
21
+ - `set` — O(1) membership testing
22
+ - `deque` — O(1) append/pop from both ends
23
+ - `heapq` — O(log n) push/pop for priority queues
24
+ - `bisect` — O(log n) search in sorted lists
25
+
26
+ ## Common Bottlenecks
27
+
28
+ ```python
29
+ # String concatenation — use join, not +=
30
+ result = "".join(chunks) # O(n), not O(n²)
31
+
32
+ # Generator expressions when you don't need the full list
33
+ total = sum(x * x for x in range(1_000_000)) # No intermediate list
34
+
35
+ # Local variable lookup is faster in hot loops
36
+ append = result.append
37
+ for item in items:
38
+ append(transform(item))
39
+ ```
40
+
41
+ ## Concurrency Models
42
+
43
+ ```python
44
+ # I/O-bound: threading or asyncio
45
+ with ThreadPoolExecutor(max_workers=10) as executor:
46
+ results = list(executor.map(fetch_url, urls))
47
+
48
+ # CPU-bound: multiprocessing (bypasses GIL)
49
+ with ProcessPoolExecutor() as executor:
50
+ results = list(executor.map(cpu_work, data_chunks))
51
+ ```
52
+
53
+ ## Caching
54
+
55
+ ```python
56
+ from functools import lru_cache, cache
57
+
58
+ @lru_cache(maxsize=256)
59
+ def fibonacci(n: int) -> int:
60
+ if n < 2: return n
61
+ return fibonacci(n - 1) + fibonacci(n - 2)
62
+
63
+ @cache # 3.9+, unlimited
64
+ def load_schema(name: str) -> Schema:
65
+ return Schema.from_file(f"schemas/{name}.json")
66
+ ```
67
+
68
+ ## Key Rules
69
+
70
+ - `slots=True` on dataclasses for memory efficiency
71
+ - `"".join()` over `+=` for string building
72
+ - NumPy/Polars for vectorized numeric operations
73
+ - Never optimize without profiling first
74
+ - A 10% speedup that makes code unmaintainable is a net loss
@@ -0,0 +1,77 @@
1
+ ---
2
+ description: Python Testing
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Python Testing
7
+
8
+ pytest is the standard. Every behavior has a test. Every bug fix starts with a failing test.
9
+
10
+ ## Test Structure (AAA)
11
+
12
+ ```python
13
+ def test_user_creation() -> None:
14
+ # Arrange
15
+ repo = FakeUserRepo()
16
+ service = UserService(repo)
17
+ input_data = CreateUserInput(name="Alice", email="alice@example.com")
18
+ # Act
19
+ user = service.create(input_data)
20
+ # Assert
21
+ assert user.name == "Alice"
22
+ assert user.id is not None
23
+ ```
24
+
25
+ ## Parametrize
26
+
27
+ ```python
28
+ @pytest.mark.parametrize("input_str, expected", [
29
+ ("hello world", "hello-world"),
30
+ ("UPPER CASE", "upper-case"),
31
+ ("", ""),
32
+ ])
33
+ def test_slugify(input_str: str, expected: str) -> None:
34
+ assert slugify(input_str) == expected
35
+ ```
36
+
37
+ ## Dependency Injection Over Mocking
38
+
39
+ ```python
40
+ def test_create_user_sends_notification() -> None:
41
+ notifier = Mock(spec=Notifier)
42
+ service = UserService(FakeUserRepo(), notifier)
43
+ service.create(CreateUserInput(name="Alice", email="a@b.com"))
44
+ notifier.send_welcome.assert_called_once_with("a@b.com")
45
+
46
+ # When you must patch (third-party code)
47
+ @patch("mypackage.services.user_service.send_email")
48
+ def test_sends_email(mock_send: Mock) -> None:
49
+ service.signup(email="test@example.com")
50
+ mock_send.assert_called_once()
51
+ ```
52
+
53
+ ## Integration Testing
54
+
55
+ ```python
56
+ @pytest.fixture
57
+ async def client(app) -> AsyncClient:
58
+ async with AsyncClient(app=app, base_url="http://test") as ac:
59
+ yield ac
60
+
61
+ @pytest.mark.asyncio
62
+ async def test_create_and_retrieve_user(client: AsyncClient) -> None:
63
+ resp = await client.post("/users", json={"name": "Alice", "email": "a@b.com"})
64
+ assert resp.status_code == 201
65
+ resp = await client.get(f"/users/{resp.json()['id']}")
66
+ assert resp.json()["name"] == "Alice"
67
+ ```
68
+
69
+ ## Anti-Patterns
70
+
71
+ ```python
72
+ # Never: Tests that depend on execution order
73
+ # Never: Assertions without context
74
+ assert result # What was expected? Use: assert result.status == "active"
75
+ # Never: Excessive mocking — if 5+ mocks, unit is too large
76
+ # Never: time.sleep() in tests — use polling or mock the clock
77
+ ```