SQL Cursor Rules
Cursor rules for SQL: query optimization, indexing strategy, safe migrations, and database security best practices.
- Always use parameterized queries; never concatenate user input into SQL strings - Add indexes on foreign keys and columns used in WHERE, JOIN, ORDER BY clauses - Use EXPLAIN ANALYZE to validate query performance before shipping - Prefer CTEs (WITH) over nested subqueries for readability - Use transactions for multi-step mutations; include rollback logic - Add NOT NULL constraints and defaults at the database level - Use RETURNING clause to avoid extra SELECT after INSERT/UPDATE - Write backward-compatible migrations; never drop columns in the same deploy
How 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.