htmx
Installation
SKILL.md
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 overhtmx.ajax()orfetch()calls - Server controls behavior — use response headers (
HX-Retarget,HX-Reswap,HX-Redirect) for control flow - Check
HX-Requestheader — 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: