The single most important YAML rule
YAML uses indentation to denote nesting. Indentation must be spaces only — tabs are forbidden. Most parsers reject any tab character used for indentation outright with a clear error; a few tolerate it and silently break alignment.
How much indentation
The spec is permissive: any consistent number of spaces works, as long as you use the same count throughout a block. Convention is 2 spaces. Some tools (older Ansible roles, certain Kubernetes manifest examples) use 4. Pick one per file and stick with it.
Indent past the parent's name
Children must be indented further than the parent's name, not just its colon. foo:\n bar: 1 works because bar sits past the start of foo. Misalign by even one space and the parser either rejects or reads the data shape differently.