Token导航 LogoToken导航

Agent Skill · 研究检索

htmx-expert(htmlx 专家)

htmx-expert 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

htmx-expert 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 46,825。

总安装 760周安装 32GitHub Stars 1下载 266核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:htmx-expert(htmlx 专家)
来源仓库:https://github.com/lullabot/htmx-expert
仓库路径:skills/htmx-expert
安装命令:
npx skills add https://github.com/lullabot/htmx-expert --skill htmx-expert
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/lullabot/htmx-expert --skill htmx-expert

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于检索 HTMX 最佳实践、常见问题与社区解决方案。适合在 Codex、Claude、Cursor、Gemini CLI 中获取技术参考与支持。通过 GitHub 仓库安装,需联网获取最新文档与示例。建议交叉验证多个来源以确保信息准确性。涉及生产环境配置时应进行沙箱测试。

htmx-expert 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/htmx-expert

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/lullabot/htmx-expert --skill htmx-expert;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

htmx-expert 怎么安装?

在终端执行 npx skills add https://github.com/lullabot/htmx-expert --skill htmx-expert。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

htmx-expert 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

htmx-expert 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

htmx-expert 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

htmx-expert 用的人多吗?

公开数据是累计安装 760 次,近一周安装 32 次,下载 266 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

htmx-expert 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
htmx-expert

htmlx 专家 · 本页

7601操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

htmx Expert

This skill provides comprehensive guidance for htmx development, the library that extends HTML to access modern browser features directly without JavaScript.

Core Philosophy

htmx represents a paradigm shift toward hypermedia-first web development. Instead of treating HTML as a presentation layer with JSON APIs, htmx extends HTML to handle AJAX requests, CSS transitions, WebSockets, and Server-Sent Events directly. Servers respond with HTML fragments, not JSON.

When to Use This Skill

  • Implementing htmx attributes and interactions
  • Building hypermedia-driven applications
  • Debugging htmx request/response cycles
  • Converting SPA patterns to htmx approaches
  • Understanding htmx events and lifecycle
  • Configuring htmx extensions
  • Implementing proper security measures

Core Attributes Reference

HTTP Verb Attributes

AttributePurposeDefault Trigger
hx-getIssue GET requestclick
hx-postIssue POST requestclick (form: submit)
hx-putIssue PUT requestclick
hx-patchIssue PATCH requestclick
hx-deleteIssue DELETE requestclick

Request Control

  • hx-trigger: Customize when requests fire

- Modifiers: changed, delay:Xms, throttle:Xms, once - Special triggers: load, revealed, every Xs - Extended: from:<selector>, target:<selector>

  • hx-include: Include additional element values in request
  • hx-params: Filter which parameters to send (*, none, not <param>, <param>)
  • hx-headers: Add custom headers (JSON format)
  • hx-vals: Add values to request (JSON format)
  • hx-encoding: Set encoding (multipart/form-data for file uploads)

Response Handling

  • hx-target: Where to place response content

- Extended selectors: this, closest <sel>, next <sel>, previous <sel>, find <sel>

  • hx-swap: How to insert content

- innerHTML (default), outerHTML, beforebegin, afterbegin, beforeend, afterend, delete, none - Modifiers: swap:Xms, settle:Xms, scroll:top, show:top

  • hx-select: Select subset of response to swap
  • hx-select-oob: Select elements for out-of-band swaps

State Management

  • hx-push-url: Push URL to browser history
  • hx-replace-url: Replace current URL in history
  • hx-history: Control history snapshot behavior
  • hx-history-elt: Specify element to snapshot

UI Indicators

  • hx-indicator: Element to show during request (add htmx-indicator class)
  • hx-disabled-elt: Elements to disable during request

Security & Control

  • hx-confirm: Show confirmation dialog before request
  • hx-validate: Enable HTML5 validation on non-form elements
  • hx-disable: Disable htmx processing on element and descendants
  • hx-sync: Coordinate requests between elements

Implementation Patterns

Basic AJAX Pattern

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

Active Search

<input type="search"
       name="q"
       hx-get="/search"
       hx-trigger="keyup changed delay:300ms"
       hx-target="#search-results">
<div id="search-results"></div>

Infinite Scroll

<div hx-get="/items?page=2"
     hx-trigger="revealed"
     hx-swap="afterend">
  Loading more...
</div>

Polling

