You are building a multi-agent research system using the Claude Agent SDK. A coordinator agent delegates to specialized subagents: one searches the web, one analyzes documents, one synthesizes findings, and one generates reports. The system researches topics and produces comprehensive, cited reports. Production monitoring shows that the research phase takes longer than expected. Analysis reveals that the coordinator invokes the web-search subagent, waits for its response, and then invokes the document-analysis subagent. These tasks are independent; neither requires the other's output. How should you modify the system to run these subagents concurrently?
Correct Answer: B
Option B expresses both independent delegations in the same orchestration turn, allowing the runtime to execute them concurrently and return their results together. The current Claude Agent SDK calls the subagent- spawning capability the Agent tool; Task is its former name. Anthropic's SDK subagent documentation explicitly identifies parallel analysis as a primary subagent use case. Claude tool responses can also contain multiple tool_use blocks , enabling independent calls to be handled as one parallel group rather than as serial model turns. Option A shortens each execution but does not remove the unnecessary wait between them and may reduce analysis quality. Option C provides useful behavioral guidance, but instructions alone do not establish the required response structure; the coordinator must actually emit both calls together. Option D duplicates coordinator execution, complicates state management, and creates unnecessary aggregation work. The correct flow is parallel fan-out from one coordinator, followed by a synchronization point that validates both results before synthesis begins. Failures should be tracked independently so that only the unsuccessful branch requires retrying.
Question 7
You are building developer productivity tools using the Claude Agent SDK. The agent helps engineers explore unfamiliar codebases, understand legacy systems, generate boilerplate code, and automate repetitive tasks. It uses the built-in tools (Read, Write, Bash, Grep, Glob) and integrates with Model Context Protocol (MCP) servers. An engineer asks your agent to identify untested code paths in a legacy payment processing module spanning 45 files. After reading the first 8 source files, the agent's responses are becoming noticeably less accurate-it' s forgetting previously discussed code patterns and hasn't yet located all test files or traced critical payment flows. What's the most effective approach to complete this investigation?
Correct Answer: A
The investigation contains several bounded research questions that can be delegated independently: locating the complete test suite, tracing payment and refund flows, identifying conditional branches, and mapping external dependencies. Each subagent can read the relevant files in its own context and return a focused summary to the coordinating agent. Anthropic recommends subagents for codebase exploration because extensive file reading rapidly consumes the main context window. Subagents isolate that volume and return only their conclusions, preserving the main conversation for synthesis and implementation. ( https://docs.anthropic.com/en/docs/claude-code /common-workflows ) Anthropic also describes parallel research as appropriate when separate investigation paths can proceed independently and the main agent can synthesize the results afterward. ( https://docs. anthropic.com/en/docs/claude-code/sub-agents ) Option B sacrifices the current conversational state and requires reconstruction after /clear . Option C may reduce token usage, but isolated text matches cannot reliably reveal full execution paths, indirect calls, or test coverage relationships. Option D converts the current analysis into a single lossy summary and risks omitting details needed later. Option A directly addresses the demonstrated context degradation while retaining a high-level coordinating thread. The subagent prompts should be narrowly scoped and require concrete outputs such as file paths, uncovered branches, call-chain evidence, and existing tests associated with each flow. Official references/topics: Subagent Context Isolation; Parallel Research; Context Preservation; Coordinated Codebase Analysis.
Question 8
You are using Claude Code to accelerate software development. Your team uses it for code generation, refactoring, debugging, and documentation. You need to integrate it into your development workflow with custom slash commands, CLAUDE.md configurations, and understand when to use plan mode vs direct execution. Your team's CLAUDE.md includes a rule: "Use 4-space indentation and always run Prettier formatting." Despite this, code reviews reveal that roughly 30% of files Claude Code generates use inconsistent formatting-sometimes 2-space indentation, sometimes missing trailing commas. Adding emphasis ("IMPORTANT: You MUST use Prettier formatting") reduces violations to about 15%, but doesn't eliminate them. What is the most effective way to ensure all generated code is consistently formatted?
Correct Answer: D
Formatting is deterministic and should be enforced by deterministic tooling rather than stronger natural- language instructions. A PostToolUse hook executes after a successful tool operation. Matching Edit|Write restricts the hook to file modifications, allowing the edited file path to be passed directly to Prettier. Anthropic provides this exact pattern in its official hooks guidance: configure a PostToolUse event with an Edit|Write matcher and run Prettier against the modified file. This ensures formatting occurs automatically after every relevant edit instead of depending on Claude remembering to execute a formatter. ( https://code. claude.com/docs/en/hooks-guide ) Option A still relies on instruction-following and unnecessarily loads procedural material. Option B asks another probabilistic model evaluation to determine whether formatting is correct, even though Prettier can enforce the result directly. A Stop hook also runs later than necessary. Option C improves contextual relevance but does not guarantee compliance; path-scoped rules remain instructions rather than enforcement controls. The hook should be stored in project settings so the workflow is shared by the team. The formatter's exit status should also be monitored so configuration or syntax failures are visible instead of silently ignored. Official references/topics: Claude Code Hooks; PostToolUse; Edit|Write Matchers; Deterministic Formatting Enforcement.
Question 9
You are integrating Claude Code into your Continuous Integration/Continuous Deployment (CI/CD) pipeline. The system runs automated code reviews, generates test cases, and provides feedback on pull requests. You need to design prompts that provide actionable feedback and minimize false positives. Your automated review generates many findings per pull request, but developer feedback shows that approximately half are dismissed as "not worth addressing." Analysis reveals that these findings are often technically accurate but involve minor style preferences or patterns that are acceptable in the project. Before adding infrastructure complexity, what prompt-design change would most effectively reduce dismissals while maintaining detection of genuine issues?
Correct Answer: C
Option C defines the reviewer's actual objective instead of relying on an undefined notion of confidence. The prompt should identify reportable categories such as correctness defects, security vulnerabilities, data-loss risks, broken requirements, and meaningful performance regressions. It should also specify that cosmetic preferences, lint-enforced formatting, speculative refactoring, and intentional repository conventions must not be reported unless they cause concrete incorrect behavior. Anthropic's Claude Code best-practices guidance recommends telling a reviewer to report gaps affecting correctness or stated requirements and to treat other observations as optional. Without such criteria, a reviewer asked to "find issues" will predictably return technically defensible but operationally low-value observations. Option A adds cost and another probabilistic decision layer before correcting the primary prompt. Option B relies on self-reported confidence, which does not necessarily align with developer value or severity. Option D can suppress genuine defects that require inference or cross-file verification because "highly confident" is undefined. Explicit scope, evidence requirements, and examples of both reportable and excluded findings directly calibrate the review toward what developers will act upon. Claude Code best practices
Question 10
You are building a structured data extraction system using Claude. The system extracts information from unstructured documents, validates the output using JSON schemas, and maintains high accuracy. It must handle edge cases gracefully and integrate with downstream systems. Your extraction uses tool use with a JSON schema in which property_type is defined as an enum: house, apartment, condo, or townhouse. After deployment, 8% of extractions fail schema validation. Investigation reveals that listings mention many uncommon property types-"studio," "loft," "duplex," "mobile home," "tiny house," and "converted warehouse"-and new types continue appearing regularly. What is the most effective long-term solution?
Correct Answer: A
Option A is the most sustainable open-world design. The property-type domain is demonstrably not closed: uncommon values already occur, and new labels continue to appear. An enum is appropriate only when the valid vocabulary is stable and exhaustive. If the source contains a legitimate value outside that vocabulary, the schema either rejects it or pressures the model to map it inaccurately. A free-form string preserves the source meaning, while deterministic post-processing can normalize "studio," "loft," "duplex," and future terms into an evolving canonical taxonomy. Anthropic's Structured Outputs documentation distinguishes structural schema conformance from the semantic decisions made within that schema; it also documents that JSON Schema constraints such as enums govern allowable output shapes and values. Few-shot mapping to the nearest existing enum, option B, discards real distinctions. Continually expanding the enum, option C, creates recurring schema changes and still lags newly observed values. An "other" bucket with detail, option D, is workable but collapses all emerging categories at the primary field and complicates analytics until downstream interpretation occurs. Capturing the raw type first and normalizing it in code provides lossless extraction, testable mappings, and forward compatibility.