Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Coordinate htmx with lightweight browser-side interactivity. Use when adding Alpine.js, _hyperscript, local UI state, custom events, dialogs, transitions, keyboard behavior, or browser-only state around htmx swaps in a server-rendered app.
.claude/skills/hashgraph-online-htmx-interactivity/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 24% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 113% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 33% | 0% |
Use this skill when htmx handles server trips but the page still needs local browser behavior. Keep the ownership line explicit so server-rendered HTML and client-side state do not fight each other.
_hyperscript is best for short event-driven behaviors attached to markup.Keep persistent Alpine state outside htmx targets that will be replaced. If htmx swaps the element that owns x-data, that state resets.
_hyperscript syntax as part of the template layer.Avoid _hyperscript for complex state machines, security-sensitive logic, large data transforms, or behavior that needs substantial tests.
Use events as the bridge between server results and local browser state:
_hyperscript, or plain JavaScript listens for the event.Prefer domain event names over implementation names:
html<section x-data="{ open: true }" @profile-saved.window="open = false"> <form hx-post="/profile" hx-target="#profile-panel" hx-swap="outerHTML"> ... </form> </section>
Use lifecycle events for cross-cutting behavior:
htmx:configRequest for headers such as CSRF when the framework needs them.htmx:beforeRequest and htmx:afterRequest for instrumentation and loading behavior that attributes cannot express.htmx:beforeSwap for exceptional status handling.htmx:afterSwap or htmx:load for initializing third-party widgets in swapped content.Prefer htmx attributes such as hx-indicator and hx-disabled-elt before writing lifecycle JavaScript.
htmx.process from the htmx-js-api skill.aria-expanded, aria-controls, aria-selected, and aria-hidden from local state.Alpine, _hyperscript, inline event attributes, and hx-on can all affect Content Security Policy. Use htmx-security when adding or tightening CSP, accepting user-authored HTML, or choosing CSP-compatible builds.
x-html or equivalent APIs for untrusted content.Other measured skills in the registry, with their headline benchmark lift.