---
title: "CUE (schema.cue)"
description: "Schema definition with validation."
canonical: "https://geordy.ai/formats/cue"
---
# CUE

**Schema definition with validation.**

A constraint language for data validation. Lets AI tooling verify your structured data is well-formed before consuming it.

CUE (Configure, Understand, Execute) is a data configuration language that unifies configuration, data validation, and templating into a single, expressive language, aiming for simplicity and composability. Released in 2018 to deliver a unified language for configuration that balances human readability with machine parsing.

## At a glance

- File: `schema.cue`
- First released: 2018
- Created by: CUE Project Contributors
- Specification: https://cuelang.org/docs/references/spec/
- Read by: AI validators, Build pipelines, Schema-aware code agents

## Why it matters for AI

CUE unifies schema definition, validation, and configuration into one language with a sound type system based on the lattice of types and values, which makes it ideal for emitting machine-checked configuration that AI agents can both read and generate without producing invalid YAML/JSON. Its constraint-based model lets you describe data shape and data values in the same file.

## Example

```
# CUE configuration for Geordy AI Platform
package main

site: {
  name: string
  domain: string
  category: *"GEO / LLMO" | *"AI / ML"
}

site: name: "Geordy AI"
site: domain: "geordy.ai"
```

## Benefits

- Unified language for config + validation + templating
- Strong type safety
- Composability

## Limitations

- Steeper learning curve than JSON/YAML
- Smaller ecosystem

## Best practices

- Define schemas as definitions (#Schema) and unify concrete data with them; never duplicate field names across schema and instance.
- Keep packages small and use `cue export` / `cue eval` to emit JSON or YAML rather than hand-writing those files; let CUE be the source of truth.
- Use disjunctions (`|`) with defaults (`*`) for optional configuration knobs and constrain numeric/string values with bounds (`>=0`, `=~"^[a-z]+$"`).
- Run `cue vet` against your data files in CI to catch schema drift early; pin the cue tool version in your repo.

## Pitfalls

- Treating CUE like YAML: order of fields does not matter and duplicate fields are unified (and may conflict), which surprises users coming from override-style config.
- Forgetting that definitions starting with `#` are closed by default - adding fields not in the schema produces a `field not allowed` error.
- Confusing concrete values with constraints: `int` is a type (incomplete), `42` is concrete; `cue export` fails on incomplete values without `-e` or defaults.

## Use cases

- **Configuration management**
- **Data validation**
- **API definition**

## Adopters

- Dagger (https://dagger.io/)
- Istio (https://github.com/istio/tools)
- Holos (https://holos.run/)
- Timoni (https://timoni.sh/)
---

Source: https://geordy.ai/formats/cue
This is a machine-readable markdown version of that page, generated by Geordy.