Skip to main content
rule

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.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/htmx-go-fiber-cursorrules-prompt-file.mdc
Open on GitHub

What 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.mdc

Frontmatter: description, globs, alwaysApply

Step 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

Similar IDE rules

All IDE rules for Backend and APIs →

From the same set68

laravel-php-83-cursorrules-prompt-file A Cursor rule that walks the agent through building Laravel packages: plan, directory layout, naming standards, tests and docs. ★ 41,011repo stars kubernetes-mkdocs-documentation-cursorrules-prompt A Cursor rule that turns the agent into a technical writer for Kubernetes and cloud native docs built with Markdown and MkDocs. ★ 41,011repo stars knative-istio-typesense-gpu-cursorrules-prompt-fil A Cursor rule that turns the assistant into a helper for serverless projects built on Knative with Istio, Typesense and HTMX. Useful when your search app runs on that stack. ★ 41,011repo stars javascript-chrome-apis-cursorrules-prompt-file A Cursor rule that points the AI agent at Chrome extension work: manifest, architecture, Chrome API usage. ★ 41,011repo stars htmx-django-cursorrules-prompt-file A Cursor rule that keeps the agent on Django rails while it writes HTMX code: templates, forms, CSRF, class-based views. ★ 41,011repo stars how-to-documentation-cursorrules-prompt-file A Cursor rule that turns technical steps, test scripts and screenshots into step-by-step guides for non-technical users. Useful when you write How To docs for a feature. ★ 41,011repo stars graphical-apps-development-cursorrules-prompt-file A Cursor rule that feeds the agent the Pyllments context: graph-based LLM apps in Python built on Panel and Langchain. ★ 41,011repo stars flutter-development-guidelines-cursorrules-prompt-file Locks down folder layout, naming and Dart style for Flutter apps built on MVVM with Riverpod. Useful when the agent scatters files across the project. ★ 41,011repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor