Introduction to Cursor Rules

This project is built for Cursor version 0.47.* and may not work correctly with lower versions. Please update your Cursor before starting.
Please use claude-3.5-sonnet or claude-3.7-sonnet model for best results. The course is designed to use these models. You can change the model in the model selector:
Model selector

Welcome to the first stage! Today we'll learn about Cursor Rules - a simple but powerful way to make AI coding work better for you.

What are Cursor Rules?

Cursor Rules are like a set of instructions that tell Cursor how to help you code. Just like you might have preferences for how your code should look or work, these rules help Cursor understand and follow your preferences. Think of these rules as a guide that helps Cursor understand how you want your code to be written.

Two Types of Rules
1. Project Rules
- Live in your project's .cursor/rules folder
- Help with specific project needs
- Can target certain files or folders
- Stay with your project in version control

You can find Cursor Rules settings by pressing CMD + Shift + P and typing "Cursor settings". Then go to the Rules tab:

Cursor Rules Settings

2. Global Rules
- Set once in your Cursor Settings
- Work across all your projects
- Perfect for your personal preferences
- Handle things like language settings and response style

Global rules can be added on the same tab as project rules.

Rules for AI Settings

How They're Different
1. Project Rules
- Specific to each project
- Travel with your project files
- Great for team collaboration
- Automatically apply to relevant files

2. Global Rules
- Work everywhere in Cursor
- Set up once and forget
- Perfect for your coding style
- No need to set up per project

Let's Create Your First Project Rule

Ready to try it out? We'll create a simple rule file to get started.

Let's ask Cursor to help us set this up:

Ask Chat:
I need help creating my first Cursor rule: 1. Create a .cursor/rules directory 2. Create a new rule file called coding-standards.mdc 3. Add basic project guidelines for consistent code style for Python 4. Keep rule simple and short. Maximum 100 words

Don't forget to accept all changes.

Sometimes Cursor has issues creating rule files. If it is the case, check your model settings. It should be claude-3.5-sonnet or claude-3.7-sonnet. If the model is set but the rule file is not created, ask chat to try one more time. You can also ask chat to create the rule and check if it is exists. For example:
Ask Chat:
I need help creating my first Cursor rule: 1. Create a .cursor/rules directory 2. Create a new rule file called coding-standards.mdc 3. Add basic project guidelines for consistent code style for Python 4. Keep rule simple and short. Maximum 100 words Check if the file is created with 'cat' or 'ls' command. If it is not created, create it with 'echo' command and ensure the file is created.
In future stages, we won't ask chat to check if the file is created. But if the problem with creating the file persists, you can always ask chat create it with terminal command.
Completion Checklist
  • Check folder creation
    Make sure you have a .cursor/rules folder in your project
  • Check file creation
    Look for coding-standards.mdc in your rules folder
  • Quick content check
    Open the file and check that it's not empty
Don't worry about the contents of your rule file just yet - we'll cover that in the next stages.