gala-vqa-programming
Build variational quantum algorithms in Gala — encoders, ansätze, optimizers, native grad
Skill by gala-pl
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/gala-pl-gala-vqa-programming
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/gala-vqa-programming
Tools it pre-approves 10
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
Bash(cargorun--bingala*)ReadWriteEditGlobGrep
What's inside
- Skill name
gala-vqa-programming- Description
- Build variational quantum algorithms in Gala — encoders, ansätze, optimizers, native grad
- License
- Apache-2.0
- Allowed tools
- Bash(cargo, run, --bin, gala, *), Read, Write, Edit, Glob, Grep
- Instructions
- 211 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (1)
- SKILL.md
SKILL.md (first lines)
## Task
$ARGUMENTS
## Overview
Gala has **native differentiation** (`grad`) that works end-to-end across hybrid quantum-classical code. This skill covers building VQA/VQE/QAOA programs with parameter-shift gradients.
## VQA Standard Library
```gala
import gala.vqa.{ angle_encode, amplitude_encode, layered_ansatz, hardware_efficient_ansatz }
import gala.vqa.{ gd_optimizer, adam_optimizer, spsa_optimizer, Params }
```
## Complete VQA Example
```gala
import gala.vqa.{ angle_encode, layered_ansatz, adam_optimizer, Params }
import gala.core.{ grad, measure }
// 1. Data encoding (classical → quantum)
fn encode(x: Vec<Float>) -> Qubits<4> quantum {
let q = qubits<4>()
angle_encode(q, x) // Ry(x[i]) on each qubit
q
}
// 2. Variational ansatz (parameterized quantum circuit)
fn ansatz(q: Qubits<4>, θ: Params) -> Qubits<4> quantum {
layered_ansatz(q, θ, depth: 3) // Ry + CZ layers
// Or custom:
// for layer in 0..θ.depth {
// for i in 0..4 { ry(q[i], θ[layer][i]) }
// for i in 0..3 { cx(q[i], q[i+1]) }
// }
q
}
// 3. Classifier (hybrid: quantum + measure)
fn classify(x: Vec<Float>, θ: Params) -> Measured<Bool> prob {
let q = ansatz(encode(x), θ)
measure(q[0]) // Measure first qubit
}
// 4. Native gradient (parameter-shift for θ, autodiff for x)
let dθ = grad(classify, wrt: θ) // Returns fn(Vec<Float>, Params) -> Params
// 5. Training loop
fn train(dataset: [(Vec<Float>, Bool)], epochs: Int) -> Params {
let mut θ = Params::random(4, 3) // 4 qubits, 3 layers
let opt = adam_optimizer(lr: 0.01)
for epoch in 0..epochs {
for (x, y) in dataset {
let g = dθ(x, θ) // Gradient wrt θ
θ = opt.step(θ, g)
}
}
θ
}
```
## Key Components
### Encoders
```gala
// Angle encoding: Ry(x[i]) on qubit i
angle_encode(q: Qubits<N>, x: Vec<Float>) -> Qubits<N> quantum
// Amplitude encoding: prepare state ∑ x[i]|i⟩ (requires normalization)
amplitude_encode(q: Qubits<N>, x: Vec<Float>) -> Qubits<N> quantum
// Basis encoding: |x⟩ for binary data
basis_encode(q: Qubits<N>, x: Vec<Bool>) -> Qubits<N> quantum
```
### Ansatz Zoo
```gala
// Layered: alternating Ry + entangling layer
layered_ansatz(q: Qubits<N>, θ: Params, depth: Int) -> Qubits<N> quantum
// Hardware-efficient: native gate set for target backend
hardware_efficient_ansatz(q: Qubits<N>, θ: Params, topology: Topology) -> Qubits<N> quantum
// QAOA: problem + mixer Hamiltonians
qaoa_ansatz(q: Qubits<N>, θ: Params, problem: Hamiltonian) -> Qubits<N> quantum
// Custom: build from gates
fn my_ansatz(q: Qubits<4>, θ: Params) -> Qubits<4> quantum {
for i in 0..4 { ry(q[i], θ[0][i]) }
cx(q[0], q[1]); cx(q[2], q[3])
for i in 0..4 { rz(q[i], θ[1][i]) }
q
}
```
### Optimizers
```gala
// Gradient descent
gd_optimizer(lr: Float) -> Optimizer
// Adam (adaptive moments)
adam_optimizer(lr: Float, beta1: Float, beta2: Float) -> Optimizer
// SPSA (simultaneous perturbation — 2 circuit evals/step)
spsa_optimizer(lr: Float, c: Float) -> Optimizer
// Usage
let opt = adam_optimizer(lr: 0.01)
θ = opt.step(θ, gradient)
```
## How `grad` Works
```
grad(f, wrt: θ) where f: (X, θ) → Measured<T>
```From gala-pl/gala, Apache-2.0.
More from gala-pl/gala
- 0.584score
gala-diff
gala-pl
Work with Gala's native differentiation — parameter-shift for quantum params, reverse-mode autodiff for classical, chain-rule composition
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-hardware-backends
gala-pl
Run Gala programs on quantum hardware — backend selection, capability checking, QIR emission, vendor SDKs
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-language-basics
gala-pl
Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-noise-modeling
gala-pl
Model and simulate noise in Gala — typed noise models, QuEST noise channels, error mitigation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-performance
gala-pl
Optimize Gala program performance — gate count, circuit depth, gradient cost, compilation time
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-python-interop
gala-pl
Call Gala from Python — PyO3 bridge, Jupyter kernel, PyTorch integration, NumPy arrays
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-quantum-algorithms
gala-pl
Implement quantum algorithms in Gala — QFT, Grover, phase estimation, adders, oracles
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-ast
gala-pl
Work with Gala's AST — add node types, implement visitors, maintain CST/AST separation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-codegen-classical
gala-pl
Work with Gala's classical codegen — Cranelift (debug) and LLVM (release) for orchestration layer
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-driver
gala-pl
Work with Gala's compilation driver — salsa DB orchestration, incremental queries, pipeline wiring
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
debug-compiler
gala-pl
Debug a compiler error or unexpected behavior in Gala source code
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-cookbook
gala-pl
Gala recipes — common patterns, idioms, algorithms, VQA templates, error handling
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 23, 2026 (5 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/gala-pl/gala
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from gala-pl
- 0.584score
gala-diff
gala-pl
Work with Gala's native differentiation — parameter-shift for quantum params, reverse-mode autodiff for classical, chain-rule composition
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-language-basics
gala-pl
Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-noise-modeling
gala-pl
Model and simulate noise in Gala — typed noise models, QuEST noise channels, error mitigation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-performance
gala-pl
Optimize Gala program performance — gate count, circuit depth, gradient cost, compilation time
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-python-interop
gala-pl
Call Gala from Python — PyO3 bridge, Jupyter kernel, PyTorch integration, NumPy arrays
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-hardware-backends
gala-pl
Run Gala programs on quantum hardware — backend selection, capability checking, QIR emission, vendor SDKs
SkillAFreshness: A★ 1Claude Code +9
Cite this page
gala-vqa-programming skill. Agent Mart. https://agentmart.dev/skills/gala-pl-gala-vqa-programming (last updated 2026-10-24)