YAML Practical Guide
Direct answer
YAML is a human-readable data serialization language used mainly for configuration. Learn indentation-based syntax, prefer YAML 1.2-safe values, validate before deploy, and use language/ecosystem guides for production patterns.
When to use this guide
Use this page as a learning path for configuration YAML (Kubernetes, CI, Compose, app config). It is a practical layer on top of the official specification at yaml.org, not a replacement for it.
Skip this if you only need a one-line syntax check — use the YAML validator instead.
Learning path
- Basic syntax — indentation, keys, lists
- YAML 1.1 vs 1.2 — boolean and number traps
- Anchors and multiline
- Cheat sheet for quick lookup
- Apply with a ecosystem hub or language hub
Minimal valid example
# config.yaml
app:
name: demo
port: 8080
features:
- logging
- metricsValidated as YAML 1.2-compatible plain data (js-yaml / PyYAML safe_load).
Common mistakes
Incorrect: tabs for indentation
app:
name: demoCorrect: spaces only
app:
name: demoReferences
Related
Production checklist
- No secrets in plain YAML — use env vars or a secret manager.
- Prefer
true/false; quote country codes and yes/no when they are strings. - Validate in CI; fail the pipeline on parser errors.
- Document required keys for teammates (or attach a JSON Schema where supported).