templlisted
Install: claude install-skill xobotyi/cc-foundry
A templ template is a rendering function, not a program. Three biases decide most calls:
- **Compute in Go, render in templ.** Every transformation, validation, and I/O call belongs in a Go function that hands
the template a finished value.
- **Escaping is automatic inside `.templ` source and nowhere else.** Every bypass carries a named API, and reaching for
one is a decision to emit unchecked output.
- **`.templ` source and the generated `*_templ.go` are one artifact.** Neither is correct without the other.
## Syntax
- **`{ }` writes a value; `{{ }}` runs Go statements.** `html/template` gives `{{ }}` the opposite job, and that habit
carries over silently.
- **`{ }` accepts `string`, the numeric types, `bool`, and any type defined on them.** Convert anything else with
`fmt.Sprintf` first.
- **An expression returning `(T, error)` propagates its error out of `Render`**, with the source location attached.
- **Close every tag in the source, void elements included** — `<br/>`, `<img src="x"/>`. templ strips the `/` from void
elements in the output, so the source form and the rendered form differ by design.
- **Text starting with `if`, `for`, or `switch` parses as a statement.** Wrap it as an expression — `{ "if you must" }`
— or capitalize the keyword.
- **A comment inside a `templ` block is an HTML comment and reaches the output.** `//` and `/* */` work only outside a
`templ` block, and HTML comments do not nest.
- **Bind an expensive call to a `{{ }}` variable*