No. 117 Write the change

// HTMX with Flask .cursorrules

Use when the behavior is already chosen and a file should change

  • Claude Code
  • Codex
  • Cursor
  • Write the change

Prompt

// HTMX with Flask .cursorrules

// HTMX and Flask best practices

const htmxFlaskBestPractices = [
  "Use Flask's render_template for server-side rendering",
  "Implement Flask-WTF for form handling",
  "Utilize Flask's url_for for generating URLs",
  "Use Flask's jsonify for JSON responses",
  "Implement Flask-SQLAlchemy for database operations",
  "Utilize Flask's Blueprint for modular applications",
];

// Folder structure

const folderStructure = `
app/
  templates/
  static/
    css/
    js/
  models/
  routes/
  __init__.py
config.py
run.py
`;

// Additional instructions

const additionalInstructions = `
1. Use Jinja2 templating with HTMX attributes
2. Implement proper CSRF protection with Flask-WTF
3. Utilize Flask's request object for handling HTMX requests
4. Use Flask-Migrate for database migrations
5. Implement proper error handling and logging
6. Follow Flask's application factory pattern
7. Use environment variables for configuration
`;

When to use

“// HTMX with Flask .cursorrules” fits when the behavior is already chosen and a file should change, because it says “// HTMX with Flask .cursorrules”, and it is written to stay in force on later turns rather than to finish one task.

For “// HTMX with Flask .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 Jinja2 templating with HTMX attributes”.

When not to use

Leave “// HTMX with Flask .cursorrules” unused when you only wanted the file explained, or two designs are still open, because “// HTMX with Flask .cursorrules” points the other way

How to run it

Claude Code

Claude Code loads “// HTMX with Flask .cursorrules” from .claude/rules on later sessions, so “// HTMX with Flask .cursorrules” survives a new chat, which a one-off paste does not.

Codex

Codex keeps “// HTMX with Flask .cursorrules” only if you put “// HTMX with Flask .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 with Flask .cursorrules” by saving “// HTMX with Flask .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

来源:PatrickJS awesome-cursorrules · https://github.com/PatrickJS/awesome-cursorrules/blob/main/rules/htmx-flask-cursorrules-prompt-file.mdc · CC0-1.0 · 2026-12-01