Skip to lesson
Exit
Rule Scoping and Anti-Patterns1 / 2

2 min lesson

Narrow an Always rule with a glob so it only loads where it belongs

Connect "Start with this check: The rule does not apply to unrelated files" to the decision you would make.

Step 1 of 2

The job: rules fire only where they help and stay small enough to reason about. Start with this check: The rule does not apply to unrelated files. Keep it small enough to check the result yourself instead of taking the summary on trust.

Scope a rule to the files it belongs in

0:47 · narrated
Read this demo as text
  1. product-aware-development and AGENTS show no path next to them in Settings, Rules — they apply everywhere. search-scope carries a path, src/components/search, so it only attaches when a file under there is in play.
  2. Close Settings. Both open tabs, EmptyState and searchFilter, sit under that same path — the glob covers either file, not just the one you happen to be editing.
  3. Keep the glob as narrow as the behavior it changes. A rule with no path fires everywhere, even files it was never written for — a scoped rule stays quiet outside its own directory.
Narrow an Always rule with a glob so it only loads where it belongs — not in fixtures and stories.

Practice next: Open a broad Always rule and scope it with globs before the next agent run.

Simulated Cursor 3.12 (macOS, light) — beta educational reconstruction, not the real product.