<div hx-get="/status"
     hx-trigger="every 5s"
     hx-swap="innerHTML">
  Status: Unknown
</div>

Form Submission

<form hx-post="/submit"
      hx-target="#response"
      hx-swap="outerHTML">
  <input name="email" type="email" required>
  <button type="submit">Submit</button>
</form>

Out-of-Band Updates

Server response can update multiple elements:

<!-- Main response -->
<div id="main-content">Updated content</div>

<!-- OOB updates -->
<div id="notification" hx-swap-oob="true">New notification!</div>
<span id="counter" hx-swap-oob="true">42</span>

Loading Indicators

<button hx-get="/slow-endpoint"
        hx-indicator="#spinner">
  Load
</button>
<img id="spinner" class="htmx-indicator" src="/spinner.gif">

CSS for indicators:

.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator {
  opacity: 1;
}

Server Response Patterns

Return HTML Fragments

Server endpoints return HTML, not JSON:

# Flask example
@app.route('/search')
def search():
    q = request.args.get('q', '')
    results = search_database(q)
    return render_template('_search_results.html', results=results)

Response Headers

htmx recognizes special headers:

HeaderPurpose
HX-LocationClient-side redirect (with context)
HX-Push-UrlPush URL to history
HX-RedirectFull page redirect
HX-RefreshRefresh the page
HX-ReswapOverride hx-swap value
HX-RetargetOverride hx-target value
HX-TriggerTrigger client-side events
HX-Trigger-After-SettleTrigger after settle
HX-Trigger-After-SwapTrigger after swap

Detect htmx Requests

Check HX-Request header to differentiate htmx from regular requests:

if request.headers.get('HX-Request'):
    return render_template('_partial.html')
else:
    return render_template('full_page.html')

Events

Key Events

EventWhen Fired
htmx:loadElement loaded into DOM
htmx:configRequestBefore request sent (modify params/headers)
htmx:beforeRequestBefore AJAX request
htmx:afterRequestAfter AJAX request completes
htmx:beforeSwapBefore content swap
htmx:afterSwapAfter content swap
htmx:afterSettleAfter DOM settles
htmx:confirmBefore confirmation dialog
htmx:validation:validateCustom validation hook

Event Handling

Using hx-on*:

<button hx-get="/data"
        hx-on:htmx:before-request="console.log('Starting...')"
        hx-on:htmx:after-swap="console.log('Done!')">
  Load
</button>

Using JavaScript:

document.body.addEventListener('htmx:configRequest', function(evt) {
  evt.detail.headers['X-Custom-Header'] = 'value';
});

Security Best Practices

  1. Escape All User Content: Prevent XSS through server-side template escaping
  2. Use hx-disable: Prevent htmx processing on untrusted content
  3. Restrict Request Origins: htmx.config.selfRequestsOnly = true;
  4. Disable Script Processing: htmx.config.allowScriptTags = false;
  5. Include CSRF Tokens: <body hx-headers='{"X-CSRF-Token": "{{csrf_token}}"}'>
  6. Content Security Policy: Layer browser-level protections

Configuration

Key htmx.config options:

htmx.config.defaultSwapStyle = 'innerHTML';
htmx.config.timeout = 0; // Request timeout (0 = none)
htmx.config.historyCacheSize = 10;
htmx.config.globalViewTransitions = false;
htmx.config.scrollBehavior = 'instant'; // or 'smooth', 'auto'
htmx.config.selfRequestsOnly = false;
htmx.config.allowScriptTags = true;
htmx.config.allowEval = true;

Or via meta tag:

<meta name="htmx-config" content='{"selfRequestsOnly":true}'>

Extensions

Loading Extensions

<script src="https://unpkg.com/htmx-ext-<name>@<version>/<name>.js"></script>
<body hx-ext="extension-name">

Common Extensions

  • head-support: Merge head tag information across requests
  • idiomorph: Morphing swaps (preserves element state)
  • sse: Server-Sent Events support
  • ws: WebSocket support
  • preload: Content preloading
  • response-targets: HTTP status-based targeting

Debugging

Enable logging:

htmx.logAll();

Check request headers in Network tab:

  • HX-Request: true
  • HX-Target: <target-id>
  • HX-Trigger: <trigger-id>
  • HX-Current-URL: <page-url>

Progressive Enhancement

Structure for graceful degradation:

