templ
Installation
SKILL.md
templ
Type-safe Go HTML templating. Components defined in .templ files compile to Go functions
returning templ.Component via templ generate. Outside templ blocks = ordinary Go.
Inside = templ syntax.
References
Extended examples and detailed patterns for the rules below:
| Topic | Reference | Contents |
|---|---|---|
| Template syntax, expressions, control flow, raw Go blocks | ${CLAUDE_SKILL_DIR}/references/syntax.md |
File structure, expression types, error propagation, auto-escaping, control flow examples |
| Component definition, composition, children, fragments | ${CLAUDE_SKILL_DIR}/references/components.md |
Component interface, @ composition, children context API, render-once, fragment rendering |
| Boolean, conditional, spread attributes, key expressions | ${CLAUDE_SKILL_DIR}/references/attributes.md |
Attribute types with code examples, spread value table, URL/JS/JSON attribute patterns |
| View models, layouts, context, html/template interop | ${CLAUDE_SKILL_DIR}/references/patterns.md |
Props struct pattern, nested layouts, context helpers with middleware, Go template interop |
| Script/style tags, inline events, data passing to JS | ${CLAUDE_SKILL_DIR}/references/javascript.md |
JSFuncCall/JSExpression/JSONString/JSONScript API, IIFE pattern, method summary table |
| Class patterns, CSS components, style attributes | ${CLAUDE_SKILL_DIR}/references/styling.md |
Class toggling approaches (KV, maps, raw Go), CSS component scoping, style sanitization |