CCA-F 练习题库· Claude Code Configuration & Workflows
Your monorepo has a root CLAUDE.md that has grown to over 400 lines, covering Python conventions, TypeScript conventions, infrastructure rules, and testing standards. Developers report that Claude sometimes applies the wrong conventions to the wrong files, and the file is difficult to maintain. What is the best approach to reorganize this configuration?
- ASplit the content into multiple files in .claude/rules/, with each file covering a focused topic, and use path-scoped YAML frontmatter to activate rules only for relevant files.
- BCreate a separate CLAUDE.md in each top-level package directory and delete the root file entirely.
- CAdd inline section headers to the monolithic file and use the /memory command to tell Claude which section to prioritize for each task.
- DBreak the root CLAUDE.md into topic files and use @import directives in the root file to pull them all in unconditionally.
正确答案:A
解析
- Ais correct, as verified against the official Claude Code memory docs (code.claude.com/docs/en/memory), which document exactly this mechanism: place topic-focused markdown files in .claude/rules/, and use YAML frontmatter with a
pathsfield of glob patterns so a rule "only load[s] into context when Claude works with matching files." This directly cures both reported symptoms — wrong conventions applied to wrong files (path scoping means the Python rules never load while editing a .ts file) and hard-to-maintain monoliths (modular per-topic files). The distractors each fail on a documented point: - B(per-package CLAUDE.md, delete root) uses real nested-CLAUDE.md scoping but is only directory-scoped, cannot separate Python vs TS within one package, and deleting the root discards shared/cross-cutting rules.
- Cmisdescribes /memory (it lists/edits memory files and toggles auto memory — it does not "prioritize a section per task") and still requires manual intervention every session.
- Dis explicitly called out by the docs — "Splitting into @path imports helps organization but doesn't reduce context, since imported files load at launch," so unconditional imports keep every convention in context and the wrong-convention problem persists.
延伸阅读
本题为本站自有原创练习题,非任何官方考试内容;解析对照 Anthropic 公开文档撰写, 如与最新文档不符请以官方为准。想在限时环境下检验水平,可参加 模拟考(题目与本页题库不重叠)。