<form action="/search" method="POST">
  <input name="q"
         hx-get="/search"
         hx-trigger="keyup changed delay:300ms"
         hx-target="#results">
  <button type="submit">Search</button>
</form>
<div id="results"></div>

Non-JavaScript users get form submission; JavaScript users get AJAX.

Third-Party Integration

Initialize libraries on htmx-loaded content:

htmx.onLoad(function(content) {
  content.querySelectorAll('.datepicker').forEach(el => {
    new Datepicker(el);
  });
});

For programmatically added htmx content:

htmx.process(document.getElementById('new-content'));

Common Gotchas

  1. ID Stability: Keep element IDs stable for CSS transitions
  2. Swap Timing: Default 0ms swap delay; use swap:100ms for transitions
  3. Event Bubbling: htmx events bubble; use event.detail for data
  4. Form Data: Only named inputs are included in requests
  5. History: History snapshots store innerHTML, not full DOM state

Development Environment Requirements

htmx Requires HTTP (Not file://)

htmx will NOT work when opening HTML files directly from the filesystem (file:// URLs). This causes htmx:invalidPath errors because:

  • Browsers block cross-origin requests from file:// URLs
  • htmx needs to make HTTP requests to endpoints

Solution: Always serve htmx applications via HTTP server:

# Simple Python server (recommended for development)
python3 -m http.server 8000

# Or create a custom server with API endpoints
python3 server.py

Minimal Development Server Pattern

For htmx examples and prototypes, create a simple Python server that:

  1. Serves static files (HTML, CSS, JS)
  2. Provides API endpoints that return HTML fragments
from http.server import HTTPServer, SimpleHTTPRequestHandler
from urllib.parse import urlparse, parse_qs

class HtmxHandler(SimpleHTTPRequestHandler):
    def do_GET(self):
        path = urlparse(self.path).path

        if path.startswith("/api/"):
            # Return HTML fragment
            self.send_response(200)
            self.send_header("Content-Type", "text/html")
            self.end_headers()
            self.wfile.write(b"<div>Response HTML</div>")
        else:
            # Serve static files
            super().do_GET()

HTTPServer(("", 8000), HtmxHandler).serve_forever()

Practical Implementation Lessons

Loading Indicators with CSS Spinner

Use CSS-only spinners instead of image files for better performance:

<button hx-get="/api/slow"
        hx-indicator="#spinner">
    Load
    <span id="spinner" class="spinner htmx-indicator"></span>
</button>

<style>
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3d72d7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
</style>

Input Search with Proper Trigger

Use input changed instead of keyup changed for better UX (catches paste, autofill):

<input type="search"
       name="q"
       hx-get="/api/search"
       hx-trigger="input changed delay:300ms, search"
       hx-target="#results">

The search trigger handles the search input's clear button (X).

Self-Targeting with Polling

For elements that replace themselves (polling), use hx-target="this":

<div hx-get="/api/time"
     hx-trigger="load, every 2s"
     hx-target="this"
     hx-swap="innerHTML">
    Loading...
</div>

Row Updates with closest

For list items where each row has its own update button:

<li id="item-1">
    <span>Item 1</span>
    <button hx-get="/api/update-item/1"
            hx-target="closest li"
            hx-swap="outerHTML">
        Update
    </button>
</li>

Server returns complete <li> element with new htmx attributes intact.

Event Attribute Syntax

The hx-on:: syntax uses double colons for htmx events:

<!-- Correct -->
<button hx-on::before-request="console.log('starting')">

<!-- Also correct (older syntax) -->
<button hx-on:htmx:before-request="console.log('starting')">

Combining Multiple Triggers

Separate triggers with commas:

<div hx-get="/api/data"
     hx-trigger="load, every 5s, click from:#refresh-btn">

Form POST with Loading State

Combine hx-indicator and hx-disabled-elt for complete UX:

<form hx-post="/api/submit"
      hx-target="#result"
      hx-indicator="#spinner"
      hx-disabled-elt="find button">
    <input name="email" required>
    <button type="submit">
        Submit
        <span id="spinner" class="spinner htmx-indicator"></span>
    </button>
</form>

Additional Resources

For detailed reference, consult:

平台分布

Codex

40.29%
按下载量换算107

Claude

27.41%
按下载量换算73

Cursor

19.03%
按下载量换算51

Gemini CLI

9.25%
按下载量换算25

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills