Dayward AI

Interview Bank

328 questions total; 2 shown with current filters.

Tag
125 more tags
#abstention2#agent-loop2#behavioral2#coding-agent2#consistency2#context-engineering2#context-window2#distributed-systems2#embeddings2#framework-design2#interview-prep2#interview-process2#mcp2#memory2#observability2#orchestration2#prompt-engineering2#provider-abstraction2#rag2#resume2#scalability2#scheduling2#skills2#sse2#streaming2#structured-output2#tool-calling2#agent-basics1#agent-design1#agent-sdk1#agentic-rag1#agents-md1#api-design1#async-task1#auth1#backoff1#bi-encoder1#build-vs-buy1#career1#chunking1#communication1#concurrency1#configuration1#consistent-hashing1#content-safety1#context-assembly1#context-management1#coreference1#cost-accounting1#cost-analysis1#cross-encoder1#data-quality1#encoding1#failure-analysis1#fairness1#few-shot1#ffmpeg1#fine-tuning1#frontend1#global-market1#golden-set1#hooks1#human-in-the-loop1#hybrid-search1#image-generation1#ingestion1#json-schema1#jwt1#langgraph1#long-context1#long-term-memory1#maintenance1#mcp-basics1#media-pipeline1#mental-model1#message-bus1#messages-api1#migration1#model-routing1#moderation1#modularity1#multi-turn1#normalisation1#openai1#operations1#ordering1#overlap1#primitives1#prioritization1#priority-queue1#proactive-messaging1#product-engineering1#project-storytelling1#prompt1#prompt-basics1#prompt-bloat1#prompt-design1#prompt-injection1#prompt-surface1#prompt-techniques1#prompting1#protocol1#query-rewriting1#rag-basics1#rate-limiting1#redis-streams1#reliability1#responses-api1#retrieval1#routing1#sampling1#schema-validation1#scripts1#server-design1#sharding1#similarity1#skill-design1#stakeholder-communication1#star1#state-machine1#system-prompt1#test-set1#token-budget1#tts1#workflow-engine1

Mastering Claude: From Conversation to Claude Code in 5 Days

D3 Getting Started With Claude Code and Managing Context: Install, Writing CLAUDE.md and "Trim Until You Can't", Permission Modes, Plan Mode's "Explore, Then Plan, Then Write", /clear /compact /rewind, Giving Claude a Verifiable Check

  • How do CLAUDE.md and skills divide responsibilities, what goes where, and what goes wrong when CLAUDE.md grows to 500 lines?CLAUDE.md 和 skill 的分工是什么?什么内容该放哪边?一份 CLAUDE.md 写到 500 行会出什么问题?
    Common in ChinaCommon overseasBasic#claude-md#skills#context

    How to reason about it · think before answering

    1. This tests context-cost awareness. 'CLAUDE.md holds rules, skills hold procedures' is the conclusion; derive it from how each is loaded.
    2. Start from load timing: CLAUDE.md enters context in full every session — a fixed cost; a skill keeps only its one-line description resident and loads its body on invocation — a variable cost. Hence short facts that always apply go in CLAUDE.md, occasional multi-step procedures go in skills.
    3. Give the table: commands, non-default style, repo etiquette, environment quirks, and the definition of done belong in CLAUDE.md; deployment runbooks, issue-fixing steps, document generators belong in skills. Multi-step procedures in CLAUDE.md or always-on rules inside a skill are both misplacements.
    4. At 500 lines the failure is dilution, not capacity: important rules drown, adherence drops, and every turn pays for the bloat. Fixes: prune ruthlessly (would removing this cause a mistake?), move occasional content to skills, split path-scoped rules into .claude/rules/ so they load only when matching files are touched.
    5. Follow-ups: a rule that keeps being ignored — prune, then disambiguate, then emphasize; anything that must run every time should be a hook, not a sentence.

    分析过程 · 先想清楚再作答

    1. 这题考的是「上下文成本意识」。答成「CLAUDE.md 放规则、skill 放流程」只是结论,面试官想听你从加载方式推出这个结论。
    2. 拆法从加载时机入手:CLAUDE.md 每次会话整份进入上下文,是固定成本;skill 只有描述那一行常驻,正文在被触发(模型判断相关或用户输入 /name)时才加载,是按需成本。所以「每次都成立的短事实」放 CLAUDE.md,「偶尔才用、一用就是多步」的流程放 skill。
    3. 给判据表:命令、风格差异、仓库礼仪、环境怪癖、完成的判据进 CLAUDE.md;部署流程、修 issue 的固定步骤、某类文档的生成方法进 skill。反过来,CLAUDE.md 里出现了多步流程,或 skill 里放了「每次都要遵守」的规则,都是放错了。
    4. 500 行的问题不是「太长跑不动」,而是稀释:重要规则被淹没,模型的遵守度反而下降,还白白吃掉每轮的窗口。对策是「删到不能再删」(删掉会不会让它犯错?不会就删)、把偶尔用的挪进 skill、按路径拆进 .claude/rules/ 只在碰到匹配文件时加载。
    5. 可预期的追问:「规则它老是不听怎么办」——先删再改再强调;「必须每次执行」的动作根本不该靠 CLAUDE.md,要改成 hook。

    Key points

    • CLAUDE.md loads in full every session — fixed cost; a skill keeps one line resident and loads on demand
    • CLAUDE.md: short always-true facts — commands, style deltas, etiquette, definition of done; skills: occasional multi-step procedures
    • Bloat dilutes: key rules drown, adherence drops, every turn pays
    • Fixes: prune, move occasional content to skills, split path-scoped rules; must-run actions become hooks

    答题要点

    • CLAUDE.md 每次会话整份加载,是固定成本;skill 只常驻一行描述,正文按需加载
    • CLAUDE.md 放每次都成立的短事实:命令、风格差异、规矩、完成判据;skill 放偶尔用的多步流程
    • 写长的后果是稀释:重要规则被淹没、遵守度下降、每轮白付窗口
    • 对策:删到不能再删、偶尔用的进 skill、按路径拆进 rules;必须每次做的改成 hook

