# Why is my path-scoped Claude Code rule missing or loading too broadly?

Exam: CCAR-F — Claude Certified Architect - Foundations (CCAR-F)
Knowledge domain: Claude Code Configuration & Workflows
Updated: 2026-12-04T01:16:40.430599+00:00
HTML: https://learningpathx.com/faq/CCAR-F/ccarf-path-rule-loading.html

## Also asked as

- How do I diagnose a Claude Code rule that does not apply to the intended files?
- What should I check when .claude/rules guidance loads for the wrong paths?

Check the saved rule's location, parsed frontmatter, pattern base, and the file operation that should trigger it. A folder name inside `.claude/rules/` organizes rules; it does not create a path condition.

Put supported `paths` frontmatter at the top of the Markdown file. For a project rule, patterns are relative to the directory containing the project's `.claude` folder. Choose explicit patterns and test a matching file, a nested match if intended, and a nonmatching file. Do not assume the glob dialect is identical to a shell or another tool.

For example, a rule listing `"**/*.test.ts"` and `"**/*.spec.tsx"` targets those suffixes. It does not cover `.test.tsx` or `.spec.ts`. Quote patterns correctly in YAML.

Current Claude Code documentation says matching Read, Write, and Edit operations can load the rule, as can supported Bash reads such as viewing a single file with `cat`. Seeing a matching filename in a listing does not establish loading. Confirm that project configuration sources are enabled and that the session is using the intended project or worktree.

If loading is too broad, look for absent or malformed frontmatter, an unconditional duplicate, and an overly broad pattern. Current documentation says invalid YAML is treated as unscoped guidance, so a parse error can broaden loading. Use the supported debug diagnostics and, when appropriate, the `InstructionsLoaded` hook to observe which file loaded and why.

Finally, inspect a representative result for the convention itself. Loaded guidance can still conflict with other instructions or be ignored. It does not enforce access permissions, and moving to another file does not prove previously loaded text was removed.

[Claude Code rules and troubleshooting](https://code.claude.com/docs/en/memory#path-specific-rules)

Source: [Apply path-specific rules for conditional convention loading](https://learningpathx.com/material/CCAR-F/apply-path-specific-rules-for-conditional-convention-loading.html)
