alterlab-ieu/alterlab-academic-skills/alterlab-cirq

Claude Code and agent skill by alterlab-ieu/alterlab-academic-skills

Trust tier 2
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Builds, simulates, and runs quantum circuits with Cirq, Google Quantum AI's framework for NISQ hardware, noise-aware low-level circuit design, and noise characterization. Use when targeting Google Quantum AI processors or their Quantum Virtual Machine models (Willow, Sycamore-class Rainbow/Weber), IonQ/AQT/Pasqal via Cirq plugins, designing noise-aware NISQ circuits, or running characterization experiments (randomized benchmarking, XEB). For IBM Quantum hardware and Qiskit Runtime prefer alterl…

Install

npx vskill@latest install alterlab-ieu/alterlab-academic-skills/alterlab-cirq

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as alterlab-ieu/alterlab-academic-skills/alterlab-cirq.

Cirq - Quantum Computing with Python

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.

When to Use This Skill

Use this skill when the user wants to:

  • Build and simulate circuits in Cirq (state-vector, density-matrix, parameter sweeps)
  • Model Google hardware noise or run on the Quantum Virtual Machine (willow_pink, weber, rainbow)
  • Submit Cirq circuits to Google Quantum Engine (approved partners), IonQ, AQT, Pasqal, or Azure Quantum
  • Run characterization experiments (randomized benchmarking, XEB) or ReCirq-style studies
Does NOT Trigger
ScenarioUse Instead
IBM Quantum hardware, Qiskit Runtime primitives, or Qiskit transpilationalterlab-qiskit
Gradient-trained quantum ML / hybrid models with autodiffalterlab-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.

Installation

bash
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:

bash
# 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]"

Quick Start

Basic Circuit
python
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'))
Parameterized Circuit
python
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}")

Core Capabilities

Circuit Building

For comprehensive information about building quantum circuits, including qubits, gates, operations, custom gates, and circuit patterns, see:

  • [references/building.md](references/building.md) - Complete guide to circuit construction

Common topics:

  • Qubit types (GridQubit, LineQubit, NamedQubit)
  • Single and two-qubit gates
  • Parameterized gates and operations
  • Custom gate decomposition
  • Circuit organization with moments
  • Standard circuit patterns (Bell states, GHZ, QFT)
  • Import/export (OpenQASM, JSON)
  • Working with qudits and observables
Simulation

For detailed information about simulating quantum circuits, including exact simulation, noisy simulation, parameter sweeps, and the Quantum Virtual Machine, see:

  • [references/simulation.md](references/simulation.md) - Complete guide to quantum simulation

Common topics:

  • Exact simulation (state vector, density matrix)
  • Sampling and measurements
  • Parameter sweeps (single and multiple parameters)
  • Noisy simulation
  • State histograms and visualization
  • Quantum Virtual Machine (QVM)
  • Expectation values and observables
  • Performance optimization
Circuit Transformation

For information about optimizing, compiling, and manipulating quantum circuits, see:

  • [references/transformation.md](references/transformation.md) - Complete guide to circuit transformations

Common topics:

  • Transformer framework
  • Gate decomposition
  • Circuit optimization (merge gates, eject Z gates, drop negligible operations)
  • Circuit compilation for hardware
  • Qubit routing and SWAP insertion
  • Custom transformers
  • Transformation pipelines
Hardware Integration

For information about running circuits on real quantum hardware from various providers, see:

  • [references/hardware.md](references/hardware.md) - Complete guide to hardware integration

Supported providers:

  • Google Quantum AI (cirq-google) - Quantum Engine for approved partners; Quantum Virtual Machine models willow_pink, weber, rainbow for everyone
  • IonQ (cirq-ionq) - Trapped ion quantum computers
  • Azure Quantum (azure-quantum) - IonQ and Quantinuum targets
  • AQT (cirq-aqt) - Alpine Quantum Technologies (ARNICA API; workspace + resource IDs)
  • Pasqal (cirq-pasqal) - Neutral atom quantum computers

Topics include device representation, qubit selection, authentication, job management, and circuit optimization for hardware.

Noise Modeling

For information about modeling noise, noisy simulation, characterization, and error mitigation, see:

  • [references/noise.md](references/noise.md) - Complete guide to noise modeling

Common topics:

  • Noise channels (depolarizing, amplitude damping, phase damping)
  • Noise models (constant, gate-specific, qubit-specific, thermal)
  • Adding noise to circuits
  • Readout noise
  • Noise characterization (randomized benchmarking, XEB)
  • Noise visualization (heatmaps)
  • Error mitigation techniques
Quantum Experiments

For information about designing experiments, parameter sweeps, data collection, and using the ReCirq framework, see:

  • [references/experiments.md](references/experiments.md) - Complete guide to quantum experiments

Common topics:

  • Experiment design patterns
  • Parameter sweeps and data collection
  • ReCirq framework structure
  • Common algorithms (VQE, QAOA, QPE)
  • Data analysis and visualization
  • Statistical analysis and fidelity estimation
  • Parallel data collection

Common Patterns

Variational Algorithm Template
python
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])
Hardware Execution Template
python
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}")
Noise Study Template
python
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)

Best Practices

  1. Circuit Design
  • Use appropriate qubit types for your topology
  • Keep circuits modular and reusable
  • Label measurements with descriptive keys
  • Validate circuits against device constraints before execution
  1. Simulation
  • Use state vector simulation for pure states (more efficient)
  • Use density matrix simulation only when needed (mixed states, noise)
  • Leverage parameter sweeps instead of individual runs
  • Monitor memory usage for large systems (2^n grows quickly)
  1. Hardware Execution
  • Always test on simulators first
  • Select best qubits using calibration data
  • Optimize circuits for target hardware gateset
  • Implement error mitigation for production runs
  • Store expensive hardware results immediately
  1. Circuit Optimization
  • Start with high-level built-in transformers
  • Chain multiple optimizations in sequence
  • Track depth and gate count reduction
  • Validate correctness after transformation
  1. Noise Modeling
  • Use realistic noise models from calibration data
  • Include all error sources (gate, decoherence, readout)
  • Characterize before mitigating
  • Keep circuits shallow to minimize noise accumulation
  1. Experiments
  • Structure experiments with clear separation (data generation, collection, analysis)
  • Use ReCirq patterns for reproducibility
  • Save intermediate results frequently
  • Parallelize independent tasks
  • Document thoroughly with metadata

Additional Resources

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
66
Repository forks
13
7-day trend score
21

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/alterlab-ieu/alterlab-academic-skills/alterlab-cirq/badge)](https://verified-skill.com/skills/alterlab-ieu/alterlab-academic-skills/alterlab-cirq)

Something wrong with this skill or its page? Tell us.