Go Cursor Rules
Cursor rules for Go: idiomatic Go patterns, error handling, concurrency, and Go module conventions.
- Always handle errors explicitly; never use blank identifier _ for errors
- Return errors as the last return value; wrap with fmt.Errorf("context: %w", err)
- Use sentinel errors (var ErrNotFound = errors.New(...)) for expected error types
- Keep interfaces small; prefer single-method interfaces (io.Reader, io.Writer)
- Use context.Context as the first parameter of all functions doing I/O
- Avoid goroutine leaks: always have an exit condition for goroutines
- Use table-driven tests with t.Run for organized test cases
- Run gofmt, golangci-lint, and go vet in CIHow to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
Related Rules
Python Cursor Rules
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
TypeScript Cursor Rules
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
React Cursor Rules
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
Next.js Cursor Rules
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.