InterviewTreedInterviewTreed

InterviewTreed Question Bank

Claude Code Interview Questions and Answers

Prepare for Claude Code interviews with practical questions, detailed answers, and examples.

Total Questions

100

Beginner

30

Intermediate

40

Advanced

30

Beginner Questions

Foundational concepts, terminology, and core ideas.

Q1Fundamentals

What is Claude Code?

Claude Code is Anthropic's agentic coding tool. It can inspect a project, search files, propose or apply edits, run permitted commands, and help verif...

Answer

Claude Code is Anthropic's agentic coding tool. It can inspect a project, search files, propose or apply edits, run permitted commands, and help verify development tasks. Review its changes as you would any teammate's work.

Syntax

claude

Example

Run `claude` from a repository and ask it to explain the architecture.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q2Fundamentals

How is Claude Code different from a regular chat interface?

A chat interface mainly exchanges messages. Claude Code can work with a project workspace and use tools to inspect files, edit code, and run commands ...

Answer

A chat interface mainly exchanges messages. Claude Code can work with a project workspace and use tools to inspect files, edit code, and run commands when allowed. Tool access makes it more capable, but also makes permission and review practices important.

Syntax

Chat: question → answer
Claude Code: goal → inspect → tool → verify

Example

Ask it to trace a request through a real repository, not a hypothetical example.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q3Setup

How do you get started with Claude Code?

Follow the current official installation instructions for your operating system, authenticate using a supported method, open a terminal in your target...

Answer

Follow the current official installation instructions for your operating system, authenticate using a supported method, open a terminal in your target repository, and launch the CLI. Exact installation and authentication steps may change, so verify them against current documentation.

Syntax

cd /path/to/project
claude

Example

Start in a development repository, not a production server.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q4Workflow

Why start Claude Code at the repository root?

The repository root usually contains project instructions, package scripts, source folders, and version-control metadata. Starting there improves cont...

Answer

The repository root usually contains project instructions, package scripts, source folders, and version-control metadata. Starting there improves context and makes relative paths predictable. Use a narrower directory when you intentionally want to restrict the task's scope.

Syntax

cd my-app
claude

Example

Ask it to identify entry points, modules, and test commands.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q5Prompting

What makes a good coding prompt?

A strong prompt defines the goal, scope, constraints, acceptance criteria, and verification steps. For broad or risky work, ask for a plan before allo...

Answer

A strong prompt defines the goal, scope, constraints, acceptance criteria, and verification steps. For broad or risky work, ask for a plan before allowing edits. Avoid vague requests such as “make it better” when you can describe observable behavior.

Syntax

Goal + scope + constraints + acceptance criteria

Example

“Fix the null-email bug, add a regression test, and do not change the API contract.”

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q6Context

How can Claude Code help you understand an unfamiliar codebase?

Ask it to map entry points, modules, data flow, dependencies, and tests, and request relevant file paths for important claims. Verify the explanation ...

Answer

Ask it to map entry points, modules, data flow, dependencies, and tests, and request relevant file paths for important claims. Verify the explanation against source files; a summary is a starting point, not proof that every architectural detail is correct.

Syntax

Prompt: map request → controller → service → database

Example

Ask it to trace one real endpoint from routing to persistence.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q7CLI

What is an interactive Claude Code session?

An interactive session supports iterative requests, clarifying questions, tool approvals, change review, and follow-up instructions. It is useful when...

Answer

An interactive session supports iterative requests, clarifying questions, tool approvals, change review, and follow-up instructions. It is useful when the task evolves as you learn more about the code. Keep each task focused and summarize decisions before switching topics.

Syntax

claude
> Inspect the login flow; do not edit yet.

Example

Ask for the cause first, then approve a targeted fix after reviewing the plan.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q8CLI

When is a non-interactive invocation useful?

A non-interactive invocation can fit scripted summaries, repeatable reviews, or automation. Confirm supported flags in the installed version, limit pe...

Answer

A non-interactive invocation can fit scripted summaries, repeatable reviews, or automation. Confirm supported flags in the installed version, limit permissions, and use an isolated environment for unattended work because automated tool use can have side effects.

Syntax

claude -p "Summarize this repository"

Example

Use a bounded prompt to summarize failing tests in CI.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q9Project Instructions

What is CLAUDE.md used for?

CLAUDE.md communicates repository-specific conventions, architecture notes, commands, coding standards, and constraints to Claude Code. Keep it concis...

Answer

CLAUDE.md communicates repository-specific conventions, architecture notes, commands, coding standards, and constraints to Claude Code. Keep it concise and accurate, avoid secrets, and update it when the workflow changes. Instructions help guide behavior but do not replace deterministic policy controls.

Syntax

# CLAUDE.md
- Run `npm test` before submitting.
- Follow existing TypeScript conventions.

Example

Document build, lint, test, security, and contribution expectations.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q10Project Instructions

How do project instructions differ from personal instructions?

Project instructions are repository-specific and may be version-controlled for the team. Personal instructions express preferences across projects. Ke...

Answer

Project instructions are repository-specific and may be version-controlled for the team. Personal instructions express preferences across projects. Keep team rules in the project and personal style preferences in user-level configuration; never store credentials in instruction files.

Syntax

Project: repo conventions
User: personal defaults

Example

A repository requires `npm run lint`; a user preference requests concise explanations.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q11CLI

What are slash commands?

Slash commands trigger built-in or configured actions inside a session. The available commands can vary with version and configuration, so inspect the...

Answer

Slash commands trigger built-in or configured actions inside a session. The available commands can vary with version and configuration, so inspect the command help in your installed environment rather than assuming every online example is current.

Syntax

/help

Example

Use the built-in help or command menu to discover supported commands.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q12Context

What does context mean in an AI coding session?

Context includes the conversation, instructions, selected file content, and tool results available to the model. Irrelevant or excessive context can m...

Answer

Context includes the conversation, instructions, selected file content, and tool results available to the model. Irrelevant or excessive context can make a task harder to manage. Keep work focused and provide a compact handoff when starting a fresh session.

Syntax

Context = instructions + relevant files + tool results + history

Example

For a payment bug, include payment code and tests rather than unrelated frontend files.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q13Tools

How should you ask Claude Code to inspect a file?

State the question and ask it to identify relevant functions, callers, and tests. A single file rarely tells the whole story, so ask it to trace depen...

Answer

State the question and ask it to identify relevant functions, callers, and tests. A single file rarely tells the whole story, so ask it to trace dependencies when behavior crosses modules. Check the cited paths before changing code.

Syntax

Inspect file → find callers → inspect tests

Example

Ask where token validation happens and which middleware calls it.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q14Tools

How should file edits be reviewed?

Inspect the diff for intended scope, correctness, edge cases, security, and unintended formatting changes. Then run relevant tests and inspect the fin...

Answer

Inspect the diff for intended scope, correctness, edge cases, security, and unintended formatting changes. Then run relevant tests and inspect the final status. A successful edit or command does not prove that the feature works correctly.

Syntax

git diff --check
git diff

Example

Review all changed files against the acceptance criteria before committing.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q15Tools

Can Claude Code run terminal commands?

It can use terminal tools when available and permitted. Commands may modify files, install packages, access networks, or affect data, so inspect comma...

Answer

It can use terminal tools when available and permitted. Commands may modify files, install packages, access networks, or affect data, so inspect command intent and target paths before approving risky actions. Prefer development environments over production systems.

Syntax

npm test
npm run lint

Example

Read a command before approving it, especially deletion, deployment, or database changes.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q16Safety

Why does Claude Code ask for permission?

Permission prompts preserve user control over tool actions. Treat them as a chance to inspect the exact command, file scope, and side effects. Approve...

Answer

Permission prompts preserve user control over tool actions. Treat them as a chance to inspect the exact command, file scope, and side effects. Approve only actions you understand and intend to permit; use the most restrictive mode that supports the task.

Syntax

Review action → check scope → approve or deny

Example

Before allowing a destructive command, confirm the target path and whether a safer alternative exists.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q17Git

Why should you check Git status before a task?

A clean working tree makes it easier to attribute changes, compare diffs, and revert mistakes. Commit or stash unrelated work first so rollback does n...

Answer

A clean working tree makes it easier to attribute changes, compare diffs, and revert mistakes. Commit or stash unrelated work first so rollback does not discard changes that existed before the agent started.

Syntax

git status --short
git diff

Example

Start from a clean branch or preserve unrelated edits before delegating a change.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q18Testing

How can Claude Code help with tests?

Ask it to find existing tests, identify expected behavior, add a focused regression case, and run the narrowest relevant command first. Review whether...

Answer

Ask it to find existing tests, identify expected behavior, add a focused regression case, and run the narrowest relevant command first. Review whether tests prove the behavior rather than merely matching the implementation.

Syntax

Locate test → add regression case → run focused test

Example

For a bug, write a test that fails before the fix when practical.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q19Debugging

What information helps Claude Code debug an error?

Provide the exact error, reproduction steps, expected and actual behavior, environment, and relevant sanitized logs. Remove tokens, personal data, and...

Answer

Provide the exact error, reproduction steps, expected and actual behavior, environment, and relevant sanitized logs. Remove tokens, personal data, and secrets before sharing diagnostic material.

Syntax

Error + repro + expected/actual + environment

Example

“This endpoint returns 500 when couponCode is null; here is a sanitized payload.”

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q20Security

How should environment variables and secrets be handled?

Use environment variables or approved secret stores for credentials, keep real `.env` files out of version control, and use placeholders in examples. ...

Answer

Use environment variables or approved secret stores for credentials, keep real `.env` files out of version control, and use placeholders in examples. Do not ask the agent to print, summarize, or commit actual secrets.

Syntax

API_KEY=<secret-store-reference>
# .env.example uses placeholders

Example

Commit `.env.example`, never a developer's real `.env` file.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q21Dependencies

What should you check before accepting a new dependency?

Check package identity, maintenance, license, known vulnerabilities, transitive dependencies, version constraints, and whether an existing dependency ...

Answer

Check package identity, maintenance, license, known vulnerabilities, transitive dependencies, version constraints, and whether an existing dependency already solves the problem. Verify the exact package name to reduce typosquatting risk.

Syntax

Inspect package → advisory/license review → lockfile → tests

Example

Ask for the reason and a no-new-dependency alternative before installing a package.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q22Documentation

How can Claude Code improve documentation?

It can draft setup guides, architecture notes, API examples, and troubleshooting instructions from repository evidence. Verify commands and examples b...

Answer

It can draft setup guides, architecture notes, API examples, and troubleshooting instructions from repository evidence. Verify commands and examples by running them and remove claims that are not supported by source code or tests.

Syntax

README: prerequisites → setup → test → troubleshooting

Example

Update setup instructions after changing the development command.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q23Refactoring

How should you prompt for a safe refactor?

State that observable behavior must remain unchanged, define the scope, and identify tests or fixtures that establish the baseline. Make small changes...

Answer

State that observable behavior must remain unchanged, define the scope, and identify tests or fixtures that establish the baseline. Make small changes, run checks, and avoid mixing unrelated formatting with semantic edits.

Syntax

Baseline → small refactor → tests → diff

Example

“Improve readability without changing the public API or output.”

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q24Workflow

When should you request a plan before edits?

Request a plan for ambiguous, cross-module, security-sensitive, data-related, or operationally risky tasks. Review affected files, assumptions, risks,...

Answer

Request a plan for ambiguous, cross-module, security-sensitive, data-related, or operationally risky tasks. Review affected files, assumptions, risks, and verification steps before authorizing implementation.

Syntax

Explore → plan → approve → implement → verify

Example

“List proposed files and risks first; do not edit yet.”

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q25Prompting

Why define task boundaries?

Explicit boundaries prevent unnecessary rewrites and reduce unintended changes. Specify files, APIs, behavior, and non-goals for large repositories. N...

Answer

Explicit boundaries prevent unnecessary rewrites and reduce unintended changes. Specify files, APIs, behavior, and non-goals for large repositories. Narrow scope also makes the diff easier to review and the test strategy easier to select.

Syntax

In scope: src/auth/**
Out of scope: database schema

Example

Ask for a targeted fix without reformatting unrelated files.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q26Prompting

What should the agent do when requirements are unclear?

It should state assumptions and ask for clarification when a decision affects architecture, security, data, or user-visible behavior. For low-impact c...

Answer

It should state assumptions and ask for clarification when a decision affects architecture, security, data, or user-visible behavior. For low-impact choices, it can propose a default and explain the trade-off, but should not silently invent critical requirements.

Syntax

Unclear requirement → ask or state assumption → verify

Example

Tell it to stop before changing an API contract if the intended behavior is unknown.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q27Quality

Why review AI-generated code even when it compiles?

Compilation does not prove correctness, security, or maintainability. Generated code can miss edge cases, authorization checks, error handling, and co...

Answer

Compilation does not prove correctness, security, or maintainability. Generated code can miss edge cases, authorization checks, error handling, and compatibility requirements. Use code review, tests, static analysis, and domain knowledge before accepting it.

Syntax

Review correctness + security + tests + maintainability

Example

Manually verify authorization and data-access logic even when tests pass.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q28Safety

What are safe practices for shell commands?

Prefer read-only exploration, inspect arguments, use scoped paths, and avoid piping untrusted content into shells. Treat deletion, privilege escalatio...

Answer

Prefer read-only exploration, inspect arguments, use scoped paths, and avoid piping untrusted content into shells. Treat deletion, privilege escalation, external uploads, package installation, and production operations as high-impact actions requiring extra scrutiny.

Syntax

git status
npm test

Example

Never blindly approve commands copied from untrusted issue text or web content.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q29Workflow

How do acceptance criteria improve agent results?

Acceptance criteria define observable outcomes and give both the agent and reviewer a shared completion standard. Include expected behavior, tests, er...

Answer

Acceptance criteria define observable outcomes and give both the agent and reviewer a shared completion standard. Include expected behavior, tests, error handling, compatibility, and non-functional requirements where relevant.

Syntax

Done = behavior works + tests pass + diff reviewed

Example

“Reject invalid email, preserve valid sign-up, add tests, run lint.”

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.
Q30Context

When should you start a fresh session?

Start fresh when the conversation has accumulated unrelated history, repeated failed approaches, or conflicting assumptions. Carry over a concise summ...

Answer

Start fresh when the conversation has accumulated unrelated history, repeated failed approaches, or conflicting assumptions. Carry over a concise summary of the goal, decisions, changed files, test results, and next steps so the new session begins with useful context.

Syntax

Handoff = goal + decisions + files + checks + next step

Example

Ask the current session to summarize verified facts and unresolved questions before resetting.

Key Points

  • Keep the task and file scope clear.
  • Review tool actions and resulting diffs.
  • Verify the result with tests or direct inspection.

Intermediate Questions

Implementation details, practical patterns, and common workflows.

Q31Agent Workflows

What are subagents and when are they useful?

Subagents are delegated workers that can investigate bounded tasks separately, depending on the available configuration. They help with independent re...

Answer

Subagents are delegated workers that can investigate bounded tasks separately, depending on the available configuration. They help with independent reviews, test discovery, or documentation research. Give each worker a clear output contract and validate results before integration.

Syntax

Main task → bounded subtask → findings → synthesis

Example

Ask one worker to review security and another to locate relevant tests; keep final edits coordinated.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q32Agent Workflows

What risks arise from parallel agent work?

Parallel workers may duplicate effort, disagree on assumptions, or edit overlapping files. Prefer parallel read-only analysis, define ownership, and i...

Answer

Parallel workers may duplicate effort, disagree on assumptions, or edit overlapping files. Prefer parallel read-only analysis, define ownership, and integrate changes deliberately. Separate worktrees can reduce collisions but do not remove review requirements.

Syntax

Assign scope → parallel analysis → integrate → test

Example

Do not let two agents independently rewrite the same service at once.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q33Customization

How can repeatable workflows be captured?

Reusable commands or skills can package instructions for common work such as pull-request review or test generation. Confirm supported locations and i...

Answer

Reusable commands or skills can package instructions for common work such as pull-request review or test generation. Confirm supported locations and invocation syntax in current documentation. Include inputs, constraints, checks, and a predictable output format.

Syntax

Workflow = inputs + steps + constraints + output

Example

Create a review checklist that covers correctness, security, tests, and documentation.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q34Automation

What are hooks in Claude Code?

Hooks are configured integrations that can run checks or commands at supported lifecycle points. They can automate formatting or policy checks, but th...

Answer

Hooks are configured integrations that can run checks or commands at supported lifecycle points. They can automate formatting or policy checks, but they execute code and may change files or environments. Verify the supported events and configuration format for your version.

Syntax

Event → hook command → result

Example

A reviewed hook can run a formatter or reject a disallowed operation.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q35Automation

How should hooks be secured?

Keep hook scripts reviewed and version-controlled, scope permissions, validate inputs, avoid unsafe shell interpolation, document side effects, and te...

Answer

Keep hook scripts reviewed and version-controlled, scope permissions, validate inputs, avoid unsafe shell interpolation, document side effects, and test failures. Hooks should not silently upload code or expose secrets.

Syntax

Validate input → least privilege → audit → fail predictably

Example

Review any hook that accesses the network or environment variables before enabling it team-wide.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q36Integrations

What is MCP and how can it extend Claude Code?

The Model Context Protocol standardizes connections between AI applications and external tools or data sources through servers. It can connect approve...

Answer

The Model Context Protocol standardizes connections between AI applications and external tools or data sources through servers. It can connect approved documentation, issue trackers, or development tools. Each integration should have minimum necessary permissions and clear data-flow boundaries.

Syntax

Claude client ↔ MCP server ↔ approved tool/data

Example

Start with read-only issue access rather than broad write access to production systems.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q37Integrations

What should be checked before adding an MCP server?

Assess source provenance, permissions, authentication, network access, data flows, command execution, and update mechanism. Use trusted servers, minim...

Answer

Assess source provenance, permissions, authentication, network access, data flows, command execution, and update mechanism. Use trusted servers, minimize scopes, test with non-sensitive data, and monitor changes to server behavior.

Syntax

Assess → scope → test → approve → monitor

Example

Review a server's write permissions before connecting it to an organization account.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q38Agent Design

Explain the basic tool-use loop.

A model interprets a goal, chooses a tool and arguments, receives the result, then decides whether to continue or finish. Reliable systems validate ar...

Answer

A model interprets a goal, chooses a tool and arguments, receives the result, then decides whether to continue or finish. Reliable systems validate arguments and outputs, enforce permissions, and cap the number of steps to avoid unsafe or endless loops.

Syntax

Goal → model decision → tool → result → next decision

Example

A file-search tool returns paths; the agent reads relevant files before proposing a patch.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q39Safety

How should permission modes be selected?

Choose the most restrictive supported mode that still permits the task. Interactive development should retain meaningful approval checkpoints. Unatten...

Answer

Choose the most restrictive supported mode that still permits the task. Interactive development should retain meaningful approval checkpoints. Unattended workflows require isolated environments, allowlisted actions, audit logs, and explicit failure behavior. Confirm exact mode names in current documentation.

Syntax

Least privilege + scoped tools + approval gates

Example

Allow tests in a sandbox but require approval for deployment or destructive database changes.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q40Code Review

How can you request a read-only code review?

Explicitly prohibit edits, define the diff and risk priorities, and request actionable findings with locations, evidence, impact, and severity. Indepe...

Answer

Explicitly prohibit edits, define the diff and risk priorities, and request actionable findings with locations, evidence, impact, and severity. Independently reproduce important findings and separate confirmed defects from speculative concerns.

Syntax

Review diff → evidence-based findings → reproduce

Example

“Do not edit. Review this diff for auth bypass, data loss, and missing tests.”

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q41Testing

How should tests be selected after a change?

Run focused tests for changed modules first, then broader integration or full suites based on dependency and risk. Report skipped, timed-out, or faile...

Answer

Run focused tests for changed modules first, then broader integration or full suites based on dependency and risk. Report skipped, timed-out, or failed commands honestly; do not imply that unexecuted tests passed.

Syntax

Changed module → focused tests → integration → full suite

Example

For a controller change, run controller tests and relevant API integration tests.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q42Debugging

How should failing tests be triaged?

Classify failures as likely regression, flaky test, environment issue, or pre-existing failure, using evidence. Reproduce the failure and fix the root...

Answer

Classify failures as likely regression, flaky test, environment issue, or pre-existing failure, using evidence. Reproduce the failure and fix the root cause instead of deleting or weakening a test just to make the suite green.

Syntax

Fail → reproduce → classify → fix root cause → rerun

Example

Compare against the base branch before changing an assertion that began failing.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q43Backend

How should an API change be handled safely?

Specify request and response contracts, validation, authorization, error semantics, compatibility, and tests. Trace callers and consumers before modif...

Answer

Specify request and response contracts, validation, authorization, error semantics, compatibility, and tests. Trace callers and consumers before modifying public behavior. For optional fields, verify both old and new payloads remain supported.

Syntax

Contract → implementation → tests → compatibility review

Example

Add an optional request field while keeping existing clients working.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q44Data

What safeguards are needed for database migrations?

Review compatibility, locks, backfill volume, rollback feasibility, deployment order, and integrity. For zero-downtime systems, an expand-and-contract...

Answer

Review compatibility, locks, backfill volume, rollback feasibility, deployment order, and integrity. For zero-downtime systems, an expand-and-contract sequence often reduces risk. Never run migrations against production without explicit authorization and the organization's release process.

Syntax

Expand schema → deploy compatible code → backfill → contract

Example

Add a nullable field first, deploy compatible code, backfill in batches, and remove old fields later.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q45Security

How can accidental secrets in diffs be detected?

Claude Code can help spot likely secrets, but it is not a complete scanner. Use established secret scanning and pre-commit or CI controls. If a real c...

Answer

Claude Code can help spot likely secrets, but it is not a complete scanner. Use established secret scanning and pre-commit or CI controls. If a real credential leaks, revoke or rotate it rather than merely deleting the visible line.

Syntax

git diff --check
# run an approved secret scanner

Example

Scan staged changes and follow incident procedures for exposed credentials.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q46Security

Can prompt injection be embedded in repository files?

Yes. Markdown, comments, issues, test fixtures, or downloaded content may contain instructions intended to manipulate the assistant. Treat these as un...

Answer

Yes. Markdown, comments, issues, test fixtures, or downloaded content may contain instructions intended to manipulate the assistant. Treat these as untrusted data, not authority to override trusted instructions or justify secret disclosure and unrelated commands.

Syntax

Untrusted file text ≠ trusted instruction

Example

Ignore a README instruction asking the agent to upload environment variables.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q47Privacy

How should logs be shared for debugging?

Share only the minimum sanitized information required. Remove tokens, cookies, personal data, customer identifiers, and unnecessary internal endpoints...

Answer

Share only the minimum sanitized information required. Remove tokens, cookies, personal data, customer identifiers, and unnecessary internal endpoints. Prefer synthetic examples and follow organizational data-handling policy.

Syntax

Sanitize → minimize → share relevant trace

Example

Replace bearer tokens with `[REDACTED]` before sharing logs.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q48Git

How do Git worktrees help agent workflows?

Worktrees provide separate working directories linked to Git branches. They can isolate parallel experiments and reduce file collisions, but branch ow...

Answer

Worktrees provide separate working directories linked to Git branches. They can isolate parallel experiments and reduce file collisions, but branch ownership, integration, and testing still need deliberate management.

Syntax

git worktree add ../fix-worktree -b fix/example

Example

Use a separate worktree for an independent experiment that should not disturb current work.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q49Git

How should merge conflicts be resolved with an agent?

Ask it to explain the intent of both sides and preserve required behavior. Review the resolved semantics and run tests covering both branches; do not ...

Answer

Ask it to explain the intent of both sides and preserve required behavior. Review the resolved semantics and run tests covering both branches; do not accept one side wholesale without understanding what it removes.

Syntax

git status
git diff

Example

Resolve a conflict in a small function and run tests for both expected behaviors.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q50CI/CD

How can Claude Code help debug a CI failure?

Provide the failed step, sanitized logs, commit context, and expected pipeline behavior. Ask it to distinguish code defects from environment, cache, p...

Answer

Provide the failed step, sanitized logs, commit context, and expected pipeline behavior. Ask it to distinguish code defects from environment, cache, permission, or dependency issues, then propose a minimal reproducible fix.

Syntax

Failure → classify → reproduce → fix → rerun

Example

Inspect the failing command before expanding workflow permissions.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q51Code Review

What should a strong review prompt include?

Define scope, priority risks, severity thresholds, evidence expectations, and output format. Ask for concrete findings rather than a generic summary, ...

Answer

Define scope, priority risks, severity thresholds, evidence expectations, and output format. Ask for concrete findings rather than a generic summary, and require uncertainty to be stated when evidence is insufficient.

Syntax

Severity + location + evidence + impact + fix

Example

Prioritize authorization bypass, data loss, injection, and correctness over style nits.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q52Architecture

How should Claude Code navigate a monorepo?

Identify workspace tooling, package boundaries, dependencies, and instructions first. Limit edits to the relevant package and its consumers, and use p...

Answer

Identify workspace tooling, package boundaries, dependencies, and instructions first. Limit edits to the relevant package and its consumers, and use package-specific scripts. Validate shared-package changes against dependent packages.

Syntax

Workspace → package → dependents → tests

Example

For `apps/web`, inspect its scripts and shared packages before editing.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q53Frontend

How can Claude Code help review accessibility?

Ask it to check semantic markup, keyboard navigation, focus behavior, accessible names, contrast, and error announcements. Combine code review with au...

Answer

Ask it to check semantic markup, keyboard navigation, focus behavior, accessible names, contrast, and error announcements. Combine code review with automated tools and manual checks because no single scan proves conformance.

Syntax

Automated scan + keyboard test + manual spot check

Example

Test that a modal manages focus and returns focus when closed.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q54Performance

Should the agent optimize performance without profiling?

It can propose hypotheses, but optimization should follow measurement. Establish a baseline, use an appropriate profiler or benchmark, change one thin...

Answer

It can propose hypotheses, but optimization should follow measurement. Establish a baseline, use an appropriate profiler or benchmark, change one thing at a time, and verify correctness and latency. Avoid adding caches without a clear invalidation strategy.

Syntax

Baseline → profile → change → benchmark → compare

Example

Measure a slow database query before adding caching.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q55Evaluation

How would you evaluate Claude Code for a team?

Build a representative benchmark of real tasks with acceptance criteria, tests, security cases, and expected review effort. Track completion rate, reg...

Answer

Build a representative benchmark of real tasks with acceptance criteria, tests, security cases, and expected review effort. Track completion rate, regressions, time-to-accepted-change, and false confidence over repeated runs.

Syntax

Tasks → criteria → runs → tests → review → metrics

Example

Include bug fixes, features, refactors, security reviews, and documentation tasks.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q56Automation

What makes unattended coding automation safer?

Use isolated execution, narrow repository access, allowlisted commands, resource limits, audit logs, and human approval before publishing, deploying, ...

Answer

Use isolated execution, narrow repository access, allowlisted commands, resource limits, audit logs, and human approval before publishing, deploying, or changing sensitive data. Fail closed when checks or permissions are unclear.

Syntax

Sandbox + allowlist + tests + approval gate

Example

Allow a bot to draft a patch but require a human to approve merge and deployment.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q57Tools

Why validate tool outputs?

Tool results can be stale, incomplete, malformed, or adversarial. Validate schema, paths, exit codes, and provenance before using them in later action...

Answer

Tool results can be stale, incomplete, malformed, or adversarial. Validate schema, paths, exit codes, and provenance before using them in later actions. Do not interpret arbitrary output as trusted shell commands.

Syntax

Tool result → validate schema/path/provenance → consume

Example

Confirm a generated file path stays inside the repository before editing it.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q58Planning

How should a multi-step feature be decomposed?

Break the feature into observable milestones with dependencies, tests, and rollback points. Finish and verify one coherent slice at a time, and revise...

Answer

Break the feature into observable milestones with dependencies, tests, and rollback points. Finish and verify one coherent slice at a time, and revise the plan when evidence changes rather than following a failing plan blindly.

Syntax

Requirements → slices → dependencies → tests → integration

Example

Implement schema, service, endpoint, and UI as separately verifiable steps.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q59Governance

Where should humans remain in the loop?

Humans should approve high-impact decisions involving security, deletion, production changes, access grants, licensing, and ambiguous requirements. Au...

Answer

Humans should approve high-impact decisions involving security, deletion, production changes, access grants, licensing, and ambiguous requirements. Automate low-risk repetitive checks while keeping accountability clear.

Syntax

Agent proposes → checks run → human approves high-impact action

Example

Require code-owner approval for authentication and infrastructure changes.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q60Architecture

How would you model an agentic coding loop?

Use a bounded state machine: gather context, plan, call an authorized tool, validate results, update state, and continue or finish. Add step budgets, ...

Answer

Use a bounded state machine: gather context, plan, call an authorized tool, validate results, update state, and continue or finish. Add step budgets, stop conditions, and escalation paths for uncertainty or repeated failures.

Syntax

while steps < MAX_STEPS:
  action = plan(state)
  result = execute_with_policy(action)
  state = validate_and_update(state, result)
  if done(state): break

Example

Reject invalid arguments and stop after repeated non-progressing actions.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q61Security

How do you apply least privilege to a coding agent?

Give the agent only the repository, commands, credentials, and network access needed for the task. Separate read and write capabilities, use short-liv...

Answer

Give the agent only the repository, commands, credentials, and network access needed for the task. Separate read and write capabilities, use short-lived credentials, scope permissions by environment, and require approval for privileged actions.

Syntax

Capabilities = minimum required permissions

Example

An agent can edit a branch but cannot access production secrets or deploy.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q62Security

What should a coding-agent sandbox isolate?

A sandbox should restrict filesystem access, process execution, network egress, credentials, and resource consumption. Containers alone are not always...

Answer

A sandbox should restrict filesystem access, process execution, network egress, credentials, and resource consumption. Containers alone are not always a complete security boundary, especially when privileged host resources are shared.

Syntax

Task → isolated workspace → restricted tools/network → audited output

Example

Run untrusted test scripts in an ephemeral environment with no production credentials.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q63Security

How can command injection happen in agent workflows?

Injection can occur when untrusted paths, issue text, or tool output are interpolated into shell commands. Prefer structured process APIs, argument ar...

Answer

Injection can occur when untrusted paths, issue text, or tool output are interpolated into shell commands. Prefer structured process APIs, argument arrays, strict allowlists, and validation instead of constructing shell strings.

Syntax

spawn("grep", ["-R", validatedPattern, validatedPath])

Example

Do not concatenate a user-controlled branch name into a shell command without validation.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q64Security

How should file tools prevent path traversal?

Resolve paths against an approved workspace root, normalize them, and reject paths that escape it, including symlink escapes where relevant. Revalidat...

Answer

Resolve paths against an approved workspace root, normalize them, and reject paths that escape it, including symlink escapes where relevant. Revalidate at execution time to reduce time-of-check/time-of-use risks.

Syntax

resolved = realpath(join(root, inputPath))
assert isWithin(root, resolved)

Example

Reject `../../.ssh/id_rsa` when the tool may read only project files.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q65Security

How can agent systems protect secrets?

Avoid exposing credentials in model context unless necessary. Use secret brokers or narrow tools that perform actions without returning credentials, r...

Answer

Avoid exposing credentials in model context unless necessary. Use secret brokers or narrow tools that perform actions without returning credentials, redact logs, and rotate exposed secrets. Keep credentials out of source files and conversation summaries.

Syntax

Model requests action → broker uses credential → safe result returned

Example

Expose a `deployPreview` tool rather than returning a deployment token to the model.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q66Security

What supply-chain risks affect AI coding workflows?

Risks include hallucinated packages, typosquatting, malicious dependencies, compromised MCP servers, and hostile instructions in external content. Ver...

Answer

Risks include hallucinated packages, typosquatting, malicious dependencies, compromised MCP servers, and hostile instructions in external content. Verify package identity and provenance, pin trusted dependencies, review server permissions, and treat retrieved content as untrusted.

Syntax

Verify source → review dependency → lock version → scan

Example

Require review before adding a package or MCP server to shared configuration.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q67Architecture

Why place a policy engine between a model and tools?

A policy engine enforces deterministic rules independently of model intent, such as allowed paths, commands, data classes, and approvals. Validate eve...

Answer

A policy engine enforces deterministic rules independently of model intent, such as allowed paths, commands, data classes, and approvals. Validate every call at the execution boundary and record allow or deny decisions for audit.

Syntax

Model action → policy check → executor → audit event

Example

Block infrastructure apply commands unless environment and approval requirements are satisfied.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q68Architecture

How should tools exposed to a coding agent be designed?

Tools should have narrow purposes, typed schemas, explicit side effects, predictable errors, and minimal outputs. Separate read and write capabilities...

Answer

Tools should have narrow purposes, typed schemas, explicit side effects, predictable errors, and minimal outputs. Separate read and write capabilities, validate arguments server-side, and avoid a single unrestricted tool that can do everything.

Syntax

Tool = name + schema + permission + effect + error contract

Example

Prefer `read_file` and `apply_patch` over unrestricted shell access when practical.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q69Reliability

How do you make agent-triggered actions idempotent?

Use stable operation identifiers, detect completed work, and verify state before retrying. This prevents duplicate tickets, commits, resources, or dep...

Answer

Use stable operation identifiers, detect completed work, and verify state before retrying. This prevents duplicate tickets, commits, resources, or deployments when the model repeats a call after a timeout.

Syntax

if not completed(taskKey): perform(taskKey)

Example

A ticket-creation tool should return the existing ticket for the same idempotency key.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.
Q70Reliability

How should retries work in agent workflows?

Retry only transient failures with bounded exponential backoff and jitter. Before retrying non-idempotent operations, check whether the first attempt ...

Answer

Retry only transient failures with bounded exponential backoff and jitter. Before retrying non-idempotent operations, check whether the first attempt succeeded. Stop after a small number of failures and report persistent errors instead of looping indefinitely.

Syntax

delay = min(cap, base * 2**attempt) + jitter

Example

Retry a rate-limited read after the prescribed delay, not a deployment blindly.

Key Points

  • Use focused, observable workflows.
  • Validate tool results and proposed changes.
  • Keep risky actions behind explicit review.

Advanced Questions

Architecture, optimization, and design trade-offs.

Q71Reliability

How can an agent detect that it is stuck?

Track repeated tool arguments, unchanged state, recurring errors, and lack of progress against acceptance criteria. Stop or escalate after bounded rep...

Answer

Track repeated tool arguments, unchanged state, recurring errors, and lack of progress against acceptance criteria. Stop or escalate after bounded repeats and summarize attempted approaches. This prevents wasted resources and repeated unsafe actions.

Syntax

if repeated(action, history) or noProgress >= limit: stop()

Example

If the same test fails after repeated unchanged patches, stop and reconsider the approach.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q72Security

How should approval be bound to a proposed action?

Bind approval to the exact action, arguments, target environment, and relevant diff or content hash. Expire approval when those details change. Broad ...

Answer

Bind approval to the exact action, arguments, target environment, and relevant diff or content hash. Expire approval when those details change. Broad approvals are hard to audit and may authorize unintended actions.

Syntax

approval = sign(hash(action + args + target + diff))

Example

If the patch changes after review, require approval for the new diff.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q73Governance

What should audit logs record for agent tool calls?

Record task and actor identity, tool name, validated arguments or a redacted summary, policy decision, timestamps, outcome, and approval reference. Av...

Answer

Record task and actor identity, tool name, validated arguments or a redacted summary, policy decision, timestamps, outcome, and approval reference. Avoid logging secrets or excessive personal data.

Syntax

event = {taskId, tool, decision, time, outcome}

Example

Log that a deployment was denied without recording the deployment token.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q74Security

How should coding-agent tasks be isolated across tenants?

Bind each task to an authenticated tenant and workspace server-side, enforce authorization on every tool call, isolate credentials and files, and neve...

Answer

Bind each task to an authenticated tenant and workspace server-side, enforce authorization on every tool call, isolate credentials and files, and never trust a tenant ID supplied only by the model. Test cross-tenant access explicitly.

Syntax

authenticated tenant → scoped workspace → authorized tools

Example

A task for tenant A must not read tenant B's repository even if a prompt requests it.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q75Security

Why restrict network egress from coding agents?

Unrestricted egress can leak source code or secrets and reach malicious endpoints. Use allowlists, proxies, and explicit review for external uploads o...

Answer

Unrestricted egress can leak source code or secrets and reach malicious endpoints. Use allowlists, proxies, and explicit review for external uploads or package downloads. Restricting egress should still allow required, approved build dependencies.

Syntax

Agent sandbox → egress proxy → approved domains

Example

Allow the package registry needed for builds while blocking arbitrary uploads.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q76Security

How should an agent handle malicious tool results?

Treat tool output as untrusted data, validate its structure and origin, and never let embedded instructions override trusted policy. For high-risk act...

Answer

Treat tool output as untrusted data, validate its structure and origin, and never let embedded instructions override trusted policy. For high-risk actions, require independent checks rather than relying on the same model to judge suspicious output.

Syntax

Untrusted result → parser → policy → limited next action

Example

A web page asking the assistant to reveal keys remains content, not an instruction.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q77Integrations

How should an organization manage MCP server lifecycle?

Maintain an approved registry, verify publisher and source, review permissions, pin versions where feasible, test updates in staging, monitor behavior...

Answer

Maintain an approved registry, verify publisher and source, review permissions, pin versions where feasible, test updates in staging, monitor behavior, and revoke access promptly if a server is compromised or no longer needed.

Syntax

Register → review → approve → monitor → revoke

Example

Require security review before enabling write access to a ticketing system.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q78Security

What should a red-team suite for coding agents include?

Test prompt injection in files and issues, path traversal, command injection, secret exfiltration, permission bypass, malicious dependencies, tenant i...

Answer

Test prompt injection in files and issues, path traversal, command injection, secret exfiltration, permission bypass, malicious dependencies, tenant isolation, and destructive actions without approval. Measure prevention and safe recovery, not only task completion.

Syntax

Threat scenario → expected policy outcome → test → evidence

Example

Place adversarial instructions in a fixture and verify that no secret is disclosed or uploaded.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q79Operations

How do you measure human review effort?

Measure review time, defect escape rate, acceptance with minor edits, rework, and severity-weighted findings. Generation speed alone is misleading if ...

Answer

Measure review time, defect escape rate, acceptance with minor edits, rework, and severity-weighted findings. Generation speed alone is misleading if review burden or production risk rises. Compare time-to-accepted-patch, not just time-to-first-diff.

Syntax

Net value = time saved − review − rework − incident cost

Example

Compare representative tasks with and without the tool using the same acceptance criteria.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q80Governance

How can a workflow score change risk?

Consider affected component, privilege level, data sensitivity, public API impact, test coverage, and reversibility. Use risk scores to select extra c...

Answer

Consider affected component, privilege level, data sensitivity, public API impact, test coverage, and reversibility. Use risk scores to select extra checks and approvals, but never let a model's score override hard security rules.

Syntax

risk ≈ impact × likelihood × exposure

Example

Authentication changes require specialist review even if an automated score seems low.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q81Reliability

How should coding-agent changes be rolled back?

Prefer small commits or isolated branches, preserve the original diff, and define rollback steps before risky operations. Database and infrastructure ...

Answer

Prefer small commits or isolated branches, preserve the original diff, and define rollback steps before risky operations. Database and infrastructure changes may require compensating actions rather than a simple source-code revert.

Syntax

checkpoint → apply → verify → rollback path

Example

Document schema rollback compatibility and data recovery before a migration.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q82Operations

Should a coding agent deploy directly to production?

Production changes should follow the organization's release process, independent CI checks, access controls, and explicit approval. Do not grant unres...

Answer

Production changes should follow the organization's release process, independent CI checks, access controls, and explicit approval. Do not grant unrestricted production credentials by default; an agent can prepare a plan or draft a pull request for a protected pipeline.

Syntax

Patch → CI → review → approval → controlled deployment

Example

Let the agent draft release notes while a protected pipeline performs deployment.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q83Security

What if an agent exposes a secret or performs an unsafe action?

Stop further actions, preserve audit evidence, revoke or rotate exposed credentials, assess scope, contain affected systems, and follow the incident p...

Answer

Stop further actions, preserve audit evidence, revoke or rotate exposed credentials, assess scope, contain affected systems, and follow the incident process. Fix the underlying permission or policy weakness rather than relying only on a new prompt.

Syntax

Contain → revoke → investigate → remediate → validate

Example

Disable a compromised integration and rotate the affected token immediately.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q84Reliability

Which checks should be deterministic rather than model-based?

Use deterministic controls for authorization, schema validation, tests, formatting, static analysis, secret scanning, and required approvals. Models h...

Answer

Use deterministic controls for authorization, schema validation, tests, formatting, static analysis, secret scanning, and required approvals. Models help interpret context and generate hypotheses but should not be the sole enforcement mechanism for hard constraints.

Syntax

Model proposes → deterministic policy decides

Example

A model can flag possible injection; tests and static analysis provide independent evidence.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q85Architecture

How would you design an enterprise coding-agent platform?

Use a task orchestrator, isolated workers, a policy and approval service, scoped tool adapters, secret brokering, observability, and evaluation infras...

Answer

Use a task orchestrator, isolated workers, a policy and approval service, scoped tool adapters, secret brokering, observability, and evaluation infrastructure. Keep authorization outside the model, make state resumable, and design for auditability, cancellation, and safe failure.

Syntax

User → orchestrator → policy → sandboxed worker ↔ tools
                  ↓ audit + evaluation

Example

Draft pull requests in isolated workspaces; require protected CI and human approval to merge.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q86Governance

How should data classification affect agent access?

Classify source code, credentials, customer data, regulated information, and public material. Define which classes may enter model context, which tool...

Answer

Classify source code, credentials, customer data, regulated information, and public material. Define which classes may enter model context, which tools may access them, and which retention and logging rules apply.

Syntax

classification → access policy → redaction → approved processing

Example

Use synthetic records for debugging rather than exposing production customer data.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q87Reliability

How should agent state be resumed after a crash?

Persist task state, decisions, tool results, and checkpoints in a controlled store. On resume, revalidate permissions and current repository state ins...

Answer

Persist task state, decisions, tool results, and checkpoints in a controlled store. On resume, revalidate permissions and current repository state instead of blindly replaying old actions; approvals may have expired or files may have changed.

Syntax

checkpoint → reload → revalidate → resume

Example

Before resuming a patch task, compare current Git status and the approved diff.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q88Security

Why should high-impact approvals expire?

Approvals should expire after a defined time or when the action, arguments, target, or diff changes. This limits the chance that an old approval autho...

Answer

Approvals should expire after a defined time or when the action, arguments, target, or diff changes. This limits the chance that an old approval authorizes a new or materially different operation.

Syntax

approval = action hash + target + expiry

Example

Require a fresh approval if deployment target or code diff changes after review.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q89Reliability

How should tool calls be rate-limited?

Apply per-user, per-task, and per-tool quotas, with tighter limits for costly or destructive operations. Rate limits should return actionable errors a...

Answer

Apply per-user, per-task, and per-tool quotas, with tighter limits for costly or destructive operations. Rate limits should return actionable errors and work with bounded retries so the agent does not amplify an outage.

Syntax

quota(task, tool) → allow or throttle

Example

Limit repeated issue-tracker writes while allowing bounded read retries.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q90Reliability

How should cancellation work in long-running agent tasks?

Propagate cancellation to active tools, stop launching new work, and leave the workspace in a recoverable state. Do not assume cancelling the model au...

Answer

Propagate cancellation to active tools, stop launching new work, and leave the workspace in a recoverable state. Do not assume cancelling the model automatically terminates subprocesses or reverses external side effects.

Syntax

cancel signal → stop scheduling → terminate child tools → checkpoint

Example

If a user cancels a build, terminate the build process and report any changes already made.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q91Reliability

Why are tool timeouts important?

Timeouts bound resource use and prevent an agent from waiting indefinitely on a hung command or service. Use task-appropriate limits, capture partial ...

Answer

Timeouts bound resource use and prevent an agent from waiting indefinitely on a hung command or service. Use task-appropriate limits, capture partial output safely, and make retries conditional on whether the operation is safe to repeat.

Syntax

run(tool, timeout=limit)

Example

Give unit tests a bounded timeout and report whether the process was terminated.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q92Reliability

Why limit tool output size?

Large outputs consume context and may hide the relevant signal. Truncate safely, summarize with deterministic tools when possible, and preserve a path...

Answer

Large outputs consume context and may hide the relevant signal. Truncate safely, summarize with deterministic tools when possible, and preserve a path to inspect the full artifact. Do not silently drop error details needed for diagnosis.

Syntax

output → cap → summarize → retain artifact reference

Example

Filter a long test log to failures while preserving the full log as a build artifact.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q93Governance

How does separation of duties apply to coding agents?

The agent that proposes a change should not be the only control deciding whether that change is safe to merge or deploy. Use independent CI, code-owne...

Answer

The agent that proposes a change should not be the only control deciding whether that change is safe to merge or deploy. Use independent CI, code-owner review, protected branches, and separate deployment permissions for high-impact systems.

Syntax

author → independent checks → reviewer → release system

Example

Let the agent create a pull request but not approve or merge its own changes.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q94Security

How should tool-access policies be tested?

Test both allowed and denied actions, including boundary paths, symlinks, encoded inputs, missing identity, expired approval, and policy-service failu...

Answer

Test both allowed and denied actions, including boundary paths, symlinks, encoded inputs, missing identity, expired approval, and policy-service failure. Critical controls should fail closed and emit auditable decisions.

Syntax

input × identity × target × approval → expected allow/deny

Example

Verify that a missing policy response cannot accidentally grant shell access.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q95Security

What does fail-closed behavior mean for an agent?

When authorization, approval, validation, or policy evaluation is unavailable or ambiguous, the system denies the high-impact action rather than guess...

Answer

When authorization, approval, validation, or policy evaluation is unavailable or ambiguous, the system denies the high-impact action rather than guessing. The user should receive a clear error and a safe recovery path.

Syntax

if policy_result != ALLOW: deny()

Example

If approval service is unreachable, block deployment and report why.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q96Operations

How should temporary agent workspaces be cleaned up?

Use lifecycle policies for ephemeral worktrees, containers, logs, and artifacts. Preserve required audit evidence, avoid deleting user-owned changes, ...

Answer

Use lifecycle policies for ephemeral worktrees, containers, logs, and artifacts. Preserve required audit evidence, avoid deleting user-owned changes, and remove temporary credentials and sensitive files when a task ends.

Syntax

task end → archive evidence → revoke credentials → cleanup workspace

Example

Delete an ephemeral sandbox after confirming the patch has been safely exported.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q97Evaluation

How should a model or prompt upgrade be evaluated?

Run the same representative task suite against the current and candidate versions, compare correctness, safety, latency, cost, and review burden, and ...

Answer

Run the same representative task suite against the current and candidate versions, compare correctness, safety, latency, cost, and review burden, and inspect regressions before rollout. Use staged deployment and rollback criteria.

Syntax

baseline suite → candidate suite → compare → canary → rollout

Example

Do not promote a new model based only on one impressive coding example.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q98Security

What should an agent security incident drill test?

Simulate leaked credentials, a malicious tool result, unauthorized file access, and an unsafe command. Verify detection, containment, revocation, audi...

Answer

Simulate leaked credentials, a malicious tool result, unauthorized file access, and an unsafe command. Verify detection, containment, revocation, audit completeness, owner notification, and recovery time. Document gaps and retest fixes.

Syntax

simulate → detect → contain → recover → learn

Example

Run a tabletop exercise where a mock agent tries to read a file outside its workspace.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q99Governance

What should be reviewed before enterprise adoption?

Review data handling, provider terms, retention, access control, audit needs, intellectual-property policy, regional requirements, and software supply...

Answer

Review data handling, provider terms, retention, access control, audit needs, intellectual-property policy, regional requirements, and software supply-chain controls with relevant stakeholders. Confirm actual configuration and contractual terms rather than assuming product defaults.

Syntax

requirements → legal/security review → controls → evidence

Example

Block sensitive repository use until data handling and access requirements are approved.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.
Q100Operations

Which metrics best indicate coding-agent success?

Track accepted-task rate, escaped defects, rework, review time, policy violations, time-to-accepted-change, and user satisfaction. Segment results by ...

Answer

Track accepted-task rate, escaped defects, rework, review time, policy violations, time-to-accepted-change, and user satisfaction. Segment results by task type and risk; raw code volume or response speed can reward low-quality output.

Syntax

success = quality + safety + cycle time + review effort

Example

Compare a representative set of tasks before and after adoption, including failure cases.

Key Points

  • Enforce critical controls outside the model.
  • Test adversarial and failure scenarios.
  • Measure correctness, safety, and review effort.

Share this question bank

Send this page to someone preparing for an interview.