Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

htmx

/htmx

Pomaga używać htmx w aplikacjach Go z templ: atrybuty hx-*, strategie swap, triggery, aktualizacje OOB, SSE, WebSockety, formularze, przekierowania, debounce i integracja z handlerami.

Repozytorium
gopher-ai ↗
Licencja
MIT
Ostatnia zmiana repozytorium
20.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
5
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 20.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pomaga używać htmx w aplikacjach Go z templ: atrybuty hx-*, strategie swap, triggery, aktualizacje OOB, SSE, WebSockety, formularze, przekierowania, debounce i integracja z handlerami.

Oryginalny opis (EN)

htmx for Go/templ apps: hx-* attributes, swap strategies, triggers, OOB updates, SSE, WebSockets, forms, redirects, debounce, server integration. Trigger when user writes or pastes templates containing hx-* attributes, asks about HTMX swaps/triggers/OOB updates, or wires HTMX to a Go handler. SKIP generic web, fetch/AJAX, or templUI questions with no htmx context.

Jak działa

  1. Core Principles
  2. Reference Files
Sekcje z nagłówków SKILL.md, w oryginale · 60 linii, 408 słów
Podgląd SKILL.md
---
name: htmx
description: "htmx for Go/templ apps: hx-* attributes, swap strategies, triggers, OOB updates, SSE, WebSockets, forms, redirects, debounce, server integration. Trigger when user writes or pastes templates containing hx-* attributes, asks about HTMX swaps/triggers/OOB updates, or wires HTMX to a Go handler. SKIP generic web, fetch/AJAX, or templUI questions with no htmx context."
---

# htmx Best Practices & Go/Templ Integration

Apply correct htmx patterns when building hypermedia-driven web applications, especially with Go and templ.

## Core Principles

- **Return HTML fragments, not JSON** — htmx is designed for hypermedia; the server returns rendered HTML
- **Use HTML attributes, not JavaScript** — prefer `hx-*` attributes over `htmx.ajax()` or `fetch()` calls
- **Server controls behavior** — use response headers (`HX-Retarget`, `HX-Reswap`, `HX-Redirect`) for control flow
- **Check `HX-Request` header** — return fragments for htmx requests, full pages for normal requests
- **Don't mix paradigms** — avoid using `fetch()` alongside htmx in the same page; pick one approach

---

## Reference Files

Read the relevant file for detailed patterns, code examples, and best practices:

### `templ-integration.md` — Templ + htmx
- CRITICAL: Templ interpolation rules (dynamic attributes, `{ }` vs quoted strings)
- Dynamic JSON in `hx-vals` — use `json.Marshal`, not `fmt.Sprintf`
- URL construction patterns (fmt.Sprintf, concatenation, templ.URL)
- Templ component patterns (spread attributes, conditional attributes, full page vs partial)
- JavaScript and `hx-on` events in templ (JSFuncCall, OnceHandle, event name syntax)
- Embedding Go data in script tags
- Alpine.js listening to htmx events from templ

### `go-handlers.md` — Go Server Patterns
- Fragment vs full page response (`isHTMXRequest` helper)
- Separate routes for partials vs full pages
- Multi-target OOB responses (writing multiple components)
- htmx-aware redirects (`HX-Redirect` instead of HTTP 302)
- Event-driven list reloads with `HX-Trigger` header
- Delete with empty response
- Validation error re-rendering with error state

### `attributes-reference.md` — Swap, Triggers & Headers
- Swap strategies table (innerHTML, outerHTML, delete, morph, etc.) and modifiers
- Trigger patterns (events, special triggers, modifiers, filters, multiple triggers)
- Self-terminating polling pattern
- Request headers (sent automatically) and response headers (server control)
- Out-of-Band (OOB) swap patterns and gotchas

### `patterns-and-extensions.md` — Advanced Patterns
- Error handling (4xx/5xx don't swap by default — 4 solutions)
- Filter state preservation with `hx-include` and `hx-push-url`
- Forms and file uploads (auto-submit, progress, external values, radio/checkbox)
- Inline editing pattern (read-only row ↔ edit form)
- Alpine.js + htmx integration (separation of concerns, event listening, `htmx.process()`)
- Loading indicators and disabled elements
- Sync strategies (`hx-sync`: replace, abort, queue)
- Target selectors (this, closest, next, previous, find)
- Extensions (json-enc, SSE, WebSockets, head-support, preload)
- JavaScript event patterns (delegation, afterSwap vs afterSettle, `htmx.onLoad`)
- Common anti-patterns table
- CSRF protection pattern
- Configuration via meta tag
- Useful Go libraries (htmx-go, go-htmx, typed-htmx-go)
Pliki w paczce (5)
  • SKILL.md 3 KB
  • attributes-reference.md 5 KB
  • go-handlers.md 3 KB
  • patterns-and-extensions.md 14 KB
  • templ-integration.md 9 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · gopherguides/gopher-ai100MIT
ericrisco/rsc-harness100MIT
j4flmao/agent-skills100MIT
G1Joshi/Agent-Skills100MIT
piyiotisk/htmx-skills100MIT

Migawka bazy z 28.10.2026 · wersja paczki 14ddae50ca3d (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

  • 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.
  • 95goldr-app
    Tworzy i rozwija aplikacje w frameworku Goldr dla Go: trasy, układy, szablony templ, formularze, CSRF i HTMX.
  • 100htmx-progressive-enhancement
    Pomaga budować UI sterowane przez serwer w htmx: kompozycje atrybutów hx-*, strategie swap (innerHTML, outerHTML, morph), aktualizacje out-of-band i migracja z SPA do HTML z serwera.
  • 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.
  • 100htmx-development
    Wdraża HTMX w Drupalu: migracja z AJAX, dynamiczne formularze, zależne listy rozwijane, nieskończone przewijanie, walidacja w czasie rzeczywistym i wieloetapowe kreatory.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.