演習 › 全問
問題 Q3-08
63 / 120分野3・パス固有ルール
まだ解いていません。
テストファイルが、src の中のあちこちの階層に散らばっている(名前は .test.ts で終わる)。「テストでは、実際の日時を使わず、固定の値を使う」というルールを、すべてのテストに適用し、他のファイルを編集するときには読み込みたくない。最も適切な方法はどれか。
正解は B
- A散らばった全フォルダーに写すと、保守が重く、漏れも出ます。
- B正解です。パターンで指定するルールなら、置き場所に関係なく、テストファイルを扱うときだけ読み込まれます。
- C常時読み込むと、関係のない作業でも文脈を占めます。
- D構成を変えるのは、ルールの目的に対して過剰です。
考え方:散らばったファイルの規約は、paths のグロブで指定するルール。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
The advantage of glob-pattern rules over directory-level CLAUDE.md files for conventions that span multiple directories (e.g., test files spread throughout a codebase)https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Using glob patterns in path-specific rules to apply conventions to files by type regardless of directory location (e.g., **/*.test.tsx for all test files)https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:How Claude remembers your project
Rules can be scoped to specific files using YAML frontmatter with the paths field. These conditional rules only apply when Claude is working with files matching the specified patterns.https://code.claude.com/docs/en/memory.md(取得 2026-11-20)