htmx

Enable server-driven interactivity in web pages using htmx attributes.

11|2|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill htmx-the-perfect-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: htmx
Source: https://github.com/the-perfect-developer/the-perfect-opencode/tree/main/.opencode/skills/htmx
Command: npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill htmx-the-perfect-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Building dynamic, interactive web interfaces often requires heavy JavaScript. HTMX enables server-driven HTML updates directly from HTML attributes, reducing boilerplate and keeping logic on the server.

Core Features & Use Cases

  • Declarative AJAX with HTML attributes (hx-get, hx-post, hx-put, hx-delete) to fetch HTML fragments.
  • Flexible targeting and swapping (hx-target, hx-swap) for partial page updates, modals, and in-page components.
  • Practical patterns like live search, infinite scroll, inline editing, and form handling with server-rendered responses.

Quick Start

Include the htmx library in your page and start annotating elements with hx-* attributes to drive server-rendered interactions.

Frequently Asked Questions about htmx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add AJAX interactivity to server-rendered HTML without writing JavaScript?

You can add AJAX interactivity to server-rendered HTML by annotating elements with hx-get and hx-post attributes. These attributes fetch HTML fragments from the server and swap them into the DOM, enabling dynamic page updates without writing heavy client-side JavaScript.

What is the best way to build live search or infinite scroll with server-rendered HTML fragments?

The best way to build live search or infinite scroll is using htmx attributes like hx-get to fetch and swap HTML fragments. By targeting specific DOM elements with hx-target and controlling insertion with hx-swap, you can update page components dynamically from server responses.

Do I need a backend framework to use htmx for partial page updates?

Yes, you need a backend server capable of rendering HTML fragments to use htmx for partial page updates. The client executes hx-* attributes to send requests, but the server must process these requests and return the HTML fragments that will be swapped into the page.

How do hx-target and hx-swap control DOM updates in progressive enhancement?

In progressive enhancement, hx-target specifies which DOM element receives the server response, and hx-swap determines how the fetched HTML fragment replaces or appends to existing content. Together they provide flexible targeting for partial page updates, modals, and in-page components.

Can I handle form submissions with server-rendered responses instead of JSON APIs?

You can handle form submissions with server-rendered responses by using hx-post on form elements. This sends the form data to the server and swaps the returned HTML fragment back into the page, maintaining logic on the server and reducing boilerplate.

When should I avoid using htmx for web interaction over a heavy JavaScript framework?

You should avoid using htmx if your application requires complex client-side state management rather than server-driven HTML updates. Htmx relies on the server to render and return HTML fragments, keeping logic server-side, which may not suit highly offline or client-heavy architectural contexts.