D4 Extending Claude Code: Hooks (Deterministic) vs. CLAUDE.md (Advisory), Skills, Subagents, Plugins, Wiring Up an MCP Server, CLI Tools First

  • Why are hooks more reliable than rules in CLAUDE.md? What belongs in each? Give one rule you would move from CLAUDE.md to a hook.为什么 hooks 比 CLAUDE.md 里的规则更可靠?各适合放什么?举一个你会从 CLAUDE.md 挪到 hook 的例子。
    Common in ChinaCommon overseasBasic#hooks#claude-md

    How to reason about it · think before answering

    1. This tests the systemic position of advisory versus deterministic, not feature recall. 'Hooks are scripts that run automatically' is a description; explain why model adherence is not program execution.
    2. Breakdown: CLAUDE.md enters the model's context as text and the model decides after reading — adherence is high but not total, drops as the file grows, and can be lost after compaction. A hook is a script Claude Code itself runs unconditionally at fixed lifecycle points (PreToolUse, PostToolUse, Stop), with the exit code deciding whether to block, independent of the model's judgment.
    3. One-line rule: actions that allow zero exceptions become hooks; preferences that usually apply stay in CLAUDE.md. The inverse also holds — delete rules the model follows by default, convert must-always rules into hooks, and the file shrinks.
    4. Make the example concrete: 'run lint and tests before committing' is occasionally skipped as text; as a Stop hook, failing tests exit 2 and the model receives the summary and keeps fixing. 'Never edit migrations/' becomes a PreToolUse hook matching Edit|Write that exits 2 on a path hit.
    5. Follow-ups: risks? Hooks are code running on your machine — a cloned repo's hooks execute, and headless mode shows no trust dialog; a Stop hook is overridden after 8 consecutive blocks to prevent loops.

    分析过程 · 先想清楚再作答

    1. 这题考的是「建议 vs 确定性」的系统位置,不是背功能名。答「hooks 是自动执行的脚本」只是描述,要说清为什么模型的遵守率不等于程序的执行率。
    2. 拆法:CLAUDE.md 的内容作为文字进入模型上下文,由模型读后决定怎么做——遵守率高但不是百分之百,文件越长越低,压缩后还可能丢失。hook 是 Claude Code 程序在固定生命周期点(PreToolUse / PostToolUse / Stop 等)无条件运行的脚本,由退出码决定拦不拦,与模型的判断无关。
    3. 判据一句话:一次例外都不能有的动作做成 hook;通常应该这样的偏好写进 CLAUDE.md。反向操作也成立:CLAUDE.md 里模型已经默认遵守的删掉,必须百分之百的换成 hook,文件就短了。
    4. 例子要具体:「提交前跑 lint 与测试」——作为文字它偶尔会被跳过;做成 Stop hook,测试不过 exit 2,模型收到失败摘要继续修,直到通过;「不许改 migrations/」做成 PreToolUse hook 匹配 Edit|Write,路径命中就 exit 2。
    5. 可预期的追问:hook 有没有风险?有——它是代码,跑在你机器上,clone 陌生仓库时别人的 hook 会执行,无头模式没有信任对话框;Stop hook 连续 8 次阻止后会被放行防死循环。

    Key points

    • CLAUDE.md is text the model reads and then decides on — high but not total adherence
    • A hook is a script the program runs unconditionally at lifecycle points; the exit code decides, not the model
    • Zero-exception actions become hooks; usual preferences stay in CLAUDE.md
    • Examples: pre-commit tests as a Stop hook; a migrations deny as a PreToolUse hook

    答题要点

    • CLAUDE.md 是送进上下文的文字,由模型读后决定,遵守率高但不是百分之百
    • hook 是程序在固定生命周期点无条件跑的脚本,退出码决定拦不拦,与模型判断无关
    • 一次例外都不能有的做 hook;通常应该这样的写 CLAUDE.md
    • 例:提交前测试改成 Stop hook;禁改 migrations 改成 PreToolUse hook