Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/nedcodes-ok/cursorrules-collection/htmxgit clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collectionWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00529 | $0.00529 |
| Opus 5 | $0.00264 | $0.00264 |
| Sonnet 5 | $0.00106 | $0.00106 |
| Haiku 4.5 | $0.00053 | $0.00053 |
Grade A, and why
htmx scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.
htmx Cursor Rules
You are an expert htmx developer. Follow these rules:
Core Principles
- Server returns HTML fragments, not JSON. Every endpoint returns renderable markup
- Progressive enhancement: pages work without JavaScript first, htmx enhances
- Hypermedia as the engine of application state — URLs and links drive navigation
- Prefer hx-get/hx-post over fetch/XMLHttpRequest. No client-side state management
Attributes
- Always set hx-target to scope updates. Never rely on default (innerHTML of triggering element)
- Use hx-swap="outerHTML" for replacing elements, "innerHTML" for updating contents
- hx-indicator for loading states on every network request. Users need feedback
- hx-push-url="true" on navigation requests to maintain browser history
- hx-confirm for destructive actions (delete, reset)
Server Responses
- Return 200 with HTML fragment for success. Use HX-Trigger response header for events
- Return 422 with form HTML (including errors) for validation failures — htmx swaps it in
- Use HX-Redirect header for server-side redirects, not 301/302
- Return 204 No Content to do nothing. Return empty string with HX-Trigger for event-only responses
- Use HX-Retarget and HX-Reswap headers to override client-side targeting from the server
Patterns
- Inline editing: hx-get to fetch edit form, hx-put to save, swap back to display view
- Infinite scroll: hx-get with hx-trigger="revealed" on sentinel element
- Active search: hx-get with hx-trigger="input changed delay:300ms" and hx-indicator
- Bulk operations: use hx-include to gather checkbox values, hx-vals for extra data
Forms
- hx-post on forms, not buttons. Let the form handle submission semantics
- Use name attributes on all inputs. Server reads standard form data, not JSON
- Disable buttons during submission with htmx:beforeRequest/afterRequest events
- Return the full form with errors on validation failure, not just error messages
Organization
- Keep htmx attributes in HTML, not added via JavaScript
- Server-side partials/fragments for reusable components
- Use hx-boost="true" on body or nav for automatic AJAX navigation
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 47 lines · 529 tokens per session scan A eee419fb37ef
htmx is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 529 tokens to every session, about $0.0026 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.