SklyDocs

Cursor Rules

How rules work in Cursor. Project rules, user rules, team rules, AGENTS.md, frontmatter fields, application modes, rule priority, remote rules, Agent Skills, and legacy .cursorrules migration.

For the official documentation, see Cursor Rules. For VS Code and GitHub Copilot, see VS Code Custom Instructions.

Rules apply only to Agent (Chat). They do not affect Cursor Tab, Inline Edit (Cmd/Ctrl+K), or other AI features.

Rule Types

Cursor has four types of rules:

Stored in .cursor/rules/ within your project directory. Version-controlled and specific to one codebase.

react-patterns.mdc
api-guidelines.md
testing-standards.md

Project rules support frontmatter for managing when and how they apply. This is the most flexible rule type.

Application Modes

Project rules can be applied in four ways, based on their frontmatter:

---
alwaysApply: true
---

Included in every chat session automatically. Use for rules that always matter, such as coding conventions, project-wide patterns, and architecture guidelines.

Frontmatter Fields

Project rules use Markdown (.md) or frontmatter-enhanced Markdown (.mdc) with optional YAML frontmatter:

---
description: "Standards for React frontend components"
alwaysApply: false
globs: ["src/components/**/*.tsx"]
---

# React Component Standards

- One component per file
- Use named exports
- Use functional components with hooks
FieldPurpose
descriptionTells the AI when this rule is relevant; used for matching
alwaysApplytrue to include in every session, false for conditional application
globsFile patterns that trigger this rule (e.g., ["*.tsx", "src/api/**"])

If you omit the frontmatter, the rule functions as a simple Markdown file, similar to how AGENTS.md works.

Referencing Files in Rules

Use @filename syntax inside a rule to include content from other files without duplication:

For implementation details, see @src/lib/auth.ts
Follow the patterns in @docs/api-reference.md

The agent resolves these references and loads the relevant file content when the rule is applied.

Rule Priority

When multiple rules apply, they follow this order:

Team Rules (highest priority)

Organization-wide standards always override individual preferences.

Project Rules

Codebase-specific conventions and patterns.

User Rules (lowest priority)

Personal preferences that yield to project and team rules.

Importing Rules

AGENTS.md vs Project Rules

FeatureAGENTS.mdProject Rules (.cursor/rules/)
FormatPlain MarkdownMarkdown with optional frontmatter
SetupDrop file in directoryCreate .cursor/rules/ directory
MetadataNonedescription, globs, alwaysApply
NestingSubdirectory supportSubdirectory support
ScopingDirectory-basedPattern-based (globs)
Best forSimple, straightforward rulesComplex, conditionally-applied rules

Legacy .cursorrules

Cursor previously used a .cursorrules file in the project root. This format still works but is outdated. Migrate to Project Rules (.cursor/rules/) or AGENTS.md for better organization and frontmatter support.

Writing Effective Rules

What to Avoid

MistakeWhy
Duplicating linter rulesIf ESLint or Prettier handles it, don't repeat it
Documenting obvious tool usageThe AI already knows common tools
Rare edge casesFocus on patterns that apply often
Copying entire codebasesReference files with @filename instead

Selling Cursor Rules on Skly

  • List "Cursor" as a supported AI tool so buyers can find compatible rules.
  • Use the .md format since it's portable across AI tools, not just Cursor.
  • Include frontmatter so buyers can configure application mode (always, intelligent, glob-scoped).
  • Make rules self-contained so buyers can use them right away without setup.
  • Test with Cursor Agent to ensure rules work in chat mode, since that's where they apply.

Comparison with VS Code

FeatureCursorVS Code / Copilot
File location.cursor/rules/.github/instructions/
Workspace fileAGENTS.md or project rules.github/copilot-instructions.md
Scopingglobs array in frontmatterapplyTo glob in frontmatter
Intelligent matchingalwaysApply: false enables AI matchingNot natively supported
Inline suggestionsSupportedNot supported
Organization sharingTeam rules via dashboardGitHub org-level instructions
AGENTS.mdSupportedSupported (experimental nesting)

Both formats use Markdown, so rules sold on Skly can usually support both tools with minimal changes.

Learn More