cli-tool/components/skills/scientific/cirq/SKILL.md
Quantum computing framework for building, simulating, optimizing, and executing quantum circuits. Use this skill when working with quantum algorithms, quantum circuit design, quantum simulation (noiseless or noisy), running on quantum hardware (Google, IonQ, AQT, Pasqal), circuit optimization and compilation, noise modeling and characterization, or quantum experiments and benchmarking (VQE, QAOA, QPE, randomized benchmarking).
npx skillsauth add davila7/claude-code-templates cirqInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cirq is Google Quantum AI's open-source framework for designing, simulating, and running quantum circuits on quantum computers and simulators.
uv pip install cirq
For hardware integration:
# Google Quantum Engine
uv pip install cirq-google
# IonQ
uv pip install cirq-ionq
# AQT (Alpine Quantum Technologies)
uv pip install cirq-aqt
# Pasqal
uv pip install cirq-pasqal
# Azure Quantum
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:
Topics 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='weber', repetitions=1000):
"""Template for running on quantum hardware."""
if provider == 'google':
import cirq_google
engine = cirq_google.get_engine()
processor = engine.get_processor(device_name)
job = processor.run(circuit, repetitions=repetitions)
return job.results()[0]
elif provider == 'ionq':
import cirq_ionq
service = cirq_ionq.Service()
result = service.run(circuit, repetitions=repetitions, target='qpu')
return result
elif provider == 'azure':
from azure.quantum.cirq import AzureQuantumService
# Setup workspace...
service = AzureQuantumService(workspace)
result = service.run(circuit, repetitions=repetitions, target='ionq.qpu')
return result
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 compilationNoisy simulation too slow:
simulation.md for performance optimizationtools
No-code automation democratizes workflow building. Zapier and Make (formerly Integromat) let non-developers automate business processes without writing code. But no-code doesn't mean no-complexity - these platforms have their own patterns, pitfalls, and breaking points. This skill covers when to use which platform, how to build reliable automations, and when to graduate to code-based solutions. Key insight: Zapier optimizes for simplicity and integrations (7000+ apps), Make optimizes for power
tools
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
tools
Workflow automation is the infrastructure that makes AI agents reliable. Without durable execution, a network hiccup during a 10-step payment flow means lost money and angry customers. With it, workflows resume exactly where they left off. This skill covers the platforms (n8n, Temporal, Inngest) and patterns (sequential, parallel, orchestrator-worker) that turn brittle scripts into production-grade automation. Key insight: The platforms make different tradeoffs. n8n optimizes for accessibility
development
Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.