Path Scope Declared
Claude Code path-scoped rules must declare a paths frontmatter key. The code reads frontmatter.paths internally — the globs key is not read and rules using it silently load without path scoping. Only paths is processed; other frontmatter keys are silently ignored.
Antipatterns
- Using
globsinstead ofpaths. Claude Code readsfrontmatter.pathsinternally — theglobskey is silently ignored and the rule loads without path scoping. - Missing frontmatter entirely. A path-scoped rule file with no
---block. The file loads for all contexts instead of being scoped to specific files. - Using
descriptionorscopeas proxy. Adding metadata fields likedescription: "Python rules"instead of the actualpathskey. Onlypathsis processed for scoping.
Formats
Single path:
---
paths: src/**/*.py
---
Multiple paths (YAML list):
---
paths:
- "src/**/*.{ts,tsx}"
- "lib/**/*.ts"
- "tests/**/*.test.ts"
---
All value formats work as of v2.1.104: unquoted string, YAML list, inline YAML array, quoted string.
Pass / Fail
Pass
---
paths:
- "src/**/*.py"
---
# Testing Design
Tests exist to catch bugs, not to confirm the implementation works.
Fail
---
globs: src/**/*.py
description: Python testing rules
---
# Testing Design
Tests exist to catch bugs, not to confirm the implementation works.
Limitations
Does not verify that matched files are the ones the author intended — only that the glob resolves to at least one file. Cannot detect overly broad patterns like paths: "**/*" that effectively disable scoping.
