General reference for templates?

New user here.

Just trying to understand how templates work and can’t find a reference
to what I can put into templates. Is there a document, or even a place
in source libraries, where I can look to understand how to add fields
and other content to a template.

If such documentation doesn’t exist, I’d be glad to help write it.