$npx -y skills add K-Dense-AI/scientific-agent-skills --skill cirqGoogle quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML
| 1 | # Cirq - Quantum Computing with Python |
| 2 | |
| 3 | Cirq is Google Quantum AI's open-source framework for designing, simulating, and running quantum circuits on quantum computers and simulators. |
| 4 | |
| 5 | ## When to Use This Skill |
| 6 | |
| 7 | Use this skill when: |
| 8 | - Building, simulating, or optimizing NISQ circuits in Python |
| 9 | - Running jobs on Google Quantum AI processors (via `cirq-google`) or partner backends (IonQ, Azure Quantum, AQT, Pasqal) |
| 10 | - Modeling noise, compiling to hardware gatesets, or designing characterization experiments |
| 11 | - Using parameter sweeps, transformers, or the ReCirq experiment patterns |
| 12 | |
| 13 | For IBM hardware use **qiskit**; for quantum ML with autodiff use **pennylane**; for physics simulations use **qutip**. |
| 14 | |
| 15 | ## Installation |
| 16 | |
| 17 | Requires Python 3.11+. Current stable release: **1.6.1** (August 2025). Vendor packages share the same version number. |
| 18 | |
| 19 | ```bash |
| 20 | uv pip install "cirq==1.6.1" |
| 21 | ``` |
| 22 | |
| 23 | For hardware integration (pin matching versions for reproducibility): |
| 24 | ```bash |
| 25 | # Google Quantum Engine (requires approved GCP project access) |
| 26 | uv pip install "cirq-google==1.6.1" |
| 27 | |
| 28 | # IonQ |
| 29 | uv pip install "cirq-ionq==1.6.1" |
| 30 | |
| 31 | # AQT (Alpine Quantum Technologies) |
| 32 | uv pip install "cirq-aqt==1.6.1" |
| 33 | |
| 34 | # Pasqal |
| 35 | uv pip install "cirq-pasqal==1.6.1" |
| 36 | |
| 37 | # Azure Quantum (IonQ, Honeywell/Quantinuum backends) |
| 38 | uv pip install "azure-quantum[cirq]" |
| 39 | ``` |
| 40 | |
| 41 | For latest features during development, omit version pins; for production or hardware runs, pin all packages to the same Cirq release. |
| 42 | |
| 43 | ## Quick Start |
| 44 | |
| 45 | ### Basic Circuit |
| 46 | |
| 47 | ```python |
| 48 | import cirq |
| 49 | import numpy as np |
| 50 | |
| 51 | # Create qubits |
| 52 | q0, q1 = cirq.LineQubit.range(2) |
| 53 | |
| 54 | # Build circuit |
| 55 | circuit = cirq.Circuit( |
| 56 | cirq.H(q0), # Hadamard on q0 |
| 57 | cirq.CNOT(q0, q1), # CNOT with q0 control, q1 target |
| 58 | cirq.measure(q0, q1, key='result') |
| 59 | ) |
| 60 | |
| 61 | print(circuit) |
| 62 | |
| 63 | # Simulate |
| 64 | simulator = cirq.Simulator() |
| 65 | result = simulator.run(circuit, repetitions=1000) |
| 66 | |
| 67 | # Display results |
| 68 | print(result.histogram(key='result')) |
| 69 | ``` |
| 70 | |
| 71 | ### Parameterized Circuit |
| 72 | |
| 73 | ```python |
| 74 | import sympy |
| 75 | |
| 76 | # Define symbolic parameter |
| 77 | theta = sympy.Symbol('theta') |
| 78 | |
| 79 | # Create parameterized circuit |
| 80 | circuit = cirq.Circuit( |
| 81 | cirq.ry(theta)(q0), |
| 82 | cirq.measure(q0, key='m') |
| 83 | ) |
| 84 | |
| 85 | # Sweep over parameter values |
| 86 | sweep = cirq.Linspace('theta', start=0, stop=2*np.pi, length=20) |
| 87 | results = simulator.run_sweep(circuit, params=sweep, repetitions=1000) |
| 88 | |
| 89 | # Process results |
| 90 | for params, result in zip(sweep, results): |
| 91 | theta_val = params['theta'] |
| 92 | counts = result.histogram(key='m') |
| 93 | print(f"θ={theta_val:.2f}: {counts}") |
| 94 | ``` |
| 95 | |
| 96 | ## Core Capabilities |
| 97 | |
| 98 | ### Circuit Building |
| 99 | For comprehensive information about building quantum circuits, including qubits, gates, operations, custom gates, and circuit patterns, see: |
| 100 | - **[references/building.md](references/building.md)** - Complete guide to circuit construction |
| 101 | |
| 102 | Common topics: |
| 103 | - Qubit types (GridQubit, LineQubit, NamedQubit) |
| 104 | - Single and two-qubit gates |
| 105 | - Parameterized gates and operations |
| 106 | - Custom gate decomposition |
| 107 | - Circuit organization with moments |
| 108 | - Standard circuit patterns (Bell states, GHZ, QFT) |
| 109 | - Import/export (OpenQASM, JSON) |
| 110 | - Working with qudits and observables |
| 111 | |
| 112 | ### Simulation |
| 113 | For detailed information about simulating quantum circuits, including exact simulation, noisy simulation, parameter sweeps, and the Quantum Virtual Machine, see: |
| 114 | - **[references/simulation.md](references/simulation.md)** - Complete guide to quantum simulation |
| 115 | |
| 116 | Common topics: |
| 117 | - Exact simulation (state vector, density matrix) |
| 118 | - Sampling and measurements |
| 119 | - Parameter sweeps (single and multiple parameters) |
| 120 | - Noisy simulation |
| 121 | - State histograms and visualization |
| 122 | - Quantum Virtual Machine (QVM) |
| 123 | - Expectation values and observables |
| 124 | - Performance optimization |
| 125 | |
| 126 | ### Circuit Transformation |
| 127 | For information about optimizing, compiling, and manipulating quantum circuits, see: |
| 128 | - **[references/transformation.md](references/transformation.md)** - Complete guide to circuit transformations |
| 129 | |
| 130 | Common topics: |
| 131 | - Transformer framework |
| 132 | - Gate decomposition |
| 133 | - Circuit optimization (merge gates, eject Z gates, drop negligible operations) |
| 134 | - Circuit compilation for hardware |
| 135 | - Qubit routing and SWAP insertion |
| 136 | - Custom transformers |
| 137 | - Transformation pipelines |
| 138 | |
| 139 | ### Hardware Integration |
| 140 | For information about running circuits on real quantum hardware from various providers, see: |
| 141 | - **[references/hardware.md](references/hardware.md)** - Complete guide to hardware integration |
| 142 | |
| 143 | Supported providers: |
| 144 | - **Google Quantum AI** (`cirq-google`) — Sycamore, Weber, Willow processors via Quantum Engine (res |