pennylane▌
K-Dense-AI/scientific-agent-skills · updated Jun 4, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
### Pennylane
- ›name: "pennylane"
- ›description: "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 ..."
| name | pennylane |
| description | 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. |
| license | Apache-2.0 license |
| metadata | version: "1.0" skill-author: K-Dense Inc. |
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
How to use pennylane on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add pennylane
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches pennylane from GitHub repository K-Dense-AI/scientific-agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate pennylane. Access the skill through slash commands (e.g., /pennylane) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★54 reviews- ★★★★★Min Farah· Dec 28, 2024
We added pennylane from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Dhruvi Jain· Dec 8, 2024
pennylane has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Luis Smith· Dec 4, 2024
Keeps context tight: pennylane is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Oshnikdeep· Nov 27, 2024
Solid pick for teams standardizing on skills: pennylane is focused, and the summary matches what you get after install.
- ★★★★★Charlotte Haddad· Nov 23, 2024
We added pennylane from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Advait Anderson· Nov 19, 2024
Keeps context tight: pennylane is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Ganesh Mohane· Oct 18, 2024
We added pennylane from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Charlotte Yang· Oct 14, 2024
Solid pick for teams standardizing on skills: pennylane is focused, and the summary matches what you get after install.
- ★★★★★Jin Yang· Oct 10, 2024
pennylane has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Sakshi Patil· Sep 25, 2024
pennylane fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
showing 1-10 of 54