API conventions should load only when Claude works on files under src/api/, not in every session. What fits best?
- Exam domain
- Claude Code Configuration & Workflows20% of the exam
- Difficulty
- Medium
- In this mock
- 13 questions on this domainPractise this domain
Why the exam asks this
Apply path-specific rules for conditional convention loading
Objective in the exam guide: Apply path-specific rules for conditional convention loading
Path-specific rules are a named task statement.
Why A is the answer
A rule file in .claude/rules/ with a paths field in its YAML frontmatter
Rules can be scoped to specific files with the paths field in YAML frontmatter, so they load conditionally.
How it works
Rules live in .claude/rules/.
A paths field in YAML frontmatter scopes a rule to matching files.
Claude Code removes the frontmatter before loading the rule.
Clues in the question
The words that point to the answer, and what each one tells you.
- Only for files under src/api/
- Path-scoped rule.
In detail
- Keep always-on rules in CLAUDE.md.
- Review rules periodically for outdated instructions.
Side by side with look-alikes
| Option | Conditional? |
|---|---|
| Rule with paths frontmatter | Yes |
| User CLAUDE.md | No |
| Paste each time | Manual |
| New repository | Overkill |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. A rule file in .claude/rules/ with a paths field in its YAML frontmatterRight
Rules can be scoped to specific files with the paths field in YAML frontmatter, so they load conditionally.
B. Add the conventions to the user-level CLAUDE.mdWrongMost tempting
User-level files load for every project.
Why it tempts: It loads for every project and session.
C. Paste the conventions into every prompt about the APIWrong
Manual pasting is easy to forget.
D. Create a separate repository for the APIWrong
Splitting repos is a large change for a context problem.
In practice
- Test path patterns by opening matching and non-matching files.