Context Cursor Foundations

Set Up .cursorrules

Configure Cursor-specific behavior with rules files

8 of 66

What are Cursor rules?

Rules are instruction files that Cursor loads based on file patterns, telling the AI how to handle specific parts of your codebase.

File locations

.cursor/rules/
  frontend.md       # Rules for React components
  backend.md        # Rules for API routes
  testing.md        # Rules for test files

Rule file format

Each rule file uses frontmatter to specify when it applies:

---
description: Rules for React components
globs: ["src/components/**/*.tsx", "src/components/**/*.ts"]
alwaysApply: false
---

## Component conventions

- Use functional components with TypeScript
- Props interface named `{ComponentName}Props`
- Place hooks at the top of the component
- Export components as named exports

Frontmatter options

FieldPurpose
descriptionWhen the rule applies (shown to the agent)
globsFile patterns that trigger this rule
alwaysApplyIf true, loaded for every conversation

Tips

  • Use alwaysApply: true sparingly (only for universal project conventions)
  • Keep rules focused: one rule per concern
  • Include examples of correct and incorrect patterns

Working out which model to run this on? See The Codex. Packaging it as a reusable skill? See The Armory.