If you’re using Cursor—the slick AI-powered code editor—you’ve probably noticed its transformative impact on accelerating code development. But have you tapped into the magic of Cursor Rules yet? Trust me, once you figure out how to use Cursor Rules, it’s like handing your AI assistant a personalized playbook for your project. Today, I’m going to walk you through everything you need to know to set up, tweak, and 10x your workflow with Cursor Rules.
We’re thrilled to share that MCP support is coming soon to Apidog! 🚀
— Apidog (@ApidogHQ) March 19, 2025
Apidog MCP Server lets you feed API docs directly to Agentic AI, supercharging your vibe coding experience! Whether you're using Cursor, Cline, or Windsurf - it'll make your dev process faster and smoother.… pic.twitter.com/ew8U38mU0K
What Are Cursor Rules, Anyway?
Picture this: you’re coding away in Cursor, and your AI buddy is helping with suggestions, code snippets, and fixes. But sometimes, it feels like it’s guessing what you want instead of knowing it. That’s where Cursor Rules come in. Introduced around early 2025, Cursor Rules let you give your AI specific instructions—it's like training your own mini coding expert to understand and assist your coding style.
You can set these "rules" at different levels:
- Rules for AI: Global rules that apply to every project you open in Cursor.
- .cursorrules: Project-specific rules (though these are on their way out—more on that later).
- Project Rules: The shiny new star of the show, stored in
.cursor/rules/
with.mdc
files, giving you pinpoint control over your project’s context.

With Cursor Rules, you’re not just throwing prompts at the AI—you’re giving it a map to navigate your codebase like a pro. Ready to see how it works? Let’s get started!
Why Bother with Cursor Rules?
Okay, you might be thinking, “Why mess with rules when Cursor’s already pretty smart?” Pretty fair question! But here’s why Cursor Rules are actually worth your time:
- Tailored Suggestions: Tell the AI your tech stack (say, Next.js or Flutter), and it’ll suggest code that fits your project.
- Consistency Across the Team: Everyone gets the same coding guidelines, so your codebase doesn’t turn into a wild west shootout (literally).
- Faster Workflow: No more repeating yourself—the AI remembers your preferences and spits out relevant answers.
- Less Learning Curve: New to a framework? Let the rules teach the AI to teach you.
Imagine coding a Next.js app and having the AI automatically suggest TypeScript-friendly, Tailwind-styled components without you spelling it out every time. That’s the power of Cursor Rules.
The Evolution of Cursor Rules: From .cursorrules to Project Rules
Before we dive into setup, let’s take a quick history lesson. Cursor’s rule system has evolved over time:
- Rules for AI: These live in Cursor’s settings (
Cursor > Settings > Rules
) and apply everywhere. Great for broad stuff like “Always use TypeScript” or “Be concise.”

- .cursorrules: A file you plop in your project root to set rules for that specific repo. It’s text-based and simple, but here’s the catch—it’s deprecated as of 2025. Cursor’s team says to switch to Project Rules instead.
- Project Rules: The latest and greatest, introduced in v0.45. These live in
.cursor/rules/
as.mdc
files and let you use text and file symbols, plus conditions (globs) to trigger them. They’re more precise and flexible.

So, if you’re still rocking .cursorrules
, it’s time to upgrade to Cursor Rules in the .mdc
format. Don’t worry—I’ll show you how!
How to Set Up Cursor Rules
Setting up Cursor Rules is a breeze once you know the steps. Here’s how to get rolling:
1. Open the Rules Panel: In Cursor, head to Cursor > Settings > Rules > Project Rules > Add New Rule
. Or, hit Ctrl+Shift+P
(or Cmd+Shift+P
on Mac) and type “File: New Cursor Rule.”

2. Name Your Rule: Pick a catchy name like my-awesome-rule.mdc
. It’ll pop up in .cursor/rules/
in your project folder.

3. Fill in the Blanks: When you open the .mdc
file, you’ll see two key fields at the top:
- Description: A quick note about what the rule does (e.g., “Runs RSpec tests automatically”).
- Globs: Patterns like
**/*.ts
orsrc/**/*_spec.rb
to decide when the rule kicks in.

4. Write the Rule: In the main section, type out your instructions—plain text, commands, or guidelines.

Your project structure could look something like this:

