面试题库
共 328 题,当前筛选 2 题。
课程全部30 天从前端工程师到 Agent 工程师5 天提示词工程零基础Claude 高效使用:从对话到 Claude CodeCodex 与 OpenAI Agents SDK 高效使用7 天 MCP:把工具接进任何 Agent7 天 Agent Skills:把经验做成可复用能力5 天上下文工程14 天 RAG:从检索到可信回答14 天用 Agent 搭一条 AI 短剧生产线
7 天 Agent Skills:把经验做成可复用能力
D4 带脚本的 skill:可执行附件、依赖与沙箱、跨平台,以及文档处理类 skill 的拆解
什么逻辑该写成脚本放进 skill 的 scripts 目录,什么该留在 SKILL.md 正文里?Which logic belongs in a skill's scripts directory and which belongs in the SKILL.md body?
国内高频海外高频基础#agent-skills#scripts分析过程 · 先想清楚再作答
- 这题在考分工感。答「复杂的写脚本」等于没答,因为复杂是个没有边界的词。面试官要听的是可判定的信号。
- 给三条信号,命中任意一条就写脚本:同一段逻辑在执行轨迹里被重新发明了第三次;结果必须逐字一致(校验、格式转换、哈希);一条命令复杂到第一次很难敲对。
- 把第二条展开成分工原则,这是本题的核心句:**确定性任务交给代码,判断性任务留给模型**。让模型「按指令做」意味着每次都有偏移的可能,让它跑脚本意味着结果确定。
- 再给反面:只是调一个现成工具加两三个参数,直接在正文写这条命令就行,不必建 scripts 目录。很多生态有免安装的一次性运行方式,用它们时**版本必须钉死**,否则上游一发版你的 skill 行为就变了。
- 补一条成本视角:脚本是长期资产,要维护、要跟模板同步、要有人看得懂。三条信号一条都不命中的时候,写正文更划算。
- 可预期的追问是「怎么发现模型在重新发明轮子」。答案是读执行轨迹而不是只看最终产出——同一个辅助函数在几次运行里反复出现,就是该沉淀成脚本的信号。
How to reason about it · think before answering
- This tests a sense of division of labor. Saying complex logic goes in scripts says nothing, because complex has no boundary. The interviewer wants decidable signals.
- Give three: the same logic gets reinvented a third time across execution traces; the result must be byte-identical (validation, format conversion, hashing); or a command is complex enough to be hard to get right first try.
- Expand the second into the core principle: deterministic work goes to code, judgment work stays with the model. Following instructions leaves room for drift; running a script does not.
- Give the other side: invoking an existing tool with two or three flags belongs inline in the body. Many ecosystems offer install-free one-off runners, and versions must be pinned or an upstream release silently changes your skill's behavior.
- Add the cost view: a script is a long-lived asset that must be maintained and kept in sync. When none of the three signals fire, prose is cheaper.
- Expected follow-up: how do you notice reinvention? Read execution traces rather than final outputs; the same helper appearing across runs is the signal.
答题要点
- 三条信号命中任一条就写脚本:重复发明第三次、结果必须逐字一致、命令复杂到难以一次敲对。
- 分工原则是确定性任务交给代码,判断性任务留给模型。
- 只加两三个参数调现成工具的,直接在正文写命令,但版本要钉死。
- 脚本是长期资产,有维护成本,三条都不命中就写正文。
- 发现重复发明要靠读执行轨迹,不是看最终产出。
Key points
- Write a script when any of three fire: third reinvention, byte-identical results required, or a command hard to get right first try.
- Deterministic work to code, judgment work to the model.
- A tool invocation with a couple of flags stays inline, with the version pinned.
- Scripts are long-lived assets with maintenance cost; if no signal fires, write prose.
- Spot reinvention by reading execution traces, not final outputs.
给 Agent 用的命令行脚本,接口设计上和给人用的有什么不同?How does designing a command-line script for an agent differ from designing one for a human?
国内高频海外高频进阶#agent-skills#scripts#cli-design分析过程 · 先想清楚再作答
- 题眼是「不同」。能列出五条通用 CLI 最佳实践的人很多,能说清哪几条是因为「使用者是模型」才成立的人少。
- 先给根本差异:人会读文档、会试错、会凭经验猜;Agent 只能读你打印的那几行字然后决定下一步。**它的全部信息就是你的输出**。
- 由此推出五条。绝对不能交互,这是硬要求不是最佳实践,Agent 在非交互终端里回答不了提示,会一直挂到超时。
- 帮助信息就是接口文档,但要短——这段输出原样进上下文,跟别的东西抢位置,这是给人用的 CLI 完全不必考虑的约束。
- 错误信息决定它下一次会不会做对:写清哪一项错了、期望什么、实际是什么、可选值有哪些。**错误信息本质上是给模型的提示词**,这一句是拿分点。
- 剩下两条:输出结构化并把数据与诊断分流到标准输出与标准错误;输出体量要可控,因为很多 Agent 环境会静默截断超长输出。再补幂等、有意义的退出码、危险操作给预演开关。
- 可预期的追问是「怎么验证接口设计得好」。答案是把帮助输出和一条错误信息单独发给一个没看过这个 skill 的人,他能照着敲对改对,模型大概率也能。
How to reason about it · think before answering
- The hinge is the difference. Many can list CLI best practices; few can say which ones exist specifically because the caller is a model.
- State the root difference: humans read docs, experiment and guess from experience; an agent has only the lines you printed before deciding the next move.
- From that: never prompt interactively. This is a hard requirement, not a nicety, because agents run in non-interactive shells and will hang until timeout.
- Help output is the interface documentation, but it must be short, since it enters the context window and competes with everything else. A human CLI never faces this constraint.
- Error messages decide the next attempt: say what failed, what was expected, what was received, and which values are allowed. Error messages are effectively prompts for the model.
- Then: structured output with data on stdout and diagnostics on stderr, and bounded output size because many harnesses truncate silently. Add idempotency, meaningful exit codes, and a dry-run flag for destructive work.
- Expected follow-up: how do you validate the design? Hand the help text and one error message to someone who has never seen the skill; if they can act on it, the model probably can too.
答题要点
- 根本差异:Agent 的全部信息就是你打印的输出,它不会读文档也不会试错。
- 绝不能交互,否则在非交互终端里会挂到超时。
- 帮助信息就是接口文档,但必须短,因为它原样占用上下文。
- 错误信息要写清哪项错、期望什么、实际什么、可选值有哪些,它本质是给模型的提示词。
- 结构化输出并分流标准输出与标准错误,输出体量要可控,危险操作给预演开关。
Key points
- The agent's only information is what you printed; it does not read docs or experiment.
- Never prompt interactively; a non-interactive shell will hang until timeout.
- Help text is the interface documentation and must be short because it consumes context.
- Error messages must state the field, the expectation, the actual value and the allowed set; they are prompts for the model.
- Emit structured data on stdout and diagnostics on stderr, bound output size, and offer a dry-run for destructive operations.