Correct way to specify rules globs?

There’s a lot of different ways people are specifying the globs in rules, I’m wondering what is the official schema for them?

YAML Array

globs: ['src/**/*.ts', 'tests/**/*.ts']

or

globs:
  - 'src/**/*.ts'
  - 'tests/**/*.ts'

Single String w/ quotes

globs: 'src/**/*.ts, tests/**/*.ts'

Single string (no quotes)

globs: src/**/*.ts, tests/**/*.ts

I’m seeing lots of files with the last but I’m guessing the first format is the correct one?

Specifying this better would make a great addition to the docs.

5 Likes

last version works

2 Likes

Yeah, that’s what I’m gathering but would be great for the Cursor team to put at least one example with the correct syntax in the docs.

9 Likes

Will let them know

3 Likes

It would also be nice if the supported glob patterns were clarified. For example, does *.?(m|c)ts?(x) work?

Support for ignore patterns would be very nice to have

I found this example:


globs: *.ts

please document the glob syntax. no spaces after commas for example is huge as the IDE has no visual indication of a space when editing a rule.

Space after comma:

No space after comma:

Also syntax support for groups, optional, negate, etc would be really nice. For example, /**/*.{j,t}s?(x) or /tests/**/*.{spec,test}.{js,ts}

7 Likes

Cursor team, please include examples in the docs for glob patterns.

1 Like

@deanrie any chance for this to get some highlight?

Hey, thanks, I’ll pass this to the team.

I can’t find documentation anywhere online for the globs format. This is super frustrating. Can we please get some documentation?

Same here — I can’t believe there’s no clear documentation on the exact syntax and format for glob rules in Cursor.

1 Like

+1 – not only are there not clear examples of how rule globbing is supposed to work (and this behavior seems to keep changing in the IDE), we’ve even been getting gaslighted by the cursor docs changing the specs for even how to define rule files :face_with_spiral_eyes:

Cursor rules docs over the last few weeks:

  • 2025-11-22 - docs show .cursor/rules/*.mdc structure
  • 2025-12-27 - docs start reporting .cursor/rules/<rule-name>/RULE.md structure (this appears to happen until 2026-01-10 according to wayback machine)
  • 2026-01-15 (today) - docs are back to .cursor/rules/*.mdc structure

Cursor team, please give some TLC to your cursor rules page and try to prevent your own IDE/AI from hallucinating how rules are supposed to work :folded_hands:

3 Likes

Cursor rules are quite unreliable IMO and will wait for the response from cursor team: I am not clear on how exactly cursor rules are applied - #3 by Luv_Agarwal

@Cursor Team please add the documentation here: Rules | Cursor Docs
This does not even have one example

For now, the accepted answer seems to be here: Allow escaping comma in cursor rules glob patterns - #2 by jameslamine

Good callout @David_Mann! I had a PR to the docs open for this a few weeks ago but it got lost. I’ll revive it.