pennylane
Cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Enables building and training quantum circuits with automatic differentiation, seamless integration with PyTorch/JAX/TensorFlow, and device-independent execution across simulators and quantum hardware (IBM, Amazon Braket, Google, Rigetti, IonQ, etc.). Use when working with quantum circuits, variational quantum algorithms (VQE, QAOA), quantum neural networks, hybrid quantum-classical models, molecular simulations, quantum chemistry calculations, or any quantum computing tasks requiring gradient-based optimization, hardware-agnostic programming, or quantum machine learning workflows.
Install
mkdir -p .claude/skills/pennylane && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4033" && unzip -o skill.zip -d .claude/skills/pennylane && rm skill.zipInstalls to .claude/skills/pennylane
About this skill
PennyLane
Overview
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.
Installation
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
Quick Start
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)
Core Capabilities
1. Quantum Circuit Construction
Build circuits with gates, measurements, and state preparation. See references/quantum_circuits.md for:
- Single and multi-qubit gates
- Controlled operations and conditional logic
- Mid-circuit measurements and adaptive circuits
- Various measurement types (expectation, probability, samples)
- Circuit inspection and debugging
2. Quantum Machine Learning
Create hybrid quantum-classical models. See references/quantum_ml.md for:
- Integration with PyTorch, JAX, TensorFlow
- Quantum neural networks and variational classifiers
- Data encoding strategies (angle, amplitude, basis, IQP)
- Training hybrid models with backpropagation
- Transfer learning with quantum circuits
3. Quantum Chemistry
Simulate molecules and compute ground state energies. See references/quantum_chemistry.md for:
- Molecular Hamiltonian generation
- Variational Quantum Eigensolver (VQE)
- UCCSD ansatz for chemistry
- Geometry optimization and dissociation curves
- Molecular property calculations
4. Device Management
Execute on simulators or quantum hardware. See references/devices_backends.md for:
- Built-in simulators (default.qubit, lightning.qubit, default.mixed)
- Hardware plugins (IBM, Amazon Braket, Google, Rigetti, IonQ)
- Device selection and configuration
- Performance optimization and caching
- GPU acceleration and JIT compilation
5. Optimization
Train quantum circuits with various optimizers. See references/optimization.md for:
- Built-in optimizers (Adam, gradient descent, momentum, RMSProp)
- Gradient computation methods (backprop, parameter-shift, adjoint)
- Variational algorithms (VQE, QAOA)
- Training strategies (learning rate schedules, mini-batches)
- Handling barren plateaus and local minima
6. Advanced Features
Leverage templates, transforms, and compilation. See references/advanced_features.md for:
- Circuit templates and layers
- Transforms and circuit optimization
- Pulse-level programming
- Catalyst JIT compilation
- Noise models and error mitigation
- Resource estimation
Common Workflows
Train a Variational Classifier
# 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)
Run VQE for Molecular Ground State
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")
Switch Between Devices
# 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)
Detailed Documentation
For comprehensive coverage of specific topics, consult the reference files:
- Getting started:
references/getting_started.md- Installation, basic concepts, first steps - Quantum circuits:
references/quantum_circuits.md- Gates, measurements, circuit patterns - Quantum ML:
references/quantum_ml.md- Hybrid models, framework integration, QNNs - Quantum chemistry:
references/quantum_chemistry.md- VQE, molecular Hamiltonians, chemistry workflows - Devices:
references/devices_backends.md- Simulators, hardware plugins, device configuration - Optimization:
references/optimization.md- Optimizers, gradients, variational algorithms - Advanced:
references/advanced_features.md- Templates, transforms, JIT compilation, noise
Best Practices
- Start with simulators - Test on
default.qubitbefore deploying to hardware - Use parameter-shift for hardware - Backpropagation only works on simulators
- Choose appropriate encodings - Match data encoding to problem structure
- Initialize carefully - Use small random values to avoid barren plateaus
- Monitor gradients - Check for vanishing gradients in deep circuits
- Cache devices - Reuse device objects to reduce initialization overhead
- Profile circuits - Use
qml.specs()to analyze circuit complexity - Test locally - Validate on simulators before submitting to hardware
- Use templates - Leverage built-in templates for common circuit patterns
- Compile when possible - Use Catalyst JIT for performance-critical code
Resources
- Official documentation: https://docs.pennylane.ai
- Codebook (tutorials): https://pennylane.ai/codebook
- QML demonstrations: https://pennylane.ai/qml/demonstrations
- Community forum: https://discuss.pennylane.ai
- GitHub: https://github.com/PennyLaneAI/pennylane
More by davila7
View all skills by davila7 →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversAccess up-to-date library info for NPM, Go & Python with Package Docs. Quickly find docs for python requests & npm cmd;
Control Apple Music on macOS using Python and the Apple Music API: manage playback, search the library, and create playl
Pokemon damage calculator for VGC: analyze damage, KO chances, and strategies. Fast, accurate pokemon damage calculation
Access HMR Docs for Python: guides, examples, and source code on hot module replacement, hot reloading, and reactive pro
Learn how to use Python to read a file and manipulate local files safely through the Filesystem API.
Boost your AI code assistant with Context7: inject real-time API documentation from OpenAPI specification sources into y
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.