htmx-interaction-patterns
Skill17 starsChanged 5 months agoApache-2.0Archived repositoryView on GitHub
Build dynamic web interfaces with htmx using hypermedia-driven patterns for partial page updates, lazy loading, infinite scroll, and server-sent events without writing JavaScript. Triggers on htmx usage, hypermedia architecture, or progressive enhancement requests.
1 other project uses a version of this.
Other versions1 project uses a version of this.
Word for word · 1
- organvm-iv-taxis/a-i--skills★ 17100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository170 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- algorithmic-artSkill
- audio-engineering-patternsSkill
- canvas-designSkill
- creative-writing-craftSkill
- generative-art-algorithmsSkill
- generative-art-deploymentSkill
- generative-music-composerSkill
- interactive-theatre-designerSkill
- modular-synthesis-philosophySkill
- movement-notation-systemsSkill
- narratological-algorithmsSkill
- natural-center-extractionSkill
- react-three-fiber-patternsSkill
- reality-tv-narrative-analyzerSkill
- script-analysis-dramaturgicalSkill
- theme-factorySkill
- three-js-interactive-builderSkill
- corpus-persona-extractionSkill
- data-ingestion-pipelineSkill
- data-pipeline-architectSkill
- data-storytelling-analystSkill
- market-gap-analysisSkill
- ml-experiment-trackerSkill
- prompt-atom-formalizationSkill
- sql-query-optimizerSkill
- systemic-product-analystSkill
- time-series-analystSkill
- accessibility-patternsSkill
- agent-testing-patternsSkill
- api-design-patternsSkill
- artifacts-builderSkill
- backend-implementation-patternsSkill
- browser-extension-patternsSkill
- cli-tool-designSkill
- code-refactoring-patternsSkill
- code-review-checklistSkill
- coding-standards-enforcerSkill
- community-platform-patternsSkill
- configuration-managementSkill
- continuous-learning-agentSkill
- data-backup-patternsSkill
- database-migration-patternsSkill
- deployment-cicdSkill
- docker-containerizationSkill
- dotfile-systems-architectSkill
- error-handling-logging-patternsSkill
- fastapi-patternsSkill
- feature-workflow-orchestratorSkill
- frontend-design-systemsSkill
- fullstack-starter-packSkill
- gcp-resource-optimizerSkill
- iterative-code-explorationSkill
- json-schema-designSkill
- mcp-builderSkill
- mcp-server-orchestratorSkill
- mobile-platform-architectSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 206
Update multiple elements from one response:
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
htmx Interaction Patterns
Build dynamic interfaces with HTML-over-the-wire — server renders HTML fragments, htmx swaps them in.
Core Concepts
htmx extends HTML with attributes that make AJAX requests and swap content — no JavaScript required.
<!-- Click button → GET /items → replace #item-list content -->
<button hx-get="/items" hx-target="#item-list" hx-swap="innerHTML">
Load Items
</button>
<div id="item-list"></div>Key Attributes
| Attribute | Purpose | Example |
hx-get | GET request | hx-get="/api/items" |
hx-post | POST request | hx-post="/api/items" |
hx-put | PUT request | hx-put="/api/items/1" |
hx-delete | DELETE request | hx-delete="/api/items/1" |
hx-target | Where to put response | hx-target="#results" |
hx-swap | How to insert | hx-swap="outerHTML" |
hx-trigger | When to fire | hx-trigger="click" |
hx-indicator | Loading indicator | hx-indicator="#spinner" |
Swap Strategies
| Strategy | Behavior |
innerHTML | Replace children (default) |
outerHTML | Replace entire target element |
afterbegin | Insert as first child |
beforeend | Insert as last child |
beforebegin | Insert before target |
afterend | Insert after target |
delete | Remove target |
none | No DOM update |
Common Patterns
Search with Debounce
<input type="search" name="q"
hx-get="/search"
hx-trigger="input changed delay:300ms"
hx-target="#results"
hx-indicator="#search-spinner"
placeholder="Search skills...">
<span id="search-spinner" class="htmx-indicator">Searching...</span>
<div id="results"></div>Server returns an HTML fragment:
@app.get("/search")
async def search(q: str = ""):
results = search_skills(q)
return HTMLResponse(render_results(results))Inline Editing
<!-- View mode -->
<div id="skill-42" hx-get="/skills/42/edit" hx-trigger="dblclick" hx-swap="outerHTML">
<h3>testing-patterns</h3>
<p>Write effective tests across the stack...</p>
</div>
<!-- Edit mode (returned by server) -->
<form id="skill-42" hx-put="/skills/42" hx-swap="outerHTML">
<input name="name" value="testing-patterns">
<textarea name="description">Write effective tests...</textarea>
<button type="submit">Save</button>
<button hx-get="/skills/42" hx-swap="outerHTML">Cancel</button>
</form>Infinite Scroll
<div id="item-list">
<!-- Items rendered here -->
<div hx-get="/items?page=2"
hx-trigger="revealed"
hx-swap="outerHTML">
Loading more...
</div>
</div>Server returns items + next trigger:
<div class="item">Item 11</div>
<div class="item">Item 12</div>
<!-- Next page trigger -->
<div hx-get="/items?page=3" hx-trigger="revealed" hx-swap="outerHTML">
Loading more...
</div>Lazy Loading
<div hx-get="/dashboard/metrics" hx-trigger="load" hx-swap="innerHTML">
<div class="skeleton-loader"></div>
</div>Active Search with URL State
<input type="search" name="q"
hx-get="/search"
hx-trigger="input changed delay:300ms"
hx-target="#results"
hx-push-url="true">Confirmation Dialogs
<button hx-delete="/items/42"
hx-confirm="Delete this item?"
hx-target="#item-42"
hx-swap="outerHTML swap:500ms">
Delete
</button>Server-Sent Events
<div hx-ext="sse" sse-connect="/events" sse-swap="message">
Waiting for updates...
</div>from sse_starlette.sse import EventSourceResponse
@app.get("/events")
async def events():
async def generate():
while True:
data = await get_update()
yield {"data": render_update(data)}
return EventSourceResponse(generate())Server-Side Patterns
Partial vs Full Responses
@app.get("/items")
async def list_items(request: Request):
items = await get_items()
if "HX-Request" in request.headers:
# htmx request: return fragment
return HTMLResponse(render_items_fragment(items))
else:
# Normal request: return full page
return HTMLResponse(render_full_page(items))Response Headers
from starlette.responses import HTMLResponse
@app.post("/items")
async def create_item(request: Request):
item = await save_item(request)
response = HTMLResponse(render_item(item))
response.headers["HX-Trigger"] = "itemCreated" # Client-side event
response.headers["HX-Retarget"] = "#item-list"
response.headers["HX-Reswap"] = "afterbegin"
return responseOOB (Out-of-Band) Swaps
Update multiple elements from one response:
<!-- Primary swap -->
<div id="item-42">Updated item content</div>
<!-- OOB: also update the counter -->
<span id="item-count" hx-swap-oob="true">43 items</span>CSS Integration
/* Loading indicator */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator { opacity: 1; }
/* Settling animation */
.htmx-settling { opacity: 0; }
.htmx-settled { opacity: 1; transition: opacity 300ms; }
/* Added items */
.htmx-added { opacity: 0; }
.htmx-settled.htmx-added { opacity: 1; transition: opacity 300ms; }Anti-Patterns
- Returning JSON from htmx endpoints — Always return rendered HTML fragments
- Large page replacements — Return small, targeted fragments
- No loading indicators — Always show feedback during requests
- Ignoring non-htmx requests — Support full-page loads for bookmarkability
- Client-side state management — Keep state on the server; let HTML be the state
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

