scientific-skills/pennylane/SKILL.md
Hardware-agnostic quantum ML framework with automatic differentiation. Use when training quantum circuits via gradients, building hybrid quantum-classical models, or needing device portability across IBM/Google/Rigetti/IonQ. Best for variational algorithms (VQE, QAOA), quantum neural networks, and integration with PyTorch/JAX/TensorFlow. For hardware-specific optimizations use qiskit (IBM) or cirq (Google); for open quantum systems use qutip.
npx skillsauth add K-Dense-AI/claude-scientific-skills pennylaneInstall 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.
PennyLane is a quantum computing library that enables training quantum computers like neural networks. It provides automatic differentiation of quantum circuits, device-independent programming, and seamless integration with classical machine learning frameworks.
Install using uv:
uv pip install pennylane
For quantum hardware access, install device plugins:
# IBM Quantum
uv pip install pennylane-qiskit
# Amazon Braket
uv pip install amazon-braket-pennylane-plugin
# Google Cirq
uv pip install pennylane-cirq
# Rigetti Forest
uv pip install pennylane-rigetti
# IonQ
uv pip install pennylane-ionq
Build a quantum circuit and optimize its parameters:
import pennylane as qml
from pennylane import numpy as np
# Create device
dev = qml.device('default.qubit', wires=2)
# Define quantum circuit
@qml.qnode(dev)
def circuit(params):
qml.RX(params[0], wires=0)
qml.RY(params[1], wires=1)
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(0))
# Optimize parameters
opt = qml.GradientDescentOptimizer(stepsize=0.1)
params = np.array([0.1, 0.2], requires_grad=True)
for i in range(100):
params = opt.step(circuit, params)
Build circuits with gates, measurements, and state preparation. See references/quantum_circuits.md for:
Create hybrid quantum-classical models. See references/quantum_ml.md for:
Simulate molecules and compute ground state energies. See references/quantum_chemistry.md for:
Execute on simulators or quantum hardware. See references/devices_backends.md for:
Train quantum circuits with various optimizers. See references/optimization.md for:
Leverage templates, transforms, and compilation. See references/advanced_features.md for:
# 1. Define ansatz
@qml.qnode(dev)
def classifier(x, weights):
# Encode data
qml.AngleEmbedding(x, wires=range(4))
# Variational layers
qml.StronglyEntanglingLayers(weights, wires=range(4))
return qml.expval(qml.PauliZ(0))
# 2. Train
opt = qml.AdamOptimizer(stepsize=0.01)
weights = np.random.random((3, 4, 3)) # 3 layers, 4 wires
for epoch in range(100):
for x, y in zip(X_train, y_train):
weights = opt.step(lambda w: (classifier(x, w) - y)**2, weights)
from pennylane import qchem
# 1. Build Hamiltonian
symbols = ['H', 'H']
coords = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.74])
H, n_qubits = qchem.molecular_hamiltonian(symbols, coords)
# 2. Define ansatz
@qml.qnode(dev)
def vqe_circuit(params):
qml.BasisState(qchem.hf_state(2, n_qubits), wires=range(n_qubits))
qml.UCCSD(params, wires=range(n_qubits))
return qml.expval(H)
# 3. Optimize
opt = qml.AdamOptimizer(stepsize=0.1)
params = np.zeros(10, requires_grad=True)
for i in range(100):
params, energy = opt.step_and_cost(vqe_circuit, params)
print(f"Step {i}: Energy = {energy:.6f} Ha")
# Same circuit, different backends
circuit_def = lambda dev: qml.qnode(dev)(circuit_function)
# Test on simulator
dev_sim = qml.device('default.qubit', wires=4)
result_sim = circuit_def(dev_sim)(params)
# Run on quantum hardware
dev_hw = qml.device('qiskit.ibmq', wires=4, backend='ibmq_manila')
result_hw = circuit_def(dev_hw)(params)
For comprehensive coverage of specific topics, consult the reference files:
references/getting_started.md - Installation, basic concepts, first stepsreferences/quantum_circuits.md - Gates, measurements, circuit patternsreferences/quantum_ml.md - Hybrid models, framework integration, QNNsreferences/quantum_chemistry.md - VQE, molecular Hamiltonians, chemistry workflowsreferences/devices_backends.md - Simulators, hardware plugins, device configurationreferences/optimization.md - Optimizers, gradients, variational algorithmsreferences/advanced_features.md - Templates, transforms, JIT compilation, noisedefault.qubit before deploying to hardwareqml.specs() to analyze circuit complexitydevelopment
Create, edit, analyze, or convert Excel spreadsheets (.xlsx, .xlsm) where the workbook file is the primary deliverable. Use for formulas, formatting, financial models, multi-sheet workbooks, and tabular cleanup exported to Excel. Also applies to .csv/.tsv when the user wants spreadsheet output. Do NOT use for Word documents, HTML reports, standalone Python scripts, database pipelines, or Google Sheets API work.
testing
Run structured What-If scenario analysis with 4–6 branch possibility exploration (best, likely, worst, wild card, contrarian, second-order). Use when the user asks speculative what-if questions about uncertain futures, strategic forks, contingency planning, or stress-testing a decision before committing.
development
Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
development
Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV/HDF5/Arrow/Parquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.