Skip to lesson
Exit
Scoping project rules1 / 2

2 min lesson

Scope one rule to component files

Scope one icon rule to component files, then test a matching and nonmatching task.

Step 1 of 2

Open one Always Apply rule that should govern only component files. Change it to Apply to Specific Files with alwaysApply set to false and a component glob. Keep the body focused on one behavior. Run a fresh task with a matching file in context, then another task outside the glob. Inspect the loaded rules and both diffs. Before keeping the rule, check every other applicable Project Rule for a contradictory instruction.

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.