CCAR-F scenarios › Code Generation with Claude Code · Question 13 of 60

Scenario 2 · Code Generation with Claude Code

Your engineering team relies on Claude Code to generate, refactor, debug, and document code. You're responsible for fitting it into the team's workflow: custom slash commands and skills, a sensible CLAUDE.md setup, and knowing when a task calls for plan mode and when direct execution is enough.

Claude Code Configuration & Workflows

The root CLAUDE.md has a long section on database migration conventions. Migration files live in many places (services/*/db/migrations/ and libs/*/migrations/), and the team notices that the section takes up context in every session, including pure frontend work. What is the best way to make these conventions load only when they are relevant?

Show answer and explanation

Answer: D — Move the conventions into .claude/rules/migrations.md with YAML frontmatter paths set to a glob such as "**/migrations/**/*.sql", so they load only when matching files are edited.

Path-scoped rules in .claude/rules/ load only when Claude is working on files matching their glob, which cuts irrelevant context, and they work across directories in a way directory-level CLAUDE.md files can't (task 3.3). Per-directory CLAUDE.md files (a) duplicate content and need manual upkeep for every new service. A skill (b) depends on someone remembering to invoke it. A rules file without a paths field (c) is better organized but still loads in every session, so the token cost the team noticed stays.