@mytechtoday/augment-extensions 3.1.0 → 3.2.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 (273) hide show
  1. package/AGENTS.md +123 -0
  2. package/README.md +981 -32
  3. package/augment-extensions/coding-standards/q/CHANGELOG.md +16 -0
  4. package/augment-extensions/coding-standards/q/README.md +53 -0
  5. package/augment-extensions/coding-standards/q/examples/ArrayAndTupleNamingConventions.qs +27 -0
  6. package/augment-extensions/coding-standards/q/examples/CallableAliasNamingConventions.qs +20 -0
  7. package/augment-extensions/coding-standards/q/examples/CircuitCompositionNamingConventions.qs +24 -0
  8. package/augment-extensions/coding-standards/q/examples/ConstantValueNamingConventions.qs +19 -0
  9. package/augment-extensions/coding-standards/q/examples/EntryPointAttributeNamingConventions.qs +17 -0
  10. package/augment-extensions/coding-standards/q/examples/FunctorApplicationInControlledCircuits.qs +84 -0
  11. package/augment-extensions/coding-standards/q/examples/FunctorSpecializationNamingConventions.qs +29 -0
  12. package/augment-extensions/coding-standards/q/examples/GenericTypeParameterNamingConventions.qs +20 -0
  13. package/augment-extensions/coding-standards/q/examples/HamiltonianOperatorNamingConventions.qs +24 -0
  14. package/augment-extensions/coding-standards/q/examples/MeasurementResultNamingConventions.qs +48 -0
  15. package/augment-extensions/coding-standards/q/examples/NamespaceNamingConventions.qs +30 -0
  16. package/augment-extensions/coding-standards/q/examples/OperationAndFunctionNamingConventions.qs +31 -0
  17. package/augment-extensions/coding-standards/q/examples/OracleCallableNamingConventions.qs +41 -0
  18. package/augment-extensions/coding-standards/q/examples/PauliBasisNamingConventions.qs +42 -0
  19. package/augment-extensions/coding-standards/q/examples/PauliOperatorNamingConventions.qs +24 -0
  20. package/augment-extensions/coding-standards/q/examples/QubitManagementAndTeleportation.qs +94 -0
  21. package/augment-extensions/coding-standards/q/examples/QubitNamingConventions.qs +53 -0
  22. package/augment-extensions/coding-standards/q/examples/QubitRegisterNamingConventions.qs +30 -0
  23. package/augment-extensions/coding-standards/q/examples/StateVectorNamingConventions.qs +23 -0
  24. package/augment-extensions/coding-standards/q/examples/UserDefinedTypeNamingConventions.qs +22 -0
  25. package/augment-extensions/coding-standards/q/examples/VariableAndParameterNamingConventions.qs +26 -0
  26. package/augment-extensions/coding-standards/q/examples/bell-state.qs +21 -0
  27. package/augment-extensions/coding-standards/q/metadata.json +38 -0
  28. package/augment-extensions/coding-standards/q/module.json +29 -0
  29. package/augment-extensions/coding-standards/q/rules/q-error-handling.md +143 -0
  30. package/augment-extensions/coding-standards/q/rules/q-naming-conventions.md +82 -0
  31. package/augment-extensions/coding-standards/q/rules/q-performance-optimization.md +10 -0
  32. package/augment-extensions/coding-standards/q/rules/q-qubit-management.md +10 -0
  33. package/augment-extensions/coding-standards/q/rules/q-security.md +10 -0
  34. package/augment-extensions/coding-standards/q/rules/q-standards.md +127 -0
  35. package/augment-extensions/coding-standards/q/rules/q-testing.md +10 -0
  36. package/augment-extensions/visual-design/CHANGELOG.md +2 -2
  37. package/augment-extensions/visual-design/README.md +31 -8
  38. package/augment-extensions/visual-design/VERSION +1 -0
  39. package/augment-extensions/visual-design/__tests__/README.md +32 -18
  40. package/augment-extensions/visual-design/__tests__/guidance-contract.test.ts +355 -0
  41. package/augment-extensions/visual-design/__tests__/vendor-styles.test.ts +23 -5
  42. package/augment-extensions/visual-design/domains/other/dotnet-application.ts +1 -1
  43. package/augment-extensions/visual-design/domains/other/mobile-application.ts +3 -4
  44. package/augment-extensions/visual-design/domains/other/os-application.ts +1 -1
  45. package/augment-extensions/visual-design/domains/other/windows-platform.ts +1 -1
  46. package/augment-extensions/visual-design/domains/web-page-styles/amazon-cloudscape.ts +4 -4
  47. package/augment-extensions/visual-design/domains/web-page-styles/google-modern.ts +10 -10
  48. package/augment-extensions/visual-design/domains/web-page-styles/microsoft-fluent.ts +3 -3
  49. package/augment-extensions/visual-design/examples/README.md +2 -0
  50. package/augment-extensions/visual-design/examples/basic-usage.md +5 -3
  51. package/augment-extensions/visual-design/examples/vendor-comparison.md +2 -2
  52. package/augment-extensions/visual-design/guidelines/coverage-map.md +30 -0
  53. package/augment-extensions/visual-design/guidelines/design-levels.md +211 -0
  54. package/augment-extensions/visual-design/guidelines/index.md +5 -0
  55. package/augment-extensions/visual-design/metadata.json +26 -5
  56. package/augment-extensions/visual-design/module.json +39 -6
  57. package/augment-extensions/visual-design/rules/accessibility-and-color.md +51 -0
  58. package/augment-extensions/visual-design/rules/design-practice.md +55 -0
  59. package/augment-extensions/visual-design/rules/index.md +34 -0
  60. package/augment-extensions/visual-design/rules/platform-guidance.md +47 -0
  61. package/augment-extensions/visual-design/scripts/validate-guidance.cjs +233 -0
  62. package/augment-extensions/visual-design/skills/README.md +11 -0
  63. package/augment-extensions/visual-design/skills/design-brief.md +40 -0
  64. package/augment-extensions/visual-design/skills/design-review.md +38 -0
  65. package/augment-extensions/visual-design/skills/responsive-validation/SKILL.md +94 -0
  66. package/augment-extensions/visual-design/skills/responsive-validation/scripts/responsive-sweep.cjs +457 -0
  67. package/augment-extensions/visual-design/style-selector.ts +4 -4
  68. package/augment-extensions/visual-design/types.ts +101 -46
  69. package/augment-extensions/visual-design/visual-design-core.ts +8 -8
  70. package/cli/dist/adapters/banner.d.ts +62 -0
  71. package/cli/dist/adapters/banner.d.ts.map +1 -0
  72. package/cli/dist/adapters/banner.js +105 -0
  73. package/cli/dist/adapters/banner.js.map +1 -0
  74. package/cli/dist/adapters/claude-code.d.ts +13 -0
  75. package/cli/dist/adapters/claude-code.d.ts.map +1 -0
  76. package/cli/dist/adapters/claude-code.js +79 -0
  77. package/cli/dist/adapters/claude-code.js.map +1 -0
  78. package/cli/dist/adapters/copilot.d.ts +17 -0
  79. package/cli/dist/adapters/copilot.d.ts.map +1 -0
  80. package/cli/dist/adapters/copilot.js +81 -0
  81. package/cli/dist/adapters/copilot.js.map +1 -0
  82. package/cli/dist/adapters/cursor.d.ts +16 -0
  83. package/cli/dist/adapters/cursor.d.ts.map +1 -0
  84. package/cli/dist/adapters/cursor.js +99 -0
  85. package/cli/dist/adapters/cursor.js.map +1 -0
  86. package/cli/dist/adapters/index.d.ts +25 -0
  87. package/cli/dist/adapters/index.d.ts.map +1 -0
  88. package/cli/dist/adapters/index.js +59 -0
  89. package/cli/dist/adapters/index.js.map +1 -0
  90. package/cli/dist/adapters/types.d.ts +113 -0
  91. package/cli/dist/adapters/types.d.ts.map +1 -0
  92. package/cli/dist/adapters/types.js +13 -0
  93. package/cli/dist/adapters/types.js.map +1 -0
  94. package/cli/dist/adapters/windsurf.d.ts +14 -0
  95. package/cli/dist/adapters/windsurf.d.ts.map +1 -0
  96. package/cli/dist/adapters/windsurf.js +78 -0
  97. package/cli/dist/adapters/windsurf.js.map +1 -0
  98. package/cli/dist/analysis/index.d.ts +1 -0
  99. package/cli/dist/analysis/index.d.ts.map +1 -1
  100. package/cli/dist/analysis/index.js +1 -0
  101. package/cli/dist/analysis/index.js.map +1 -1
  102. package/cli/dist/analysis/pattern-analyzer.d.ts +6 -0
  103. package/cli/dist/analysis/pattern-analyzer.d.ts.map +1 -0
  104. package/cli/dist/analysis/pattern-analyzer.js +100 -0
  105. package/cli/dist/analysis/pattern-analyzer.js.map +1 -0
  106. package/cli/dist/cli.js +62 -35
  107. package/cli/dist/cli.js.map +1 -1
  108. package/cli/dist/commands/code-analysis.d.ts.map +1 -1
  109. package/cli/dist/commands/code-analysis.js +22 -2
  110. package/cli/dist/commands/code-analysis.js.map +1 -1
  111. package/cli/dist/commands/export.d.ts +81 -0
  112. package/cli/dist/commands/export.d.ts.map +1 -0
  113. package/cli/dist/commands/export.js +334 -0
  114. package/cli/dist/commands/export.js.map +1 -0
  115. package/cli/dist/commands/gui.d.ts +3 -1
  116. package/cli/dist/commands/gui.d.ts.map +1 -1
  117. package/cli/dist/commands/gui.js +263 -22
  118. package/cli/dist/commands/gui.js.map +1 -1
  119. package/cli/dist/commands/init.d.ts +2 -0
  120. package/cli/dist/commands/init.d.ts.map +1 -1
  121. package/cli/dist/commands/init.js +95 -3
  122. package/cli/dist/commands/init.js.map +1 -1
  123. package/cli/dist/commands/lifecycle.d.ts +14 -0
  124. package/cli/dist/commands/lifecycle.d.ts.map +1 -0
  125. package/cli/dist/commands/lifecycle.js +463 -0
  126. package/cli/dist/commands/lifecycle.js.map +1 -0
  127. package/cli/dist/commands/link.d.ts +3 -0
  128. package/cli/dist/commands/link.d.ts.map +1 -1
  129. package/cli/dist/commands/link.js +126 -16
  130. package/cli/dist/commands/link.js.map +1 -1
  131. package/cli/dist/commands/list.js +2 -2
  132. package/cli/dist/commands/list.js.map +1 -1
  133. package/cli/dist/commands/mcp.d.ts +1 -2
  134. package/cli/dist/commands/mcp.d.ts.map +1 -1
  135. package/cli/dist/commands/mcp.js +20 -20
  136. package/cli/dist/commands/mcp.js.map +1 -1
  137. package/cli/dist/commands/module-management.d.ts +9 -0
  138. package/cli/dist/commands/module-management.d.ts.map +1 -0
  139. package/cli/dist/commands/module-management.js +420 -0
  140. package/cli/dist/commands/module-management.js.map +1 -0
  141. package/cli/dist/commands/self-remove.d.ts.map +1 -1
  142. package/cli/dist/commands/self-remove.js +98 -44
  143. package/cli/dist/commands/self-remove.js.map +1 -1
  144. package/cli/dist/commands/show.d.ts +1 -1
  145. package/cli/dist/commands/show.d.ts.map +1 -1
  146. package/cli/dist/commands/show.js +21 -10
  147. package/cli/dist/commands/show.js.map +1 -1
  148. package/cli/dist/commands/showCompleted.d.ts +1 -0
  149. package/cli/dist/commands/showCompleted.d.ts.map +1 -1
  150. package/cli/dist/commands/showCompleted.js +4 -3
  151. package/cli/dist/commands/showCompleted.js.map +1 -1
  152. package/cli/dist/commands/skill.d.ts +7 -1
  153. package/cli/dist/commands/skill.d.ts.map +1 -1
  154. package/cli/dist/commands/skill.js +79 -21
  155. package/cli/dist/commands/skill.js.map +1 -1
  156. package/cli/dist/commands/unlink.d.ts.map +1 -1
  157. package/cli/dist/commands/unlink.js +38 -2
  158. package/cli/dist/commands/unlink.js.map +1 -1
  159. package/cli/dist/commands/update.d.ts.map +1 -1
  160. package/cli/dist/commands/update.js +6 -16
  161. package/cli/dist/commands/update.js.map +1 -1
  162. package/cli/dist/commands/upgrade.d.ts +2 -0
  163. package/cli/dist/commands/upgrade.d.ts.map +1 -1
  164. package/cli/dist/commands/upgrade.js +22 -5
  165. package/cli/dist/commands/upgrade.js.map +1 -1
  166. package/cli/dist/commands/use.d.ts.map +1 -1
  167. package/cli/dist/commands/use.js +2 -68
  168. package/cli/dist/commands/use.js.map +1 -1
  169. package/cli/dist/core/compatibility-checker.d.ts +37 -1
  170. package/cli/dist/core/compatibility-checker.d.ts.map +1 -1
  171. package/cli/dist/core/compatibility-checker.js +133 -12
  172. package/cli/dist/core/compatibility-checker.js.map +1 -1
  173. package/cli/dist/gui/state/navigation-state.d.ts +20 -0
  174. package/cli/dist/gui/state/navigation-state.d.ts.map +1 -0
  175. package/cli/dist/gui/state/navigation-state.js +115 -0
  176. package/cli/dist/gui/state/navigation-state.js.map +1 -0
  177. package/cli/dist/gui/state/selection-state.d.ts +21 -0
  178. package/cli/dist/gui/state/selection-state.d.ts.map +1 -0
  179. package/cli/dist/gui/state/selection-state.js +117 -0
  180. package/cli/dist/gui/state/selection-state.js.map +1 -0
  181. package/cli/dist/lib/export-runner.d.ts +76 -0
  182. package/cli/dist/lib/export-runner.d.ts.map +1 -0
  183. package/cli/dist/lib/export-runner.js +111 -0
  184. package/cli/dist/lib/export-runner.js.map +1 -0
  185. package/cli/dist/lib/mcp-detection.d.ts +40 -0
  186. package/cli/dist/lib/mcp-detection.d.ts.map +1 -0
  187. package/cli/dist/lib/mcp-detection.js +167 -0
  188. package/cli/dist/lib/mcp-detection.js.map +1 -0
  189. package/cli/dist/lib/mirror-coordination.d.ts +57 -0
  190. package/cli/dist/lib/mirror-coordination.d.ts.map +1 -0
  191. package/cli/dist/lib/mirror-coordination.js +151 -0
  192. package/cli/dist/lib/mirror-coordination.js.map +1 -0
  193. package/cli/dist/lib/mirror-runner.d.ts +123 -0
  194. package/cli/dist/lib/mirror-runner.d.ts.map +1 -0
  195. package/cli/dist/lib/mirror-runner.js +579 -0
  196. package/cli/dist/lib/mirror-runner.js.map +1 -0
  197. package/cli/dist/lib/module-resolver.d.ts +65 -0
  198. package/cli/dist/lib/module-resolver.d.ts.map +1 -0
  199. package/cli/dist/lib/module-resolver.js +211 -0
  200. package/cli/dist/lib/module-resolver.js.map +1 -0
  201. package/cli/dist/lib/source-hash.d.ts +62 -0
  202. package/cli/dist/lib/source-hash.d.ts.map +1 -0
  203. package/cli/dist/lib/source-hash.js +99 -0
  204. package/cli/dist/lib/source-hash.js.map +1 -0
  205. package/cli/dist/types/coordination-export.d.ts +33 -0
  206. package/cli/dist/types/coordination-export.d.ts.map +1 -0
  207. package/cli/dist/types/coordination-export.js +28 -0
  208. package/cli/dist/types/coordination-export.js.map +1 -0
  209. package/cli/dist/types/lifecycle.d.ts +81 -0
  210. package/cli/dist/types/lifecycle.d.ts.map +1 -0
  211. package/cli/dist/types/lifecycle.js +3 -0
  212. package/cli/dist/types/lifecycle.js.map +1 -0
  213. package/cli/dist/utils/beads-sync.d.ts +4 -0
  214. package/cli/dist/utils/beads-sync.d.ts.map +1 -1
  215. package/cli/dist/utils/beads-sync.js.map +1 -1
  216. package/cli/dist/utils/catalog-sync.d.ts.map +1 -1
  217. package/cli/dist/utils/catalog-sync.js +41 -8
  218. package/cli/dist/utils/catalog-sync.js.map +1 -1
  219. package/cli/dist/utils/coordination-queries.d.ts +3 -0
  220. package/cli/dist/utils/coordination-queries.d.ts.map +1 -1
  221. package/cli/dist/utils/coordination-queries.js.map +1 -1
  222. package/cli/dist/utils/extensions-config.d.ts +29 -0
  223. package/cli/dist/utils/extensions-config.d.ts.map +1 -0
  224. package/cli/dist/utils/extensions-config.js +151 -0
  225. package/cli/dist/utils/extensions-config.js.map +1 -0
  226. package/cli/dist/utils/extractCommandHelp.d.ts.map +1 -1
  227. package/cli/dist/utils/extractCommandHelp.js +8 -2
  228. package/cli/dist/utils/extractCommandHelp.js.map +1 -1
  229. package/cli/dist/utils/file-tracking.d.ts +4 -0
  230. package/cli/dist/utils/file-tracking.d.ts.map +1 -1
  231. package/cli/dist/utils/file-tracking.js.map +1 -1
  232. package/cli/dist/utils/inspection-cache.d.ts +8 -0
  233. package/cli/dist/utils/inspection-cache.d.ts.map +1 -1
  234. package/cli/dist/utils/inspection-cache.js +12 -0
  235. package/cli/dist/utils/inspection-cache.js.map +1 -1
  236. package/cli/dist/utils/inspection-handlers.d.ts.map +1 -1
  237. package/cli/dist/utils/inspection-handlers.js +230 -52
  238. package/cli/dist/utils/inspection-handlers.js.map +1 -1
  239. package/cli/dist/utils/install-rules.d.ts +20 -0
  240. package/cli/dist/utils/install-rules.d.ts.map +1 -1
  241. package/cli/dist/utils/install-rules.js +367 -0
  242. package/cli/dist/utils/install-rules.js.map +1 -1
  243. package/cli/dist/utils/interactive-prompt.d.ts +7 -0
  244. package/cli/dist/utils/interactive-prompt.d.ts.map +1 -0
  245. package/cli/dist/utils/interactive-prompt.js +41 -0
  246. package/cli/dist/utils/interactive-prompt.js.map +1 -0
  247. package/cli/dist/utils/lifecycle.d.ts +47 -0
  248. package/cli/dist/utils/lifecycle.d.ts.map +1 -0
  249. package/cli/dist/utils/lifecycle.js +841 -0
  250. package/cli/dist/utils/lifecycle.js.map +1 -0
  251. package/cli/dist/utils/mcp-integration.d.ts +24 -3
  252. package/cli/dist/utils/mcp-integration.d.ts.map +1 -1
  253. package/cli/dist/utils/mcp-integration.js +364 -151
  254. package/cli/dist/utils/mcp-integration.js.map +1 -1
  255. package/cli/dist/utils/module-system.d.ts +5 -0
  256. package/cli/dist/utils/module-system.d.ts.map +1 -1
  257. package/cli/dist/utils/module-system.js +113 -29
  258. package/cli/dist/utils/module-system.js.map +1 -1
  259. package/cli/dist/utils/openspec-sync.d.ts +4 -0
  260. package/cli/dist/utils/openspec-sync.d.ts.map +1 -1
  261. package/cli/dist/utils/openspec-sync.js.map +1 -1
  262. package/cli/dist/utils/plugin-system.js +1 -1
  263. package/cli/dist/utils/plugin-system.js.map +1 -1
  264. package/cli/dist/utils/skill-system.d.ts +11 -0
  265. package/cli/dist/utils/skill-system.d.ts.map +1 -1
  266. package/cli/dist/utils/skill-system.js +101 -3
  267. package/cli/dist/utils/skill-system.js.map +1 -1
  268. package/cli/dist/utils/zip-archive.d.ts +25 -0
  269. package/cli/dist/utils/zip-archive.d.ts.map +1 -0
  270. package/cli/dist/utils/zip-archive.js +287 -0
  271. package/cli/dist/utils/zip-archive.js.map +1 -0
  272. package/modules.md +21 -4
  273. package/package.json +138 -140
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to this module will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-05-03
9
+
10
+ ### Added
11
+
12
+ - Initial release of Q# Coding Standards module
13
+ - AI prompter rules file (`q-standards.md`) for QDK 1.0+ and Azure Quantum
14
+ - Skeleton split-rule files: naming, qubit management, error handling, performance, security, testing
15
+ - Bell-state example (`examples/bell-state.qs`)
16
+ - `augx` CLI and `augx gui` integration via standard module discovery
@@ -0,0 +1,53 @@
1
+ # Q# Coding Standards
2
+
3
+ AI prompter rules and coding standards for Q# quantum development with the Quantum Development Kit (QDK) and Azure Quantum.
4
+
5
+ ## Overview
6
+
7
+ This module ships a single, AI-optimized prompter rules file that Augment Code AI loads when generating, reviewing, or refactoring Q# code. Guidance covers qubit management, functor support, hybrid classical-quantum patterns, resource estimation, and Microsoft.Quantum.* library usage.
8
+
9
+ ## Key Benefits
10
+
11
+ - **Quantum Correctness**: Operations vs. functions, `Adj + Ctl` functors, qubit scoping rules
12
+ - **Resource Awareness**: Resource estimation, gate-count and depth minimization
13
+ - **Hybrid Interop**: Classical-quantum separation, `@EntryPoint`, IQ#/C# host patterns
14
+ - **Library-First**: `Microsoft.Quantum.Intrinsic`, `Canon`, `Preparation`, `Diagnostics`
15
+ - **QDK 1.0+**: Targets modern QDK, Azure Quantum, and current simulators
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ augx link coding-standards/q
21
+ ```
22
+
23
+ Verify with:
24
+
25
+ ```bash
26
+ augx list --linked
27
+ ```
28
+
29
+ ## Contents
30
+
31
+ ### Rules
32
+
33
+ - **q-standards.md** - Q# AI prompter: naming, formatting, qubit management, functors, error handling, resource estimation, security, anti-patterns
34
+ - **naming-conventions.md** - Naming rules (skeleton)
35
+ - **qubit-management.md** - `use`/`borrow`, `Reset`, `within/apply`, functors (skeleton)
36
+ - **error-handling.md** - `fail`, `Result` branching, diagnostics assertions (skeleton)
37
+ - **performance-optimization.md** - Resource estimation, gate-count and depth (skeleton)
38
+ - **security.md** - No-cloning, QKD/QRNG, host boundary hygiene (skeleton)
39
+ - **testing.md** - Diagnostics assertions, simulators, functor tests (skeleton)
40
+
41
+ ### Examples
42
+
43
+ - **bell-state.qs** - Skeleton Bell-pair preparation with `@EntryPoint`
44
+
45
+ ## Discovery
46
+
47
+ ```bash
48
+ augx show q-standards
49
+ augx search "qubit"
50
+ augx search "resource estimation"
51
+ ```
52
+
53
+ This module is auto-discovered by the `augx` CLI and `augx gui` interface via the standard module loader; no additional configuration is required.
@@ -0,0 +1,27 @@
1
+ /*
2
+ WHAT: Array and tuple naming conventions in Q#.
3
+ HOW: Arrays use camelCase plural names ending in "s" or "Array" (e.g., measurementResults, qubitArray). Tuples use camelCase descriptive names; when deconstructing, use meaningful variable names. Avoid generic names like "data".
4
+ WHEN: For qubit registers, measurement outcomes, or any multi-value classical data returned from callables.
5
+ WHERE: In variable declarations, operation parameters, and return types throughout quantum algorithms.
6
+ WHY: Arrays and tuples are fundamental to representing qubit registers and measurement statistics in Q#; clear naming prevents off-by-one errors in indexing and makes resource estimation and debugging significantly easier in large-scale quantum programs.
7
+ */
8
+
9
+ namespace MyTechToday.Quantum.NamingStandards.Collections {
10
+
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Measurement;
13
+ open Microsoft.Quantum.Arrays;
14
+
15
+ // Good: camelCase plural array and descriptive tuple
16
+ operation RunMultipleMeasurements(qubitArray : Qubit[], repetitions : Int) : Result[] {
17
+ mutable measurementResults = new Result[0]; // camelCase plural array
18
+ for _ in 1..repetitions {
19
+ let singleShotResult = M(qubitArray[0]); // Descriptive tuple element name
20
+ set measurementResults += [singleShotResult];
21
+ }
22
+ return measurementResults;
23
+ }
24
+
25
+ // Bad example (commented for illustration only):
26
+ // let results = ...; // Incorrect: vague singular name for array
27
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ WHAT: Callable alias naming conventions in Q#.
3
+ HOW: Aliases use PascalCase matching the original callable style (e.g., MyHadamard = H); open directives use full hierarchical PascalCase.
4
+ WHEN: Creating shorter or domain-specific names for frequently used library callables.
5
+ WHERE: After open statements or inside namespace with "let" alias syntax.
6
+ WHY: Aliases reduce verbosity in long quantum circuits while preserving clarity; maintains consistency with original PascalCase for discoverability.
7
+ */
8
+
9
+ // GOOD: PascalCase alias for library callable
10
+ namespace AugmentExtensions.Quantum.NamingStandards.Aliases {
11
+
12
+ open Microsoft.Quantum.Intrinsic as IntrinsicGates;
13
+
14
+ // GOOD: PascalCase alias
15
+ let MyHadamard = IntrinsicGates.H;
16
+
17
+ operation UseAlias(targetQubit : Qubit) : Unit {
18
+ MyHadamard(targetQubit); // Alias call retains style
19
+ }
20
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ WHAT: Quantum circuit and gate sequence naming conventions in Q#.
3
+ HOW: Circuit variables use camelCase with "Circuit" suffix (e.g., bellCircuit); gate sequences use camelCase plural (e.g., gateSequence).
4
+ WHEN: Building, composing, or applying sequences of gates or sub-circuits.
5
+ WHERE: Variable declarations for ApplyUnitary or custom circuit types.
6
+ WHY: Modern quantum programming treats circuits as first-class; descriptive naming clarifies composition order and prevents errors in layered algorithms.
7
+ */
8
+
9
+ // GOOD: camelCase for circuit variables
10
+ namespace AugmentExtensions.Quantum.NamingStandards.Circuits {
11
+
12
+ open Microsoft.Quantum.Canon;
13
+
14
+ operation BuildAndApplyCircuit() : Unit {
15
+ // GOOD: camelCase circuit variable
16
+ let bellCircuit = [H, CNOT]; // Gate sequence
17
+
18
+ // GOOD: camelCase gate sequence
19
+ let gateSequence = [X, Y, Z];
20
+
21
+ // BAD example (commented): let BellCircuit = ...
22
+ // Violates: PascalCase
23
+ }
24
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ WHAT: Constant value naming conventions in Q#.
3
+ HOW: Constants use camelCase (preferred) or UPPER_SNAKE_CASE only for truly global immutable values (e.g., maxQubitsAllowed); never magic numbers.
4
+ WHEN: Defining reusable numeric or string constants for qubit counts, angles, or tolerances.
5
+ WHERE: Top-level let statements inside namespace or inside operations.
6
+ WHY: Quantum code often uses fixed values (angles, qubit limits); named constants improve maintainability and prevent hard-coded value errors in simulations or hardware runs.
7
+ */
8
+
9
+ // GOOD: camelCase constants with descriptive names
10
+ namespace AugmentExtensions.Quantum.NamingStandards.Constants {
11
+
12
+ // GOOD: camelCase for local constants
13
+ let piOverFour = 3.1415926535 / 4.0;
14
+
15
+ operation UseConstantAngle(targetQubit : Qubit) : Unit {
16
+ // GOOD: Reusing constant
17
+ Rz(piOverFour, targetQubit);
18
+ }
19
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ WHAT: Entry point and attribute naming conventions in Q#.
3
+ HOW: @EntryPoint() uses exact PascalCase attribute; custom attributes follow PascalCase.
4
+ WHEN: Marking the main executable operation in Q# programs for simulators or hardware.
5
+ WHERE: Immediately above the primary operation declaration.
6
+ WHY: Ensures the quantum program has a clear starting point for execution; consistent attribute naming aligns with Q# compiler and Azure Quantum requirements.
7
+ */
8
+
9
+ // GOOD: Exact @EntryPoint() attribute
10
+ namespace AugmentExtensions.Quantum.NamingStandards.EntryPoints {
11
+
12
+ @EntryPoint()
13
+ operation MainQuantumProgram() : Unit {
14
+ // GOOD: Operation follows PascalCase as usual
15
+ Message("Quantum program started with proper entry point");
16
+ }
17
+ }
@@ -0,0 +1,84 @@
1
+ // FunctorApplicationInControlledCircuits.qs
2
+ // Demonstrates optimal Q# naming conventions for functor (Adjoint/Controlled) application within controlled gate sequences.
3
+
4
+ // Context & Educational Value
5
+ // This file extends the examples library by focusing on naming conventions for functor application (Adjoint and Controlled) within controlled gate sequences typical of phase estimation or variational circuits. It uniquely contributes by showing how to name controlled operations, adjoint blocks, and auxiliary qubits so that functor intent remains explicit even in deeply nested quantum logic, complementing the repo's foundational examples with advanced circuit-control patterns.
6
+ // The implementation employs 17 distinct Q# constructs (multiple using/borrow, H/X/CNOT/CZ/Rz/Ry, Measure/MResetX, Reset, Adjoint/Controlled functors, repeat-until-success, within-apply, if statements, for loops, custom operations, arrays, and tuples) in a realistic controlled-phase simulation scenario.
7
+
8
+ qsharp // What: This example demonstrates Q# naming conventions for functor (Adjoint/Controlled) application, controlled unitary sequences, and auxiliary qubit management in a controlled-circuit pattern.
9
+
10
+ //
11
+ // How: The code defines PascalCase operations that explicitly incorporate functor modifiers, uses camelCase for control/target parameters and result variables, and orchestrates complex control flow with repeat-until and within-apply constructs, each accompanied by inline naming rationale.
12
+ //
13
+ // When: Apply these naming patterns during development of variational quantum algorithms, phase-estimation routines, or any controlled-gate heavy subcircuit where functor composition must be unambiguously readable.
14
+ //
15
+ // Where: This module belongs in utility namespaces of larger Q# projects focused on quantum simulation, optimization libraries, or hardware-aware circuit compilation pipelines.
16
+ //
17
+ // Why: Explicit functor-aware naming (e.g., ApplyAdjointControlledPhase) eliminates ambiguity in complex gate sequences, accelerates debugging of unitary inverses and controls, supports collaborative code reviews, and ensures long-term maintainability as circuits evolve toward error-corrected hardware.
18
+
19
+ // Q# naming demonstration file – strictly follows Microsoft QDK conventions for maximum readability and maintainability
20
+ namespace Augment.Extensions.CodingStandards.Q.Examples {
21
+
22
+ open Microsoft.Quantum.Intrinsic;
23
+ open Microsoft.Quantum.Canon;
24
+ open Microsoft.Quantum.Measurement;
25
+
26
+ // Operation name incorporates functor intent and PascalCase for clarity
27
+ operation ApplyAdjointControlledPhase(controlRegister : Qubit[], targetQubit : Qubit) : Unit is Adj + Ctl {
28
+ // Parameter names clearly distinguish control register from target
29
+ Adjoint Controlled Rz([controlRegister[0]], (1.0, targetQubit)); // Adjoint + Controlled functor combination; names make composition explicit
30
+ }
31
+
32
+ // Separate controlled operation for demonstration
33
+ operation ApplyControlledRotation(controlQubit : Qubit, targetQubit : Qubit, angle : Double) : Unit is Ctl {
34
+ Controlled Ry([controlQubit], (angle, targetQubit)); // Controlled functor with descriptive parameter names
35
+ }
36
+
37
+ @EntryPoint()
38
+ operation DemonstrateFunctorControlledCircuit() : Unit {
39
+ using (controlQubit = Qubit(), targetQubit = Qubit(), auxiliaryQubit = Qubit()) {
40
+
41
+ H(controlQubit); // H on control; name indicates role
42
+ X(targetQubit);
43
+
44
+ ApplyAdjointControlledPhase([controlQubit], targetQubit); // custom functor operation call
45
+
46
+ ApplyControlledRotation(controlQubit, targetQubit, 0.785); // additional controlled call
47
+
48
+ CZ(controlQubit, auxiliaryQubit); // CZ demonstrates controlled-Z naming
49
+
50
+ // Measurement with descriptive result name
51
+ let phaseEstimationResult = MResetX(auxiliaryQubit);
52
+
53
+ // Repeat-until-success pattern with camelCase success variable
54
+ mutable successFlag = false;
55
+ repeat {
56
+ H(auxiliaryQubit);
57
+ let tempResult = Measure([PauliZ], [auxiliaryQubit]);
58
+ if (tempResult == Zero) {
59
+ set successFlag = true;
60
+ }
61
+ } until successFlag fixup {
62
+ Reset(auxiliaryQubit);
63
+ }
64
+
65
+ // within-apply for adjoint block demonstration
66
+ within {
67
+ S(targetQubit);
68
+ } apply {
69
+ T(targetQubit);
70
+ }
71
+
72
+ // Additional constructs: for loop, more gates, ResetAll
73
+ for i in 0..1 {
74
+ let tempControl = controlQubit; // camelCase temporary
75
+ }
76
+
77
+ Rz(0.5, targetQubit);
78
+ Ry(0.25, targetQubit);
79
+ Rx(0.125, auxiliaryQubit);
80
+
81
+ ResetAll([controlQubit, targetQubit, auxiliaryQubit]);
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ WHAT: Functor and specialization naming conventions in Q#.
3
+ HOW: Callables supporting functors keep the base name in PascalCase; specializations are declared with 'is Adj + Ctl' or similar. When naming adjoint or controlled versions explicitly (rare), append "Adjoint" or "Controlled" in PascalCase.
4
+ WHEN: For any operation that needs adjoint or controlled variants, which is common in quantum algorithms requiring reversibility or multi-qubit control.
5
+ WHERE: In operation declarations and when applying functors (e.g., Adjoint OpName()).
6
+ WHY: Functors are a quantum-specific Q# feature enabling automatic generation of adjoint/controlled versions; consistent naming ensures the compiler and developers can reliably apply them, reducing gate count and improving performance in resource estimation.
7
+ */
8
+
9
+ namespace MyTechToday.Quantum.NamingStandards.Functors {
10
+
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Canon;
13
+
14
+ // Good: Base operation name in PascalCase with explicit functor support
15
+ operation ApplyPhaseRotation(targetQubit : Qubit) : Unit is Adj + Ctl {
16
+ Rz(PI() / 4.0, targetQubit); // Supports Adjoint and Controlled automatically
17
+ }
18
+
19
+ // Good: Explicit use of functor in calling code
20
+ operation DemonstrateFunctor() : Unit {
21
+ use q = Qubit();
22
+ Adjoint ApplyPhaseRotation(q); // Adjoint applied to PascalCase name
23
+ Controlled ApplyPhaseRotation([q], q); // Controlled variant
24
+ Reset(q);
25
+ }
26
+
27
+ // Bad example (commented for illustration only):
28
+ // operation apply_phase() is Adj { ... } // Incorrect: lowercase and missing clear verb
29
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ WHAT: Generic type parameter naming conventions in Q#.
3
+ HOW: Type parameters use single uppercase letter or descriptive camelCase with "T" prefix (e.g., 'TInput, 'TOutput); avoid single lowercase.
4
+ WHEN: Defining generic operations/functions that work on multiple types (states, results, etc.).
5
+ WHERE: Operation/function signatures using <'T> syntax; inside generic bodies.
6
+ WHY: Generics enable reusable quantum libraries; clear parameter names improve type inference readability and prevent confusion in complex quantum algorithm templates.
7
+ */
8
+
9
+ // GOOD: Descriptive generic type parameters
10
+ namespace AugmentExtensions.Quantum.NamingStandards.Generics {
11
+
12
+ operation ApplyGenericOperation<'TInput, 'TOutput>(input : 'TInput) : 'TOutput {
13
+ // GOOD: 'TInput and 'TOutput follow convention
14
+ // BAD example (commented): operation ApplyGenericOperation<tinput, toutput>
15
+ // Violates: lowercase
16
+
17
+ // Placeholder for generic logic
18
+ return input as 'TOutput; // Type cast for demo
19
+ }
20
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ WHAT: Hamiltonian operator and term naming conventions in Q#.
3
+ HOW: Hamiltonians use camelCase with "Hamiltonian" suffix (e.g., molecularHamiltonian); individual terms use camelCase plural (e.g., pauliTerms).
4
+ WHEN: Defining or evolving under Hamiltonians for variational algorithms or simulation.
5
+ WHERE: Parameter lists or variable declarations for time evolution or expectation values.
6
+ WHY: Variational quantum algorithms depend on accurate Hamiltonian representation; clear naming prevents term misordering and improves readability in chemistry or physics simulations.
7
+ */
8
+
9
+ // GOOD: camelCase Hamiltonian and term names
10
+ namespace AugmentExtensions.Quantum.NamingStandards.Hamiltonians {
11
+
12
+ open Microsoft.Quantum.Canon;
13
+
14
+ operation EvolveUnderHamiltonian(time : Double) : Unit {
15
+ // GOOD: camelCase Hamiltonian variable
16
+ let molecularHamiltonian = [/* Pauli terms */];
17
+
18
+ // GOOD: camelCase terms array
19
+ let pauliTerms = new Pauli[2];
20
+
21
+ // BAD example (commented): let MolecularHamiltonian = ...
22
+ // Violates: PascalCase
23
+ }
24
+ }
@@ -0,0 +1,48 @@
1
+ /*
2
+ * What: This example demonstrates Q# naming conventions exclusively for measurement results, Result arrays, classical extraction variables, and post-processing counters.
3
+ * How: Result variables and arrays use camelCase with semantic descriptors; functions are PascalCase verb-led; all names interconnect with qubit and operation names to form a cohesive classical readout pipeline.
4
+ * When: Apply these conventions in any measurement-heavy routine, tomography, or variational algorithm where classical data must be extracted and analyzed.
5
+ * Where: They belong inside utility libraries (e.g., Microsoft.Quantum.Measurement extensions) or domain-specific modules that bridge quantum hardware and classical host code.
6
+ * Why: Consistent result naming eliminates ambiguity in large-scale circuits, accelerates debugging of measurement statistics, and enables automated tools to trace data flow from quantum to classical domains.
7
+ */
8
+
9
+ namespace Augment.Quantum.Examples.Naming.MeasurementResultNamingConventions
10
+ {
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Measurement;
13
+ open Microsoft.Quantum.Convert;
14
+ open Microsoft.Quantum.Arrays;
15
+
16
+ /// # Summary
17
+ /// Measures a named register and returns processed classical results using
18
+ /// strictly observed naming conventions for every Result-related identifier.
19
+ operation MeasureAndProcessNamedRegister(qubitRegister : Qubit[]) : Int
20
+ {
21
+ // Parameter 'qubitRegister' uses camelCase + descriptive noun; plural form signals array of qubits (interconnected with array-naming rules).
22
+ let rawMeasurementResults = MeasureAllZ(qubitRegister); // Result array uses camelCase + 'raw' prefix to indicate unprocessed hardware output.
23
+
24
+ // 'rawMeasurementResults' name makes the origin (hardware measurement) explicit, preventing confusion with derived classical data.
25
+ mutable bitStringValue = ResultArrayAsInt(rawMeasurementResults); // Mutable classical variable follows camelCase; 'bitStringValue' documents conversion intent.
26
+
27
+ // Function 'ResultArrayAsInt' is PascalCase and verb-led, matching repository OperationAndFunctionNamingConventions.qs style.
28
+ mutable successCount = 0; // Counter variable camelCase + semantic name; used in post-processing loop below.
29
+ for result in rawMeasurementResults
30
+ {
31
+ if result == One
32
+ {
33
+ set successCount += 1; // Mutation of named counter; name clearly communicates its purpose (counting |1⟩ outcomes).
34
+ }
35
+ }
36
+
37
+ // Final return value uses descriptive name inside the operation for traceability.
38
+ return bitStringValue;
39
+ }
40
+
41
+ @EntryPoint()
42
+ operation DemonstrateMeasurementResultNaming() : Unit
43
+ {
44
+ use registerForMeasurement = Qubit[3]; // Register name camelCase; demonstrates interconnection with qubit naming.
45
+ let finalClassicalValue = MeasureAndProcessNamedRegister(registerForMeasurement); // Local variable camelCase + semantic descriptor.
46
+ ResetAll(registerForMeasurement);
47
+ }
48
+ }
@@ -0,0 +1,30 @@
1
+ /*
2
+ WHAT: Namespace naming conventions in Q#.
3
+ HOW: Use PascalCase for every segment, separated by periods (e.g., Company.Quantum.Module.SubModule). Begin with a clear organization/project prefix. Never use underscores, hyphens, or all-lowercase. Keep segments descriptive but concise; avoid generic terms like "Utils".
4
+ WHEN: For every .qs file and when organizing related operations, functions, and types into logical groups.
5
+ WHERE: Declared as the first non-comment line in each source file, immediately before any open statements.
6
+ WHY: Enables hierarchical organization that scales with large quantum libraries, prevents name collisions across Microsoft.Quantum.* packages, improves IntelliSense and discoverability in the Quantum Development Kit, and follows .NET ecosystem conventions for seamless integration with classical host code.
7
+ */
8
+
9
+ namespace MyTechToday.Quantum.NamingStandards.Namespaces { // Good: PascalCase segments with meaningful hierarchy starting with organization prefix
10
+
11
+ // Bad example (commented for illustration only):
12
+ // namespace mytech_quantum_namingstandards { // Incorrect: snake_case, missing hierarchy, lowercase
13
+
14
+ open Microsoft.Quantum.Intrinsic;
15
+ open Microsoft.Quantum.Canon;
16
+ open Microsoft.Quantum.Measurement;
17
+
18
+ // Good: Operation placed inside the properly named namespace
19
+ operation PrepareBellState() : Unit {
20
+ use q1 = Qubit();
21
+ use q2 = Qubit();
22
+ H(q1);
23
+ CNOT(q1, q2);
24
+ let result = M(q2); // Measurement result demonstrates namespace isolation
25
+ ResetAll([q1, q2]);
26
+ }
27
+
28
+ // Additional example showing nested conceptual grouping via namespace
29
+ // (in practice, deeper nesting would use a separate file with matching namespace)
30
+ }
@@ -0,0 +1,31 @@
1
+ /*
2
+ WHAT: Operation and function (callable) naming conventions in Q#.
3
+ HOW: Use PascalCase for all callable names. Operations (which may have side effects on qubits) start with verbs like "Prepare", "Apply", or "Measure". Pure functions start with nouns or adjectives like "Calculate" or "Get". Never use abbreviations unless they are QDK-standard (e.g., QFT).
4
+ WHEN: Every time declaring an operation or function to clearly communicate intent and quantum vs. classical behavior.
5
+ WHERE: In namespace scope for public callables; local callables within operations use the same PascalCase rule.
6
+ WHY: Makes code self-documenting for quantum algorithm readers, enables easy functor application (Adj, Ctl), improves collaboration in team quantum projects, and aligns with Microsoft Quantum Development Kit library patterns for readability and maintainability.
7
+ */
8
+
9
+ namespace MyTechToday.Quantum.NamingStandards.Callables {
10
+
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Canon;
13
+
14
+ // Good: Operation name uses verb + descriptive noun in PascalCase
15
+ operation PrepareBellState() : Unit {
16
+ use qs = Qubit[2];
17
+ H(qs[0]);
18
+ CNOT(qs[0], qs[1]);
19
+ ResetAll(qs);
20
+ }
21
+
22
+ // Good: Pure function name uses noun/adjective form
23
+ function CalculatePhaseEstimate(measurements : Result[]) : Double {
24
+ // Pure computation - no qubit side effects
25
+ return 0.0; // Placeholder for educational clarity
26
+ }
27
+
28
+ // Bad example (commented for illustration only):
29
+ // operation prepare_bell() : Unit { ... } // Incorrect: snake_case and lowercase verb
30
+ // function calcPhase() : Double { ... } // Incorrect: abbreviation and camelCase
31
+ }
@@ -0,0 +1,41 @@
1
+ /*
2
+ * What: This example demonstrates Q# naming conventions exclusively for oracle/black-box callables, their qubit-register parameters, and internal phase-marking variables.
3
+ * How: Oracle operations follow PascalCase verb-noun-plus-domain pattern; parameters combine camelCase with semantic descriptors; all names interconnect with qubit and result naming.
4
+ * When: Apply whenever defining custom oracles, phase oracles, or black-box unitaries in quantum algorithms.
5
+ * Where: These conventions belong in algorithm-specific libraries (e.g., Microsoft.Quantum.Oracles or domain Grover modules).
6
+ * Why: Descriptive oracle naming makes algorithmic intent transparent, facilitates functor application (Adjoint/Controlled), and enables library consumers to compose oracles confidently without inspecting implementation details.
7
+ */
8
+
9
+ namespace Augment.Quantum.Examples.Naming.OracleCallableNamingConventions
10
+ {
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Canon;
13
+ open Microsoft.Quantum.Measurement;
14
+
15
+ /// # Summary
16
+ /// Example phase oracle that marks a specific basis state using strictly named identifiers.
17
+ operation PhaseOracleMarkTargetState(targetIndex : Int, register : Qubit[]) : Unit is Adj + Ctl
18
+ {
19
+ // Operation name 'PhaseOracleMarkTargetState' is PascalCase, verb-led, and domain-specific—clearly signals its role in Grover/phase estimation.
20
+ // 'is Adj + Ctl' functor declaration follows FunctorSpecializationNamingConventions.qs style while remaining on-topic for callable naming.
21
+ let phaseMarkerQubit = register[0]; // Local qubit extraction uses camelCase + descriptive name; documents which register element is the marker.
22
+ Rz(2.0 * PI() / IntAsDouble(targetIndex + 1), phaseMarkerQubit); // Rotation uses named qubit; name prevents misinterpretation of index usage.
23
+ }
24
+
25
+ /// # Summary
26
+ /// Wrapper callable demonstrating oracle composition and result extraction naming.
27
+ operation RunNamedOracleOnRegister() : Result
28
+ {
29
+ use dataRegister = Qubit[2];
30
+ PhaseOracleMarkTargetState(0, dataRegister); // Oracle call uses the full PascalCase name; parameters follow established qubit-register convention.
31
+ let finalMeasurementOutcome = M(dataRegister[0]); // Result variable camelCase + semantic descriptor tying back to oracle action.
32
+ ResetAll(dataRegister);
33
+ return finalMeasurementOutcome;
34
+ }
35
+
36
+ @EntryPoint()
37
+ operation DemonstrateOracleCallableNaming() : Unit
38
+ {
39
+ let outcome = RunNamedOracleOnRegister();
40
+ }
41
+ }
@@ -0,0 +1,42 @@
1
+ /*
2
+ * What: This example demonstrates Q# naming conventions exclusively for Pauli bases, Pauli arrays, measurement-basis parameters, and operator-specific variables.
3
+ * How: Pauli constants and arrays receive PascalCase descriptive names; parameters and locals use camelCase with explicit basis/role suffixes; all interconnect with measurement callables.
4
+ * When: Use whenever constructing multi-basis measurements, stabilizer circuits, or randomized benchmarking sequences.
5
+ * Where: Ideal for placement in Microsoft.Quantum.Characterization or custom quantum-diagnostics libraries.
6
+ * Why: Explicit Pauli naming prevents off-by-one errors in basis selection, makes circuit intent self-documenting, and supports automated verification of measurement compatibility.
7
+ */
8
+
9
+ namespace Augment.Quantum.Examples.Naming.PauliBasisNamingConventions
10
+ {
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Measurement;
13
+ open Microsoft.Quantum.Arrays;
14
+
15
+ /// # Summary
16
+ /// Performs a multi-basis measurement using named Pauli operators and demonstrates
17
+ /// every naming decision for Pauli-related identifiers.
18
+ operation MultiBasisNamedMeasurement(qubitRegister : Qubit[]) : Result[]
19
+ {
20
+ // Parameter name 'qubitRegister' maintains consistency with prior examples.
21
+ let pauliBasisX = PauliX; // Constant uses PascalCase + explicit basis suffix; self-documents the Pauli operator chosen.
22
+ let pauliBasisY = PauliY; // Companion constant follows identical pattern for visual grouping.
23
+ let pauliBasisZ = PauliZ;
24
+
25
+ // Pauli array constructed with descriptive camelCase name; order is documented by name.
26
+ let measurementBases = [pauliBasisX, pauliBasisY, pauliBasisZ];
27
+
28
+ // 'measurementBases' name makes the array’s purpose (basis selection) immediately clear to readers and static analyzers.
29
+ let measuredOutcomes = MeasureEachZ(qubitRegister); // Intermediate array follows camelCase + semantic descriptor; links Pauli choice to outcome.
30
+
31
+ // Final return uses camelCase for the result collection.
32
+ return measuredOutcomes;
33
+ }
34
+
35
+ @EntryPoint()
36
+ operation DemonstratePauliBasisNaming() : Unit
37
+ {
38
+ use testRegister = Qubit[3];
39
+ let outcomes = MultiBasisNamedMeasurement(testRegister);
40
+ ResetAll(testRegister);
41
+ }
42
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ WHAT: Pauli operator and basis state naming conventions in Q#.
3
+ HOW: Pauli constants and variables use UPPER_SNAKE_CASE for built-ins (e.g., PAULI_Z) or camelCase when custom (e.g., customPauliX); basis states use camelCase with "Basis" suffix.
4
+ WHEN: When specifying Pauli bases for measurements or Pauli strings in Hamiltonians.
5
+ WHERE: Parameter lists for Measure, within Pauli arrays, or in custom operator definitions.
6
+ WHY: Pauli operators are foundational to quantum error correction and simulation; consistent naming ensures correct basis selection, prevents mixing I/X/Y/Z, and aligns with Q# standard library expectations.
7
+ */
8
+
9
+ // GOOD: UPPER_SNAKE_CASE for standard Paulis and camelCase for custom
10
+ namespace AugmentExtensions.Quantum.NamingStandards.Paulis {
11
+
12
+ open Microsoft.Quantum.Intrinsic;
13
+ open Microsoft.Quantum.Measurement;
14
+
15
+ operation PauliBasisMeasurement(targetQubit : Qubit) : Result {
16
+ // GOOD: UPPER_SNAKE_CASE for built-in Pauli constants
17
+ let basisPauli = PAULI_Z; // Standard library constant
18
+
19
+ // GOOD: camelCase custom Pauli variable
20
+ let customPauliX = PauliX;
21
+
22
+ return Measure([basisPauli], [targetQubit]);
23
+ }
24
+ }