Path-scoped rules
.claude/rules/ splits project instructions into topic files that can load conditionally. A rule without paths: frontmatter loads at session start like CLAUDE.md; a rule with paths: loads only when Claude reads a matching file — saving context.
---paths: - "**/*.test.ts" - "**/*.test.tsx"---
# Testing Rules
- Use descriptive test names: "should [expected] when [condition]"- Mock external dependencies, not internal modules- Clean up side effects in afterEachSubdirectories are discovered automatically (.claude/rules/frontend/react.md works). Like CLAUDE.md, rules are guidance — for guaranteed behavior use hooks or permissions.
Check your understanding
Section titled “Check your understanding”Question 1When does a rule with paths: frontmatter load?
Path-scoped rules load only when a matching file enters context.