Render HTMX UI Skill
Use this skill to build or modify server-rendered interfaces with Go templates and HTMX.
Workflow
- Read HTMX Integration Patterns and Rendering Primitives.
- Inspect existing templates in
app/posts/templates/and shared templates inapp/views/templates/. - Use full page templates for normal navigation.
- Use
.partial.htmltemplates for modal, list, card, and refresh fragments. - Render with
Renderer.Render,Renderer.RenderPartial, orRenderer.RenderComponentas appropriate. - Include CSRF tokens in forms with
{{.CSRFToken}}. - Run
go test ./...; for renderer changes, includego test ./app/gojang/views/renderers.
HTMX Patterns
- Open modals with
hx-get. - Submit creates with
hx-post, edits withhx-put, and deletes withhx-delete. - Use
HX-Trigger: closeModalafter successful modal actions. - Use
HX-RetargetandHX-Reswapwhen updating a different target. - Return validation errors by re-rendering form partials with
TemplateData.Errors.
Template Conventions
Full pages define title and content. Partials use the .partial.html suffix and render without base.html. Shared components live in app/views/templates/components/. Keep business logic in handlers or view-model helpers, not templates.