workspace-architect 1.3.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 (354) hide show
  1. package/.env.example +1 -0
  2. package/.gitattributes +1 -0
  3. package/.github/workflows/manual-publish.yml +36 -0
  4. package/.github/workflows/sync-and-publish.yml +58 -0
  5. package/.release-it.json +20 -0
  6. package/CHANGELOG.md +43 -0
  7. package/README.md +62 -0
  8. package/assets/chatmodes/4.1-Beast.chatmode.md +152 -0
  9. package/assets/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
  10. package/assets/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
  11. package/assets/chatmodes/accessibility.chatmode.md +298 -0
  12. package/assets/chatmodes/address-comments.chatmode.md +59 -0
  13. package/assets/chatmodes/aem-frontend-specialist.chatmode.md +385 -0
  14. package/assets/chatmodes/api-architect.chatmode.md +40 -0
  15. package/assets/chatmodes/atlassian-requirements-to-jira.chatmode.md +444 -0
  16. package/assets/chatmodes/azure-logic-apps-expert.chatmode.md +100 -0
  17. package/assets/chatmodes/azure-principal-architect.chatmode.md +58 -0
  18. package/assets/chatmodes/azure-saas-architect.chatmode.md +118 -0
  19. package/assets/chatmodes/azure-verified-modules-bicep.chatmode.md +44 -0
  20. package/assets/chatmodes/azure-verified-modules-terraform.chatmode.md +58 -0
  21. package/assets/chatmodes/bicep-implement.chatmode.md +40 -0
  22. package/assets/chatmodes/bicep-plan.chatmode.md +112 -0
  23. package/assets/chatmodes/blueprint-mode-codex.chatmode.md +110 -0
  24. package/assets/chatmodes/blueprint-mode.chatmode.md +171 -0
  25. package/assets/chatmodes/clojure-interactive-programming.chatmode.md +174 -0
  26. package/assets/chatmodes/code-tour.chatmode.md +205 -0
  27. package/assets/chatmodes/critical-thinking.chatmode.md +23 -0
  28. package/assets/chatmodes/csharp-dotnet-janitor.chatmode.md +83 -0
  29. package/assets/chatmodes/csharp-mcp-expert.chatmode.md +69 -0
  30. package/assets/chatmodes/debug.chatmode.md +79 -0
  31. package/assets/chatmodes/declarative-agents-architect.chatmode.md +76 -0
  32. package/assets/chatmodes/demonstrate-understanding.chatmode.md +60 -0
  33. package/assets/chatmodes/dotnet-upgrade.chatmode.md +222 -0
  34. package/assets/chatmodes/drupal-expert.chatmode.md +687 -0
  35. package/assets/chatmodes/electron-angular-native.chatmode.md +285 -0
  36. package/assets/chatmodes/expert-cpp-software-engineer.chatmode.md +27 -0
  37. package/assets/chatmodes/expert-dotnet-software-engineer.chatmode.md +22 -0
  38. package/assets/chatmodes/expert-nextjs-developer.chatmode.md +477 -0
  39. package/assets/chatmodes/expert-react-frontend-engineer.chatmode.md +738 -0
  40. package/assets/chatmodes/gilfoyle.chatmode.md +66 -0
  41. package/assets/chatmodes/go-mcp-expert.chatmode.md +122 -0
  42. package/assets/chatmodes/gpt-5-beast-mode.chatmode.md +109 -0
  43. package/assets/chatmodes/hlbpa.chatmode.md +232 -0
  44. package/assets/chatmodes/implementation-plan.chatmode.md +159 -0
  45. package/assets/chatmodes/janitor.chatmode.md +89 -0
  46. package/assets/chatmodes/java-mcp-expert.chatmode.md +325 -0
  47. package/assets/chatmodes/kotlin-mcp-expert.chatmode.md +181 -0
  48. package/assets/chatmodes/kusto-assistant.chatmode.md +143 -0
  49. package/assets/chatmodes/laravel-expert-agent.chatmode.md +628 -0
  50. package/assets/chatmodes/mentor.chatmode.md +32 -0
  51. package/assets/chatmodes/meta-agentic-project-scaffold.chatmode.md +15 -0
  52. package/assets/chatmodes/microsoft-agent-framework-dotnet.chatmode.md +62 -0
  53. package/assets/chatmodes/microsoft-agent-framework-python.chatmode.md +62 -0
  54. package/assets/chatmodes/microsoft-study-mode.chatmode.md +32 -0
  55. package/assets/chatmodes/microsoft_learn_contributor.chatmode.md +388 -0
  56. package/assets/chatmodes/ms-sql-dba.chatmode.md +25 -0
  57. package/assets/chatmodes/php-mcp-expert.chatmode.md +498 -0
  58. package/assets/chatmodes/pimcore-expert.chatmode.md +869 -0
  59. package/assets/chatmodes/plan.chatmode.md +114 -0
  60. package/assets/chatmodes/planner.chatmode.md +14 -0
  61. package/assets/chatmodes/playwright-tester.chatmode.md +13 -0
  62. package/assets/chatmodes/postgresql-dba.chatmode.md +17 -0
  63. package/assets/chatmodes/power-bi-data-modeling-expert.chatmode.md +319 -0
  64. package/assets/chatmodes/power-bi-dax-expert.chatmode.md +334 -0
  65. package/assets/chatmodes/power-bi-performance-expert.chatmode.md +533 -0
  66. package/assets/chatmodes/power-bi-visualization-expert.chatmode.md +549 -0
  67. package/assets/chatmodes/power-platform-expert.chatmode.md +116 -0
  68. package/assets/chatmodes/power-platform-mcp-integration-expert.chatmode.md +149 -0
  69. package/assets/chatmodes/prd.chatmode.md +201 -0
  70. package/assets/chatmodes/principal-software-engineer.chatmode.md +41 -0
  71. package/assets/chatmodes/prompt-builder.chatmode.md +352 -0
  72. package/assets/chatmodes/prompt-engineer.chatmode.md +72 -0
  73. package/assets/chatmodes/python-mcp-expert.chatmode.md +99 -0
  74. package/assets/chatmodes/refine-issue.chatmode.md +34 -0
  75. package/assets/chatmodes/research-technical-spike.chatmode.md +169 -0
  76. package/assets/chatmodes/ruby-mcp-expert.chatmode.md +346 -0
  77. package/assets/chatmodes/rust-gpt-4.1-beast-mode.chatmode.md +197 -0
  78. package/assets/chatmodes/rust-mcp-expert.chatmode.md +465 -0
  79. package/assets/chatmodes/search-ai-optimization-expert.chatmode.md +227 -0
  80. package/assets/chatmodes/semantic-kernel-dotnet.chatmode.md +31 -0
  81. package/assets/chatmodes/semantic-kernel-python.chatmode.md +28 -0
  82. package/assets/chatmodes/shopify-expert.chatmode.md +681 -0
  83. package/assets/chatmodes/simple-app-idea-generator.chatmode.md +134 -0
  84. package/assets/chatmodes/software-engineer-agent-v1.chatmode.md +164 -0
  85. package/assets/chatmodes/specification.chatmode.md +127 -0
  86. package/assets/chatmodes/swift-mcp-expert.chatmode.md +240 -0
  87. package/assets/chatmodes/task-planner.chatmode.md +374 -0
  88. package/assets/chatmodes/task-researcher.chatmode.md +254 -0
  89. package/assets/chatmodes/tdd-green.chatmode.md +59 -0
  90. package/assets/chatmodes/tdd-red.chatmode.md +59 -0
  91. package/assets/chatmodes/tdd-refactor.chatmode.md +84 -0
  92. package/assets/chatmodes/tech-debt-remediation-plan.chatmode.md +49 -0
  93. package/assets/chatmodes/terraform-azure-implement.chatmode.md +104 -0
  94. package/assets/chatmodes/terraform-azure-planning.chatmode.md +157 -0
  95. package/assets/chatmodes/typescript-mcp-expert.chatmode.md +91 -0
  96. package/assets/chatmodes/voidbeast-gpt41enhanced.chatmode.md +230 -0
  97. package/assets/chatmodes/wg-code-alchemist.chatmode.md +61 -0
  98. package/assets/chatmodes/wg-code-sentinel.chatmode.md +55 -0
  99. package/assets/collections/ai-prompt-engineering.json +18 -0
  100. package/assets/collections/angular-development.json +7 -0
  101. package/assets/collections/azure-cloud-architect.json +29 -0
  102. package/assets/collections/cpp-development.json +6 -0
  103. package/assets/collections/database-administration.json +8 -0
  104. package/assets/collections/devops-sre.json +11 -0
  105. package/assets/collections/dotnet-development.json +22 -0
  106. package/assets/collections/general-productivity.json +9 -0
  107. package/assets/collections/go-development.json +7 -0
  108. package/assets/collections/java-spring-developer.json +26 -0
  109. package/assets/collections/learning-mentoring.json +10 -0
  110. package/assets/collections/legacy-migration.json +4 -0
  111. package/assets/collections/mcp-specialist.json +41 -0
  112. package/assets/collections/mobile-development.json +4 -0
  113. package/assets/collections/php-cms-development.json +11 -0
  114. package/assets/collections/power-platform-specialist.json +31 -0
  115. package/assets/collections/project-management.json +12 -0
  116. package/assets/collections/python-development.json +13 -0
  117. package/assets/collections/quality-assurance.json +13 -0
  118. package/assets/collections/ruby-development.json +9 -0
  119. package/assets/collections/rust-development.json +10 -0
  120. package/assets/collections/security-specialist.json +8 -0
  121. package/assets/collections/software-architect.json +25 -0
  122. package/assets/collections/technical-writing.json +9 -0
  123. package/assets/collections/web-frontend-development.json +14 -0
  124. package/assets/instructions/a11y.instructions.md +369 -0
  125. package/assets/instructions/ai-prompt-engineering-safety-best-practices.instructions.md +867 -0
  126. package/assets/instructions/angular.instructions.md +104 -0
  127. package/assets/instructions/ansible.instructions.md +88 -0
  128. package/assets/instructions/aspnet-rest-apis.instructions.md +110 -0
  129. package/assets/instructions/astro.instructions.md +182 -0
  130. package/assets/instructions/azure-devops-pipelines.instructions.md +185 -0
  131. package/assets/instructions/azure-functions-typescript.instructions.md +14 -0
  132. package/assets/instructions/azure-logic-apps-power-automate.instructions.md +1943 -0
  133. package/assets/instructions/azure-verified-modules-terraform.instructions.md +229 -0
  134. package/assets/instructions/bicep-code-best-practices.instructions.md +54 -0
  135. package/assets/instructions/blazor.instructions.md +77 -0
  136. package/assets/instructions/clojure.instructions.md +349 -0
  137. package/assets/instructions/cmake-vcpkg.instructions.md +10 -0
  138. package/assets/instructions/codexer.instructions.md +428 -0
  139. package/assets/instructions/coldfusion-cfc.instructions.md +30 -0
  140. package/assets/instructions/coldfusion-cfm.instructions.md +28 -0
  141. package/assets/instructions/collections.instructions.md +54 -0
  142. package/assets/instructions/containerization-docker-best-practices.instructions.md +681 -0
  143. package/assets/instructions/convert-jpa-to-spring-data-cosmos.instructions.md +949 -0
  144. package/assets/instructions/copilot-thought-logging.instructions.md +62 -0
  145. package/assets/instructions/csharp-ja.instructions.md +114 -0
  146. package/assets/instructions/csharp-ko.instructions.md +77 -0
  147. package/assets/instructions/csharp-mcp-server.instructions.md +95 -0
  148. package/assets/instructions/csharp.instructions.md +114 -0
  149. package/assets/instructions/dart-n-flutter.instructions.md +447 -0
  150. package/assets/instructions/declarative-agents-microsoft365.instructions.md +316 -0
  151. package/assets/instructions/devbox-image-definition.instructions.md +302 -0
  152. package/assets/instructions/devops-core-principles.instructions.md +167 -0
  153. package/assets/instructions/dotnet-architecture-good-practices.instructions.md +279 -0
  154. package/assets/instructions/dotnet-framework.instructions.md +113 -0
  155. package/assets/instructions/dotnet-maui-9-to-dotnet-maui-10-upgrade.instructions.md +1922 -0
  156. package/assets/instructions/dotnet-maui.instructions.md +69 -0
  157. package/assets/instructions/dotnet-upgrade.instructions.md +287 -0
  158. package/assets/instructions/dotnet-wpf.instructions.md +79 -0
  159. package/assets/instructions/genaiscript.instructions.md +21 -0
  160. package/assets/instructions/generate-modern-terraform-code-for-azure.instructions.md +82 -0
  161. package/assets/instructions/gilfoyle-code-review.instructions.md +114 -0
  162. package/assets/instructions/github-actions-ci-cd-best-practices.instructions.md +607 -0
  163. package/assets/instructions/go-mcp-server.instructions.md +346 -0
  164. package/assets/instructions/go.instructions.md +373 -0
  165. package/assets/instructions/instructions.instructions.md +256 -0
  166. package/assets/instructions/java-11-to-java-17-upgrade.instructions.md +793 -0
  167. package/assets/instructions/java-17-to-java-21-upgrade.instructions.md +464 -0
  168. package/assets/instructions/java-21-to-java-25-upgrade.instructions.md +311 -0
  169. package/assets/instructions/java-mcp-server.instructions.md +553 -0
  170. package/assets/instructions/java.instructions.md +81 -0
  171. package/assets/instructions/joyride-user-project.instructions.md +206 -0
  172. package/assets/instructions/joyride-workspace-automation.instructions.md +46 -0
  173. package/assets/instructions/kotlin-mcp-server.instructions.md +481 -0
  174. package/assets/instructions/kubernetes-deployment-best-practices.instructions.md +307 -0
  175. package/assets/instructions/langchain-python.instructions.md +229 -0
  176. package/assets/instructions/localization.instructions.md +39 -0
  177. package/assets/instructions/makefile.instructions.md +410 -0
  178. package/assets/instructions/markdown.instructions.md +52 -0
  179. package/assets/instructions/memory-bank.instructions.md +299 -0
  180. package/assets/instructions/mongo-dba.instructions.md +25 -0
  181. package/assets/instructions/ms-sql-dba.instructions.md +25 -0
  182. package/assets/instructions/nestjs.instructions.md +406 -0
  183. package/assets/instructions/nextjs-tailwind.instructions.md +72 -0
  184. package/assets/instructions/nextjs.instructions.md +143 -0
  185. package/assets/instructions/nodejs-javascript-vitest.instructions.md +30 -0
  186. package/assets/instructions/object-calisthenics.instructions.md +302 -0
  187. package/assets/instructions/oqtane.instructions.md +86 -0
  188. package/assets/instructions/performance-optimization.instructions.md +420 -0
  189. package/assets/instructions/php-mcp-server.instructions.md +809 -0
  190. package/assets/instructions/playwright-dotnet.instructions.md +101 -0
  191. package/assets/instructions/playwright-python.instructions.md +62 -0
  192. package/assets/instructions/playwright-typescript.instructions.md +86 -0
  193. package/assets/instructions/power-apps-canvas-yaml.instructions.md +827 -0
  194. package/assets/instructions/power-apps-code-apps.instructions.md +601 -0
  195. package/assets/instructions/power-bi-custom-visuals-development.instructions.md +810 -0
  196. package/assets/instructions/power-bi-data-modeling-best-practices.instructions.md +639 -0
  197. package/assets/instructions/power-bi-dax-best-practices.instructions.md +795 -0
  198. package/assets/instructions/power-bi-devops-alm-best-practices.instructions.md +623 -0
  199. package/assets/instructions/power-bi-report-design-best-practices.instructions.md +752 -0
  200. package/assets/instructions/power-bi-security-rls-best-practices.instructions.md +504 -0
  201. package/assets/instructions/power-platform-connector.instructions.md +430 -0
  202. package/assets/instructions/power-platform-mcp-development.instructions.md +88 -0
  203. package/assets/instructions/powershell-pester-5.instructions.md +197 -0
  204. package/assets/instructions/powershell.instructions.md +356 -0
  205. package/assets/instructions/prompt.instructions.md +73 -0
  206. package/assets/instructions/python-mcp-server.instructions.md +204 -0
  207. package/assets/instructions/python.instructions.md +56 -0
  208. package/assets/instructions/quarkus-mcp-server-sse.instructions.md +49 -0
  209. package/assets/instructions/quarkus.instructions.md +98 -0
  210. package/assets/instructions/r.instructions.md +116 -0
  211. package/assets/instructions/reactjs.instructions.md +162 -0
  212. package/assets/instructions/ruby-mcp-server.instructions.md +629 -0
  213. package/assets/instructions/ruby-on-rails.instructions.md +124 -0
  214. package/assets/instructions/rust-mcp-server.instructions.md +715 -0
  215. package/assets/instructions/rust.instructions.md +135 -0
  216. package/assets/instructions/security-and-owasp.instructions.md +51 -0
  217. package/assets/instructions/self-explanatory-code-commenting.instructions.md +162 -0
  218. package/assets/instructions/shell.instructions.md +132 -0
  219. package/assets/instructions/spec-driven-workflow-v1.instructions.md +323 -0
  220. package/assets/instructions/springboot.instructions.md +68 -0
  221. package/assets/instructions/sql-sp-generation.instructions.md +74 -0
  222. package/assets/instructions/svelte.instructions.md +161 -0
  223. package/assets/instructions/swift-mcp-server.instructions.md +498 -0
  224. package/assets/instructions/taming-copilot.instructions.md +40 -0
  225. package/assets/instructions/tanstack-start-shadcn-tailwind.instructions.md +212 -0
  226. package/assets/instructions/task-implementation.instructions.md +190 -0
  227. package/assets/instructions/tasksync.instructions.md +352 -0
  228. package/assets/instructions/terraform-azure.instructions.md +254 -0
  229. package/assets/instructions/terraform-sap-btp.instructions.md +195 -0
  230. package/assets/instructions/terraform.instructions.md +113 -0
  231. package/assets/instructions/typescript-5-es2022.instructions.md +114 -0
  232. package/assets/instructions/typescript-mcp-server.instructions.md +228 -0
  233. package/assets/instructions/update-code-from-shorthand.instructions.md +130 -0
  234. package/assets/instructions/vuejs3.instructions.md +153 -0
  235. package/assets/instructions/wordpress.instructions.md +186 -0
  236. package/assets/prompts/add-educational-comments.prompt.md +129 -0
  237. package/assets/prompts/ai-prompt-engineering-safety-review.prompt.md +230 -0
  238. package/assets/prompts/architecture-blueprint-generator.prompt.md +322 -0
  239. package/assets/prompts/aspnet-minimal-api-openapi.prompt.md +42 -0
  240. package/assets/prompts/az-cost-optimize.prompt.md +305 -0
  241. package/assets/prompts/azure-resource-health-diagnose.prompt.md +290 -0
  242. package/assets/prompts/boost-prompt.prompt.md +25 -0
  243. package/assets/prompts/breakdown-epic-arch.prompt.md +66 -0
  244. package/assets/prompts/breakdown-epic-pm.prompt.md +58 -0
  245. package/assets/prompts/breakdown-feature-implementation.prompt.md +128 -0
  246. package/assets/prompts/breakdown-feature-prd.prompt.md +61 -0
  247. package/assets/prompts/breakdown-plan.prompt.md +509 -0
  248. package/assets/prompts/breakdown-test.prompt.md +365 -0
  249. package/assets/prompts/code-exemplars-blueprint-generator.prompt.md +126 -0
  250. package/assets/prompts/comment-code-generate-a-tutorial.prompt.md +26 -0
  251. package/assets/prompts/containerize-aspnet-framework.prompt.md +455 -0
  252. package/assets/prompts/containerize-aspnetcore.prompt.md +393 -0
  253. package/assets/prompts/conventional-commit.prompt.md +73 -0
  254. package/assets/prompts/copilot-instructions-blueprint-generator.prompt.md +294 -0
  255. package/assets/prompts/cosmosdb-datamodeling.prompt.md +1045 -0
  256. package/assets/prompts/create-agentsmd.prompt.md +249 -0
  257. package/assets/prompts/create-architectural-decision-record.prompt.md +97 -0
  258. package/assets/prompts/create-github-action-workflow-specification.prompt.md +276 -0
  259. package/assets/prompts/create-github-issue-feature-from-specification.prompt.md +28 -0
  260. package/assets/prompts/create-github-issues-feature-from-implementation-plan.prompt.md +28 -0
  261. package/assets/prompts/create-github-issues-for-unmet-specification-requirements.prompt.md +35 -0
  262. package/assets/prompts/create-github-pull-request-from-specification.prompt.md +24 -0
  263. package/assets/prompts/create-implementation-plan.prompt.md +157 -0
  264. package/assets/prompts/create-llms.prompt.md +210 -0
  265. package/assets/prompts/create-oo-component-documentation.prompt.md +193 -0
  266. package/assets/prompts/create-readme.prompt.md +21 -0
  267. package/assets/prompts/create-specification.prompt.md +127 -0
  268. package/assets/prompts/create-spring-boot-java-project.prompt.md +163 -0
  269. package/assets/prompts/create-spring-boot-kotlin-project.prompt.md +147 -0
  270. package/assets/prompts/create-technical-spike.prompt.md +231 -0
  271. package/assets/prompts/csharp-async.prompt.md +50 -0
  272. package/assets/prompts/csharp-docs.prompt.md +63 -0
  273. package/assets/prompts/csharp-mcp-server-generator.prompt.md +59 -0
  274. package/assets/prompts/csharp-mstest.prompt.md +67 -0
  275. package/assets/prompts/csharp-nunit.prompt.md +72 -0
  276. package/assets/prompts/csharp-tunit.prompt.md +101 -0
  277. package/assets/prompts/csharp-xunit.prompt.md +69 -0
  278. package/assets/prompts/declarative-agents.prompt.md +93 -0
  279. package/assets/prompts/documentation-writer.prompt.md +46 -0
  280. package/assets/prompts/dotnet-best-practices.prompt.md +84 -0
  281. package/assets/prompts/dotnet-design-pattern-review.prompt.md +41 -0
  282. package/assets/prompts/dotnet-upgrade.prompt.md +116 -0
  283. package/assets/prompts/editorconfig.prompt.md +64 -0
  284. package/assets/prompts/ef-core.prompt.md +76 -0
  285. package/assets/prompts/finalize-agent-prompt.prompt.md +27 -0
  286. package/assets/prompts/first-ask.prompt.md +29 -0
  287. package/assets/prompts/folder-structure-blueprint-generator.prompt.md +405 -0
  288. package/assets/prompts/gen-specs-as-issues.prompt.md +165 -0
  289. package/assets/prompts/generate-custom-instructions-from-codebase.prompt.md +240 -0
  290. package/assets/prompts/git-flow-branch-creator.prompt.md +293 -0
  291. package/assets/prompts/github-copilot-starter.prompt.md +372 -0
  292. package/assets/prompts/go-mcp-server-generator.prompt.md +334 -0
  293. package/assets/prompts/java-docs.prompt.md +24 -0
  294. package/assets/prompts/java-junit.prompt.md +64 -0
  295. package/assets/prompts/java-mcp-server-generator.prompt.md +756 -0
  296. package/assets/prompts/java-refactoring-extract-method.prompt.md +105 -0
  297. package/assets/prompts/java-refactoring-remove-parameter.prompt.md +85 -0
  298. package/assets/prompts/java-springboot.prompt.md +66 -0
  299. package/assets/prompts/javascript-typescript-jest.prompt.md +44 -0
  300. package/assets/prompts/kotlin-mcp-server-generator.prompt.md +449 -0
  301. package/assets/prompts/kotlin-springboot.prompt.md +71 -0
  302. package/assets/prompts/mcp-copilot-studio-server-generator.prompt.md +118 -0
  303. package/assets/prompts/memory-merger.prompt.md +107 -0
  304. package/assets/prompts/mkdocs-translations.prompt.md +110 -0
  305. package/assets/prompts/model-recommendation.prompt.md +677 -0
  306. package/assets/prompts/multi-stage-dockerfile.prompt.md +47 -0
  307. package/assets/prompts/my-issues.prompt.md +9 -0
  308. package/assets/prompts/my-pull-requests.prompt.md +15 -0
  309. package/assets/prompts/next-intl-add-language.prompt.md +20 -0
  310. package/assets/prompts/php-mcp-server-generator.prompt.md +522 -0
  311. package/assets/prompts/playwright-automation-fill-in-form.prompt.md +30 -0
  312. package/assets/prompts/playwright-explore-website.prompt.md +19 -0
  313. package/assets/prompts/playwright-generate-test.prompt.md +19 -0
  314. package/assets/prompts/postgresql-code-review.prompt.md +214 -0
  315. package/assets/prompts/postgresql-optimization.prompt.md +406 -0
  316. package/assets/prompts/power-apps-code-app-scaffold.prompt.md +150 -0
  317. package/assets/prompts/power-bi-dax-optimization.prompt.md +175 -0
  318. package/assets/prompts/power-bi-model-design-review.prompt.md +405 -0
  319. package/assets/prompts/power-bi-performance-troubleshooting.prompt.md +384 -0
  320. package/assets/prompts/power-bi-report-design-consultation.prompt.md +353 -0
  321. package/assets/prompts/power-platform-mcp-connector-suite.prompt.md +156 -0
  322. package/assets/prompts/project-workflow-analysis-blueprint-generator.prompt.md +294 -0
  323. package/assets/prompts/prompt-builder.prompt.md +142 -0
  324. package/assets/prompts/pytest-coverage.prompt.md +28 -0
  325. package/assets/prompts/python-mcp-server-generator.prompt.md +105 -0
  326. package/assets/prompts/readme-blueprint-generator.prompt.md +79 -0
  327. package/assets/prompts/remember-interactive-programming.prompt.md +13 -0
  328. package/assets/prompts/remember.prompt.md +125 -0
  329. package/assets/prompts/repo-story-time.prompt.md +156 -0
  330. package/assets/prompts/review-and-refactor.prompt.md +15 -0
  331. package/assets/prompts/ruby-mcp-server-generator.prompt.md +660 -0
  332. package/assets/prompts/rust-mcp-server-generator.prompt.md +578 -0
  333. package/assets/prompts/shuffle-json-data.prompt.md +151 -0
  334. package/assets/prompts/sql-code-review.prompt.md +303 -0
  335. package/assets/prompts/sql-optimization.prompt.md +298 -0
  336. package/assets/prompts/suggest-awesome-github-copilot-agents.prompt.md +72 -0
  337. package/assets/prompts/suggest-awesome-github-copilot-chatmodes.prompt.md +71 -0
  338. package/assets/prompts/suggest-awesome-github-copilot-collections.prompt.md +149 -0
  339. package/assets/prompts/suggest-awesome-github-copilot-instructions.prompt.md +88 -0
  340. package/assets/prompts/suggest-awesome-github-copilot-prompts.prompt.md +71 -0
  341. package/assets/prompts/swift-mcp-server-generator.prompt.md +669 -0
  342. package/assets/prompts/technology-stack-blueprint-generator.prompt.md +242 -0
  343. package/assets/prompts/typescript-mcp-server-generator.prompt.md +90 -0
  344. package/assets/prompts/update-avm-modules-in-bicep.prompt.md +60 -0
  345. package/assets/prompts/update-implementation-plan.prompt.md +157 -0
  346. package/assets/prompts/update-llms.prompt.md +216 -0
  347. package/assets/prompts/update-markdown-file-index.prompt.md +76 -0
  348. package/assets/prompts/update-oo-component-documentation.prompt.md +162 -0
  349. package/assets/prompts/update-specification.prompt.md +127 -0
  350. package/assets/prompts/write-coding-standards-from-file.prompt.md +316 -0
  351. package/bin/cli.js +200 -0
  352. package/package.json +53 -0
  353. package/scripts/sync.js +99 -0
  354. package/verdaccio/config.yaml +202 -0
