litestar-htmx
Installation
SKILL.md
HTMX
Execution Workflow
- Decide whether HTMX should be enabled globally with
HTMXPluginor locally withrequest_class=HTMXRequest. - Shape handlers around one contract: full page for normal requests, fragment or HTMX-aware response for HTMX requests.
- Read request context from
request.htmxinstead of hand-parsing HTMX headers. - Choose the right response primitive:
HTMXTemplatefor rendered fragments or the dedicated HTMX response classes for redirect, refresh, swap, retarget, event, history, or polling behavior. - Keep templates small and swap-oriented so each endpoint returns only the markup or signal the target element needs.
- Verify both non-HTMX and HTMX behaviors in tests, including headers, redirect semantics, and fragment shape.