Builds, simulates, and runs quantum circuits with Cirq, Google Quantum AI's framework. Supports noise-aware NISQ circuit design, Quantum Virtual Machine models, and characterization experiments.
Ships in alterlab-domain-specific. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Cirq is Google Quantum AI's open-source framework for designing, simulating, and running quantum circuits on quantum computers and simulators.
Keyless by default. The core of this skill — building circuits, exact and noisy simulation (cirq.Simulator, cirq.DensityMatrixSimulator), parameter sweeps, characterization experiments, and the noisy Quantum Virtual Machine — runs entirely offline with no account or token. Real-hardware submission (the providers below) is an optional add-on that uses the provider's own credentials; when a hardware token is absent, design and validate the circuit and run it on the simulator/QVM first.
Use this skill when the user wants to:
willow_pink, weber, rainbow)| Scenario | Use Instead |
|---|---|
| IBM Quantum hardware, Qiskit Runtime primitives, or Qiskit transpilation | alterlab-qiskit |
| Gradient-trained quantum ML / hybrid models with autodiff | alterlab-pennylane |
| Lindblad master equations, decoherence, or cavity-QED dynamics (no circuits) | alterlab-qutip |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-qiskit) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
uv pip install cirq # Python ≥ 3.11; current 1.7.x as of 2026-09
The cirq package is a meta-package that already pulls in cirq-core, cirq-google,
cirq-ionq, cirq-aqt, cirq-pasqal, and cirq-web; install cirq-core alone for a
lightweight simulation-only environment. Optional extras:
# OpenQASM import (cirq.contrib.qasm_import needs `ply`), quimb tensor-network tools
uv pip install "cirq-core[contrib]"
# Azure Quantum — its `cirq` extra pins cirq-core 1.6.x, so use a separate environment
uv pip install "azure-quantum[cirq]"
import cirq
import numpy as np
# Create qubits
q0, q1 = cirq.LineQubit.range(2)
# Build circuit
circuit = cirq.Circuit(
cirq.H(q0), # Hadamard on q0
cirq.CNOT(q0, q1), # CNOT with q0 control, q1 target
cirq.measure(q0, q1, key='result')
)
print(circuit)
# Simulate
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=1000)
# Display results
print(result.histogram(key='result'))
import sympy
# Define symbolic parameter
theta = sympy.Symbol('theta')
# Create parameterized circuit
circuit = cirq.Circuit(
cirq.ry(theta)(q0),
cirq.measure(q0, key='m')
)
# Sweep over parameter values
sweep = cirq.Linspace('theta', start=0, stop=2*np.pi, length=20)
results = simulator.run_sweep(circuit, params=sweep, repetitions=1000)
# Process results
for params, result in zip(sweep, results):
theta_val = params['theta']
counts = result.histogram(key='m')
print(f"θ={theta_val:.2f}: {counts}")
For comprehensive information about building quantum circuits, including qubits, gates, operations, custom gates, and circuit patterns, see:
Common topics:
For detailed information about simulating quantum circuits, including exact simulation, noisy simulation, parameter sweeps, and the Quantum Virtual Machine, see:
Common topics:
For information about optimizing, compiling, and manipulating quantum circuits, see:
Common topics:
For information about running circuits on real quantum hardware from various providers, see:
Supported providers:
willow_pink, weber, rainbow for everyoneTopics include device representation, qubit selection, authentication, job management, and circuit optimization for hardware.
For information about modeling noise, noisy simulation, characterization, and error mitigation, see:
Common topics:
For information about designing experiments, parameter sweeps, data collection, and using the ReCirq framework, see:
Common topics:
import scipy.optimize
def variational_algorithm(ansatz, cost_function, initial_params):
"""Template for variational quantum algorithms."""
def objective(params):
circuit = ansatz(params)
simulator = cirq.Simulator()
result = simulator.simulate(circuit)
return cost_function(result)
# Optimize
result = scipy.optimize.minimize(
objective,
initial_params,
method='COBYLA'
)
return result
# Define ansatz
def my_ansatz(params):
q = cirq.LineQubit(0)
return cirq.Circuit(
cirq.ry(params[0])(q),
cirq.rz(params[1])(q)
)
# Define cost function
def my_cost(result):
state = result.final_state_vector
# Calculate cost based on state
return np.real(state[0])
# Run optimization
result = variational_algorithm(my_ansatz, my_cost, [0.0, 0.0])
def run_on_hardware(circuit, provider='google', device_name='<processor_id>',
device_config='<config_name>', target='ionq.simulator',
repetitions=1000):
"""Template for running on quantum hardware."""
if provider == 'google':
# Approved Quantum Engine users only; otherwise use the Quantum Virtual Machine
# (cirq_google.engine.create_default_noisy_quantum_virtual_machine).
import cirq_google
engine = cirq_google.get_engine() # uses GOOGLE_CLOUD_PROJECT
processor = engine.get_processor(device_name)
# cirq-google 1.7: device_config_name is required (see processor.list_configs())
# and run() returns a cirq.Result directly.
return processor.run(circuit, device_config_name=device_config,
repetitions=repetitions)
elif provider == 'ionq':
import cirq_ionq
service = cirq_ionq.Service() # reads IONQ_API_KEY
return service.run(circuit, repetitions=repetitions, target='qpu')
elif provider == 'azure':
from azure.quantum.cirq import AzureQuantumService
# Setup workspace...
service = AzureQuantumService(workspace)
# Target names are system-specific (e.g. 'ionq.qpu.forte-1'); see service.targets()
return service.run(circuit, repetitions=repetitions, target=target)
else:
raise ValueError(f"Unknown provider: {provider}")
def noise_comparison_study(circuit, noise_levels):
"""Compare circuit performance at different noise levels."""
results = {}
for noise_level in noise_levels:
# Create noisy circuit
noisy_circuit = circuit.with_noise(cirq.depolarize(p=noise_level))
# Simulate
simulator = cirq.DensityMatrixSimulator()
result = simulator.run(noisy_circuit, repetitions=1000)
# Analyze
results[noise_level] = {
'histogram': result.histogram(key='result'),
'dominant_state': max(
result.histogram(key='result').items(),
key=lambda x: x[1]
)
}
return results
# Run study
noise_levels = [0.0, 0.001, 0.01, 0.05, 0.1]
results = noise_comparison_study(circuit, noise_levels)
Circuit Design
Simulation
Hardware Execution
Circuit Optimization
Noise Modeling
Experiments
Circuit too deep for hardware:
transformation.md for optimization techniquesMemory issues with simulation:
Device validation errors:
hardware.md for device-specific compilationPart of the AlterLab Academic Skills suite.
Noisy simulation too slow:
simulation.md for performance optimizationevals/evals.json (opens in a new tab)references/building.md (opens in a new tab)references/experiments.md (opens in a new tab)references/hardware.md (opens in a new tab)references/noise.md (opens in a new tab)references/simulation.md (opens in a new tab)references/transformation.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/alterlab-domain-specific:alterlab-cirqfrom alterlab-domain-specific
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-domain-specific18 skills in this plugin
/alterlab-adaptyvPrepares and validates Adaptyv Bio Foundry protein-testing submissions with no account — optimizes and pre-screens sequences locally (NetSolP/SoluProt heuristics, SolubleMPNN, ESM), assembles the experiment payload, and validates it offline against the Foundry's own type/method/sequence rules so it is ready and correct before it costs anything. Submitting to the Foundry, browsing the target catalog, tracking status and retrieving results run through the Foundry API with the user's own ADAPTYV_API_KEY (experiments cost money and take weeks). Use when designing proteins for wet-lab validation (binding/affinity, expression, thermostability, fluorescence), preparing or validating a Foundry submission, pre-screening sequences, or tracking an Adaptyv experiment. Triggers on "Adaptyv", "Foundry API", "cloud lab", "biolayer interferometry / BLI", "wet-lab validation". Part of the AlterLab Academic Skills suite./alterlab-aeonRuns time series machine learning with the aeon library — classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search via scikit-learn compatible APIs. Use when working with temporal data, sequential patterns, or time-indexed observations (univariate or multivariate) that need specialized algorithms beyond standard ML approaches. Part of the AlterLab Academic Skills suite./alterlab-astropyProcesses astronomy and astrophysics data with the Astropy Python library — celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, and world coordinate systems (WCS). Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or general astronomical data analysis. Part of the AlterLab Academic Skills suite./alterlab-digital-humanitiesApplies computational methods to humanities research — text mining and NLP (LDA/BERTopic topic modeling, sentiment, named entity recognition with spaCy/NLTK), corpus linguistics (concordance, collocation, keyness), digital archives (Dublin Core, TEI XML), GIS for history, network analysis, stylometry and authorship attribution, OCR (Tesseract, Kraken, Transkribus), and data visualization (Gephi, Palladio). Use when distant-reading a literary corpus, mapping historical events or trade networks, attributing disputed authorship, digitizing historical documents, or building digital scholarly editions. Part of the AlterLab Academic Skills suite./alterlab-fluidsimRuns computational fluid dynamics simulations with the FluidSim Python framework using pseudospectral FFT methods, with HPC support and output analysis. Use when simulating Navier-Stokes equations (2D/3D), shallow water equations, or stratified flows, or when analyzing turbulence, vortex dynamics, or geophysical flows. Part of the AlterLab Academic Skills suite./alterlab-genimlMachine learning on genomic interval data (BED files) with the geniml Python package — region embeddings (Region2Vec), joint region+metadata embeddings (BEDspace/StarSpace), single-cell ATAC-seq embeddings (scEmbed), consensus peak sets / universes (build-universe), tokenization, BEDshift randomization, and BBClient/BEDbase caching. Use when training or using region/cell embeddings, clustering scATAC-seq, building a tokenization universe from BED collections, or any ML/feature-learning task over genomic regions. NOT for plain interval arithmetic (overlap/intersect/merge counts) — that is gtars, not geniml. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job