Cudaq Importing
NVIDIA/skills
A skill your agent uses when porting circuits from another framework (e.g.
Reference patterns for writing qiskit 2.x code for variational quantum machine learning: feature maps, VQC training, VQE for chemistry, MPS circuits and noise models.
$ npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install aiming-lab/AutoResearchClaw quantum-qiskit --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/aiming-lab/AutoResearchClaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/researchclaw/skills/builtin/domain/quantum-qiskit .claude/skills/quantum-qiskit && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "quantum-qiskit" agent skill from https://github.com/aiming-lab/AutoResearchClaw/tree/main/researchclaw/skills/builtin/domain/quantum-qiskit into .claude/skills/quantum-qiskit/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "quantum-qiskit", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/aiming-lab/AutoResearchClaw/tree/main/researchclaw/skills/builtin/domain/quantum-qiskitType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install aiming-lab/AutoResearchClaw quantum-qiskit --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aiming-lab/AutoResearchClaw.git skills-src && mkdir -p .agents/skills && cp -r skills-src/researchclaw/skills/builtin/domain/quantum-qiskit .agents/skills/quantum-qiskit && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "quantum-qiskit" agent skill from https://github.com/aiming-lab/AutoResearchClaw/tree/main/researchclaw/skills/builtin/domain/quantum-qiskit into .agents/skills/quantum-qiskit/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "quantum-qiskit", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install aiming-lab/AutoResearchClaw quantum-qiskit --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aiming-lab/AutoResearchClaw.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/researchclaw/skills/builtin/domain/quantum-qiskit .cursor/skills/quantum-qiskit && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "quantum-qiskit" agent skill from https://github.com/aiming-lab/AutoResearchClaw/tree/main/researchclaw/skills/builtin/domain/quantum-qiskit into .cursor/skills/quantum-qiskit/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "quantum-qiskit", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/aiming-lab/AutoResearchClaw.git --path researchclaw/skills/builtin/domain/quantum-qiskit--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install aiming-lab/AutoResearchClaw quantum-qiskit --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aiming-lab/AutoResearchClaw.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/researchclaw/skills/builtin/domain/quantum-qiskit .gemini/skills/quantum-qiskit && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "quantum-qiskit" agent skill from https://github.com/aiming-lab/AutoResearchClaw/tree/main/researchclaw/skills/builtin/domain/quantum-qiskit into .gemini/skills/quantum-qiskit/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "quantum-qiskit", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install aiming-lab/AutoResearchClaw quantum-qiskitInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/aiming-lab/AutoResearchClaw.git skills-src && mkdir -p .github/skills && cp -r skills-src/researchclaw/skills/builtin/domain/quantum-qiskit .github/skills/quantum-qiskit && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "quantum-qiskit" agent skill from https://github.com/aiming-lab/AutoResearchClaw/tree/main/researchclaw/skills/builtin/domain/quantum-qiskit into .github/skills/quantum-qiskit/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "quantum-qiskit", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install aiming-lab/AutoResearchClaw quantum-qiskit --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/aiming-lab/AutoResearchClaw.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/researchclaw/skills/builtin/domain/quantum-qiskit .opencode/skills/quantum-qiskit && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "quantum-qiskit" agent skill from https://github.com/aiming-lab/AutoResearchClaw/tree/main/researchclaw/skills/builtin/domain/quantum-qiskit into .opencode/skills/quantum-qiskit/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "quantum-qiskit", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
quantum-qiskitReference patterns for writing qiskit 2.x code for variational quantum machine learning: feature maps, VQC training, VQE for chemistry, MPS circuits and noise models.
This is a reference for Python code that imports qiskit, qiskit_aer, qiskit_algorithms, qiskit_machine_learning or qiskit_nature. It documents API shapes that work in qiskit 2.x, the migration breaks from qiskit 1.x that affect VQE and chemistry code, and a few common mistakes with concrete fixes. For example, importing from qiskit_nature.second_q.algorithms or qiskit_algorithms.VQE fails at import time under qiskit 2.x.
Its ten sections run from imports and data-encoding feature maps (angle encoding is one of three standard families) through variational ansatz construction, VQC training, VQE for chemistry, matrix-product-state circuits and noise model integration, then compatibility notes, common errors and a metric logging convention for the Autoclaw tool. Helper code includes a check that two encoders give distinguishable output states for the same input.
10 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit be4ba47. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Qiskit 2.x Quantum ML Reference loads about 4.7k tokens when it runs. Until then it costs about 104 tokens; SKILL.md has 1,050 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from aiming-lab/AutoResearchClaw at commit be4ba47, republished under its MIT licence (© aiming-lab). 1,050 words, ~4,714 tokens.
.claude/skills/quantum-qiskit/SKILL.md (or your agent's skills folder).This skill is a canonical reference for writing Python code that uses
qiskit 2.x and its ecosystem (qiskit_aer, qiskit_algorithms,
qiskit_machine_learning, qiskit_nature). It documents the API shapes
that work in qiskit 2.x today, the qiskit-1.x → 2.x migration breaks
that affect VQE and chemistry code, and a small number of common
mistakes with concrete fixes.
Section overview:
import numpy as np
from qiskit import QuantumCircuit
from qiskit.circuit import ParameterVector
from qiskit.circuit.library import (
ZFeatureMap,
ZZFeatureMap,
StatePreparation,
EfficientSU2,
)
from qiskit.primitives import StatevectorSampler, StatevectorEstimator # V2 primitives
from qiskit.quantum_info import Statevector, SparsePauliOp
from qiskit_aer import AerSimulator
from qiskit_algorithms.optimizers import SPSA, COBYLA, L_BFGS_B, ADAM
from qiskit_algorithms.utils import algorithm_globals
from qiskit_machine_learning.algorithms.classifiers import VQCFor chemistry:
from qiskit_nature.units import DistanceUnit
from qiskit_nature.second_q.drivers import PySCFDriver
from qiskit_nature.second_q.mappers import ParityMapper, JordanWignerMapperDo not import from qiskit_nature.second_q.algorithms or
qiskit_algorithms.VQE under qiskit 2.x (they fail at import time, see
section 8).
Three standard families. Each builder returns a parameterized circuit
suitable for use as the feature_map argument of VQC or for direct
contraction with a variational ansatz.
def build_angle_encoding(num_features: int) -> QuantumCircuit:
"""Hadamard plus single-qubit Z-rotation per feature.
Mathematically equivalent to ZFeatureMap(reps=1).
"""
return ZFeatureMap(feature_dimension=num_features, reps=1)
def build_amplitude_encoding(num_features: int):
"""Load an L2-normalized, zero-padded input as the amplitudes of a
quantum state. The encoding uses ceil(log2(num_features)) qubits.
Returns (circuit, parameter_vector, num_qubits). The caller binds
parameters per-sample via the helper below.
"""
num_qubits = int(np.ceil(np.log2(max(num_features, 2))))
full_dim = 2 ** num_qubits
params = ParameterVector("x_amp", full_dim)
qc = QuantumCircuit(num_qubits)
qc.append(StatePreparation(list(params)), range(num_qubits))
return qc, params, num_qubits
def amplitude_binding(x: np.ndarray, params, num_qubits: int) -> dict:
"""Build the parameter-value dict for a single input sample."""
x_norm = x / max(float(np.linalg.norm(x)), 1e-12)
padded = np.zeros(2 ** num_qubits, dtype=np.float64)
padded[: len(x_norm)] = x_norm
padded = padded / max(float(np.linalg.norm(padded)), 1e-12)
return {params[i]: float(padded[i]) for i in range(len(padded))}
def build_zz_feature_map(num_features: int) -> QuantumCircuit:
"""Two repetitions of Hadamard plus pairwise ZZ entangling rotations."""
return ZZFeatureMap(
feature_dimension=num_features, reps=2, entanglement="linear"
)To verify that two encoders produce distinguishable output for a fixed input (catches dispatch bugs in code that constructs multiple encoders in a loop):
def assert_different_output_states(qc_a, qc_b, x, tol: float = 1e-6):
sv_a = Statevector(qc_a.assign_parameters(x))
sv_b = Statevector(qc_b.assign_parameters(x))
diff = float(np.linalg.norm(sv_a.data - sv_b.data))
assert diff > tol, f"encoders produced identical states (diff={diff})"def build_ansatz(num_qubits: int, reps: int = 2) -> QuantumCircuit:
"""Hardware-efficient ansatz with alternating Pauli rotations
and a linear chain of CNOT entanglers. Trainable parameter count
is (reps + 1) * num_qubits for the default su2_gates = ['ry']."""
return EfficientSU2(
num_qubits=num_qubits, reps=reps, entanglement="linear"
)ansatz.num_parameters gives the trainable parameter count, useful
for matching parameter budgets against classical baselines.
def train_vqc(
feature_map: QuantumCircuit,
ansatz: QuantumCircuit,
X_train: np.ndarray,
y_train: np.ndarray,
seed: int,
maxiter: int = 200,
) -> VQC:
algorithm_globals.random_seed = seed
vqc = VQC(
feature_map=feature_map,
ansatz=ansatz,
loss="cross_entropy",
optimizer=COBYLA(maxiter=maxiter),
sampler=StatevectorSampler(seed=seed),
)
vqc.fit(X_train, y_train)
return vqcSupported VQC.__init__ kwargs in qiskit_machine_learning:
feature_map, ansatz, loss, optimizer, sampler,
initial_point, callback, warm_start. Other names raise
TypeError.
Use VQC.fit(X, y) and VQC.predict(X). Do not write a custom
optimization loop that calls the Sampler directly inside a COBYLA
closure: VQC.fit already does this with correct parameter-shift
gradients and shot accounting.
Build the qubit Hamiltonian from PySCF, then run a manual optimization
loop over a StatevectorEstimator. The classes qiskit_algorithms.VQE
and the qiskit_nature.second_q.algorithms.* submodule are not
importable in qiskit 2.x (see section 8); the pattern below uses only
the safe parts of those packages.
def build_h2_hamiltonian(bond_length_angstrom: float):
driver = PySCFDriver(
atom=f"H 0 0 0; H 0 0 {bond_length_angstrom}",
basis="sto3g",
charge=0,
spin=0,
unit=DistanceUnit.ANGSTROM,
)
problem = driver.run()
num_particles = tuple(problem.num_particles) # (1, 1) for H2
mapper = ParityMapper(num_particles=num_particles) # 2-qubit reduction
qubit_op = mapper.map(problem.hamiltonian.second_q_op())
e_nuclear = float(problem.nuclear_repulsion_energy)
# H2 in STO-3G with parity mapping plus 2-qubit reduction produces a
# 2-qubit Hamiltonian (not 4-qubit).
return qubit_op, e_nuclear
def run_vqe(qubit_op, e_nuclear, optimizer_name: str, seed: int):
algorithm_globals.random_seed = seed
rng = np.random.RandomState(seed)
ansatz = build_ansatz(num_qubits=qubit_op.num_qubits, reps=2)
initial_point = rng.normal(0.0, 0.1, ansatz.num_parameters)
estimator = StatevectorEstimator(seed=seed)
energy_history: list[tuple[int, float]] = []
def energy(theta: np.ndarray) -> float:
bound = ansatz.assign_parameters(theta)
result = estimator.run([(bound, qubit_op)]).result()
e = float(result[0].data.evs) + e_nuclear
energy_history.append((len(energy_history) + 1, e))
return e
optimizers = {
"spsa": SPSA(maxiter=200),
"cobyla": COBYLA(maxiter=200, rhobeg=0.1, tol=1e-4),
"lbfgsb": L_BFGS_B(maxiter=100, ftol=1e-6),
"adam": ADAM(maxiter=200, lr=0.05, beta_1=0.9, beta_2=0.999),
}
if optimizer_name not in optimizers:
raise ValueError(f"unknown optimizer: {optimizer_name}")
result = optimizers[optimizer_name].minimize(energy, initial_point)
return result, energy_historyThe number of energy evaluations is len(energy_history). Cumulative
shots equals len(energy_history) * shots_per_eval. For shot-budget
studies, emulate shot noise by adding Gaussian noise N(0, sigma) to
each value with sigma ≈ ||H||_1 / sqrt(shots_per_eval).
A running-mean convergence check is needed at low shot counts because the per-evaluation energy variance can exceed the chemical-accuracy threshold even when the optimizer has converged:
from collections import deque
def cumulative_shots_to_threshold(
energy_history: list[tuple[int, float]],
e_target: float,
threshold: float = 0.0016, # 1.6 mHa
shots_per_eval: int = 1024,
window: int = 5,
) -> int | None:
"""Return cumulative shots at the first point where the running mean
over `window` evaluations stays within `threshold` of `e_target` for
`window` consecutive windows. Return None if never reached."""
buf = deque(maxlen=window)
streak = 0
for eval_count, energy in energy_history:
buf.append(energy)
if len(buf) < window:
continue
if abs(sum(buf) / window - e_target) <= threshold:
streak += 1
if streak >= window:
return eval_count * shots_per_eval
else:
streak = 0
return NoneA matrix product state classifier with bond dimension chi is
mathematically equivalent to a qiskit circuit with one qubit per input
feature (or pixel), a linear-chain entangling ansatz of depth
reps = log2(chi), and class-label measurements as expectation values.
Running this on AerSimulator(method="matrix_product_state") with an
internal bond-dimension cap gives an efficient classical simulation
even at 32 to 128 qubits.
def encode_features_to_circuit(x: np.ndarray, n_qubits: int) -> QuantumCircuit:
"""Per-feature embedding equivalent to phi(x) = [cos(pi*x/2), sin(pi*x/2)].
Apply RY(pi * x_i) on qubit i so |0> maps to cos(pi*x_i/2)|0> + sin(pi*x_i/2)|1>."""
qc = QuantumCircuit(n_qubits)
for i in range(n_qubits):
qc.ry(float(x[i]) * np.pi, i)
return qc
def build_mps_ansatz(n_qubits: int, reps_for_chi: int) -> QuantumCircuit:
"""Linear-chain entangling ansatz; effective bond dimension <= 2 ** reps_for_chi.
reps_for_chi=4 covers chi up to 16."""
return EfficientSU2(
num_qubits=n_qubits, reps=reps_for_chi, entanglement="linear"
)
def mps_class_logits(
x: np.ndarray,
theta: np.ndarray,
ansatz: QuantumCircuit,
n_classes: int,
max_bond: int = 16,
) -> np.ndarray:
"""Return one logit per class, computed via AerSimulator MPS method.
Each class c corresponds to a Pauli observable acting on the first
ceil(log2(n_classes)) qubits with sign pattern fixed by the bits of c."""
import math
n_qubits = ansatz.num_qubits
sim = AerSimulator(
method="matrix_product_state",
matrix_product_state_max_bond_dimension=int(max_bond),
)
bound_ansatz = ansatz.assign_parameters(theta)
qc = encode_features_to_circuit(x, n_qubits)
qc.compose(bound_ansatz, inplace=True)
n_label_qubits = max(1, math.ceil(math.log2(n_classes)))
logits = []
for c in range(n_classes):
pauli = list("I" * n_qubits)
for bit_idx in range(n_label_qubits):
if (c >> bit_idx) & 1:
pauli[bit_idx] = "Z"
obs = SparsePauliOp.from_list([("".join(pauli[::-1]), 1.0)])
qc_with_save = qc.copy()
qc_with_save.save_expectation_value(obs, list(range(n_qubits)))
result = sim.run(qc_with_save).result()
logits.append(float(result.data(0)["expectation_value"]))
return np.array(logits)Train with parameter-shift gradients on the cross-entropy of
softmax(logits) against the one-hot labels.
When a manual NumPy MPS implementation is used instead, three subtle errors are common and produce silently-degenerate models:
Using the qiskit-circuit form above avoids all three: the circuit
representation is unambiguous, parameter-shift gradients are correct by
construction, and matrix_product_state_max_bond_dimension enforces
the bond cap inside the simulator.
The qiskit primitive samplers (Sampler V1 and StatevectorSampler
V2) do not accept a noise_model argument; they are noiseless by
definition. To inject noise, the noise model must live on a
qiskit_aer.AerSimulator backend, and the sampler then wraps that
backend via BackendSamplerV2:
from qiskit_aer.noise import NoiseModel, depolarizing_error
from qiskit.primitives import BackendSamplerV2
def build_noisy_sampler(depolarizing_rate: float, seed: int) -> BackendSamplerV2:
noise_model = NoiseModel()
if depolarizing_rate > 0:
single_qubit_error = depolarizing_error(depolarizing_rate, 1)
noise_model.add_all_qubit_quantum_error(
single_qubit_error, ["ry", "rz", "rx", "h"]
)
two_qubit_error = depolarizing_error(depolarizing_rate, 2)
noise_model.add_all_qubit_quantum_error(two_qubit_error, ["cx"])
backend = AerSimulator(noise_model=noise_model, seed_simulator=seed)
return BackendSamplerV2(backend=backend)
def build_ideal_sampler(seed: int) -> StatevectorSampler:
return StatevectorSampler(seed=seed)Use it with VQC:
sampler = build_noisy_sampler(depolarizing_rate=0.005, seed=seed)
vqc = VQC(
feature_map=fm,
ansatz=ansatz,
sampler=sampler,
optimizer=COBYLA(maxiter=200),
)
vqc.fit(X_train, y_train)Each evaluation regime needs its own sampler instance. A model trained
on a noisy sampler at rate p_train can be evaluated on a separate
noisy sampler at a different rate p_test to probe noise robustness, or
on build_ideal_sampler to probe the clean-test transfer.
Do not silently swallow exceptions raised by vqc.fit. If training
fails at high noise rates, either let the cell fail with a documented
error or record a training_failed=True marker in the metrics rather
than calling vqc.predict on an unfitted model, which raises
QiskitMachineLearningError: 'The model has not been fitted yet'.
Qiskit 2.0 removed qiskit.primitives.Estimator and
qiskit.primitives.BaseEstimator (the V1 interfaces). Two consequences:
from qiskit_algorithms import VQE fails because the file imports
BaseEstimator. Use a manual VQE loop with
qiskit.primitives.StatevectorEstimator (V2) and the
qiskit_algorithms.optimizers.* classes' .minimize() methods
directly. See section 5.from qiskit_nature.second_q.algorithms import GroundStateEigensolver
fails for the same reason. The qiskit_nature.second_q.drivers and
qiskit_nature.second_q.mappers submodules are still safe.Other 2.x notes:
transpile(circuits=list, coupling_map=single) raises
TranspilerError. Either call transpile per circuit or omit
coupling_map (statevector backends do not need it).Statevector(qc) returns a Statevector object; use .data for
the numpy array of amplitudes.algorithm_globals.random_seed is the global seed for SPSA and
random ansatz initialization. Set it before each training run.| Wrong | Why | Correct |
|---|---|---|
Sampler(noise_model=NoiseModel()) | V1/V2 Samplers are noiseless | BackendSamplerV2(backend=AerSimulator(noise_model=...)) |
from qiskit_algorithms import VQE | imports removed V1 BaseEstimator | Manual loop over StatevectorEstimator plus optimizer.minimize() |
VQC(..., gradient=...) | not a supported kwarg | Drop the kwarg; VQC.fit handles gradients internally |
params = pv_a.concatenate(pv_b) | ParameterVector is not numpy | params = list(pv_a) + list(pv_b) |
Plain qc.rz(x[i], i) for angle encoding | RZ on ` | 0>` is a global phase, has no effect |
qc.ry(x[i], i) + qc.cx(...) labeled as amplitude encoding | This is angle encoding, not amplitude | Use StatePreparation over the L2-normalized, zero-padded vector |
scipy.optimize.minimize(...) in VQE | requires hand-rolled shot accounting and convergence checks | qiskit_algorithms.optimizers.{SPSA, COBYLA, L_BFGS_B, ADAM}.minimize(energy, x0) |
Per-step abs(raw_energy - e_fci) <= threshold for convergence | Per-step noise can exceed the threshold even when converged | Running mean over a window (see cumulative_shots_to_threshold) |
Report maxiter * evals_per_iter * shots_per_eval as "shots to convergence" when not actually converged | This is the upper bound, not a measurement | Report None (or a documented sentinel) for non-converged runs |
near_identity_init for a NumPy MPS classifier | every class logit collapses to the same value | Random initialization, or use the qiskit-circuit form (section 6) |
When this skill is used inside the autoclaw bench runner (stage 12 or
stage 13 sandbox), per-cell metrics should be emitted to stdout as
single lines starting with METRIC_RESULT followed by a JSON object.
The autoclaw sandbox parser aggregates these into condition_summaries
at stage 14.
import json
def emit_metric_result(condition: str, dataset: str, seed: int, **metrics) -> None:
payload = {"condition": condition, "dataset": dataset, "seed": int(seed)}
payload.update({k: float(v) for k, v in metrics.items() if v is not None})
print("METRIC_RESULT " + json.dumps(payload))This section is specific to the autoclaw pipeline. Outside of autoclaw, choose a metric-logging convention appropriate to the host system.
© aiming-lab, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in researchclaw/skills/builtin/domain/quantum-qiskit of aiming-lab/AutoResearchClaw.
Open the folder on GitHubat commit be4ba47
Qiskit 2.x Quantum ML Reference next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Qiskit 2.x Quantum ML Reference this skillaiming-lab/AutoResearchClaw | 15k | — | ~4.7k | Automated safety check: Pass | MIT | |
| Cudaq ImportingNVIDIA/skills | 3.5k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Gtars Genomic Interval Toolkitdavila7/claude-code-templates | 32k | 12 repos | ~1.9k | Automated safety check: Pass | MIT | |
| PyHealth Clinical ML Toolkitdavila7/claude-code-templates | 32k | 12 repos | ~4.4k | Automated safety check: Pass | MIT | |
| Mq Variational Trainingmindspore-ai/mindquantum | 101 | — | ~2.5k | Automated safety check: Pass | Apache-2.0 | |
| DP-GEN Simplify Workflowjinzhezenggroup/computational-chemistry-agent-skills | 148 | — | ~2.7k | Automated safety check: Pass | LGPL-3.0-or-later |
NVIDIA/skills
A skill your agent uses when porting circuits from another framework (e.g.
davila7/claude-code-templates
Works with genomic intervals using gtars, a Rust toolkit with Python bindings: overlap detection, coverage tracks, tokenization for ML models and reference sequences.
davila7/claude-code-templates
Builds machine learning pipelines on clinical data with PyHealth: EHR datasets, prediction tasks, medical code mapping, healthcare models and evaluation.
mindspore-ai/mindquantum
Build and train variational quantum algorithms (VQE, QAOA, QML, QNN) with MindQuantum.
jinzhezenggroup/computational-chemistry-agent-skills
Prepares, validates and runs DP-GEN simplify jobs that thin out repeated or redundant DeepMD datasets, generating param.json and machine.json for local or scheduler runs.
Light0305/Light-skills
Builds the code for a frozen research experiment test-first, with leakage controls, seed handling and saved evidence so results can be rerun and audited.
aiming-lab/AutoResearchClaw
Diagnoses where an agent failed across runs and turns the findings into new skills, system prompt patches and knowledge entries, using the A-Evolve loop.
aiming-lab/AutoResearchClaw
Turns a broad metabolic modelling topic into a concrete, paper-shaped plan with organism, model, perturbations, metrics and figures before any FBA code is written.
aiming-lab/AutoResearchClaw
Runs a metabolic flux analysis from model loading to phenotype prediction and figures by handing work to four sub-agents in sequence.
aiming-lab/AutoResearchClaw
Builds or loads a genome-scale metabolic model in COBRApy, sets its growth medium and objective, and exports it as a validated JSON file for flux analysis.
aiming-lab/AutoResearchClaw
Quick reference for Biopython work: sequence operations, SeqIO file parsing, BLAST searches, Entrez queries, phylogenetic trees and PDB structure analysis.
aiming-lab/AutoResearchClaw
Reference guide for working with molecules in RDKit: reading SMILES and SDF files, computing descriptors and fingerprints, and searching substructures.
Categories
Reference patterns for writing qiskit 2.x code for variational quantum machine learning: feature maps, VQC training, VQE for chemistry, MPS circuits and noise models. This is a reference for Python code that imports qiskit, qiskit_aer, qiskit_algorithms, qiskit_machine_learning or qiskit_nature.x that affect VQE and chemistry code, and a few common mistakes with concrete fixes.
Qiskit 2.x Quantum ML Reference fits situations like: writing a variational quantum classifier with qiskit_machine_learning; setting up VQE for a chemistry problem under qiskit 2.x; fixing import errors after upgrading from qiskit 1.x; adding a noise model to a simulation.
Run `npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a claude-code`. Or copy the skill folder (researchclaw/skills/builtin/domain/quantum-qiskit in aiming-lab/AutoResearchClaw) into .claude/skills/quantum-qiskit in your project. Claude Code loads it when a task matches its description.
Run `npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a codex`. Or copy the skill folder (researchclaw/skills/builtin/domain/quantum-qiskit in aiming-lab/AutoResearchClaw) into .agents/skills/quantum-qiskit in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aiming-lab/AutoResearchClaw --skill quantum-qiskit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/quantum-qiskit, .gemini/skills/quantum-qiskit, .github/skills/quantum-qiskit and .opencode/skills/quantum-qiskit in your project.
SKILL.md names no scripts, command-line tools or credentials: Qiskit 2.x Quantum ML Reference is instructions for the agent only. Our summary lists: Python with qiskit 2.x and the add-on packages you use.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Qiskit 2.x Quantum ML Reference is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 4.7k tokens (SKILL.md is roughly 19k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Qiskit 2.x Quantum ML Reference: Cudaq Importing (NVIDIA/skills, 3.5k stars), Gtars Genomic Interval Toolkit (davila7/claude-code-templates, 32k stars), PyHealth Clinical ML Toolkit (davila7/claude-code-templates, 32k stars) and Mq Variational Training (mindspore-ai/mindquantum, 101 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
aiming-lab (a GitHub organization) maintains it in aiming-lab/AutoResearchClaw, which has 14,595 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on August 19, 2026.
Source: aiming-lab/AutoResearchClaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.