Setup guide
How to use an AI agent in Cursor
Three short walkthroughs — Project Rules (modern), legacy .cursorrules, and global Rules for AI. Pick the one that matches your workflow.
Before you start
You need Cursor installed (free or Pro both work) and the agent skill file (Markdown persona) you want to load. Cursor's rule system feeds Composer, Cmd-K inline edits, and Chat — all of them. If you don't have an agent skill yet, browse the Rent an Agent catalog.
Brand new to AI agents? Start with the beginner's guide for the bigger picture before diving into Cursor-specific setup.
~4 minutes · Recommended
Project Rules (.cursor/rules/*.mdc)
The modern Cursor approach. Multiple rule files per project with frontmatter for scoping, layering, and conditional activation. Version-controlled, shareable, and the right home for a strong persona like Digital Elon.
- 1
Open the project in Cursor
Open the codebase where you want the agent active. Cursor auto-detects Project Rules in the `.cursor/rules/` directory at the repo root — no settings to toggle.
- 2
Create the .cursor/rules/ directory
In a terminal at the repo root, run `mkdir -p .cursor/rules`. The folder must be at the repo root, not nested inside a subfolder.
- 3
Create a .mdc rule file
Create a new file at `.cursor/rules/agent.mdc` (or any name ending in `.mdc`). The filename becomes the rule name shown in Cursor's UI. Open it in your editor.
- 4
Add frontmatter and paste the agent file
Start the file with YAML frontmatter declaring rule scope, then paste the agent persona below. A reasonable default frontmatter for a strategic-operator persona is: `description: First-principles strategic operator`, `alwaysApply: true`. Below the frontmatter (after the closing `---`), paste the full agent persona Markdown.
Frontmatter knobs: `description` shows in the rule picker, `globs: ['**/*.py']` scopes the rule to matching files only, `alwaysApply: true` runs the rule on every session regardless of file type.
- 5
Save and reload
Save the file. Cursor picks up Project Rules automatically — restart Cursor if the rule doesn't seem active. Confirm by asking the model who it is; the agent persona should reply.
Tip: commit `.cursor/rules/` to git so teammates inherit the persona too.
~2 minutes · Legacy
Legacy .cursorrules file
Still works for backward compatibility. Single flat Markdown file at the repo root. Use this if you want the absolute simplest setup or are working in a repo that already has a `.cursorrules` you can extend.
- 1
Create a .cursorrules file at the repo root
In a terminal at the project root, run `touch .cursorrules`. The file must be at the repo root, not in a subfolder — Cursor does not search up the tree.
- 2
Paste the agent skill content
Open `.cursorrules` in your editor. Paste the full agent persona Markdown directly into the file (no frontmatter needed — `.cursorrules` is a flat text blob). Save.
- 3
Restart Cursor or reload the window
Cursor caches rules per session. Reload the window (Cmd-Shift-P → 'Reload Window' on macOS, Ctrl-Shift-P on Windows/Linux) or close and reopen Cursor. Ask the model who it is to confirm the persona loaded.
~2 minutes · Global
Global Rules for AI
Applies the agent persona across every Cursor project you open. Use sparingly — a strong persona globally can hurt when you switch from strategic work to routine refactors. Project Rules (Method 1) is usually a better home.
- 1
Open Cursor Settings
Press Cmd-Shift-J (macOS) or Ctrl-Shift-J (Windows/Linux) to open Cursor Settings. Alternatively: Cursor menu → Settings → Cursor Settings.
- 2
Navigate to Rules for AI
In the settings sidebar, click General → Rules for AI. A text area opens — this rule applies globally across every Cursor project you open.
- 3
Paste the agent persona
Paste the full agent persona Markdown into the Rules for AI text area. Save (changes apply immediately).
Use sparingly. Global rules apply to every project, so a strong persona like Digital Elon may not fit when you're hopping between strategic decisions and routine refactors. Project Rules (Method 1) is usually a better home for a strong persona.
Common issues
The rule doesn't seem to activate
Three causes in order of likelihood: (1) .cursorrules or .cursor/rules/ is in a subfolder, not the repo root; (2) Cursor needs a window reload after rule changes; (3) Project Rules with a `globs:` scope only activate for matching files, set `alwaysApply: true` for unconditional persona.
Both .cursorrules and Project Rules exist — which wins?
Cursor version-dependent, but the modern behavior is that Project Rules supplement (not replace) the legacy file. If you're migrating, pick one — delete the other to avoid conflicting personas layering in unexpected ways.
The agent persona conflicts with my codebase's coding style
Use Project Rules with `globs:` to scope. Put the strategic-operator persona behind a tag or trigger (e.g. `description: Strategic review — use when planning, not when coding`) and keep your existing coding-style rule active for code files.
Frequently asked questions
Related
Setup guide
Use an AI agent in Claude
Claude.ai web, Claude Desktop, and Claude Code in three short walkthroughs.
Read the guide →
Setup guide
Use an AI agent in ChatGPT
ChatGPT Custom Instructions, Custom GPT builder, and the OpenAI API in three walkthroughs.
Read the guide →
Cursor
Cursor — official site
Download, pricing, and Cursor's own documentation for Project Rules, Composer, and the AI features.
Visit cursor.com →
Need an agent skill to drop in?
Every listing on Rent an Agent ships as a Markdown agent skill plus a setup-guide PDF. Drop it into your .cursor/rules/ folder in four minutes and start working.