Command Palette

Search for a command to run...

Назад к скиллам
скилл № 10174

htmx

Use when the user asks about htmx, hx-get, hx-post, hx-swap, hx-target, hypermedia/HATEOAS apps or server-driven partial page updates. Produces htmx…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить htmx в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

htmx

Purpose

Build hypermedia-driven web applications where the server sends HTML fragments in response to AJAX requests triggered by HTML attributes — no JavaScript required.

Agent Protocol

Trigger

Exact user phrases: "htmx setup", "htmx project", "htmx hx-get", "htmx hx-post", "htmx HATEOAS", "htmx hypermedia", "htmx server", "htmx ajax", "hypermedia app".

Input Context

Before activating, verify:

  • htmx is included (CDN script or npm).
  • What backend framework is used (Django, Rails, Go, Laravel, etc.).

Output Artifact

No file output. Produces HTML snippets with htmx attributes as text.

Response Format

HTML with htmx attributes:

<button hx-get="/api/data" hx-target="#result" hx-swap="innerHTML">
  Load Data
</button>
<div id="result"></div>

No preamble. No postamble. No explanations. Compress output — why use many token when few do trick.

Completion Criteria

  • AJAX requests use hx-get, hx-post, hx-put, hx-patch, or hx-delete.
  • Responses are HTML fragments, not JSON.
  • Target element specified with hx-target or defaults to the triggering element.
  • Swap strategy chosen: innerHTML, outerHTML, beforebegin, afterbegin, beforeend, afterend.
  • HATEOAS: server returns next-available actions as hypermedia links.
  • History and URL updates via hx-push-url or hx-replace-url.
  • Validation and feedback via hx-trigger, hx-indicator, hx-disable.

Max Response Length

~4096 tokens.

Component Architecture / Decision Trees

Architecture Options

Approach Trade-off When to Use
hx-get fragment swap Simple data fetch, GET semantics Read operations, lazy load
hx-post form with validation Form submission, 422 errors Mutations with validation
hx-boost on links/forms Full-page SPA-like navigation Enhancing existing HTML
hx-trigger="every 10s" Polling for updates Real-time-ish dashboards
hx-trigger="revealed" Lazy load below fold Performance optimization
hx-trigger="intersect" Viewport-based loading Infinite scroll
Server-Sent Events (hx-sse) Server push Real-time notifications
WebSockets (hx-ws) Bidirectional stream Chat, collaborative editing

Decision Tree: Request Trigger

What triggers the AJAX request?
  Button/link click -> hx-trigger="click" (default for buttons, links, forms)
  Page load -> hx-trigger="load"
  Element scrolled into view -> hx-trigger="revealed"
  Input change -> hx-trigger="change, keyup delay:300ms" (search-as-you-type)
  Time interval -> hx-trigger="every 5s" (polling)
  Intersection observer -> hx-trigger="intersect threshold:0.5"
  Custom JS event -> hx-trigger="custom-event from:body"
  Focus loss -> hx-trigger="focusOut delay:200ms"

Decision Tree: Swap Strategy

What should happen with the response?
  Replace target's children -> hx-swap="innerHTML" (default)
  Replace the whole target -> hx-swap="outerHTML"
  Insert before the target -> hx-swap="beforebegin"
  Insert after the target -> hx-swap="afterend"
  Append inside target -> hx-swap="beforeend"
  Prepend inside target -> hx-swap="afterbegin"
  Execute response JS only -> hx-swap="none"
  Remove the target -> hx-swap="delete"

Hypermedia Architecture Decision

How much of the page does this interaction affect?
  Small widget update -> Return fragment, swap innerHTML on container
  Form submission with errors -> Return updated form HTML with 422 status
  Section replacement (tab) -> Return section HTML, swap outerHTML on section
  Full page navigation -> Use hx-boost on links for seamless navigation
  Modal/dialog -> Return dialog HTML, swap innerHTML on modal container
  Infinite scroll -> Return next page items, swap beforeend on list

Component Design Patterns

Button with Loading State

<button hx-get="/api/refresh" hx-target="#data" hx-indicator="#spinner">
  Refresh
  <img id="spinner" class="htmx-indicator" src="/spinner.gif" />
</button>

Form with Validation

<form hx-post="/contacts" hx-target="#form-area" hx-swap="outerHTML">
  <input type="text" name="email" hx-get="/contacts/check-email"
         hx-trigger="change" hx-target="#email-error">
  <div id="email-error"></div>
  <button type="submit">Submit</button>
</form>

Server returns updated form HTML with class "error" on invalid fields and HTTP 422 status.

Infinite Scroll

<div hx-get="/posts?page=2" hx-trigger="revealed" hx-swap="beforeend" hx-target="#posts">
</div>
<div id="posts">
  <!-- Existing posts rendered by server -->
</div>

Tabs via Fragment Swap

<div hx-target="#tab-content" hx-swap="innerHTML">
  <a hx-get="/tabs/info">Info</a>
  <a hx-get="/tabs/settings">Settings</a>
</div>
<div id="tab-content">
  <!-- Server-rendered tab content -->
</div>

Inline Edit

<div hx-get="/contacts/1/edit" hx-trigger="dblclick" hx-target="this" hx-swap="outerHTML">
  <spa
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/htmx-advanced-patterns.md
  • references/htmx-advanced.md
  • references/htmx-deployment.md
  • references/htmx-fundamentals.md
  • references/htmx-patterns.md
  • references/htmx-server-integration.md
  • references/htmx-setup.md
  • references/htmx-testing.md

FAQ

Что делает скилл htmx?

Use when the user asks about htmx, hx-get, hx-post, hx-swap, hx-target, hypermedia/HATEOAS apps or server-driven partial page updates. Produces htmx attributes, HTML-fragment server responses and CSRF-safe request handling. Not for client-side reactivity inside a page (use alpinejs).

Как установить скилл htmx?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл htmx запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить htmx с