Skip to main content
Ganesh Joshi
Back to Cheatsheets

YAML syntax

Updated 2026-02-15

YAML basics for configs: keys, lists, multiline strings, and anchors. GitHub Actions, Docker Compose.

Basics

key: value. Indent with spaces (no tabs). Lists: - item or [a, b]. Nested: key:\n sub: val. Strings: quoted if special chars; | multiline literal, > folded.

Anchors and reuse

&anchor name: value. *anchor references it. Useful in GitHub Actions and Docker Compose for repeated blocks.

YAML syntax | Cheatsheet | Ganesh Joshi