executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
htmx-js-apiUse the htmx JavaScript API for imperative integration in server-rendered apps. Use when calling htmx.ajax, htmx.process, htmx.trigger, htmx.on, htmx.off, htmx.onLoad, htmx.find, htmx.findAll, htmx.closest, htmx.addClass, htmx.removeClass, htmx.toggleClass, htmx.takeClass, configuring htmx.config, logging htmx events, or integrating non-htmx JavaScript with…
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this skill when declarative attributes are not enough. Prefer attributes first; reach for the JavaScript API to integrate with third-party widgets, dynamically injected markup, instrumentation, or programmatic request flows.
Use htmx attributes when the behavior is visible in the HTML and tied to one element. Use the JS API when:
Set global config once before relying on htmx behavior. Common examples:
htmx-security.Keep config close to where htmx is loaded so there is one source of truth.
Use htmx DOM helpers for concise integration code:
| Need | Methods |
|---|---|
| Find one element | htmx.find, htmx.closest |
| Find many elements | htmx.findAll |
| Remove an element | htmx.remove |
| Add a class | htmx.addClass |
| Remove a class | htmx.removeClass |
| Toggle a class | htmx.toggleClass |
| Make one element selected | htmx.takeClass |
Do not use helper calls to hide complex UI state that belongs in a component or server response.
htmx.on for delegated or global listeners.htmx.off when unregistering listeners from code that can mount/unmount.htmx.trigger to bridge plain JavaScript events into htmx behavior.htmx.onLoad for behavior that must run on newly loaded htmx content.Example:
htmx.on("saved", function (event) {
console.info("Saved", event.detail);
});
htmx.trigger("#results", "filters:changed");
Use htmx.ajax when code needs to initiate an htmx request while preserving htmx swap semantics.
htmx.ajax("GET", "/notifications", {
target: "#notifications",
swap: "innerHTML"
});
Before using htmx.ajax, ask whether a real link, button, or form with htmx attributes would be clearer and more accessible.
Use htmx.process(element) after non-htmx code injects markup that contains htmx attributes.
const panel = document.querySelector("#panel");
panel.innerHTML = htmlFromTrustedSource;
htmx.process(panel);
Only process trusted markup. If markup includes user content, review sanitization with htmx-security before insertion.
htmx.logAll() temporarily while diagnosing event/request behavior.htmx.logNone() after debugging.htmx.logger for structured local diagnostics.Use extension APIs only when a documented htmx extension or project-specific integration requires it. For WebSocket and SSE work, prefer htmx-realtime for transport design before writing extension code.
fetch() plus innerHTML.htmx.config from feature code after the app has started.