Sample Cursor rule for DESIGN.md
Save this as .cursor/rules/design.mdc. With globs set and alwaysApply false, Cursor attaches the rule when a matching file is in context.
TipCursor doesn’t paste @DESIGN.md into the prompt. Put must-follow rules, such as “no new hex values”, in the rule body.
---
globs: src/**/*.tsx, src/**/*.css
alwaysApply: false
---
- Read @DESIGN.md before changing any UI.
- Use its color, typography, spacing and radius tokens. No new hex values.
- Reuse existing components and follow its Do's and Don'ts.
- If DESIGN.md has no rule for a case, say so instead of inventing one.
Choose how the rule is applied
TipA plain .md file in .cursor/rules is ignored. Use .mdc, or use AGENTS.md for plain Markdown.
| Type | Front matter | When it loads |
|---|---|---|
| Always Apply | alwaysApply: true | Every chat |
| Apply to Specific Files | globs, alwaysApply: false | When a matching file is in context |
| Apply Intelligently | description, alwaysApply: false | When Agent judges the description relevant |
| Apply Manually | alwaysApply: false only | When you @-mention the rule in chat |
Use AGENTS.md instead of a rule
Cursor reads AGENTS.md, a plain Markdown file with no front matter, in the project root and in subfolders. Nested files combine with their parents, and the more specific file wins. If your repository already has AGENTS.md for Codex or Copilot, add a short UI section there.
Check what Agent built
- Ask Agent to list the DESIGN.md tokens and components it used
- Search the diff for new hex values and one-off pixel sizes
- Open the page at phone and desktop widths and compare it with DESIGN.md
- Rule not applied? Check the .mdc extension and that your globs match the files
- Keep each rule under 500 lines, as Cursor’s docs advise
