templ-syntax
/templ-syntax
Uczy składni plików .templ: wyrażeń, warunków, pętli i integracji z kodem Go, z przykładami.
Ocena i bezpieczeństwo
- Pliki w paczce
- 4
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 2
Brak sygnałów. Repozytorium zmienione 13.11.2026, bez odwołań do wycofanych modeli i API.
Zlib, otwarta.
Co robi i kiedy
Uczy składni plików .templ: wyrażeń, warunków, pętli i integracji z kodem Go, z przykładami.
Wyzwalacze z opisu
Oryginalny opis (EN)
Learn and write templ component syntax including expressions, conditionals, loops, and Go integration. Use when writing .templ files, learning templ syntax, or mentions 'templ component', 'templ expressions', or '.templ file syntax'.
Jak działa
- Level 1: Fast Path
- Level 2: Core Rules
- Level 3: Common Patterns
- Escalate to Other Skills
- References
Podgląd SKILL.md
---
name: templ-syntax
description: Learn and write templ component syntax including expressions, conditionals, loops, and Go integration. Use when writing .templ files, learning templ syntax, or mentions 'templ component', 'templ expressions', or '.templ file 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.
1. Define a component with typed params.
2. Render values with `{ expr }`.
3. Compose components with `@OtherComponent(...)`.
4. Use Go control flow (`if`, `for`, `switch`) directly in markup.
5. Keep business logic in Go helpers, not inline in templates.
```templ
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
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
- Foundations: `resources/foundations.md`
- Patterns: `resources/patterns.md`
- Reference: `resources/reference.md`
- templ docs: https://templ.guide
- Syntax and expressions: https://templ.guide/syntax-and-usage/
Pliki w paczce (4)
- SKILL.md 2 KB
- resources/foundations.md 1 KB
- resources/patterns.md 2 KB
- resources/reference.md 2 KB
Wersje
W bazie nie ma innych skilli o nazwie templ-syntax.
Migawka bazy z 13.11.2026 · wersja paczki 04c9137d8d48 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100templ-components
Tworzy wielokrotnego użytku komponenty UI w templ z właściwościami, dziećmi i wzorcami kompozycji. - 100templ-http
Łączy komponenty templ z serwerem Go przez net/http: tworzy trasy, handlery i wyświetla widoki. - 95templ-htmx
Buduje interaktywne aplikacje oparte na hipermediach z templ i HTMX: dynamiczne interfejsy, aktualizacje w czasie rzeczywistym i interakcje AJAX. - 100templui
Podpowiada komponenty templUI v1 i shadcn-templ v2 w aplikacjach Go/templ: instalację, bloki UI i konwersję HTML. - 100templ-to-gsx-migration
Prowadzi migrację komponentów templ do gsx lub współistnienie obu w jednym module: deklaracje, dzieci, wywołania między pakietami. - 100implement
Implementuje przypadki użycia i naprawia błędy w aplikacji webowej w Go: zapytania sqlc, serwisy, walidacja formularzy, handlery net/http, widoki templ z htmx i trasy.