# Quantum Error Correction

> Surface codes, syndrome measurement, and topological qubits mechanics.

- Skill: `j4flmao/quantum-error-correction` (Agent Skill)
- Install (CLI): `npx skillmds@latest add j4flmao/quantum-error-correction`
- Raw SKILL.md: https://api.skillmd.com/api/skills/j4flmao/quantum-error-correction/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: j4flmao (https://skillmd.com/u/j4flmao)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/j4flmao/quantum-error-correction

---

# Quantum Error Correction (QEC)

QEC protects fragile quantum information from decoherence and environmental noise using logical qubits encoded across multiple physical qubits.

## Surface Codes and Topological Qubits
Surface codes are a class of stabilizer codes mapped onto a 2D lattice.
- Qubits are placed on the edges of the lattice.
- Star (vertex) operators $A_v = \prod_{i \in \text{star}} X_i$ and plaquette operators $B_p = \prod_{i \in \text{boundary}} Z_i$ form the stabilizer generators.

## Syndrome Measurement
Error detection occurs without measuring the logical state via syndrome extraction circuits using ancillary measure qubits.

```mermaid
flowchart TD
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
    subgraph SyndromeExtractionSyndromeExtraction ["Syndrome Extraction<br><br><br>"]
        Data[Data Qubits] -->|"CNOT(Data, Ancilla)"| Ancilla[Measure Qubit]
        Ancilla -->|"Measure(Z)"| Syndrome[Syndrome Graph]
    end
    subgraph DecoderMWPMDecoder ["MWPM Decoder<br><br><br>"]
        Syndrome -->|"MapToGraph()"| Match[Minimum Weight Perfect Matching]
        Match -->|"ApplyCorrection()"| Recovery[Recovery Operations]
    end
```

### Decoder Topology
The Minimum Weight Perfect Matching (MWPM) algorithm pairs any detected error defects (anyons) in the space-time syndrome graph.

