Cursor Rules are custom instructions stored in a project that guide how AI assistants behave when working with your codebase. They define coding conventions, preferred patterns, tech stack details, and project-specific context that AI should follow consistently across all interactions.
Cursor Rules solve a fundamental problem in AI-assisted development: getting AI to follow your project's specific conventions without repeating instructions every time.
Effective rules typically include:
# Project Context
This is a Next.js 15 application with TypeScript.
We use Tailwind CSS and Shadcn UI components.
# Coding Conventions
- Use functional components with hooks
- Prefer named exports over default exports
- Use 'type' instead of 'interface' for TypeScript
- Handle errors with try/catch and proper error types
# File Structure
- Components go in /components
- Server actions in /server
- Utilities in /lib
Without rules, you might type "remember to use TypeScript" dozens of times per day. Rules: