k-dense-ai/scientific-agent-skills/qiskit
- community
Checking that the SKILL.md file is still in the repository.
Builds, simulates, transpiles, and executes 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.
Install
npx vskill@latest install k-dense-ai/scientific-agent-skills/qiskitSKILL.md
Qiskit
Use current Qiskit 2.x APIs to build circuits, prepare hardware-compatible instruction set architecture (ISA) circuits, and execute them through V2 primitives.
Reviewed 2026-10-01 with local tests on qiskit==2.5.2, qiskit-ibm-runtime==0.50.0, and qiskit-aer==0.17.2. IBM account, QPU, session, and batch examples are illustrative and documentation/source-checked; no remote workloads were submitted. See references/sources.md for the verification boundary.
Runtime 0.50 deprecates the top-level SamplerV2/EstimatorV2 implementations. New code imports Sampler from qiskit_ibm_runtime.executor_sampler and Estimator from qiskit_ibm_runtime.executor_estimator. These still implement the V2 PUB interface, using client-side processing and Executor. Use option models from qiskit_ibm_runtime.options_models.
Choose the Right Path
| Goal | Recommended interface | |
|---|---|---|
| Ideal evolution with finite-shot sampling | qiskit.primitives.StatevectorSampler | |
| Exact local expectation values | qiskit.primitives.StatevectorEstimator | |
| High-performance or noisy simulation | Qiskit Aer | |
| IBM QPU sampling | qiskit_ibm_runtime.executor_sampler.Sampler | |
| IBM QPU expectation values and mitigation | qiskit_ibm_runtime.executor_estimator.Estimator | |
| 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:
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
Sampler V2 preserves shots and classical-register structure. Access the register by its actual name; measure_all() uses meas.
For circuits with multiple classical registers, each register’s counts are a marginal distribution. Preserve shot alignment when computing cross-register correlations; multiplying marginal frequencies destroys those correlations. Use SamplerPubResult.join_data with an explicit register order for joint bitstrings and record that order in the result labels. Qiskit 2.5.2 puts the first joined BitArray register in the least-significant bits, contrary to the current docstring; verify with an asymmetric state. See references/primitives.md.
Quick Local Estimation
Estimator circuits should not contain final measurements. PUB arrays broadcast; verify circuit parameter order before constructing large sweeps.
IBM QPU Sampling
This example assumes credentials were saved securely as described in references/setup.md. It never embeds or prints an API key.
Save the job ID before waiting for results so the job can be retrieved later.
IBM QPU Estimation
Runtime Estimator requires both an ISA circuit and observables mapped through the transpiler layout:
Error mitigation is not guaranteed to improve every workload and increases cost. Record finalized options (estimator.finalize_options().model_dump()), result metadata, and usage. A Runtime dry_run=True call is a server submission returning randomized mock data, not a local simulator or scientific validation.
Non-Negotiable Qiskit 2.x Rules
- Use V2 primitive interfaces and PUB inputs. Do not write new V1
Sampler,Estimator, orQuantumInstancecode. - 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, ormode=batchfor Runtime primitives. - Use the Runtime client-side
Estimatorfor 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 usebackend.configuration()orBackendProperties. - 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_transpilerwhen comparing compilation settings. A simulator seed does not make QPU results deterministic. qiskit.pulsewas removed in Qiskit 2.0. Use supported fractional gates for IBM hardware. Qiskit Dynamics is archived; isolate legacy pulse-model research and verify its dependency stack separately.- QPY is the Qiskit-native circuit serialization format. Do not use Python pickle for untrusted circuit artifacts.
See references/migration.md for a detailed old-to-current API map.
Execution Modes
Choose based on workload shape and account plan:
- 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.
Close sessions and batches after submission. Exiting their context stops new submissions but allows accepted jobs to finish, subject to service limits.
Reference Map
Read only the files needed for the current task:
| Topic | Reference | |
|---|---|---|
| Versions, installation, authentication, CI | references/setup.md | |
| Circuits, parameters, control flow, QPY | references/circuits.md | |
| V2 PUBs, broadcasting, local and Runtime results | references/primitives.md | |
| Targets, ISA circuits, layouts, pass managers | references/transpilation.md | |
| IBM backends, modes, jobs, Aer, mitigation | references/backends.md | |
| End-to-end map/optimize/execute/analyze patterns | references/patterns.md | |
| Algorithms, addons, Nature, ML, Optimization | references/algorithms.md | |
| Circuit, result, state, and backend plots | references/visualization.md | |
| Qiskit 0.x/1.x and Runtime migration | references/migration.md | |
| Testing, reproducibility, and troubleshooting | references/testing.md | |
| Upstream docs, release notes, and version baseline | references/sources.md |
Bundled Scripts
Run from the skill directory:
The Runtime inspection script selects or inspects a backend but never submits a quantum job.
Final Checklist
Before returning Qiskit code:
- Confirm package versions and Python compatibility.
- Run locally with statevector primitives or Aer.
- Verify parameter order, observable qubit count, and classical-register names.
- Transpile against the exact
BackendV2target and inspect depth and two-qubit operations. - Apply the final layout to every observable.
- Estimate QPU cost and choose job, batch, or session mode.
- Save job IDs, package versions, seeds, backend name, primitive options, and result metadata.
- Never expose API keys in source, logs, notebooks, or version control.
Citing Scientific Agent Skills
This skill is part of Scientific Agent Skills by K-Dense. If it materially contributed to a manuscript, report, presentation, or code release, add the paper to the references or software section and tell the user you did so:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/qiskit/SKILL.md
Popularity
- Repository stars
- 32,639
- Repository forks
- 3,224
- 7-day trend score
- 52
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 5 Aug 2026, 2 months ago.
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
[](https://verified-skill.com/skills/k-dense-ai/scientific-agent-skills/qiskit)