3.3 · D323 questions · 5 free

Path-specific rules & conditional conventions

Apply path-specific rules for conditional convention loading.

This subtopic (3.3) sits in Claude Code Configuration & Workflows (D3) on Anthropic's Claude Certified Architect — Foundations (CCA-F) exam. The bank holds 23 practice questions here — 6 easy, 11 medium, and 6 hard — with 5 free to try, answers and explanations included. 3 of the free questions are below; the rest are in the practice stream.

What the exam tests here

  • path-specific rules vs directory CLAUDE.md for cross-directory conventions
  • rules load only when editing matching files — reduces token usage
  • path-scoped rules — .claude/rules/ with YAML frontmatter paths field
  • glob patterns for conditional rule activation based on file paths
Practice this subtopic — 5 freeFree questions with answers ↓

Free practice questions: Path-specific rules & conditional conventions

Question 1 of 3 · free · medium

Your team's CLAUDE.md references a rule file in .claude/rules/api-style.md with paths frontmatter scoped to src/api/**/*.ts. When exactly does Claude Code load this rule into the active context?

Show answer & explanation

Correct answer: B. When Claude reads a file matching src/api/**/*.ts during the session

Path-scoped rules trigger when Claude reads files matching the configured glob pattern, not on every tool use or at session launch. Rules without paths frontmatter load unconditionally at launch; the paths field makes loading conditional on file reads, reducing token usage to only relevant sessions.

Question 2 of 3 · free · medium

Your CLAUDE.md workflow applies a type-safety rule whenever Claude reads TypeScript or JavaScript files under src/. You want a single paths pattern in a .claude/rules/ file that matches both src/**/*.ts and src/**/*.js. Which pattern is correct?

Show answer & explanation

Correct answer: D. src/**/*.{ts,js}

Brace expansion {ts,js} is the supported glob syntax for matching multiple extensions in a single pattern, producing src/**/*.ts and src/**/*.js as alternatives. src/**/*.[ts|js] uses character-class syntax, which matches single characters t, s, |, or j — not file extensions. The OR keyword is not valid glob syntax. src/**/[ts,js] is also character-class syntax and matches individual characters, not extensions.

Question 3 of 3 · free · hard

Your developer productivity agent must apply a 'no inline SQL string concatenation' convention only when it uses Edit on Python files inside services/billing/, but not when editing Python files in services/reporting/ or under tests/. The convention lives in a .claude/rules/no-sql-concat.md file. Which frontmatter glob pattern restricts the rule to exactly this scope?

Show answer & explanation

Correct answer: A. paths: services/billing/**/*.py — match Python files at any depth under the billing service only.

services/billing/**/*.py matches Python files at any depth under services/billing while excluding services/reporting and tests by virtue of the prefix. 'services/**/*.py' is too broad — it includes services/reporting. 'services/billing/*.py' is too narrow — it stops at the directory's top level and misses nested files. 'paths: **/*.py with exclude: tests/**/*' invents an exclude clause that isn't part of the paths frontmatter schema.

2 more free questions on this subtopic in the practice stream, plus 18 in the full bank. Keep practicing →

Related reading (Anthropic docs)