@@ -0,0 +1,795 @@
1
+ ---
2
+ description: 'Comprehensive Power BI DAX best practices and patterns based on Microsoft guidance for creating efficient, maintainable, and performant DAX formulas.'
3
+ applyTo: '**/*.{pbix,dax,md,txt}'
4
+ ---
5
+
6
+ # Power BI DAX Best Practices
7
+
8
+ ## Overview
9
+ This document provides comprehensive instructions for writing efficient, maintainable, and performant DAX (Data Analysis Expressions) formulas in Power BI, based on Microsoft's official guidance and best practices.
10
+
11
+ ## Core DAX Principles
12
+
13
+ ### 1. Formula Structure and Variables
14
+ Always use variables to improve performance, readability, and debugging:
15
+
16
+ ```dax
17
+ // ✅ PREFERRED: Using variables for clarity and performance
18
+ Sales YoY Growth % =
19
+ VAR CurrentSales = [Total Sales]
20
+ VAR PreviousYearSales =
21
+ CALCULATE(
22
+ [Total Sales],
23
+ SAMEPERIODLASTYEAR('Date'[Date])
24
+ )
25
+ RETURN
26
+ DIVIDE(CurrentSales - PreviousYearSales, PreviousYearSales)
27
+
28
+ // ❌ AVOID: Repeated calculations without variables
29
+ Sales YoY Growth % =
30
+ DIVIDE(
31
+ [Total Sales] - CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date])),
32
+ CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
33
+ )
34
+ ```
35
+
36
+ **Key Benefits of Variables:**
37
+ - **Performance**: Calculations are evaluated once and cached
38
+ - **Readability**: Complex formulas become self-documenting
39
+ - **Debugging**: Can temporarily return variable values for testing
40
+ - **Maintainability**: Changes need to be made in only one place
41
+
42
+ ### 2. Proper Reference Syntax
43
+ Follow Microsoft's recommended patterns for column and measure references:
44
+
45
+ ```dax
46
+ // ✅ ALWAYS fully qualify column references
47
+ Customer Count =
48
+ DISTINCTCOUNT(Sales[CustomerID])
49
+
50
+ Profit Margin =
51
+ DIVIDE(
52
+ SUM(Sales[Profit]),
53
+ SUM(Sales[Revenue])
54
+ )
55
+
56
+ // ✅ NEVER fully qualify measure references
57
+ YTD Sales Growth =
58
+ DIVIDE([YTD Sales] - [YTD Sales PY], [YTD Sales PY])
59
+
60
+ // ❌ AVOID: Unqualified column references
61
+ Customer Count = DISTINCTCOUNT([CustomerID]) // Ambiguous
62
+
63
+ // ❌ AVOID: Fully qualified measure references
64
+ Growth Rate = DIVIDE(Sales[Total Sales] - Sales[Total Sales PY], Sales[Total Sales PY]) // Breaks if measure moves
65
+ ```
66
+
67
+ ### 3. Error Handling Strategies
68
+ Implement robust error handling using appropriate patterns:
69
+
70
+ ```dax
71
+ // ✅ PREFERRED: Use DIVIDE function for safe division
72
+ Profit Margin =
73
+ DIVIDE([Total Profit], [Total Revenue])
74
+
75
+ // ✅ PREFERRED: Use defensive strategies in model design
76
+ Average Order Value =
77
+ VAR TotalOrders = COUNTROWS(Orders)
78
+ VAR TotalRevenue = SUM(Orders[Amount])
79
+ RETURN
80
+ IF(TotalOrders > 0, DIVIDE(TotalRevenue, TotalOrders))
81
+
82
+ // ❌ AVOID: ISERROR and IFERROR functions (performance impact)
83
+ Profit Margin =
84
+ IFERROR([Total Profit] / [Total Revenue], BLANK())
85
+
86
+ // ❌ AVOID: Complex error handling that could be prevented
87
+ Unsafe Calculation =
88
+ IF(
89
+ OR(
90
+ ISBLANK([Revenue]),
91
+ [Revenue] = 0
92
+ ),
93
+ BLANK(),
94
+ [Profit] / [Revenue]
95
+ )
96
+ ```
97
+
98
+ ## DAX Function Categories and Best Practices
99
+
100
+ ### Aggregation Functions
101
+ ```dax
102
+ // Use appropriate aggregation functions for performance
103
+ Customer Count = DISTINCTCOUNT(Sales[CustomerID]) // ✅ For unique counts
104
+ Order Count = COUNTROWS(Orders) // ✅ For row counts
105
+ Average Deal Size = AVERAGE(Sales[DealValue]) // ✅ For averages
106
+
107
+ // Avoid COUNT when COUNTROWS is more appropriate
108
+ // ❌ COUNT(Sales[OrderID]) - slower for counting rows
109
+ // ✅ COUNTROWS(Sales) - faster and more explicit
110
+ ```
111
+
112
+ ### Filter and Context Functions
113
+ ```dax
114
+ // Efficient use of CALCULATE with multiple filters
115
+ High Value Customers =
116
+ CALCULATE(
117
+ DISTINCTCOUNT(Sales[CustomerID]),
118
+ Sales[OrderValue] > 1000,
119
+ Sales[OrderDate] >= DATE(2024,1,1)
120
+ )
121
+
122
+ // Proper context modification patterns
123
+ Same Period Last Year =
124
+ CALCULATE(
125
+ [Total Sales],
126
+ SAMEPERIODLASTYEAR('Date'[Date])
127
+ )
128
+
129
+ // Using FILTER appropriately (avoid as filter argument)
130
+ // ✅ PREFERRED: Direct filter expression
131
+ High Value Orders =
132
+ CALCULATE(
133
+ [Total Sales],
134
+ Sales[OrderValue] > 1000
135
+ )
136
+
137
+ // ❌ AVOID: FILTER as filter argument (unless table manipulation needed)
138
+ High Value Orders =
139
+ CALCULATE(
140
+ [Total Sales],
141
+ FILTER(Sales, Sales[OrderValue] > 1000)
142
+ )
143
+ ```
144
+
145
+ ### Time Intelligence Patterns
146
+ ```dax
147
+ // Standard time intelligence measures
148
+ YTD Sales =
149
+ CALCULATE(
150
+ [Total Sales],
151
+ DATESYTD('Date'[Date])
152
+ )
153
+
154
+ MTD Sales =
155
+ CALCULATE(
156
+ [Total Sales],
157
+ DATESMTD('Date'[Date])
158
+ )
159
+
160
+ // Moving averages with proper date handling
161
+ 3-Month Moving Average =
162
+ VAR CurrentDate = MAX('Date'[Date])
163
+ VAR StartDate = EDATE(CurrentDate, -2)
164
+ RETURN
165
+ CALCULATE(
166
+ DIVIDE([Total Sales], 3),
167
+ DATESBETWEEN(
168
+ 'Date'[Date],
169
+ StartDate,
170
+ CurrentDate
171
+ )
172
+ )
173
+
174
+ // Quarter over quarter growth
175
+ QoQ Growth =
176
+ VAR CurrentQuarter = [Total Sales]
177
+ VAR PreviousQuarter =
178
+ CALCULATE(
179
+ [Total Sales],
180
+ DATEADD('Date'[Date], -1, QUARTER)
181
+ )
182
+ RETURN
183
+ DIVIDE(CurrentQuarter - PreviousQuarter, PreviousQuarter)
184
+ ```
185
+
186
+ ### Advanced DAX Patterns
187
+ ```dax
188
+ // Ranking with proper context
189
+ Product Rank =
190
+ RANKX(
191
+ ALL(Product[ProductName]),
192
+ [Total Sales],
193
+ ,
194
+ DESC,
195
+ DENSE
196
+ )
197
+
198
+ // Running totals
199
+ Running Total =
200
+ CALCULATE(
201
+ [Total Sales],
202
+ FILTER(
203
+ ALL('Date'[Date]),
204
+ 'Date'[Date] <= MAX('Date'[Date])
205
+ )
206
+ )
207
+
208
+ // ABC Analysis (Pareto)
209
+ ABC Classification =
210
+ VAR CurrentProductSales = [Total Sales]
211
+ VAR TotalSales = CALCULATE([Total Sales], ALL(Product))
212
+ VAR RunningTotal =
213
+ CALCULATE(
214
+ [Total Sales],
215
+ FILTER(
216
+ ALL(Product),
217
+ [Total Sales] >= CurrentProductSales
218
+ )
219
+ )
220
+ VAR PercentageOfTotal = DIVIDE(RunningTotal, TotalSales)
221
+ RETURN
222
+ SWITCH(
223
+ TRUE(),
224
+ PercentageOfTotal <= 0.8, "A",
225
+ PercentageOfTotal <= 0.95, "B",
226
+ "C"
227
+ )
228
+ ```
229
+
230
+ ## Performance Optimization Techniques
231
+
232
+ ### 1. Efficient Variable Usage
233
+ ```dax
234
+ // ✅ Store expensive calculations in variables
235
+ Complex Measure =
236
+ VAR BaseCalculation =
237
+ CALCULATE(
238
+ SUM(Sales[Amount]),
239
+ FILTER(
240
+ Product,
241
+ Product[Category] = "Electronics"
242
+ )
243
+ )
244
+ VAR PreviousYear =
245
+ CALCULATE(
246
+ BaseCalculation,
247
+ SAMEPERIODLASTYEAR('Date'[Date])
248
+ )
249
+ RETURN
250
+ DIVIDE(BaseCalculation - PreviousYear, PreviousYear)
251
+ ```
252
+
253
+ ### 2. Context Transition Optimization
254
+ ```dax
255
+ // ✅ Minimize context transitions in iterator functions
256
+ Total Product Profit =
257
+ SUMX(
258
+ Product,
259
+ Product[UnitPrice] - Product[UnitCost]
260
+ )
261
+
262
+ // ❌ Avoid unnecessary calculated columns in large tables
263
+ // Create in Power Query instead when possible
264
+ ```
265
+
266
+ ### 3. Efficient Filtering Patterns
267
+ ```dax
268
+ // ✅ Use table expressions efficiently
269
+ Top 10 Customers =
270
+ CALCULATE(
271
+ [Total Sales],
272
+ TOPN(
273
+ 10,
274
+ ALL(Customer[CustomerName]),
275
+ [Total Sales]
276
+ )
277
+ )
278
+
279
+ // ✅ Leverage relationship filtering
280
+ Sales with Valid Customers =
281
+ CALCULATE(
282
+ [Total Sales],
283
+ FILTER(
284
+ Customer,
285
+ NOT(ISBLANK(Customer[CustomerName]))
286
+ )
287
+ )
288
+ ```
289
+
290
+ ## Common DAX Anti-Patterns to Avoid
291
+
292
+ ### 1. Performance Anti-Patterns
293
+ ```dax
294
+ // ❌ AVOID: Nested CALCULATE functions
295
+ Inefficient Nested =
296
+ CALCULATE(
297
+ CALCULATE(
298
+ [Total Sales],
299
+ Product[Category] = "Electronics"
300
+ ),
301
+ 'Date'[Year] = 2024
302
+ )
303
+
304
+ // ✅ PREFERRED: Single CALCULATE with multiple filters
305
+ Efficient Single =
306
+ CALCULATE(
307
+ [Total Sales],
308
+ Product[Category] = "Electronics",
309
+ 'Date'[Year] = 2024
310
+ )
311
+
312
+ // ❌ AVOID: Converting BLANK to zero unnecessarily
313
+ Sales with Zero =
314
+ IF(ISBLANK([Total Sales]), 0, [Total Sales])
315
+
316
+ // ✅ PREFERRED: Keep BLANK as BLANK for better visual behavior
317
+ Sales = SUM(Sales[Amount])
318
+ ```
319
+
320
+ ### 2. Readability Anti-Patterns
321
+ ```dax
322
+ // ❌ AVOID: Complex nested expressions without variables
323
+ Complex Without Variables =
324
+ DIVIDE(
325
+ CALCULATE(SUM(Sales[Revenue]), Sales[Date] >= DATE(2024,1,1)) -
326
+ CALCULATE(SUM(Sales[Revenue]), Sales[Date] >= DATE(2023,1,1), Sales[Date] < DATE(2024,1,1)),
327
+ CALCULATE(SUM(Sales[Revenue]), Sales[Date] >= DATE(2023,1,1), Sales[Date] < DATE(2024,1,1))
328
+ )
329
+
330
+ // ✅ PREFERRED: Clear variable-based structure
331
+ Year Over Year Growth =
332
+ VAR CurrentYear =
333
+ CALCULATE(
334
+ SUM(Sales[Revenue]),
335
+ Sales[Date] >= DATE(2024,1,1)
336
+ )
337
+ VAR PreviousYear =
338
+ CALCULATE(
339
+ SUM(Sales[Revenue]),
340
+ Sales[Date] >= DATE(2023,1,1),
341
+ Sales[Date] < DATE(2024,1,1)
342
+ )
343
+ RETURN
344
+ DIVIDE(CurrentYear - PreviousYear, PreviousYear)
345
+ ```
346
+
347
+ ## DAX Debugging and Testing Strategies
348
+
349
+ ### 1. Variable-Based Debugging
350
+ ```dax
351
+ // Use this pattern for step-by-step debugging
352
+ Debug Measure =
353
+ VAR Step1 = CALCULATE([Sales], 'Date'[Year] = 2024)
354
+ VAR Step2 = CALCULATE([Sales], 'Date'[Year] = 2023)
355
+ VAR Step3 = Step1 - Step2
356
+ VAR Step4 = DIVIDE(Step3, Step2)
357
+ RETURN
358
+ -- Return different variables for testing:
359
+ -- Step1 -- Test current year sales
360
+ -- Step2 -- Test previous year sales
361
+ -- Step3 -- Test difference calculation
362
+ Step4 -- Final result
363
+ ```
364
+
365
+ ### 2. Testing Patterns
366
+ ```dax
367
+ // Include data validation in measures
368
+ Validated Measure =
369
+ VAR Result = [Complex Calculation]
370
+ VAR IsValid =
371
+ Result >= 0 &&
372
+ Result <= 1 &&
373
+ NOT(ISBLANK(Result))
374
+ RETURN
375
+ IF(IsValid, Result, BLANK())
376
+ ```
377
+
378
+ ## Measure Organization and Naming
379
+
380
+ ### 1. Naming Conventions
381
+ ```dax
382
+ // Use descriptive, consistent naming
383
+ Total Sales = SUM(Sales[Amount])
384
+ Total Sales YTD = CALCULATE([Total Sales], DATESYTD('Date'[Date]))
385
+ Total Sales PY = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
386
+ Sales Growth % = DIVIDE([Total Sales] - [Total Sales PY], [Total Sales PY])
387
+
388
+ // Prefix for measure categories
389
+ KPI - Revenue Growth = [Sales Growth %]
390
+ Calc - Days Since Last Order = DATEDIFF(MAX(Orders[OrderDate]), TODAY(), DAY)
391
+ Base - Order Count = COUNTROWS(Orders)
392
+ ```
393
+
394
+ ### 2. Measure Dependencies
395
+ ```dax
396
+ // Build measures hierarchically for reusability
397
+ // Base measures
398
+ Revenue = SUM(Sales[Revenue])
399
+ Cost = SUM(Sales[Cost])
400
+
401
+ // Derived measures
402
+ Profit = [Revenue] - [Cost]
403
+ Margin % = DIVIDE([Profit], [Revenue])
404
+
405
+ // Advanced measures
406
+ Profit YTD = CALCULATE([Profit], DATESYTD('Date'[Date]))
407
+ Margin Trend = [Margin %] - CALCULATE([Margin %], PREVIOUSMONTH('Date'[Date]))
408
+ ```
409
+
410
+ ## Model Integration Best Practices
411
+
412
+ ### 1. Working with Star Schema
413
+ ```dax
414
+ // Leverage proper relationships
415
+ Sales by Category =
416
+ CALCULATE(
417
+ [Total Sales],
418
+ Product[Category] = "Electronics"
419
+ )
420
+
421
+ // Use dimension tables for filtering
422
+ Regional Sales =
423
+ CALCULATE(
424
+ [Total Sales],
425
+ Geography[Region] = "North America"
426
+ )
427
+ ```
428
+
429
+ ### 2. Handle Missing Relationships
430
+ ```dax
431
+ // When direct relationships don't exist
432
+ Cross Table Analysis =
433
+ VAR CustomerList = VALUES(Customer[CustomerID])
434
+ RETURN
435
+ CALCULATE(
436
+ [Total Sales],
437
+ FILTER(
438
+ Sales,
439
+ Sales[CustomerID] IN CustomerList
440
+ )
441
+ )
442
+ ```
443
+
444
+ ## Advanced DAX Concepts
445
+
446
+ ### 1. Row Context vs Filter Context
447
+ ```dax
448
+ // Understanding context differences
449
+ Row Context Example =
450
+ SUMX(
451
+ Sales,
452
+ Sales[Quantity] * Sales[UnitPrice] // Row context
453
+ )
454
+
455
+ Filter Context Example =
456
+ CALCULATE(
457
+ [Total Sales], // Filter context
458
+ Product[Category] = "Electronics"
459
+ )
460
+ ```
461
+
462
+ ### 2. Context Transition
463
+ ```dax
464
+ // When row context becomes filter context
465
+ Sales Per Product =
466
+ SUMX(
467
+ Product,
468
+ CALCULATE([Total Sales]) // Context transition happens here
469
+ )
470
+ ```
471
+
472
+ ### 3. Extended Columns and Computed Tables
473
+ ```dax
474
+ // Use for complex analytical scenarios
475
+ Product Analysis =
476
+ ADDCOLUMNS(
477
+ Product,
478
+ "Total Sales", CALCULATE([Total Sales]),
479
+ "Rank", RANKX(ALL(Product), CALCULATE([Total Sales])),
480
+ "Category Share", DIVIDE(
481
+ CALCULATE([Total Sales]),
482
+ CALCULATE([Total Sales], ALL(Product[ProductName]))
483
+ )
484
+ )
485
+ ```
486
+
487
+ ### 4. Advanced Time Intelligence Patterns
488
+ ```dax
489
+ // Multi-period comparisons with calculation groups
490
+ // Example showing how to create dynamic time calculations
491
+ Dynamic Period Comparison =
492
+ VAR CurrentPeriodValue =
493
+ CALCULATE(
494
+ [Sales],
495
+ 'Time Intelligence'[Time Calculation] = "Current"
496
+ )
497
+ VAR PreviousPeriodValue =
498
+ CALCULATE(
499
+ [Sales],
500
+ 'Time Intelligence'[Time Calculation] = "PY"
501
+ )
502
+ VAR MTDCurrent =
503
+ CALCULATE(
504
+ [Sales],
505
+ 'Time Intelligence'[Time Calculation] = "MTD"
506
+ )
507
+ VAR MTDPrevious =
508
+ CALCULATE(
509
+ [Sales],
510
+ 'Time Intelligence'[Time Calculation] = "PY MTD"
511
+ )
512
+ RETURN
513
+ DIVIDE(MTDCurrent - MTDPrevious, MTDPrevious)
514
+
515
+ // Working with fiscal years and custom calendars
516
+ Fiscal YTD Sales =
517
+ VAR FiscalYearStart =
518
+ DATE(
519
+ IF(MONTH(MAX('Date'[Date])) >= 7, YEAR(MAX('Date'[Date])), YEAR(MAX('Date'[Date])) - 1),
520
+ 7,
521
+ 1
522
+ )
523
+ VAR FiscalYearEnd = MAX('Date'[Date])
524
+ RETURN
525
+ CALCULATE(
526
+ [Total Sales],
527
+ DATESBETWEEN(
528
+ 'Date'[Date],
529
+ FiscalYearStart,
530
+ FiscalYearEnd
531
+ )
532
+ )
533
+ ```
534
+
535
+ ### 5. Advanced Performance Optimization Techniques
536
+ ```dax
537
+ // Optimized running totals
538
+ Running Total Optimized =
539
+ VAR CurrentDate = MAX('Date'[Date])
540
+ RETURN
541
+ CALCULATE(
542
+ [Total Sales],
543
+ FILTER(
544
+ ALL('Date'[Date]),
545
+ 'Date'[Date] <= CurrentDate
546
+ )
547
+ )
548
+
549
+ // Efficient ABC Analysis using RANKX
550
+ ABC Classification Advanced =
551
+ VAR ProductRank =
552
+ RANKX(
553
+ ALL(Product[ProductName]),
554
+ [Total Sales],
555
+ ,
556
+ DESC,
557
+ DENSE
558
+ )
559
+ VAR TotalProducts = COUNTROWS(ALL(Product[ProductName]))
560
+ VAR ClassAThreshold = TotalProducts * 0.2
561
+ VAR ClassBThreshold = TotalProducts * 0.5
562
+ RETURN
563
+ SWITCH(
564
+ TRUE(),
565
+ ProductRank <= ClassAThreshold, "A",
566
+ ProductRank <= ClassBThreshold, "B",
567
+ "C"
568
+ )
569
+
570
+ // Efficient Top N with ties handling
571
+ Top N Products with Ties =
572
+ VAR TopNValue = 10
573
+ VAR MinTopNSales =
574
+ CALCULATE(
575
+ MIN([Total Sales]),
576
+ TOPN(
577
+ TopNValue,
578
+ ALL(Product[ProductName]),
579
+ [Total Sales]
580
+ )
581
+ )
582
+ RETURN
583
+ IF(
584
+ [Total Sales] >= MinTopNSales,
585
+ [Total Sales],
586
+ BLANK()
587
+ )
588
+ ```
589
+
590
+ ### 6. Complex Analytical Scenarios
591
+ ```dax
592
+ // Customer cohort analysis
593
+ Cohort Retention Rate =
594
+ VAR CohortMonth =
595
+ CALCULATE(
596
+ MIN('Date'[Date]),
597
+ ALLEXCEPT(Sales, Sales[CustomerID])
598
+ )
599
+ VAR CurrentMonth = MAX('Date'[Date])
600
+ VAR MonthsFromCohort =
601
+ DATEDIFF(CohortMonth, CurrentMonth, MONTH)
602
+ VAR CohortCustomers =
603
+ CALCULATE(
604
+ DISTINCTCOUNT(Sales[CustomerID]),
605
+ 'Date'[Date] = CohortMonth
606
+ )
607
+ VAR ActiveCustomersInMonth =
608
+ CALCULATE(
609
+ DISTINCTCOUNT(Sales[CustomerID]),
610
+ 'Date'[Date] = CurrentMonth,
611
+ FILTER(
612
+ Sales,
613
+ CALCULATE(
614
+ MIN('Date'[Date]),
615
+ ALLEXCEPT(Sales, Sales[CustomerID])
616
+ ) = CohortMonth
617
+ )
618
+ )
619
+ RETURN
620
+ DIVIDE(ActiveCustomersInMonth, CohortCustomers)
621
+
622
+ // Market basket analysis
623
+ Product Affinity Score =
624
+ VAR CurrentProduct = SELECTEDVALUE(Product[ProductName])
625
+ VAR RelatedProduct = SELECTEDVALUE('Related Product'[ProductName])
626
+ VAR TransactionsWithBoth =
627
+ CALCULATE(
628
+ DISTINCTCOUNT(Sales[TransactionID]),
629
+ Sales[ProductName] = CurrentProduct
630
+ ) +
631
+ CALCULATE(
632
+ DISTINCTCOUNT(Sales[TransactionID]),
633
+ Sales[ProductName] = RelatedProduct
634
+ ) -
635
+ CALCULATE(
636
+ DISTINCTCOUNT(Sales[TransactionID]),
637
+ Sales[ProductName] = CurrentProduct,
638
+ CALCULATE(
639
+ COUNTROWS(Sales),
640
+ Sales[ProductName] = RelatedProduct,
641
+ Sales[TransactionID] = EARLIER(Sales[TransactionID])
642
+ ) > 0
643
+ )
644
+ VAR TotalTransactions = DISTINCTCOUNT(Sales[TransactionID])
645
+ RETURN
646
+ DIVIDE(TransactionsWithBoth, TotalTransactions)
647
+ ```
648
+
649
+ ### 7. Advanced Debugging and Profiling
650
+ ```dax
651
+ // Debug measure with detailed variable inspection
652
+ Complex Measure Debug =
653
+ VAR Step1_FilteredSales =
654
+ CALCULATE(
655
+ [Sales],
656
+ Product[Category] = "Electronics",
657
+ 'Date'[Year] = 2024
658
+ )
659
+ VAR Step2_PreviousYear =
660
+ CALCULATE(
661
+ [Sales],
662
+ Product[Category] = "Electronics",
663
+ 'Date'[Year] = 2023
664
+ )
665
+ VAR Step3_GrowthAbsolute = Step1_FilteredSales - Step2_PreviousYear
666
+ VAR Step4_GrowthPercentage = DIVIDE(Step3_GrowthAbsolute, Step2_PreviousYear)
667
+ VAR DebugInfo =
668
+ "Current: " & FORMAT(Step1_FilteredSales, "#,0") &
669
+ " | Previous: " & FORMAT(Step2_PreviousYear, "#,0") &
670
+ " | Growth: " & FORMAT(Step4_GrowthPercentage, "0.00%")
671
+ RETURN
672
+ -- Switch between these for debugging:
673
+ -- Step1_FilteredSales -- Test current year
674
+ -- Step2_PreviousYear -- Test previous year
675
+ -- Step3_GrowthAbsolute -- Test absolute growth
676
+ -- DebugInfo -- Show debug information
677
+ Step4_GrowthPercentage -- Final result
678
+
679
+ // Performance monitoring measure
680
+ Query Performance Monitor =
681
+ VAR StartTime = NOW()
682
+ VAR Result = [Complex Calculation]
683
+ VAR EndTime = NOW()
684
+ VAR ExecutionTime = DATEDIFF(StartTime, EndTime, SECOND)
685
+ VAR WarningThreshold = 5 // seconds
686
+ RETURN
687
+ IF(
688
+ ExecutionTime > WarningThreshold,
689
+ "⚠️ Slow: " & ExecutionTime & "s - " & Result,
690
+ Result
691
+ )
692
+ ```
693
+
694
+ ### 8. Working with Complex Data Types
695
+ ```dax
696
+ // JSON parsing and manipulation
697
+ Extract JSON Value =
698
+ VAR JSONString = SELECTEDVALUE(Data[JSONColumn])
699
+ VAR ParsedValue =
700
+ IF(
701
+ NOT(ISBLANK(JSONString)),
702
+ PATHCONTAINS(JSONString, "$.analytics.revenue"),
703
+ BLANK()
704
+ )
705
+ RETURN
706
+ ParsedValue
707
+
708
+ // Dynamic measure selection
709
+ Dynamic Measure Selector =
710
+ VAR SelectedMeasure = SELECTEDVALUE('Measure Selector'[MeasureName])
711
+ RETURN
712
+ SWITCH(
713
+ SelectedMeasure,
714
+ "Revenue", [Total Revenue],
715
+ "Profit", [Total Profit],
716
+ "Units", [Total Units],
717
+ "Margin", [Profit Margin %],
718
+ BLANK()
719
+ )
720
+ ```
721
+
722
+ ## DAX Formula Documentation
723
+
724
+ ### 1. Commenting Best Practices
725
+ ```dax
726
+ /*
727
+ Business Rule: Calculate customer lifetime value based on:
728
+ - Average order value over customer lifetime
729
+ - Purchase frequency (orders per year)
730
+ - Customer lifespan (years since first order)
731
+ - Retention probability based on last order date
732
+ */
733
+ Customer Lifetime Value =
734
+ VAR AvgOrderValue =
735
+ DIVIDE(
736
+ CALCULATE(SUM(Sales[Amount])),
737
+ CALCULATE(DISTINCTCOUNT(Sales[OrderID]))
738
+ )
739
+ VAR OrdersPerYear =
740
+ DIVIDE(
741
+ CALCULATE(DISTINCTCOUNT(Sales[OrderID])),
742
+ DATEDIFF(
743
+ CALCULATE(MIN(Sales[OrderDate])),
744
+ CALCULATE(MAX(Sales[OrderDate])),
745
+ YEAR
746
+ ) + 1 -- Add 1 to avoid division by zero for customers with orders in single year
747
+ )
748
+ VAR CustomerLifespanYears = 3 -- Business assumption: average 3-year relationship
749
+ RETURN
750
+ AvgOrderValue * OrdersPerYear * CustomerLifespanYears
751
+ ```
752
+
753
+ ### 2. Version Control and Change Management
754
+ ```dax
755
+ // Include version history in measure descriptions
756
+ /*
757
+ Version History:
758
+ v1.0 - Initial implementation (2024-01-15)
759
+ v1.1 - Added null checking for edge cases (2024-02-01)
760
+ v1.2 - Optimized performance using variables (2024-02-15)
761
+ v2.0 - Changed business logic per stakeholder feedback (2024-03-01)
762
+
763
+ Business Logic:
764
+ - Excludes returns and cancelled orders
765
+ - Uses ship date for revenue recognition
766
+ - Applies regional tax calculations
767
+ */
768
+ ```
769
+
770
+ ## Testing and Validation Framework
771
+
772
+ ### 1. Unit Testing Patterns
773
+ ```dax
774
+ // Create test measures for validation
775
+ Test - Sales Sum =
776
+ VAR DirectSum = SUM(Sales[Amount])
777
+ VAR MeasureResult = [Total Sales]
778
+ VAR Difference = ABS(DirectSum - MeasureResult)
779
+ RETURN
780
+ IF(Difference < 0.01, "PASS", "FAIL: " & Difference)
781
+ ```
782
+
783
+ ### 2. Performance Testing
784
+ ```dax
785
+ // Monitor execution time for complex measures
786
+ Performance Monitor =
787
+ VAR StartTime = NOW()
788
+ VAR Result = [Complex Calculation]
789
+ VAR EndTime = NOW()
790
+ VAR Duration = DATEDIFF(StartTime, EndTime, SECOND)
791
+ RETURN
792
+ "Result: " & Result & " | Duration: " & Duration & "s"
793
+ ```
794
+
795
+ Remember: Always validate DAX formulas with business users to ensure calculations match business requirements and expectations. Use Power BI's Performance Analyzer and DAX Studio for performance optimization and debugging.