@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,79 @@
1
+ ---
2
+ description: API Contracts
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # API Contracts
7
+
8
+ Defining and maintaining contracts between frontend and backend.
9
+
10
+ ## Why Contracts Matter
11
+
12
+ - **Type safety** — catch mismatches at compile time
13
+ - **Single source of truth** — one schema drives both sides
14
+ - **Parallel development** — frontend and backend work independently
15
+
16
+ ## Schema-Driven Development
17
+
18
+ Define Zod schemas first, derive types:
19
+
20
+ ```ts
21
+ import { z } from 'zod';
22
+ export const CreateUserSchema = z.object({
23
+ email: z.string().email(),
24
+ name: z.string().min(1).max(100),
25
+ });
26
+ export const UserResponseSchema = z.object({
27
+ id: z.string(), email: z.string(), name: z.string(),
28
+ createdAt: z.string().datetime(),
29
+ });
30
+ export type CreateUserRequest = z.infer<typeof CreateUserSchema>;
31
+ ```
32
+
33
+ ### Backend — validate input
34
+
35
+ ```ts
36
+ app.post('/users', async (req, res) => {
37
+ const parsed = CreateUserSchema.safeParse(req.body);
38
+ if (!parsed.success) return res.status(422).json({ error: parsed.error });
39
+ res.status(201).json({ data: await createUser(parsed.data) });
40
+ });
41
+ ```
42
+
43
+ ### Frontend — validate before sending
44
+
45
+ ```ts
46
+ async function createUser(data: CreateUserRequest) {
47
+ const res = await fetch('/api/users', {
48
+ method: 'POST', body: JSON.stringify(CreateUserSchema.parse(data)),
49
+ headers: { 'Content-Type': 'application/json' },
50
+ });
51
+ if (!res.ok) throw new ApiError(res);
52
+ return (await res.json()).data;
53
+ }
54
+ ```
55
+
56
+ ## Type-Safe Clients
57
+
58
+ Use **tRPC** for end-to-end type safety, or generate OpenAPI specs from Zod via `zod-to-openapi`.
59
+
60
+ ## Contract Testing
61
+
62
+ ```ts
63
+ it('POST /users returns valid UserResponse', async () => {
64
+ const res = await request(app)
65
+ .post('/users').send({ email: 'test@example.com', name: 'Test' });
66
+ expect(res.status).toBe(201);
67
+ expect(UserResponseSchema.safeParse(res.body.data).success).toBe(true);
68
+ });
69
+ ```
70
+
71
+ ## Versioning
72
+
73
+ URL versioning (`/api/v1/users`) for breaking changes. Add new fields as optional for backwards compatibility.
74
+
75
+ ## Anti-Patterns
76
+
77
+ - Defining request/response shapes independently on frontend and backend
78
+ - Skipping server-side validation because the client validates
79
+ - Evolving APIs without contract tests to catch breakage
@@ -0,0 +1,79 @@
1
+ ---
2
+ description: Fullstack Architecture
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Fullstack Architecture
7
+
8
+ Architectural patterns for full-stack applications.
9
+
10
+ ## Architectural Layers
11
+
12
+ ```
13
+ Presentation → Application → Domain ← Infrastructure
14
+ ```
15
+
16
+ - **Presentation**: Components, pages, state management, routing
17
+ - **Application**: Route handlers, request validation, auth, response formatting
18
+ - **Domain**: Business rules, models, use cases — pure functions, no external deps
19
+ - **Infrastructure**: Database, external APIs, file storage, caching
20
+
21
+ Dependencies point inward — domain has zero dependencies on outer layers.
22
+
23
+ ## Server vs Client Components
24
+
25
+ ```tsx
26
+ // Server Component (default) — direct DB access, no interactivity
27
+ export default async function UsersPage() {
28
+ const users = await db.user.findMany();
29
+ return <ul>{users.map(u => <li key={u.id}>{u.name}</li>)}</ul>;
30
+ }
31
+
32
+ // Client Component — interactivity, hooks, browser APIs
33
+ 'use client';
34
+ export function UserForm({ onSubmit }: Props) {
35
+ const [name, setName] = useState('');
36
+ return <form onSubmit={...}><input value={name} onChange={e => setName(e.target.value)} /></form>;
37
+ }
38
+ ```
39
+
40
+ **Composition**: Server component fetches data, passes to client component for interactivity.
41
+
42
+ ## Server Actions
43
+
44
+ ```tsx
45
+ 'use server';
46
+ export async function createUser(formData: FormData) {
47
+ await db.user.create({ data: { name: formData.get('name') as string } });
48
+ revalidatePath('/users');
49
+ }
50
+ // Usage: <form action={createUser}>...</form>
51
+ ```
52
+
53
+ ## State Synchronization
54
+
55
+ - **Optimistic updates**: `useOptimistic` to update UI before server confirms
56
+ - **Cache invalidation**: `revalidatePath` / `revalidateTag` after mutations
57
+
58
+ ## Error Handling Across Stack
59
+
60
+ ```tsx
61
+ // Server: structured errors with status codes
62
+ if (!user) {
63
+ return NextResponse.json(
64
+ { error: { code: 'NOT_FOUND', message: 'User not found' } },
65
+ { status: 404 }
66
+ );
67
+ }
68
+ // Client: handle loading, error, and success states
69
+ const { data, error, isLoading } = useQuery(['user', id], fetchUser);
70
+ if (isLoading) return <Skeleton />;
71
+ if (error) return <ErrorMessage error={error} />;
72
+ return <UserCard user={data} />;
73
+ ```
74
+
75
+ ## Anti-Patterns
76
+
77
+ - Putting business logic in route handlers instead of the domain layer
78
+ - Using client components when server components suffice (unnecessary JS shipped)
79
+ - Mutating server state without cache invalidation
@@ -0,0 +1,61 @@
1
+ ---
2
+ description: Fullstack Development
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Fullstack Development
7
+
8
+ Guidelines for building cohesive full-stack web applications.
9
+
10
+ ## Scope
11
+
12
+ - Monolithic full-stack apps and frameworks (Next.js, Nuxt, SvelteKit, Remix)
13
+ - Separate frontend/backend codebases sharing types
14
+ - JAMstack with serverless backends
15
+
16
+ ## Key Principles
17
+
18
+ - **Unified Type System** — Share types between frontend and backend; catch errors at compile time
19
+ - **Clear Boundaries** — Maintain separation between client and server concerns, even in unified frameworks
20
+ - **API-First Thinking** — Design the API contract first, then implement both sides
21
+ - **End-to-End Testing** — Test full user journeys, not just isolated components
22
+
23
+ ## Server vs Client Boundaries
24
+
25
+ ```ts
26
+ // Server-only (never sent to client)
27
+ import { PrismaClient } from '@prisma/client';
28
+ export const db = new PrismaClient();
29
+
30
+ // Client-only
31
+ export const trackEvent = (event: string) => {
32
+ window.analytics?.track(event);
33
+ };
34
+
35
+ // Shared (works both sides) — validation schemas, types, constants
36
+ export const UserSchema = z.object({
37
+ email: z.string().email(),
38
+ name: z.string().min(1),
39
+ });
40
+ ```
41
+
42
+ ## Data Flow
43
+
44
+ ```
45
+ User Action → Component → API Request → Server Handler
46
+ ↓ ↓
47
+ UI Update ← State ← API Response ← Database
48
+ ```
49
+
50
+ ## Anti-Patterns
51
+
52
+ - Duplicating validation logic instead of sharing schemas
53
+ - Importing server-only code (DB clients, secrets) into client bundles
54
+ - Skipping loading/error states on the frontend
55
+
56
+ ## Definition of Done
57
+
58
+ - [ ] Types and validation shared between frontend and backend
59
+ - [ ] Loading, error, and empty states handled
60
+ - [ ] E2E tests cover critical paths
61
+ - [ ] No TypeScript errors
@@ -0,0 +1,77 @@
1
+ ---
2
+ description: Shared Types
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Shared Types
7
+
8
+ Strategies for sharing types between frontend and backend.
9
+
10
+ ## Why Share Types
11
+
12
+ - **Single source of truth** — define once, use everywhere
13
+ - **Compile-time safety** — catch mismatches before runtime
14
+ - **Refactoring confidence** — changes propagate automatically
15
+
16
+ ## Shared Validation Schemas
17
+
18
+ Derive types from Zod schemas so runtime validation and static types stay in sync:
19
+
20
+ ```ts
21
+ import { z } from 'zod';
22
+ export const CreateUserSchema = z.object({
23
+ email: z.string().email(),
24
+ name: z.string().min(1).max(100),
25
+ role: z.enum(['user', 'admin']).default('user'),
26
+ });
27
+ export type CreateUserInput = z.infer<typeof CreateUserSchema>;
28
+ ```
29
+
30
+ Both sides import the same schema:
31
+
32
+ ```ts
33
+ // Backend
34
+ const result = CreateUserSchema.safeParse(req.body);
35
+ if (!result.success) return res.status(422).json({ error: result.error });
36
+ // Frontend
37
+ const form = useForm<CreateUserInput>({ resolver: zodResolver(CreateUserSchema) });
38
+ ```
39
+
40
+ ## API Response & Error Types
41
+
42
+ ```ts
43
+ export interface ApiResponse<T> { data: T; }
44
+ export interface PaginatedResponse<T> {
45
+ data: T[];
46
+ pagination: { page: number; limit: number; total: number };
47
+ }
48
+ export const ErrorCode = {
49
+ VALIDATION_ERROR: 'VALIDATION_ERROR',
50
+ NOT_FOUND: 'NOT_FOUND',
51
+ UNAUTHORIZED: 'UNAUTHORIZED',
52
+ } as const;
53
+ export type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
54
+ export interface AppError { code: ErrorCode; message: string; details?: unknown; }
55
+ ```
56
+
57
+ ## Date Handling
58
+
59
+ Dates serialize to strings in JSON — define internal and DTO types with transformers:
60
+
61
+ ```ts
62
+ export interface User { id: string; name: string; createdAt: Date; }
63
+ export interface UserDTO { id: string; name: string; createdAt: string; }
64
+ export const toUserDTO = (u: User): UserDTO => ({ ...u, createdAt: u.createdAt.toISOString() });
65
+ ```
66
+
67
+ ## Best Practices
68
+
69
+ - Keep the shared package minimal — no frontend or backend deps
70
+ - Use `const` objects with `as const` for enum-like values
71
+ - Export explicitly; enable `strict: true` in shared `tsconfig.json`
72
+
73
+ ## Anti-Patterns
74
+
75
+ - Duplicating types across frontend and backend instead of sharing
76
+ - Putting framework-specific code (React hooks, Express middleware) in shared
77
+ - Using `any` to bridge type mismatches between client and server
@@ -0,0 +1,72 @@
1
+ ---
2
+ description: Fullstack Testing
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Fullstack Testing
7
+
8
+ Testing strategies for full-stack applications.
9
+
10
+ ## Testing Pyramid
11
+
12
+ - **E2E** — critical user journeys (fewest, slowest)
13
+ - **Integration** — API + DB, components + API via MSW
14
+ - **Unit** — pure functions, isolated logic (most, fastest)
15
+
16
+ ## E2E Tests
17
+
18
+ ```ts
19
+ test('user can sign up', async ({ page }) => {
20
+ await page.goto('/signup');
21
+ await page.fill('[name="email"]', 'test@example.com');
22
+ await page.fill('[name="password"]', 'SecurePass123!');
23
+ await page.click('button[type="submit"]');
24
+ await expect(page).toHaveURL('/dashboard');
25
+ });
26
+ ```
27
+
28
+ Seed state via the API, not the UI — keeps E2E tests fast.
29
+
30
+ ## Integration Tests
31
+
32
+ ```ts
33
+ it('creates user and returns in list', async () => {
34
+ await request(app).post('/api/users')
35
+ .send({ email: 'new@example.com', name: 'New' }).expect(201);
36
+ const list = await request(app).get('/api/users');
37
+ expect(list.body.data).toContainEqual(
38
+ expect.objectContaining({ email: 'new@example.com' })
39
+ );
40
+ });
41
+ ```
42
+
43
+ ### Component + API (MSW)
44
+
45
+ Mock API responses with MSW's `setupServer` — call `server.listen()` in `beforeAll`, `server.close()` in `afterAll`. Assert rendered output after data loads with `waitFor`.
46
+
47
+ ## Contract Tests
48
+
49
+ Validate responses against shared Zod schemas:
50
+
51
+ ```ts
52
+ it('GET /users returns valid responses', async () => {
53
+ const res = await request(app).get('/api/users');
54
+ for (const user of res.body.data)
55
+ expect(UserResponseSchema.safeParse(user).success).toBe(true);
56
+ });
57
+ ```
58
+
59
+ ## Test Data
60
+
61
+ ```ts
62
+ import { faker } from '@faker-js/faker';
63
+ export const userInput = (overrides?) => ({
64
+ email: faker.internet.email(), name: faker.person.fullName(), ...overrides,
65
+ });
66
+ ```
67
+
68
+ ## Best Practices
69
+
70
+ - Test at the right level — don't E2E-test what a unit test covers
71
+ - Always test error scenarios (API failures, validation, empty states)
72
+ - Isolate tests — clean DB state between integration tests
@@ -0,0 +1,349 @@
1
+ # Fullstack Development Guide
2
+
3
+ Comprehensive guidelines for building cohesive full-stack web applications.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ This guide applies to:
10
+ - Monolithic full-stack applications
11
+ - Full-stack frameworks (Next.js, Nuxt, SvelteKit, Remix)
12
+ - Separate frontend/backend codebases sharing types
13
+ - JAMstack with serverless backends
14
+
15
+ ### Key Principles
16
+
17
+ 1. **Unified Type System** - Share types between frontend and backend
18
+ 2. **Clear Boundaries** - Maintain separation between client and server
19
+ 3. **API-First Thinking** - Design the contract first
20
+ 4. **End-to-End Testing** - Test the full user journey
21
+
22
+ ### Project Structure
23
+
24
+ **Monorepo:**
25
+ ```
26
+ packages/
27
+ ├── shared/ # Shared types, validation, utilities
28
+ ├── web/ # Frontend application
29
+ ├── api/ # Backend API
30
+ └── e2e/ # End-to-end tests
31
+ ```
32
+
33
+ **Full-Stack Framework:**
34
+ ```
35
+ src/
36
+ ├── app/ # Pages and routing
37
+ ├── components/ # React components
38
+ ├── lib/
39
+ │ ├── client/ # Client-only code
40
+ │ ├── server/ # Server-only code
41
+ │ └── shared/ # Isomorphic code
42
+ └── types/ # TypeScript definitions
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Architecture
48
+
49
+ ### Architectural Layers
50
+
51
+ ```
52
+ Presentation → Application → Domain ← Infrastructure
53
+ ```
54
+
55
+ - **Presentation**: Components, pages, UI
56
+ - **Application**: Route handlers, request validation
57
+ - **Domain**: Business rules, pure functions
58
+ - **Infrastructure**: Database, external APIs
59
+
60
+ ### Server vs Client Components
61
+
62
+ **Server Components** (default):
63
+ ```tsx
64
+ // Direct database access, no interactivity
65
+ export default async function UsersPage() {
66
+ const users = await db.user.findMany();
67
+ return <ul>{users.map(u => <li key={u.id}>{u.name}</li>)}</ul>;
68
+ }
69
+ ```
70
+
71
+ **Client Components**:
72
+ ```tsx
73
+ 'use client';
74
+ // Interactivity, hooks, browser APIs
75
+ export function UserForm({ onSubmit }) {
76
+ const [name, setName] = useState('');
77
+ return <form onSubmit={...}>...</form>;
78
+ }
79
+ ```
80
+
81
+ ### Data Flow
82
+
83
+ ```
84
+ User Action → Component → API Request → Server Handler
85
+ ↓ ↓
86
+ UI Update ← State ← API Response ← Database
87
+ ```
88
+
89
+ ---
90
+
91
+ ## API Contracts
92
+
93
+ ### Schema-Driven Development
94
+
95
+ ```ts
96
+ // shared/schemas/user.ts
97
+ import { z } from 'zod';
98
+
99
+ export const CreateUserSchema = z.object({
100
+ email: z.string().email(),
101
+ name: z.string().min(1).max(100),
102
+ });
103
+
104
+ export const UserResponseSchema = z.object({
105
+ id: z.string(),
106
+ email: z.string(),
107
+ name: z.string(),
108
+ createdAt: z.string().datetime(),
109
+ });
110
+
111
+ export type CreateUserRequest = z.infer<typeof CreateUserSchema>;
112
+ export type UserResponse = z.infer<typeof UserResponseSchema>;
113
+ ```
114
+
115
+ ### Use on Backend
116
+
117
+ ```ts
118
+ app.post('/users', async (req, res) => {
119
+ const result = CreateUserSchema.safeParse(req.body);
120
+ if (!result.success) {
121
+ return res.status(422).json({ error: result.error });
122
+ }
123
+ const user = await createUser(result.data);
124
+ res.status(201).json({ data: user });
125
+ });
126
+ ```
127
+
128
+ ### Use on Frontend
129
+
130
+ ```ts
131
+ export const usersApi = {
132
+ async create(data: CreateUserRequest): Promise<UserResponse> {
133
+ const validated = CreateUserSchema.parse(data);
134
+ const response = await fetch('/api/users', {
135
+ method: 'POST',
136
+ body: JSON.stringify(validated),
137
+ });
138
+ return (await response.json()).data;
139
+ },
140
+ };
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Shared Types
146
+
147
+ ### Monorepo Setup
148
+
149
+ ```ts
150
+ // packages/shared/src/types/user.ts
151
+ export interface User {
152
+ id: string;
153
+ email: string;
154
+ name: string;
155
+ createdAt: Date;
156
+ }
157
+
158
+ export type CreateUserInput = Omit<User, 'id' | 'createdAt'>;
159
+ ```
160
+
161
+ ### Using Shared Types
162
+
163
+ ```ts
164
+ // In API
165
+ import { User, CreateUserInput } from '@myapp/shared';
166
+
167
+ // In Web
168
+ import { User, CreateUserInput } from '@myapp/shared';
169
+ ```
170
+
171
+ ### Validation Schemas
172
+
173
+ ```ts
174
+ // shared/validation/user.ts
175
+ export const CreateUserSchema = z.object({
176
+ email: z.string().email(),
177
+ name: z.string().min(1),
178
+ });
179
+
180
+ export type CreateUserInput = z.infer<typeof CreateUserSchema>;
181
+ ```
182
+
183
+ ### Error Types
184
+
185
+ ```ts
186
+ export const ErrorCode = {
187
+ VALIDATION_ERROR: 'VALIDATION_ERROR',
188
+ NOT_FOUND: 'NOT_FOUND',
189
+ UNAUTHORIZED: 'UNAUTHORIZED',
190
+ } as const;
191
+
192
+ export type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
193
+ ```
194
+
195
+ ---
196
+
197
+ ## State Synchronization
198
+
199
+ ### Optimistic Updates
200
+
201
+ ```tsx
202
+ 'use client';
203
+ import { useOptimistic } from 'react';
204
+
205
+ export function TodoList({ todos, addTodo }) {
206
+ const [optimisticTodos, addOptimisticTodo] = useOptimistic(
207
+ todos,
208
+ (state, newTodo) => [...state, newTodo]
209
+ );
210
+
211
+ async function handleAdd(formData) {
212
+ addOptimisticTodo({ id: 'temp', title: formData.get('title') });
213
+ await addTodo(formData);
214
+ }
215
+ }
216
+ ```
217
+
218
+ ### Cache Invalidation
219
+
220
+ ```ts
221
+ import { revalidatePath, revalidateTag } from 'next/cache';
222
+
223
+ export async function updateUser(id: string, data) {
224
+ await db.user.update({ where: { id }, data });
225
+ revalidatePath(`/users/${id}`);
226
+ }
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Testing
232
+
233
+ ### Testing Pyramid
234
+
235
+ 1. **E2E Tests**: Critical user flows
236
+ 2. **Integration Tests**: API + DB, components + API
237
+ 3. **Unit Tests**: Pure functions, isolated logic
238
+
239
+ ### E2E Tests
240
+
241
+ ```ts
242
+ test('user can sign up and access dashboard', async ({ page }) => {
243
+ await page.goto('/signup');
244
+ await page.fill('[name="email"]', 'test@example.com');
245
+ await page.fill('[name="password"]', 'SecurePass123!');
246
+ await page.click('button[type="submit"]');
247
+
248
+ await expect(page).toHaveURL('/dashboard');
249
+ await expect(page.locator('text=Welcome')).toBeVisible();
250
+ });
251
+ ```
252
+
253
+ ### Integration Tests
254
+
255
+ ```ts
256
+ describe('User Management', () => {
257
+ it('creates user and returns in list', async () => {
258
+ const createRes = await request(app)
259
+ .post('/api/users')
260
+ .send({ email: 'new@example.com', name: 'New User' });
261
+
262
+ expect(createRes.status).toBe(201);
263
+
264
+ const listRes = await request(app).get('/api/users');
265
+ expect(listRes.body.data).toContainEqual(
266
+ expect.objectContaining({ email: 'new@example.com' })
267
+ );
268
+ });
269
+ });
270
+ ```
271
+
272
+ ### Contract Tests
273
+
274
+ ```ts
275
+ describe('User API Contract', () => {
276
+ it('returns valid UserResponse', async () => {
277
+ const response = await request(app).get('/api/users');
278
+
279
+ for (const user of response.body.data) {
280
+ const result = UserResponseSchema.safeParse(user);
281
+ expect(result.success).toBe(true);
282
+ }
283
+ });
284
+ });
285
+ ```
286
+
287
+ ### Test Data Factories
288
+
289
+ ```ts
290
+ import { faker } from '@faker-js/faker';
291
+
292
+ export const createUserInput = (overrides?) => ({
293
+ email: faker.internet.email(),
294
+ name: faker.person.fullName(),
295
+ ...overrides,
296
+ });
297
+ ```
298
+
299
+ ---
300
+
301
+ ## Error Handling
302
+
303
+ ### Server-Side
304
+
305
+ ```ts
306
+ export async function GET(request, { params }) {
307
+ const user = await db.user.findUnique({ where: { id: params.id } });
308
+
309
+ if (!user) {
310
+ return NextResponse.json(
311
+ { error: { code: 'NOT_FOUND', message: 'User not found' } },
312
+ { status: 404 }
313
+ );
314
+ }
315
+
316
+ return NextResponse.json({ data: user });
317
+ }
318
+ ```
319
+
320
+ ### Client-Side
321
+
322
+ ```tsx
323
+ export function UserProfile({ userId }) {
324
+ const { data, error, isLoading } = useQuery(['user', userId], () =>
325
+ fetch(`/api/users/${userId}`).then(res => res.json())
326
+ );
327
+
328
+ if (isLoading) return <Skeleton />;
329
+ if (error) return <ErrorMessage error={error} />;
330
+ return <UserCard user={data.data} />;
331
+ }
332
+ ```
333
+
334
+ ---
335
+
336
+ ## Definition of Done
337
+
338
+ A fullstack feature is complete when:
339
+
340
+ - [ ] Types shared between frontend and backend
341
+ - [ ] API contract documented
342
+ - [ ] Frontend renders correctly
343
+ - [ ] Backend handles all edge cases
344
+ - [ ] Validation consistent on both sides
345
+ - [ ] Loading and error states handled
346
+ - [ ] E2E tests cover critical paths
347
+ - [ ] No TypeScript errors
348
+ - [ ] Performance acceptable
349
+ - [ ] Code reviewed and approved