htmx-go-fiber-cursorrules-prompt-file — Cursor rule for Go and Fiber
A Cursor rule for Go projects built on Fiber with HTMX: it pins down folder layout, routing and template rendering so the agent stops improvising.
.cursor/rules/htmx-go-fiber-cursorrules-prompt-file.mdcWhat htmx-go-fiber-cursorrules-prompt-file does
The file lists practices for the HTMX, Go and Fiber stack. The agent gets a set of anchors: server-side HTML rendering through Fiber templates, routing for HTMX requests, middleware for request processing, JSON methods for API responses, error handling with Fiber's own facilities, static file serving.
A folder layout is spelled out too: cmd/main.go, internal/handlers, internal/models, internal/templates, static/css, static/js, plus go.mod and go.sum. The extra instructions cover routing with App.Get/Post, CSRF protection via middleware, reading HTMX headers from the context, logging with the Logger middleware, and configuration through environment variables.
The rule ships with alwaysApply: false and globs **/*, so Cursor is not obliged to apply it everywhere — worth checking whether it actually picks the file up in your repo. There is no code inside, only directives, so a fresh empty project will get less out of it than one already underway.
What it helps with
- give the agent a folder layout for a Go service on Fiber
- wire HTMX requests into Fiber routing
- move template rendering to the server side
- add CSRF protection through middleware
- set up logging and config from environment variables
Example prompts for the agent
- Generate a Fiber handler that returns an HTML fragment for an HTMX request
- Lay out the project as in the rule: cmd, internal/handlers, internal/templates, static
- Add CSRF middleware and Logger to the Fiber app
How to install htmx-go-fiber-cursorrules-prompt-file
Manually: put the files in place
.cursor/rules/htmx-go-fiber-cursorrules-prompt-file.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/htmx-go-fiber-cursorrules-prompt-file.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/htmx-go-fiber-cursorrules-prompt-file.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/htmx-go-fiber-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/htmx-go-fiber-cursorrules-prompt-file.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about htmx-go-fiber-cursorrules-prompt-file
How do I install htmx-go-fiber-cursorrules-prompt-file in Cursor?
Place the file at .cursor/rules/htmx-go-fiber-cursorrules-prompt-file.mdc in your project root. There is no install command; you copy the file into the repository.
What does this rule do?
It describes practices for HTMX, Go and Fiber: server-side template rendering, HTMX routing, middleware, JSON responses, error handling and static file serving. It also fixes the project folder structure.
Why might the rule not apply?
It sets alwaysApply: false with globs **/*, so Cursor does not have to apply it to every file. Check that the rule is active in your project.
Source text
htmx-go-fiber-cursorrules-prompt-file.mdc · CC0-1.0
--- description: "Cursor rules for Go development with Fiber integration." globs: **/* alwaysApply: false --- // HTMX with Go and Fiber .cursorrules // HTMX, Go, and Fiber best practices const htmxGoFiberBestPractices = [ "Use Fiber's HTML rendering for server-side templates", "Implement Fiber's routing system for HTMX requests", "Utilize Fiber's middleware for request processing", "Use Fiber's JSON methods for API responses", "Implement proper error handling with Fiber's error handling", "Utilize Fiber's static file serving for assets", ]; // Folder structure const folderStructure = ` cmd/ main.go internal/ handlers/ models/ templates/ static/ css/ js/ go.mod go.sum `; // Additional instructions const additionalInstructions = ` 1. Use Fiber's App.Get/Post/etc for routing HTMX requests 2. Implement CSRF protection with Fiber middleware 3. Utilize Fiber's Context for handling HTMX-specific headers 4. Use Fiber's template engine for server-side rendering 5. Implement proper logging with Fiber's Logger middleware 6. Follow Fiber's best practices for project structure 7. Use environment variables for configuration `;
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules