Platforms/Cursor

Cursor

Cursor is an AI-first code editor built on VS Code. It uses project rules to customize AI behavior.

Configuration File

.cursor/rules

Project-level rules file that Cursor reads automatically. Place in your project root directory.

File Location

your-project/
├── .cursor/
│   └── rules          ← Your config file goes here
├── src/
└── package.json

The .cursor folder should be at the root of your project. Cursor will automatically detect and apply the rules.

How Cursor Uses Rules

When you interact with Cursor's AI (Cmd+K, chat, etc.), it reads your rules file and uses the instructions to:

  • Understand your project context and conventions
  • Generate code that matches your style preferences
  • Follow your specified best practices
  • Use your preferred tools and libraries

Example Rules File

# Project: My Next.js App

## Tech Stack
- Next.js 14 with App Router
- TypeScript (strict mode)
- Tailwind CSS
- Prisma ORM

## Code Style
- Use functional components with hooks
- Prefer named exports over default exports
- Use async/await instead of .then()
- Always include proper TypeScript types

## File Organization
- Components in /components
- API routes in /app/api
- Database models in /prisma

## Testing
- Write tests with Vitest
- Aim for 80%+ coverage on new code

Tips

Keep It Concise

Cursor works best with clear, focused rules. Don't overload with too much information.

Use Markdown Headers

Organize rules with headers for better readability and AI parsing.

Be Specific About Stack

Mention exact versions and frameworks for more accurate suggestions.

Include Examples

Show code examples for patterns you want the AI to follow.

← All PlatformsClaude Code →