Lv.1 0 XP

Path Rules in Practice — Real-World Rule Design

Core 6 min +25 XP
💡
THE ANALOGY

Smart building access control. Different rooms have different access rules — the server room has stricter requirements than the cafeteria. Path-specific rules apply different Claude Code guidelines to different parts of your codebase automatically.

⚠️ EXAM TRAP — The Wrong Answer People Choose

Writing rules so broad they're equivalent to project-level CLAUDE.md, or so narrow they almost never activate. The power of path-specific rules is precision — the right guidance, at the right time, for the right files.

KEY POINTS
1 Rules should be as specific as possible — the more targeted, the more useful.
2 Multiple rules can apply to the same file if its path matches multiple patterns — all active rules are combined.
3 Rule files should be focused on the specific concerns of that file type — not general project conventions.
4 Test your glob patterns — a rule with a broken pattern never loads, and you won't know unless you test it.
5 Rules are additive — they supplement project-level CLAUDE.md, not replace it.