0.000
Load rules only when files match with .claude/rules
Put domain-specific instructions in path-scoped `.claude/rules/` so they load only when Claude touches matching files.
The problem
Stuffing frontend, backend, and infra rules into one CLAUDE.md taxes every session, even for unrelated work.
The hack
Split specialized guidance into `.claude/rules/` with path globs so instructions enter context only when relevant.
Why it works
Path-scoped rules keep the root CLAUDE.md lean while still applying the right conventions at the right time.
Setup
1. Create `.claude/rules/` in the repo. 2. Add focused markdown files (e.g. `frontend.md`, `migrations.md`) with path frontmatter or documented path scoping. 3. Leave only always-on facts in root CLAUDE.md. 4. Touch a matching file in a session and confirm via `/memory` that the rule loaded.
Additional details
Great for monorepos where team CLAUDE.md files would otherwise fight each other.
Discussion
No comments yet. Be the first to say whether this worked for you.