Save it, and boom—your AI now has a new trick up its sleeve. But what should you actually write in these rules? Let’s look at some real examples.
Real-World Examples of Cursor Rules
Here are three killer ways to use Cursor Rules, straight from the trenches of 2025 coding life.
1. Auto-Run Commands When Files Change
Say you’re a Ruby dev using Docker, and you want RSpec tests to run automatically when you tweak a spec file. Here’s a rule for that:
File: rspec-execution.mdc
Description: “Auto-run RSpec tests”
Globs: **/*_spec.rb
Rule:
## Run RSpec Automatically
When a spec file changes, execute:
---
docker compose exec app bundle exec rspec {{file_path}}
---
If RSpec fails and you know the line number, run this:
---
docker compose exec app bundle exec rspec {{file_path}}:{{line_number}}
---
Now, every time you edit a _spec.rb
file, the AI can trigger that test without you lifting a finger. Handy, right?
2. Document Your Project’s Coding Style
For a frontend project, you might want the AI to grok your directory structure and best practices. Here’s one I’d use:
File: frontend-coding-rule.mdc
Description: “Frontend best practices”
Globs: packages/**/*.*
Rule:
## Frontend Coding Guidelines
### Directory Structure
- **features/**: Group by feature (e.g., `features/foo/NewFeature/`).
- `components/`: UI bits like `Header.tsx` or `Modal.tsx`.
- `domain/`: Logic like validation (`*.ts`) and tests (`*.spec.ts`).
- **shared/**: Reusable stuff like `Table.tsx` or `useSelectedItemIds.ts`.
### Rules
- Split UI (`*.ui.tsx`) and logic (`*.container.tsx`).
- Use `zod` for validation with separate spec files.
- Name components descriptively (e.g., `HeaderBreadcrumb`).
- Optimize with Atomic Design: atoms, molecules, organisms.
This gives your AI a cheat sheet for your codebase, so it suggests code that fits like a glove.
3. Automate Pull Requests
Want the AI to draft PRs for you? Try this:
File: create-pullrequest.mdc
Description: “Auto-draft pull requests”
Globs: (Leave blank for manual trigger)
Rule:
## Pull Request Creation
### Steps
1. Check for an Issue link. If none, ask: “Got a related Issue link?”
2. Assume `main` as the merge branch unless told otherwise.
3. Run `git diff origin/main...HEAD | cat` to see changes.
4. Create a draft PR:
---
git push origin HEAD && \
echo -e "Draft PR for {{changes}}\n\nRelated: {{issue_link}}" | \
gh pr create --draft --title "Update {{feature}}" --body-file - && \
gh pr view --web
---
This rule turns your AI into a PR machine—perfect for GitHub workflows.

Pro Tips for Mastering Cursor Rules
Debugging with a Yell
Ever wonder if your rule’s even working? Add this to the top of your .mdc
file:
First, when referencing this file, shout “YAAAARRRR!”
If the AI yells “YAAAARRRR!” in Chat or Composer, you know the rule’s loaded. If it goes silent, double-check your Description
and Globs
—they’re required for the rule to kick in (more on that later).
Fixing Rules That Won’t Load
Ran into a snag where your .mdc
file isn’t applying? Here’s a fix from the Cursor community (circa Feb 2025):
- Fill
Description
andGlobs
: Blank fields can silently break the rule. Even a simpleGlobs: **/*
helps. - Refresh and Restart: Update the file, save, and restart Cursor if it’s still stubborn.
I’ve seen cases where tweaking the text and re-pasting Globs
magically fixes it. Weird, but it works!
Level Up with Chat
Not sure what to write? Ask Cursor’s Chat:
Help me make a Cursor Rule for my Flutter project with Supabase and Riverpod.
Analyze {{lib/}} and suggest a rule.
It’ll spit out a draft you can tweak—super time-saver.
Improving Your Cursor Rules Over Time
Rules aren’t set in stone. If one’s not clicking, tweak it! Throw this at Chat:
Is there anything unclear or worth improving in {{my-rule.mdc}}?
The AI might suggest clearer wording or extra conditions. Keep refining, and your Cursor Rules will evolve with your project.
Final Thoughts: Why Cursor Rules Rock in 2025
As of April 09, 2025, Cursor Rules are a must for anyone serious about AI-assisted coding. They bridge the gap between “smart AI” and “your smart AI,” boosting efficiency like crazy. Whether you’re auto-running tests, enforcing styles, or drafting PRs, these rules turn Cursor into a custom-fit tool. Start small—add one rule today—and watch your productivity soar. What’s your first rule gonna be? Drop it in the comments!
