Build, simulate, transpile, and execute quantum circuits with Qiskit and IBM Quantum Runtime. Use for Qiskit 2.x circuits and operators, V2 Sampler or Estimator primitives, target-aware transpilation, local or noisy simulation, IBM QPU execution, Runtime sessions or batches, error mitigation, and Qiskit ecosystem packages.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
qiskit
description
Build, simulate, transpile, and execute quantum circuits with Qiskit and IBM Quantum Runtime. Use for Qiskit 2.x circuits and operators, V2 Sampler or Estimator primitives, target-aware transpilation, local or noisy simulation, IBM QPU execution, Runtime sessions or batches, error mitigation, and Qiskit ecosystem packages.
license
Apache-2.0
compatibility
Python 3.10+ on a supported 64-bit platform. Local SDK workflows need qiskit; noisy simulation needs qiskit-aer; IBM QPU access needs qiskit-ibm-runtime, network access, an IBM Quantum Platform account, and an API key.
metadata
{"version":"2.0","skill-author":"K-Dense Inc."}
Qiskit
Use current Qiskit 2.x APIs to build circuits, prepare hardware-compatible instruction set architecture (ISA) circuits, and execute them through V2 primitives.
This skill was verified on 2026-07-23 against the PyPI releases qiskit==2.5.0, qiskit-ibm-runtime==0.48.0, and qiskit-aer==0.17.2. Check references/sources.md before changing pins or documenting newly released behavior.
Choose the Right Path
Goal
Recommended interface
Exact local sampling
qiskit.primitives.StatevectorSampler
Exact local expectation values
qiskit.primitives.StatevectorEstimator
High-performance or noisy simulation
Qiskit Aer
IBM QPU sampling
qiskit_ibm_runtime.SamplerV2
IBM QPU expectation values and mitigation
qiskit_ibm_runtime.EstimatorV2
Backend without native primitives
BackendSamplerV2 or BackendEstimatorV2
Open-system or master-equation dynamics
Prefer QuTiP
Differentiable quantum machine learning
Prefer PennyLane unless Qiskit integration is required
Installation
Create an isolated environment and install only the components needed:
uv venv --python 3.13
source .venv/bin/activate
# Core SDK plus plotting support
uv pip install "qiskit[visualization]==2.5.0"# Add only when needed
uv pip install "qiskit-ibm-runtime==0.48.0"
uv pip install "qiskit-aer==0.17.2"
Do not install qiskit-terra; it was superseded by the qiskit distribution. Qiskit Runtime, Aer, Nature, Machine Learning, Optimization, and Algorithms are separate distributions.
For IBM account setup, CI-safe credential handling, optional packages, and environment repair, read references/setup.md.
Core Workflow
Follow this sequence for every hardware-oriented workload:
Map the problem to a circuit and, for Estimator, one or more observables.
Optimize the parameterized circuit once for the selected backend.
Apply the layout to every observable.
Execute ISA circuits through a V2 primitive using Primitive Unified Blocs (PUBs).
Analyze register-aware results, metadata, uncertainty, and resource usage.
Do not bind and retranspile a parameterized circuit inside every optimizer iteration. Transpile the parameterized circuit once, then pass parameter arrays in PUBs.
Quick Local Sampling
from qiskit import QuantumCircuit
from qiskit.primitives import StatevectorSampler
circuit = QuantumCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all() # creates the classical register named "meas"
sampler = StatevectorSampler(seed=7)
pub_result = sampler.run([circuit], shots=1024).result()[0]
counts = pub_result.data.meas.get_counts()
print(counts)
Sampler V2 preserves shots and classical-register structure. Access the register by its actual name; measure_all() uses meas.
Error mitigation is not guaranteed to improve every workload and increases cost. Record the complete options and result metadata.
Non-Negotiable Qiskit 2.x Rules
Use V2 primitive interfaces and PUB inputs. Do not write new V1 Sampler, Estimator, or QuantumInstance code.
Runtime primitives accept ISA circuits; they do not perform layout, routing, and basis translation for you.
Apply the transpiler layout to Estimator observables with observable.apply_layout(isa_circuit.layout).
Use mode=backend, mode=session, or mode=batch for Runtime primitives.
Use EstimatorV2 for resilience levels and expectation-value mitigation. Sampler has different noise-management options and no Estimator-style resilience levels.
Treat BackendV2.target, backend.operation_names, backend.coupling_map, and direct backend attributes as the source of hardware constraints. Do not use backend.configuration() or BackendProperties.
Read Sampler output by classical register name. Bitstrings are displayed most-significant bit first; Qiskit qubit 0 is conventionally the least-significant bit.
Use a fixed seed_transpiler when comparing compilation settings. A simulator seed does not make QPU results deterministic.
qiskit.pulse was removed in Qiskit 2.0. Use supported fractional gates for IBM hardware or Qiskit Dynamics for pulse-model research.
QPY is the Qiskit-native circuit serialization format. Do not use Python pickle for untrusted circuit artifacts.
Job mode: one-off work; instantiate a primitive with mode=backend.
Batch mode: independent jobs submitted together; available on the Open Plan.
Session mode: iterative jobs that benefit from prioritized follow-on execution; unavailable on the Open Plan.
from qiskit_ibm_runtime import Batch, SamplerV2 as Sampler
with Batch(backend=backend, max_time="10m") as batch:
sampler = Sampler(mode=batch)
jobs = [sampler.run([circuit], shots=1024) for circuit in isa_circuits]
results = [job.result() for job in jobs]
Close sessions and batches after submission. Exiting their context stops new submissions but allows accepted jobs to finish, subject to service limits.