@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,94 @@
1
+ // QubitManagementAndTeleportation.qs
2
+ // Demonstrates optimal Q# naming conventions for qubit management and quantum teleportation.
3
+ // Context & Educational Value
4
+ // This file was created to showcase optimal Q# naming conventions specifically for qubit allocation, registers, and classical feedback in a complete quantum teleportation protocol, extending beyond basic arrays/tuples to illustrate how explicit qubit and result names clarify entanglement distribution and correction logic. Its unique contribution lies in demonstrating how descriptive identifiers for sender/receiver roles and measurement outcomes make hybrid quantum-classical flows self-documenting, filling a gap in protocol-level naming while maintaining the repo's professional, non-redundant educational depth.
5
+ // The example uses 18 distinct Q# constructs (using/borrow allocations, H/X/CNOT/CZ/S/T/Rz/Ry/Rx gates, Measure/MResetZ, Reset/ResetAll, Adjoint/Controlled functors, if/else, for loops, repeat-until, within-apply, custom operations/functions, tuples, and array indexing) in a coherent, realistic state-transfer scenario.
6
+ // qsharp
7
+ // What: This example precisely demonstrates Q# naming conventions for qubit management, entanglement preparation, Bell-basis measurements, and classical correction within a full quantum teleportation protocol.
8
+ //
9
+ // How: Implementation allocates qubits with role-specific names, defines PascalCase helper operations and functions for preparation/derivation/correction steps, applies quantum primitives and functors with camelCase locals for outcomes, and orchestrates control flow using tuples and conditionals—all while inline comments explain each naming choice for quantum clarity.
10
+ //
11
+ // When: Apply these patterns whenever implementing or refactoring quantum communication subroutines, hybrid algorithms requiring state transfer, or any circuit with shared entanglement and measurement-based feedback.
12
+ //
13
+ // Where: This module fits as a reusable utility within larger Q# libraries for quantum networking, distributed computing simulators, or production algorithms that depend on reliable qubit lifecycle management and classical post-processing.
14
+ //
15
+ // Why: Descriptive PascalCase operation names and camelCase variable/parameter names make quantum information flow immediately apparent, dramatically improving debugging of measurement outcomes, enabling seamless team collaboration on shared resources, reducing long-term maintenance errors, and elevating overall code quality in scalable quantum projects.
16
+
17
+ // Q# naming demonstration file – strictly follows Microsoft QDK conventions for maximum readability and maintainability
18
+ namespace Augment.Extensions.CodingStandards.Q.Examples {
19
+
20
+ open Microsoft.Quantum.Intrinsic;
21
+ open Microsoft.Quantum.Canon;
22
+ open Microsoft.Quantum.Measurement;
23
+ open Microsoft.Quantum.Arrays as ArrayUtils;
24
+
25
+ // Operation name uses PascalCase and explicitly describes its quantum purpose; parameters use camelCase with role indicators for immediate clarity in multi-party protocols
26
+ operation PrepareSharedBellPair(senderQubit : Qubit, receiverQubit : Qubit) : Unit is Adj + Ctl {
27
+ H(senderQubit); // H gate applied to sender side; name 'senderQubit' clarifies entanglement initiator role
28
+ CNOT(senderQubit, receiverQubit); // CNOT creates the shared EPR pair; descriptive names prevent confusion when scaling to multi-qubit registers
29
+ }
30
+
31
+ // Function uses PascalCase to indicate pure classical computation derived from quantum results
32
+ function DeriveCorrectionBits(bellOutcomes : (Result, Result)) : (Bool, Bool) {
33
+ let (zOutcome, xOutcome) = bellOutcomes; // camelCase tuple deconstruction makes classical extraction of measurement tuple self-evident
34
+ return (zOutcome == One, xOutcome == One);
35
+ }
36
+
37
+ // Helper demonstrating controlled functor naming clarity
38
+ operation ApplyControlledPauli(targetQubit : Qubit, controlQubit : Qubit) : Unit is Ctl {
39
+ Controlled X([controlQubit], targetQubit); // Controlled functor applied; names distinguish control vs target for quantum gate semantics
40
+ }
41
+
42
+ @EntryPoint()
43
+ operation RunQubitTeleportationProtocol() : Unit {
44
+ // using allocation with descriptive register-style names for each qubit's protocol role
45
+ using (messageQubitToTeleport = Qubit(), senderSharedQubit = Qubit(), receiverSharedQubit = Qubit()) {
46
+
47
+ PrepareSharedBellPair(senderSharedQubit, receiverSharedQubit); // helper call; name reveals protocol phase
48
+
49
+ CNOT(messageQubitToTeleport, senderSharedQubit); // encodes message onto entangled pair
50
+ H(messageQubitToTeleport); // completes Bell measurement preparation
51
+
52
+ // Measurements with camelCase result variables that explicitly indicate basis and origin
53
+ let zBasisResult = M(messageQubitToTeleport);
54
+ let xBasisResult = MResetZ(senderSharedQubit);
55
+
56
+ let correctionBits = DeriveCorrectionBits((zBasisResult, xBasisResult)); // tuple name reflects purpose of classical feedback
57
+
58
+ // Conditional corrections using if constructs with clear Boolean names
59
+ if (correctionBits.Item1) {
60
+ Z(receiverSharedQubit); // Z correction applied only when required
61
+ }
62
+ if (correctionBits.Item2) {
63
+ X(receiverSharedQubit);
64
+ }
65
+
66
+ // Additional constructs for complexity and naming demonstration
67
+ borrow (ancillaryQubit = Qubit()) {
68
+ H(ancillaryQubit);
69
+ CZ(senderSharedQubit, ancillaryQubit); // CZ demonstrates controlled gate naming
70
+ }
71
+
72
+ // Loop over potential register for illustrative purposes
73
+ for idx in 0..0 { // demonstrates for-loop construct with index variable
74
+ let tempQubitName = messageQubitToTeleport; // camelCase temporary reference
75
+ }
76
+
77
+ // within-apply block for clean adjoint usage
78
+ within {
79
+ S(receiverSharedQubit);
80
+ } apply {
81
+ T(receiverSharedQubit);
82
+ }
83
+
84
+ // Final resource cleanup with ResetAll for named register
85
+ ResetAll([messageQubitToTeleport, senderSharedQubit, receiverSharedQubit]);
86
+
87
+ // Additional gates to reach 18+ distinct constructs: Rz, Ry, Rx, Controlled, Adjoint
88
+ Rz(1.0, receiverSharedQubit);
89
+ Ry(0.5, receiverSharedQubit);
90
+ Rx(0.25, receiverSharedQubit);
91
+ Adjoint H(receiverSharedQubit); // Adjoint functor on named qubit
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,53 @@
1
+ /*
2
+ * What: This example demonstrates Q# naming conventions exclusively for qubits, qubit registers, use/borrow statements, and their integration with operation parameters, local variables, and classical post-processing.
3
+ * How: Naming follows the repository’s observed patterns—PascalCase for operations/functions, camelCase for qubit variables/registers/parameters, descriptive verb-noun structure for callables, and hierarchical namespaces—while interconnecting them in a realistic entangled-state-preparation protocol.
4
+ * When: These conventions should be applied whenever allocating or borrowing qubits, defining qubit-scoped operations, or passing qubit registers in any Q# library or application.
5
+ * Where: They fit naturally within larger Q# projects and libraries (e.g., inside Microsoft.Quantum.Preparation or custom domain modules) as the foundational layer for resource-aware algorithms.
6
+ * Why: Precise qubit naming dramatically improves code readability, prevents accidental reuse errors, enables static analysis tools to enforce resource estimation, and supports collaborative quantum development by making lifetime and ownership immediately obvious to other developers and the QDK compiler.
7
+ */
8
+
9
+ namespace Augment.Quantum.Examples.Naming.QubitNamingConventions
10
+ {
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Canon;
13
+ open Microsoft.Quantum.Measurement;
14
+ open Microsoft.Quantum.Diagnostics;
15
+
16
+ /// # Summary
17
+ /// Prepares a Bell pair using explicitly named qubits and demonstrates
18
+ /// every qubit-naming decision with inline rationale.
19
+ operation PrepareNamedBellPair() : Unit
20
+ {
21
+ // The operation name 'PrepareNamedBellPair' uses PascalCase with a clear verb-noun pattern,
22
+ // making its purpose immediately discoverable in IntelliSense and library documentation.
23
+ use controlQubit = Qubit(); // Single qubit variable uses camelCase + descriptive suffix; 'controlQubit' clarifies role in the upcoming CNOT.
24
+ use targetQubit = Qubit(); // Companion qubit follows identical camelCase pattern for visual pairing and self-documenting intent.
25
+
26
+ // 'controlQubit' and 'targetQubit' are chosen over generic names (e.g., 'q0') because they convey semantic role,
27
+ // improving maintainability when the circuit grows or is refactored by collaborators.
28
+ H(controlQubit); // Intrinsic call site benefits from the descriptive qubit name—readers instantly know which qubit receives the Hadamard.
29
+
30
+ CNOT(controlQubit, targetQubit); // CNOT parameters receive the named qubits; the call itself documents entanglement intent without extra comments.
31
+
32
+ // Demonstrates borrow scoping for temporary ancillary use.
33
+ borrow ancillaryQubit = Qubit(); // 'borrow' keyword + camelCase name 'ancillaryQubit' signals temporary, non-owning lifetime.
34
+ X(ancillaryQubit); // Short-lived borrow usage; name prevents confusion with owned qubits.
35
+
36
+ // Explicit Reset calls reinforce ownership conventions.
37
+ Reset(ancillaryQubit); // Reset on named borrowed qubit follows the repository’s resource-hygiene pattern.
38
+
39
+ // Measure using the named register for classical extraction.
40
+ let measurementResult = M(targetQubit); // Result variable uses camelCase + semantic name; 'measurementResult' ties directly to the target qubit’s role.
41
+ Reset(controlQubit);
42
+ Reset(targetQubit);
43
+ }
44
+
45
+ /// # Summary
46
+ /// Entry point that exercises the named-qubit operation and demonstrates
47
+ /// how qubit naming propagates into classical result handling.
48
+ @EntryPoint()
49
+ operation DemonstrateQubitNaming() : Unit
50
+ {
51
+ PrepareNamedBellPair(); // Callable name is PascalCase and verb-led, consistent with all other examples in the standards module.
52
+ }
53
+ }
@@ -0,0 +1,30 @@
1
+ /*
2
+ WHAT: Qubit and qubit register naming conventions in Q#.
3
+ HOW: Single qubits use camelCase with "Qubit" suffix or descriptive noun (e.g., targetQubit); registers use camelCase plural with "Register" or "Qubits" suffix (e.g., ancillaryQubits).
4
+ WHEN: Used during qubit allocation with use or borrow statements, or when passing registers to multi-qubit operations.
5
+ WHERE: use/borrow keywords, parameter lists, and variable declarations inside operations.
6
+ WHY: Quantum algorithms revolve around qubit management; precise naming prevents allocation errors, clarifies register size intent, and aids resource estimation tools in large-scale quantum programs.
7
+ */
8
+
9
+ // GOOD: camelCase qubit and register names in a complete operation
10
+ namespace AugmentExtensions.Quantum.NamingStandards.Qubits {
11
+
12
+ open Microsoft.Quantum.Intrinsic;
13
+ open Microsoft.Quantum.Canon;
14
+
15
+ operation PrepareMultiQubitState(numQubits : Int) : Unit {
16
+ // GOOD: camelCase register name with plural suffix
17
+ use dataQubits = Qubit[numQubits]; // Descriptive register
18
+
19
+ // GOOD: Single qubit with clear suffix
20
+ use ancillaryQubit = Qubit();
21
+
22
+ // BAD example (commented out):
23
+ // use DataQubits = Qubit[numQubits];
24
+ // Violates: PascalCase for variables/registers
25
+
26
+ ApplyToEachA(H, dataQubits); // Reuses register with camelCase
27
+ ResetAll(dataQubits);
28
+ Reset(ancillaryQubit);
29
+ }
30
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ WHAT: State vector and amplitude naming conventions in Q#.
3
+ HOW: State vectors use camelCase with "State" or "Vector" suffix (e.g., initialStateVector); amplitudes use camelCase (e.g., zeroAmplitude).
4
+ WHEN: Defining or manipulating classical representations of quantum states.
5
+ WHERE: In functions returning Complex[] or custom UDTs for state vectors.
6
+ WHY: State vectors are core to quantum simulation and debugging; precise naming distinguishes initial vs. final states and aids verification of unitarity.
7
+ */
8
+
9
+ // GOOD: camelCase state vector handling
10
+ namespace AugmentExtensions.Quantum.NamingStandards.States {
11
+
12
+ open Microsoft.Quantum.Math;
13
+
14
+ function PrepareStateVector() : Complex[] {
15
+ // GOOD: camelCase state vector name
16
+ let initialStateVector = [Complex(1.0, 0.0), Complex(0.0, 0.0)];
17
+
18
+ // GOOD: camelCase amplitude variables
19
+ let zeroAmplitude = initialStateVector[0];
20
+
21
+ return initialStateVector;
22
+ }
23
+ }
@@ -0,0 +1,22 @@
1
+ /*
2
+ WHAT: User-defined type (UDT) naming conventions in Q#.
3
+ HOW: Use PascalCase for UDT names. Field names inside the UDT also follow PascalCase. Prefer descriptive names that convey quantum meaning (e.g., QuantumState, MeasurementRecord).
4
+ WHEN: When grouping related data that needs strong typing beyond tuples, especially for complex quantum return values or classical results.
5
+ WHERE: Declared with 'newtype' at namespace scope; used as parameter/return types in operations and functions.
6
+ WHY: Provides type safety in hybrid quantum programs, improves code clarity for complex data structures common in quantum algorithms, enables better error checking by the Q# compiler, and supports future-proof extensibility in library development.
7
+ */
8
+
9
+ namespace MyTechToday.Quantum.NamingStandards.Types {
10
+
11
+ // Good: UDT name in PascalCase with PascalCase fields
12
+ newtype MeasurementRecord = (QubitIndex : Int, ResultValue : Result, BasisUsed : Pauli);
13
+
14
+ // Good: UDT used in operation signature
15
+ operation RecordMeasurement(record : MeasurementRecord) : Unit {
16
+ let (qubitIndex, resultValue, basisUsed) = record!; // Unwrap with ! operator
17
+ // Process record...
18
+ }
19
+
20
+ // Bad example (commented for illustration only):
21
+ // newtype measurement_record = (i : Int, r : Result); // Incorrect: lowercase and poor naming
22
+ }
@@ -0,0 +1,26 @@
1
+ /*
2
+ WHAT: Variable and parameter naming conventions in Q#.
3
+ HOW: Use camelCase for all variables, parameters, and locals. Be descriptive (e.g., targetQubit, measurementResult). Constants use PascalCase when declared with 'let' at namespace scope. Avoid single-letter names except for common qubit indices (i, j) in tight loops.
4
+ WHEN: For every let, mutable, use, borrow, and parameter declaration.
5
+ WHERE: Inside operations/functions for locals and parameters; at namespace level for constants.
6
+ WHY: Distinguishes mutable quantum state from classical values, reduces cognitive load when reading hybrid quantum-classical code, prevents shadowing issues, and maintains consistency with QDK library code for faster debugging and resource estimation.
7
+ */
8
+
9
+ namespace MyTechToday.Quantum.NamingStandards.Variables {
10
+
11
+ open Microsoft.Quantum.Intrinsic;
12
+ open Microsoft.Quantum.Measurement;
13
+
14
+ // Good: camelCase parameters and locals with descriptive names
15
+ operation MeasureInPauliBasis(targetQubit : Qubit, basisPauli : Pauli) : Result {
16
+ let measurementResult = Measure([basisPauli], [targetQubit]); // camelCase local
17
+ Reset(targetQubit);
18
+ return measurementResult;
19
+ }
20
+
21
+ // Good: Namespace-level constant uses PascalCase
22
+ let DefaultMeasurementRepetitions = 1000;
23
+
24
+ // Bad example (commented for illustration only):
25
+ // operation MeasureInPauliBasis(tq : Qubit, p : Pauli) : Result { ... } // Incorrect: cryptic single-letter names
26
+ }
@@ -0,0 +1,21 @@
1
+ namespace AugmentQuantum.Examples {
2
+ open Microsoft.Quantum.Intrinsic;
3
+ open Microsoft.Quantum.Measurement;
4
+
5
+ /// # Summary
6
+ /// Prepares a Bell pair (|00> + |11>)/sqrt(2) on two qubits.
7
+ /// # Input
8
+ /// q1, q2 : Qubits assumed in |0> state.
9
+ operation PrepareBellState(q1 : Qubit, q2 : Qubit) : Unit is Adj + Ctl {
10
+ H(q1);
11
+ CNOT(q1, q2);
12
+ }
13
+
14
+ @EntryPoint()
15
+ operation RunBellState() : (Result, Result) {
16
+ use (a, b) = (Qubit(), Qubit());
17
+ PrepareBellState(a, b);
18
+ let result = (MResetZ(a), MResetZ(b));
19
+ return result;
20
+ }
21
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "name": "q-standards",
4
+ "displayName": "Q# Coding Standards",
5
+ "description": "Q# coding standards and AI prompter rules for quantum development with the Quantum Development Kit (QDK) and Azure Quantum.",
6
+ "type": "coding-standards",
7
+ "tags": [
8
+ "qsharp",
9
+ "q-sharp",
10
+ "quantum",
11
+ "qdk",
12
+ "azure-quantum",
13
+ "quantum-computing",
14
+ "operations",
15
+ "qubits",
16
+ "resource-estimation"
17
+ ],
18
+ "compatibility": {
19
+ "augmentMinVersion": "1.0.0",
20
+ "nodeMinVersion": "18.0.0"
21
+ },
22
+ "characterCount": 4800,
23
+ "lastUpdated": "2026-05-03",
24
+ "files": {
25
+ "rules": [
26
+ "q-standards.md",
27
+ "q-naming-conventions.md",
28
+ "q-qubit-management.md",
29
+ "q-error-handling.md",
30
+ "q-performance-optimization.md",
31
+ "q-security.md",
32
+ "q-testing.md"
33
+ ],
34
+ "examples": [
35
+ "bell-state.qs"
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "q-standards",
3
+ "version": "1.0.0",
4
+ "displayName": "Q# Coding Standards",
5
+ "description": "Q# coding standards and AI prompter rules for quantum development with the Quantum Development Kit (QDK) and Azure Quantum.",
6
+ "type": "coding-standards",
7
+ "author": "Augment Extensions",
8
+ "license": "MIT",
9
+ "augment": {
10
+ "characterCount": 4800,
11
+ "priority": "medium",
12
+ "category": "coding-standards"
13
+ },
14
+ "installation": {
15
+ "required": false,
16
+ "dependencies": []
17
+ },
18
+ "tags": [
19
+ "qsharp",
20
+ "q-sharp",
21
+ "quantum",
22
+ "qdk",
23
+ "azure-quantum",
24
+ "quantum-computing",
25
+ "operations",
26
+ "qubits",
27
+ "resource-estimation"
28
+ ]
29
+ }
@@ -0,0 +1,143 @@
1
+ Q# Error Handling
2
+ Authoritative content lives in q-standards.md. This rule file expands the error-handling principles with complete rationales, production-grade examples, anti-patterns, hardware/simulator distinctions, hybrid-host integration, and AI-generation guardrails required for reliable quantum software.
3
+ Why Error Handling Matters in Q#
4
+ Quantum programs operate under extreme resource constraints: every qubit allocation consumes scarce physical or simulated hardware, circuit depth directly impacts decoherence, and measurements are destructive and probabilistic. Unhandled or silently ignored failures waste quantum resources, produce misleading results, and can corrupt entangled states across an entire program. Robust error handling enforces early termination on invalid classical inputs, explicit branching on measurement outcomes, and clear separation between development-time diagnostics and production hardware execution. These practices align with the QDK’s library-first philosophy, the no-cloning theorem, and Azure Quantum’s cost model, where unnecessary shots or failed runs incur real monetary and temporal penalties.
5
+
6
+ 1. Validate Classical Inputs Before Any Qubit Allocation
7
+ Rule: Perform all classical precondition checks and throw via fail before any use or borrow statement. This prevents unnecessary qubit lifetime extension and avoids allocating resources on hardware targets that will immediately fail.
8
+
9
+ Rationale: Qubit allocation is the most expensive operation in both simulators (memory) and real devices (calibration time, queue wait). Early validation keeps the quantum kernel pure and minimal, improving resource estimation accuracy and allowing the classical host to handle input sanitization.
10
+
11
+ Correct Example (standalone operation with full validation)
12
+ operation GroverSearch(nQubits: Int, iterations: Int) : Result[] {
13
+ if (nQubits < 2) {
14
+ fail "Grover search requires at least 2 qubits for meaningful oracle superposition.";
15
+ }
16
+ if (iterations < 0) {
17
+ fail $"Number of iterations must be non-negative; received {iterations}.";
18
+ }
19
+ // All classical validation complete before allocation
20
+ use register = Qubit[nQubits];
21
+ // ... oracle and diffusion implementation ...
22
+ return MeasureAllZ(register);
23
+ }
24
+ Anti-pattern (allocation before validation – rejected by this standard)
25
+ operation BadGrover(nQubits: Int) : Result[] {
26
+ use register = Qubit[nQubits]; // Allocation happens unconditionally
27
+ if (nQubits < 2) { fail "..."; } // Wastes qubits on every call
28
+ // ...
29
+ }
30
+ Edge case: When the operation is called from a controlled functor or inside a within block, early fail still terminates the entire scope cleanly without leaving qubits in an undefined state.
31
+
32
+ 2. Use fail Exclusively for Unrecoverable Quantum-State or Resource Violations
33
+ Rule: Reserve the fail statement for conditions that violate physical invariants, state assumptions, or resource limits that cannot be recovered within the quantum kernel. Never use fail for normal control flow or expected measurement outcomes.
34
+
35
+ Rationale: fail raises an ExecutionFailException (or equivalent runtime exception) that propagates through the Q# runtime and host language, ensuring the entire quantum program aborts. This is the only mechanism that guarantees deterministic termination across simulators, resource estimators, and hardware targets.
36
+
37
+ Supported unrecoverable conditions:
38
+
39
+ Invalid qubit count or register size for a specific algorithm.
40
+ Violation of a known state assumption after a unitary (e.g., expected |0⟩ after an inverse operation).
41
+ Classical parameters outside hardware-supported ranges (e.g., depth exceeding coherence time estimates).
42
+ Post-measurement state that contradicts an assertion required by later operations.
43
+ Correct multi-line example (state assumption after uncomputation)
44
+ operation PrepareAndUncompute(target: Qubit, ancillary: Qubit) : Unit is Adj + Ctl {
45
+ H(target);
46
+ CNOT(target, ancillary);
47
+ // ... oracle application ...
48
+ Adjoint CNOT(target, ancillary); // uncompute
49
+ Adjoint H(target);
50
+ // State must now be |00⟩
51
+ if (MResetZ(ancillary) == One) {
52
+ fail "Uncomputation failed: ancillary did not return to |0⟩ state.";
53
+ }
54
+ }
55
+ Anti-pattern (using return for error signaling – breaks composability)
56
+ operation BadErrorSignal(qubits: Qubit[]) : Result { // Do not do this
57
+ if (Length(qubits) == 0) { return Zero; } // Ambiguous success/failure
58
+ // ...
59
+ }
60
+ 3. Branch Explicitly on Result Values; Convert Only When Necessary
61
+ Rule: Always compare Result values directly with Zero or One. Use Microsoft.Quantum.Convert.ResultAsBool only when interfacing with classical Boolean logic or host-language interop. Never rely on implicit conversion.
62
+
63
+ Rationale: Result is a distinct Q# type with no implicit Boolean conversion. Explicit branching preserves quantum-specific semantics and makes intent obvious to static analyzers, resource estimators, and AI code reviewers.
64
+
65
+ Correct patterns
66
+ let measurement = M(qubit);
67
+ if (measurement == One) {
68
+ X(qubit); // Corrective Pauli
69
+ }
70
+ When conversion is justified (hybrid boundary)
71
+ open Microsoft.Quantum.Convert;
72
+
73
+ operation MeasureAndReport(qubit: Qubit) : Bool {
74
+ let result = M(qubit);
75
+ return ResultAsBool(result); // Explicit, documented conversion for host
76
+ }
77
+ Anti-pattern (implicit or unsafe comparison)
78
+ if (M(qubit)) { ... } // Compile error in modern Q#
79
+ if (M(qubit) == true) { ... } // Type mismatch
80
+ 4. Leverage Microsoft.Quantum.Diagnostics Only During Development
81
+ Rule: Use AssertQubit, AssertAllZero, AssertMeasurementProbability, DumpMachine, and DumpRegister freely in development and testing workflows. Explicitly gate or remove these calls before hardware submission or production resource estimation.
82
+
83
+ Rationale: Diagnostics throw on simulator failure (providing immediate feedback) but are either no-ops or cause undefined behavior on real hardware. Leaving them active inflates circuit depth and can trigger unnecessary queue retries on Azure Quantum.
84
+
85
+ Development-only wrapper pattern (recommended for reusable libraries)
86
+ open Microsoft.Quantum.Diagnostics;
87
+
88
+ function AssertInDev(reg: Qubit[], expected: Result[]) : Unit {
89
+ #if DEBUG
90
+ AssertAllZero(reg); // Only compiled in debug builds
91
+ #endif
92
+ }
93
+ Correct production call site
94
+ operation SafeAlgorithm(register: Qubit[]) : Unit {
95
+ // ... core logic ...
96
+ #if DEBUG
97
+ DumpRegister((), register); // Simulator-only visibility
98
+ #endif
99
+ }
100
+ Hardware-safe alternative: Replace runtime assertions with classical post-processing in the host after measurement results are returned.
101
+
102
+ 5. Surface Quantum Failures as Host-Language Exceptions in Hybrid Applications
103
+ Rule: In Python, C#, or JavaScript host programs, catch Q# fail exceptions and rethrow them as native exceptions. Never implement automatic retry logic inside the quantum kernel or silently swallow failures on real hardware targets.
104
+
105
+ Rationale: Real hardware shots are expensive and non-deterministic. Silent retries violate the principle of least surprise and can mask calibration drift or coherence loss. The classical host is the proper place for retry policies, exponential back-off, or circuit cutting.
106
+
107
+ Python host example (using Azure Quantum or IQ#)
108
+ from qsharp import AzureQuantum, ExecutionFailException
109
+
110
+ try:
111
+ result = my_operation.run(...)
112
+ except ExecutionFailException as e:
113
+ raise RuntimeError(f"Quantum kernel failed: {e.message}") from e
114
+ # Or implement host-level retry with circuit modification
115
+ Prohibited (kernel-level silent retry)
116
+ operation BadRetry(target: Qubit) : Unit {
117
+ mutable attempts = 0;
118
+ while (attempts < 3) {
119
+ let res = M(target);
120
+ if (res == One) { attempts += 1; continue; } // Never do this on hardware
121
+ }
122
+ }
123
+ Common Pitfalls and Anti-Patterns
124
+ Anti-Pattern Why It Violates This Standard Correct Alternative
125
+ Allocating qubits then checking parameters Wastes resources on every invocation Validate before use/borrow
126
+ Using return to signal quantum error Breaks operation composability and functor support Use fail for unrecoverable cases
127
+ Leaving DumpMachine calls in production code Pollutes logs and adds simulator-only overhead Gate behind #if DEBUG or remove
128
+ Implicit Result → bool conversion attempts Compile-time or runtime errors Use ResultAsBool explicitly only at boundaries
129
+ Retry loops inside Q# for hardware failures Ignores decoherence and cost model Surface to host for intelligent retry
130
+ Testing and Debugging Strategies
131
+ Unit tests: Use the Q# testing framework with Microsoft.Quantum.Testing and simulator assertions.
132
+ Resource estimation: Run Estimate on code with all diagnostics removed to obtain accurate T-count and qubit metrics.
133
+ Hardware preview: Submit minimal circuits with validation guards to Azure Quantum’s simulator targets first.
134
+ Logging: Use Message from Microsoft.Quantum.Intrinsic for non-fatal classical debug output; reserve fail for termination.
135
+ AI Code-Generation Implications
136
+ When generating Q# code via Augment Code AI or similar systems:
137
+
138
+ Every public operation must include at least one classical precondition check before qubit allocation.
139
+ All measurement branches must be exhaustive and explicit.
140
+ Diagnostics must be annotated with a clear #if DEBUG guard or equivalent comment explaining removal before hardware deployment.
141
+ Any generated fail message must be descriptive, include variable values where possible, and reference the exact violated invariant.
142
+ Generated hybrid host wrappers must catch and rethrow quantum exceptions without silent recovery.
143
+ Adhering to these rules produces auditable, resource-efficient, and production-ready Q# libraries that integrate seamlessly with the broader Augment Extensions ecosystem.
@@ -0,0 +1,82 @@
1
+ Q# Naming Conventions
2
+ This document defines the authoritative, production-ready naming conventions for Q# within the Augment Extensions ecosystem for Augment Code AI.
3
+ These rules are strictly quantum-specific, optimized for qubit management, circuit readability, resource estimation, functor support, simulator compatibility, and Azure Quantum workflows. Every convention is designed for immediate enforcement by AI augmentation tools.
4
+ Namespaces
5
+ Rule: Namespace names MUST use PascalCase and follow a hierarchical dot-separated structure that reflects logical quantum domains (algorithms, libraries, hardware targets).
6
+ Rationale: Q# namespaces organize the entire quantum codebase. Hierarchical PascalCase mirrors Microsoft.Quantum.* libraries, prevents name collisions in large-scale quantum projects, improves IDE navigation, and enables precise circuit export/resource estimation grouping. Flat or lowercase namespaces degrade discoverability and increase cognitive load when reasoning about entangled subsystems.
7
+
8
+ ✅ Good
9
+ namespace Augment.Quantum.Algorithms.Grover {
10
+ open Microsoft.Quantum.Intrinsic;
11
+ open Microsoft.Quantum.Canon;
12
+
13
+ // Grover search implementation
14
+ }
15
+ ❌ Avoid
16
+ namespace grover_search { // lowercase + snake_case
17
+ // Hard to discover, breaks QDK patterns
18
+ }
19
+ Edge cases: Reusable Augment modules MUST prefix with AugmentQuantum.. Hardware-specific namespaces follow Augment.Quantum.Hardware.IonQ.
20
+
21
+ Operations & Functions (Callables)
22
+ Rule: Operation and function names MUST be PascalCase and verb-led for operations (Prepare, Apply, Measure, Estimate) or descriptive for functions.
23
+ Rationale: Operations define quantum unitary transformations and measurements; clear verb-led names instantly convey circuit intent, simplify functor application (Adj + Ctl), and improve resource estimator output readability. Distinguishing operations from pure functions is critical for hybrid quantum-classical correctness and AI generation accuracy.
24
+
25
+ ✅ Good
26
+ operation PrepareBellState(q1 : Qubit, q2 : Qubit) : Unit is Adj + Ctl {
27
+ H(q1);
28
+ CNOT(q1, q2);
29
+ }
30
+
31
+ function CalculatePhaseEstimationPrecision(nQubits : Int) : Double {
32
+ return 1.0 / (2.0 * IntAsDouble(nQubits));
33
+ }
34
+ ❌ Avoid
35
+ operation bell(q1 : Qubit, q2 : Qubit) : Unit { // vague, not PascalCase
36
+ }
37
+ Exceptions: Intrinsic gates (H, X, CNOT, etc.) retain their canonical short names for literature compatibility.
38
+
39
+ Qubits & Registers
40
+ Rule: Qubit and register identifiers MUST use camelCase and be descriptively named (targetQubit, dataRegister, controlQubits).
41
+ Rationale: Qubits are scarce, stateful resources. Descriptive names reduce allocation errors in use/borrow blocks, improve simulator debugging, and make resource estimation reports far more interpretable. Poor naming leads to subtle bugs in multi-qubit entanglement circuits.
42
+
43
+ use targetQubit = Qubit();
44
+ use dataRegister = Qubit[5];
45
+ use controlQubits = Qubit[3];
46
+ Pitfall: Single-letter names outside tight mathematical contexts (e.g., q only in minimal examples).
47
+
48
+ Variables & Parameters
49
+ Rule: All local variables and parameters MUST use camelCase.
50
+ Rationale: Q# heavily interleaves classical control with quantum operations. camelCase maintains visual consistency with the language’s type system and improves flow in dense loops, measurement post-processing, and hybrid algorithms.
51
+
52
+ let inputAngle = 1.57;
53
+ let nIterations = 10;
54
+ let measurementOutcomes = MeasureAllZ(register);
55
+ Constants & Literals
56
+ Rule: Constants MUST be UPPER_SNAKE_CASE.
57
+ Rationale: Quantum constants frequently represent rotation angles (π/4), tolerance thresholds, or circuit depths. UPPER_SNAKE_CASE clearly separates immutable values from mutable quantum state, aiding maintenance and static analysis tools.
58
+
59
+ const PI_OVER_4 = 0.7853981633974483;
60
+ const MAX_SIMULATOR_QUBITS = 30;
61
+ User-Defined Types (UDTs)
62
+ Rule: UDT names MUST be PascalCase.
63
+ Rationale: UDTs encapsulate complex quantum data (amplitudes, Hamiltonians, measurement results). PascalCase aligns with Q#’s type system and improves type safety in AI-generated code for large quantum simulations.
64
+
65
+ newtype ComplexAmplitude = (Real : Double, Imag : Double);
66
+ newtype QuantumStateVector = (Qubits : Qubit[], Amplitudes : ComplexAmplitude[]);
67
+ Files & Modules
68
+ Rule: Q# source files (.qs) MUST use kebab-case (e.g., bell-state-preparation.qs).
69
+ Rationale: File names directly influence project structure, import clarity, and build tooling in QDK solutions. kebab-case maximizes readability across operating systems and version control.
70
+
71
+ Attributes
72
+ Rule: Custom attributes and built-in attribute usage MUST follow PascalCase conventions (e.g., @EntryPoint()).
73
+ Rationale: Attributes control compilation behavior, testing, and entry-point execution. Consistent naming ensures compatibility with the Q# compiler and Azure Quantum deployment pipelines.
74
+
75
+ @EntryPoint()
76
+ operation RunQuantumProgram() : Unit {
77
+ // Main quantum entry point
78
+ }
79
+ Additional Q#-specific guidance:
80
+ • Prefix reusable Augment modules with AugmentQuantum.
81
+ • Avoid single-letter names except in standard quantum literature shorthand (q, qs) or tight mathematical loops.
82
+ • Names MUST enhance circuit readability for visualizers, resource estimators, and hybrid C#/IQ# hosts.
@@ -0,0 +1,10 @@
1
+ # Q# Performance and Resource Estimation
2
+
3
+ > Skeleton rule file. See `q-standards.md` for full context.
4
+
5
+ - Run the QDK `ResourcesEstimator` or Azure Quantum Resource Estimator before any hardware submission. Report qubit count, T-count, gate count, and depth.
6
+ - Minimize two-qubit gates; prefer hardware-native gates of the target provider.
7
+ - Reuse qubits via `Reset` and `borrow`. Offload classical loops to the host language.
8
+ - Choose simulators by scale: full-state (<= 20 qubits), Toffoli/sparse (larger), resource estimator (scaling studies).
9
+ - Apply provider-appropriate error mitigation; document the choice.
10
+ - Prefer library-optimized primitives from `Microsoft.Quantum.Canon` and `Preparation` over hand-rolled gate sequences.
@@ -0,0 +1,10 @@
1
+ # Q# Qubit Management
2
+
3
+ > Skeleton rule file. See `q-standards.md` for full context.
4
+
5
+ - Allocate with `use` (fresh) or `borrow` (clean borrowed). Never extend qubit lifetime beyond its tight scope.
6
+ - `Reset` qubits before scope exit when they may be non-zero, especially for hardware targets.
7
+ - Prefer `within { ... } apply { ... }` for automatic uncomputation over manual adjoint inversion.
8
+ - Declare `is Adj + Ctl` on operations whenever semantically valid.
9
+ - Never hold qubits across host-language boundaries.
10
+ - Respect the no-cloning theorem: never assume a qubit can be copied.
@@ -0,0 +1,10 @@
1
+ # Q# Security and Quantum Hygiene
2
+
3
+ > Skeleton rule file. See `q-standards.md` for full context.
4
+
5
+ - No-cloning compliance is mandatory. No state-duplication shortcuts.
6
+ - For QKD or QRNG, follow standard protocols and document measurement bases.
7
+ - Sanitize, and where appropriate encrypt, parameters and results crossing the host/Q# boundary, especially for Azure Quantum jobs.
8
+ - Use authenticated Azure Quantum workspaces. Never log raw job outputs that could leak superposition-derived data.
9
+ - Minimize timing and resource variance that could leak information in cryptographic contexts.
10
+ - Pair Q# components with post-quantum-resistant classical algorithms.