Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Qiskit Quantum Algorithms

ASecurity

Designing and executing quantum algorithms using IBM Qiskit v1.0+. Use when constructing quantum circuits, variational quantum algorithms (VQE/QAOA), quantum machine learning (QNN), error mitigation (M3/ZNE), transpilation pass managers, or running on IBM Quantum hardware and Aer simulators.

8 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentspythongotestingapibackend

Works with

api

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add hamzabellouch/agent-skills --skill qiskit-quantum-algorithms --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Qiskit Quantum Algorithms?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Qiskit Quantum Algorithms
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hamzabellouch-qiskit-quantum-algorithms/badge)](https://www.skillsdirectory.com/skills/hamzabellouch-qiskit-quantum-algorithms)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: qiskit-quantum-algorithms
metadata:
  category: Quantum Computing and Quantum AI
description: Designing and executing quantum algorithms using IBM Qiskit v1.0+. Use when constructing quantum circuits, variational quantum algorithms (VQE/QAOA), quantum machine learning (QNN), error mitigation (M3/ZNE), transpilation pass managers, or running on IBM Quantum hardware and Aer simulators.
compatibility: Qiskit v1.0+, Python 3.10+, Qiskit Aer, Qiskit IBM Runtime, NumPy, SciPy
---

# Qiskit Quantum Algorithms & Quantum AI Guidelines

This skill details quantum circuit construction, Variational Quantum Eigensolver (VQE) implementation, Quantum Approximate Optimization Algorithm (QAOA), noise mitigation strategies, and Qiskit v1.0+ transpilation workflows.

---

## 1. Qiskit v1.0+ Architecture & Primitives Paradigm

Qiskit v1.0 introduces a modular architecture centered around **Primitives** (`SamplerV2` and `EstimatorV2`):

```
+-------------------------------------------------------------------------+
|                         Quantum Circuit Definition                      |
|           (Qubit Registers, Parametric Gates, Entangled States)         |
+------------------------------------+------------------------------------+
                                     |
                                Transpilation
                                     v
+-------------------------------------------------------------------------+
|                  Target Hardware Transpilation Pass                     |
|           (Coupling Map Alignment, Gate Basis Translation, Routing)     |
+------------------------------------+------------------------------------+
                                     |
                                  Execute
                                     v
+-------------------------------------------------------------------------+
|                        Qiskit Runtime Primitives                        |
|                                                                         |
|     SamplerV2 (Quasi-probability)   |   EstimatorV2 (Expectation Values) |
+-------------------------------------------------------------------------+
```

1. **SamplerV2**: Measures individual qubit bitstrings to compute probability distributions.
2. **EstimatorV2**: Evaluates expectation values of Hermitian operators $\langle \psi | H | \psi \rangle$ directly (used in VQE / QAOA).

---

## 2. Variational Quantum Eigensolver (VQE) Implementation

Below is a production-grade Qiskit v1.0 implementation of VQE solving for the ground state energy of a molecular Hamiltonian using an efficient parametric ansatz:

```python
import numpy as np
from scipy.optimize import minimize
from qiskit import QuantumCircuit
from qiskit.circuit.library import EfficientSU2
from qiskit.quantum_info import SparsePauliOp
from qiskit_aer.primitives import EstimatorV2 as AerEstimator

class VQEGroundStateSolver:
    def __init__(self, hamiltonian: SparsePauliOp, num_qubits: int):
        self.hamiltonian = hamiltonian
        self.num_qubits = num_qubits
        
        # 1. Construct Parametric Ansatz (Hardware-Efficient SU2)
        self.ansatz = EfficientSU2(
            num_qubits=num_qubits, 
            su2_gates=['ry', 'rz'], 
            entanglement='linear', 
            reps=2
        )
        self.ansatz.measure_all()
        
        # 2. Instantiate Estimator Primitive
        self.estimator = AerEstimator()

    def _cost_function(self, params: np.ndarray) -> float:
        """Evaluates expectation value <psi(params)|H|psi(params)>."""
        # Bind classical parameters to ansatz circuit
        pub = (self.ansatz, self.hamiltonian, params)
        job = self.estimator.run([pub])
        result = job.result()
        
        # Extract expectation value from primitive result array
        expectation_value = result[0].data.evs
        return float(expectation_value)

    def solve(self) -> Dict:
        # Initial random parameters
        initial_params = np.random.uniform(-np.pi, np.pi, self.ansatz.num_parameters)
        
        # Perform classical optimization (COBYLA / L-BFGS-B)
        opt_result = minimize(
            self._cost_function, 
            initial_params, 
            method='COBYLA', 
            options={'maxiter': 200, 'rhobeg': 0.1}
        )
        
        return {
            "ground_state_energy": opt_result.fun,
            "optimal_parameters": opt_result.x,
            "iterations": opt_result.nfev,
            "status": "CONVERGED" if opt_result.success else "FAILED"
        }

if __name__ == "__main__":
    # Example Molecular Hamiltonian H = 0.5 * Z0*Z1 + 0.2 * X0*X1 - 0.8 * Z0
    hamiltonian = SparsePauliOp.from_list([
        ("ZZ", 0.5),
        ("XX", 0.2),
        ("ZI", -0.8)
    ])
    
    solver = VQEGroundStateSolver(hamiltonian, num_qubits=2)
    solution = solver.solve()
    print("VQE Energy Result:", solution["ground_state_energy"])
```

---

## 3. Qiskit Transpilation & Error Mitigation

### 3.1 Custom Pass Manager Transpilation

Targeting physical quantum hardware requires transpiling high-level circuits to native hardware gate sets (`cz`, `sx`, `rz`) while optimizing circuit depth:

```python
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime import QiskitRuntimeService

def transpile_for_ibm_backend(circuit: QuantumCircuit, backend_name: str = "ibm_brisbane"):
    # 1. Fetch real hardware target profile
    service = QiskitRuntimeService()
    backend = service.backend(backend_name)
    
    # 2. Generate Preset Pass Manager at Optimization Level 3
    pm = generate_preset_pass_manager(optimization_level=3, target=backend.target)
    
    # 3. Transpile Circuit
    transpiled_circuit = pm.run(circuit)
    
    print(f"Original Depth: {circuit.depth()} -> Transpiled Depth: {transpiled_circuit.depth()}")
    return transpiled_circuit
```

---

## 4. Anti-Patterns & Critical Pitfalls

| Anti-Pattern | Severity | Consequence | Correct Pattern |
|---|---|---|---|
| Using deprecated Qiskit 0.x methods (`execute()`, `Backend.run()`) | Critical | API breakage in Qiskit 1.0+ | Upgrade code to Qiskit 1.0 `SamplerV2` / `EstimatorV2` primitives |
| Un-transpiled execution on physical hardware | Critical | Execution error (Unsupported Gate Set) | Always run through `generate_preset_pass_manager` targeting backend |
| Unbounded ansatz depth on NISQ hardware | High | Decoherence & noise drown out quantum signal | Use shallow hardware-efficient ansätze (`EfficientSU2` reps <= 3) |
| Hardcoded measurement mapping | Medium | Faulty bitstring interpretation | Explicitly track classical register bits when sampling |
| Missing error mitigation on noisy backend | High | Inaccurate expectation values | Enable Zero-Noise Extrapolation (ZNE) or Readout Mitigation |

---

## 5. Verification & Testing Checklist

- [ ] **Statevector Simulator Verification**: Compare VQE results against exact `Statevector` diagonalization before executing on hardware.
- [ ] **Circuit Gate Count**: Verify 2-qubit gate count (`CZ`/`CNOT`) is minimized during pass manager transpilation.
- [ ] **Qiskit Version Lock**: Enforce `qiskit>=1.0.0` in `requirements.txt`.

Attribution

hamzabellouchhamzabellouch
View sourceSee grades on GitHubMore from hamzabellouch →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →