Skip to content
Agentmart
Submit a tool

gala-language-basics

Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations

Skill by gala-pl

IndexedApache-2.0★ 1
Write a review

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-language-basics

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.

We use your email only for this newsletter. Privacy

About

Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations

No 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-language-basics

Tools it pre-approves 10

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Bash(cargo
  • run
  • --bin
  • gala
  • *)
  • Read
  • Write
  • Edit
  • Glob
  • Grep

What's inside

Skill name
gala-language-basics
Description
Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations
License
Apache-2.0
Allowed tools
Bash(cargo, run, --bin, gala, *), Read, Write, Edit, Glob, Grep
Instructions
165 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 is a **hybrid quantum-classical language** where quantum mechanics laws are enforced at compile time. This skill covers the core language concepts you need to write Gala programs.

## Key Concepts

### 1. Linear Qubits (No-Cloning)
```gala
// Qubits are linear — must be used exactly once
let q = qubit()          // Allocate |0⟩
h(q)                     // Apply Hadamard (in-place sugar)
// q is consumed by h, rebound to result
measure(q)               // Consumes q, returns Measured<Bool>
```

**Rules:**
- No duplication: `let q2 = q` ❌ (compile error E0413)
- No implicit drop: every qubit must be `measure`d, `return`ed, or `drop`ped
- No aliasing: can't have two references to same qubit

### 2. Effects System (Three Worlds)
```gala
fn pure_fn(x: Int) -> Int pure { x + 1 }           // Classical only
fn quantum_fn(q: Qubit) -> Qubit quantum { h(q) }  // Unitary, reversible
fn prob_fn(q: Qubit) -> Measured<Bool> prob { measure(q) }  // Measures
```

**Effect lattice:** `pure ⊑ quantum ⊑ prob`
- `quantum` can call `pure`
- `prob` can call `quantum` and `pure`
- `quantum` **cannot** call `prob` (measurement boundary)

### 3. Core Types
| Type | Linear? | Description |
|------|---------|-------------|
| `Qubit` | Yes | Single qubit |
| `Qubits<N>` | Yes | Register of N qubits (const generic) |
| `Measured<T>` | No | Classical result with distribution |
| `Bool`, `Int`, `Float`, `Complex` | No | Classical scalars |
| `Params` | No | Trainable parameters for VQA |

### 4. Basic Quantum Operations
```gala
// Allocation
qubit() -> Qubit quantum
qubits<N>() -> Qubits<N> quantum

// Single-qubit gates (in-place sugar)
h(q)      // Hadamard
x(q), y(q), z(q)  // Pauli
s(q), t(q)        // Phase
rx(q, θ), ry(q, θ), rz(q, θ)  // Rotations

// Two-qubit gates
cx(ctrl, target) -> (Qubit, Qubit) quantum  // CNOT
cz(ctrl, target) -> (Qubit, Qubit) quantum  // CZ
swap(a, b) -> (Qubit, Qubit) quantum

// Measurement
measure(q: Qubit) -> Measured<Bool> prob

// Safe release (auto-uncomputes if liftable)
drop(q: Qubit) quantum
```

### 5. In-Place Sugar
```gala
// Explicit (always valid)
let q = h(q)
let (a, b) = cx(a, b)

// Sugar (compiler rewrites to explicit)
h(q)                    // → let q = h(q)
cx(a, b)                // → let (a, b) = cx(a, b)
```

## Quick Start

```bash
# Create new project
gala new my_project
cd my_project

# Write program in src/main.gala
# Run on simulator
gala run --shots 1000

# Type-check only
gala check

# Format
gala fmt
```

## Hello World: Bell Pair

```gala
// src/main.gala
fn bell() -> Qubits<2> quantum {
    let a = qubit()
    let b = qubit()
    h(a)
    cx(a, b)
    (a, b)
}

fn main() -> Measured<Bool> prob {
    let (a, b) = bell()
    measure(a)
}
```

Run: `gala run --shots 1000` → ~50% `true`, ~50% `false` (entangled)

## Common Patterns

From gala-pl/gala, Apache-2.0.

More from gala-pl/gala

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Oct 23, 2026 (4 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from gala-pl

Cite this page

gala-language-basics skill. Agent Mart. https://agentmart.dev/skills/gala-pl-gala-language-basics (last updated 2026-10-24)