templ-syntax

Use this skill with progressive disclosure: start at Level 1, then read deeper sections only when needed.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "templ-syntax" with this command: npx skills add xe/site/xe-site-templ-syntax

Templ Syntax

Use this skill with progressive disclosure: start at Level 1, then read deeper sections only when needed.

Level 1: Fast Path

Use this skill when you need to write or fix .templ syntax.

  • Define a component with typed params.

  • Render values with { expr } .

  • Compose components with @OtherComponent(...) .

  • Use Go control flow (if , for , switch ) directly in markup.

  • Keep business logic in Go helpers, not inline in templates.

package components

templ Greeting(name string, isAdmin bool) { <h1>Hello, { name }</h1> if isAdmin { <p>Admin mode</p> } }

Level 2: Core Rules

  • Output: { value } auto-escapes text.

  • Dynamic attrs: class={ classes } , disabled?={ isDisabled } .

  • Children: accept with { children... } , pass with block syntax.

  • Composition: call components with @Component(...) .

  • Safety: URLs should use safe helpers (for example templ.URL(...) ) when appropriate.

Level 3: Common Patterns

templ Card(title string) { <section class="card"> <h2>{ title }</h2> <div>{ children... }</div> </section> }

templ UserList(users []string) { if len(users) == 0 { <p>No users</p> } else { <ul> for _, user := range users { <li>{ user }</li> } </ul> } }

Escalate to Other Skills

  • Building reusable UI APIs: use templ-components .

  • Wiring templates to handlers/routes: use templ-http .

  • Adding dynamic interactions: use templ-htmx .

References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

templ-htmx

No summary provided by upstream source.

Repository SourceNeeds Review
27-xe
General

templ-components

No summary provided by upstream source.

Repository SourceNeeds Review
24-xe
General

go-table-driven-tests

No summary provided by upstream source.

Repository SourceNeeds Review
13-xe
General

test_skill

import json import tkinter as tk from tkinter import messagebox, simpledialog

Archived SourceRecently Updated