CCAR-F 备考手册 · Claude Certified Architect – Foundations
Scenario 2 · 主考 Domain 3 / 5
S2 · Code Generation with Claude Code 把一个人的用法变成一个团队的配置
官方设定:用 Claude Code 加速软件开发,团队用它做代码生成、重构、调试与文档;需要把它接进开发流程——自定义 slash commands、CLAUDE.md 配置,并理解什么时候用 plan mode、什么时候直接执行。 这个场景几乎全是「配置放哪」和「先想还是先做」两类判断,官方样题里有三道(Q4、Q5、Q6)出自这里。
官方样题 Q5:涉及数十个文件,且需要就服务边界与模块依赖做决策。答案是 plan mode——它正是为大规模变更、多个可行方案、架构决策设计的,让你在提交变更前安全地探索并设计,避免昂贵返工。三个错法:直接开干让实现「自然揭示」服务边界(依赖发现太晚,返工成本最高)、直接执行但给一份详尽的前置指令(假设你已经知道正确结构,而你还没读代码)、以及最值得记住的那个——先直接执行,遇到意外复杂度再切 plan,官方解析点名它「忽视了复杂性已经写在需求里,而不是可能才出现」。
Your team wants a /migrate-check slash command that runs the standard pre-migration checklist. Every developer should get it automatically when they clone or pull the repository, with no setup steps. Where does the command file belong?
D3 治标不治本违反 P9C:CLAUDE.md 装的是项目指令与上下文,不是命令定义(官方样题 Q4 的 C 选项原判)。写在那里不会产生一个可调用的 /migrate-check。
D1 凭空捏造违反 P9D:.claude/config.json 加 commands array 这个机制在 Claude Code 里不存在——官方样题 Q4 的 D 选项,解析原话是「描述了一个不存在的配置机制」。
ch16 · Q2 · 准则 P5
You must replace the team's ORM across a service: 60+ files import it, several wrap it with custom transaction helpers, and there are two viable strategies (a compatibility shim versus a full rewrite) with different testing and rollout implications. Which approach fits?
Your repo has React components, Go services, and SQL migrations, each with distinct conventions. Migration files live under db/migrations/, but test files sit beside the code they test throughout the repo. You want conventions applied automatically by file type. What configuration best fits both cases?
D6 概率当保证违反 P9B:依赖推断而非显式匹配,与「automatically applied」的确定性要求冲突(官方样题 Q6 的 B 选项原判);而且整份内容每次会话全量进 context。
D3 治标不治本违反 P9C:skill 是按需调用的任务流(TS 3.2),需要有人或 Claude 主动触发——题干要的是编辑到文件就自动生效(官方样题 Q6 的 C 选项原判)。
D3 治标不治本违反 P9D:迁移那半可行,测试那半不行——CLAUDE.md 是目录绑定的,散布全库的测试文件意味着要复制维护几十份同样内容(官方样题 Q6 的 D 选项原判)。
ch16 · Q4 · 准则 P5
Yesterday a session analyzed a payments service and produced a refactoring plan. Overnight, three teammates merged changes to eight of the analyzed files, including the two the plan depends on most. You want to continue today. What should you do?
You have asked Claude three times to normalize your legacy config files into a new format, describing the rules in prose each time. Results keep differing: sometimes boolean strings are converted, sometimes not; nested keys are flattened inconsistently. Your rules are clear to any human reader. What is the most effective next step?
A task has two phases: first understand how feature flags propagate through a 300-file service, then add a new flag type. Phase one generates hundreds of file reads and search results. By phase two the agent gives inconsistent answers and describes "the usual flag pattern" instead of the specific evaluator classes it found. What should you change?
D3 治标不治本违反 P7C:更大的 context window 解决「装不下」,而这里是注意力质量与上下文退化问题(官方样题 Q12 的 C 选项被点名的正是这个混淆)。它只把耗尽时点推后。
ch16 · Q7 · 准则 P9
Three engineers who have worked on the repo for a year report Claude reliably follows the team's error-wrapping convention. Two engineers who joined this week report it ignores the convention entirely. Same repo, same branch, same tool version. What is the most likely cause, and what is the fastest way to confirm it?
A crash report gives a clear stack trace: parseDuration in config/loader.go panics on an empty string. The fix is a guard clause. The function is used in three places, all of which want the same fallback behavior. Which approach is appropriate?
Your team ships a codebase-audit skill in .claude/skills/. It emits several hundred lines of intermediate findings that crowd the main conversation, and during one run it executed a cleanup command that deleted generated files a developer still needed. What two frontmatter changes address these?