htmx
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.
What this skill does
# 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)
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.