No. 116 Write the change
// HTMX Basic Setup .cursorrules
// HTMX Basic Setup .cursorrules.
- Claude Code
- Codex
- Cursor
- Write the change
// HTMX Basic Setup .cursorrules
// HTMX best practices
const htmxBestPractices = [
"Use hx-get for GET requests",
"Implement hx-post for POST requests",
"Utilize hx-trigger for custom events",
"Use hx-swap to control how content is swapped",
"Implement hx-target to specify where to swap content",
"Utilize hx-indicator for loading indicators",
];
// Folder structure
const folderStructure = `
src/
templates/
static/
css/
js/
app.py
`;
// Additional instructions
const additionalInstructions = `
1. Use semantic HTML5 elements
2. Implement proper CSRF protection
3. Utilize HTMX extensions when needed
4. Use hx-boost for full page navigation
5. Implement proper error handling
6. Follow progressive enhancement principles
7. Use server-side templating (e.g., Jinja2, Handlebars)
`;
When to use
“// HTMX Basic Setup .cursorrules” fits when the behavior is already chosen and a file should change, because it says “// HTMX Basic Setup .cursorrules”, and it is written to stay in force on later turns rather than to finish one task.
For “// HTMX Basic Setup .cursorrules”, the extra line you type is the requirement those steps ask for, for example “make src/cart.js return 0 on an empty cart and skip a line with no price”, and the file then starts at “Use semantic HTML5 elements”.
When not to use
Leave “// HTMX Basic Setup .cursorrules” unused when you only wanted the file explained, or two designs are still open, because “// HTMX Basic Setup .cursorrules” points the other way
How to run it
Claude Code
Claude Code loads “// HTMX Basic Setup .cursorrules” from .claude/rules on later sessions, so “// HTMX Basic Setup .cursorrules” survives a new chat, which a one-off paste does not.
Codex
Codex keeps “// HTMX Basic Setup .cursorrules” only if you put “// HTMX Basic Setup .cursorrules” in AGENTS.md, or in AGENTS.override.md beside the directory that should inherit it. A paste that is not saved is gone next thread.
Cursor
Cursor keeps “// HTMX Basic Setup .cursorrules” by saving “// HTMX Basic Setup .cursorrules” as .cursor/rules. The chat transcript alone will not reload it tomorrow.
Comparison
对比待补
This before-and-after was not run on this machine.
Related
- Stage: Write the change
- Same stage: // HTMX with Flask .cursorrules
来源:PatrickJS awesome-cursorrules · https://github.com/PatrickJS/awesome-cursorrules/blob/main/rules/htmx-basic-cursorrules-prompt-file.mdc · CC0-1.0 · 2026-12-01