Interview Bank
328 questions total; 1 shown with current filters.
CourseAllFrom Frontend Engineer to Agent Engineer in 30 DaysPrompt Engineering From Scratch in 5 DaysMastering Claude: From Conversation to Claude Code in 5 DaysMastering Codex and the OpenAI Agents SDK in 5 DaysMCP in 7 Days: Wire Tools Into Any AgentAgent Skills in 7 Days: Turn Experience Into Reusable CapabilityContext Engineering in 5 DaysRAG in 14 Days: From Retrieval to Trustworthy AnswersBuild an AI Short-Drama Production Pipeline With Agents in 14 Days
Mastering Claude: From Conversation to Claude Code in 5 Days
D1 Advanced Prompting and Claude's "Personality": System Prompt, XML Tags, Letting the Model Think First, Structured Output
What belongs in a system prompt and what doesn't? If the model keeps ignoring one rule, what do you check first?system prompt 应该放什么、不该放什么?如果一条规则模型总是不遵守,你会先检查什么?
Common in ChinaCommon overseasBasic#system-prompt#prompt-designHow to reason about it · think before answering
- The question tests boundaries, not writing skill. Naming what to exclude, and why, is what separates a strong answer.
- Give the rule: the system prompt is a fixed premise resent on every request, so it holds only what is true for the whole conversation — role, constraints as prohibitions, output style. Anything that varies per turn belongs in the user message.
- Then the anti-patterns: obvious conventions, pasted API docs, and per-turn material dilute the important rules and also invalidate the prompt-cache prefix on every call.
- Debug order for an ignored rule: check length first and prune, then check for ambiguity or conflicting rules, and only then add emphasis. If the rule is a must-run action, move it to a deterministic gate instead of adding more words.
- Likely follow-up: can system go last? Possible but unwise — earlier instructions carry more weight and a moving prefix breaks caching.
分析过程 · 先想清楚再作答
- 这题考的是「职责边界」而不是「会不会写」。答成「放角色和要求」是及格线,能说出「不该放什么」以及「为什么」才有区分度。
- 先给一条判据:system prompt 是每次请求都重发的固定前提,所以只放整场对话都成立的东西——角色、边界(禁止项)、输出风格;每次都变的(时间、用户名、本轮材料)放 user 消息。
- 再说反面:把模型本来就知道的常识(「写干净的代码」)、大段 API 文档、每轮都不一样的材料塞进 system,只会稀释真正重要的规则,还会让 prompt caching 的前缀每次都变。
- 「规则总是不遵守」的排查顺序:先看 system 是不是太长导致规则被淹没(删到不能再删),再看规则是否含糊或与别的规则冲突,最后才考虑加强调;如果是「每次必须执行」的动作,应该改成程序层面的门禁而不是继续加规则。
- 可预期的追问:system 放最后行不行?可以但不推荐——模型对靠前的指令更敏感,且会破坏缓存前缀。
Key points
- Include role, prohibitions, and output style — premises that hold for the whole conversation
- Exclude volatile facts, common sense the model already has, and long pasted docs
- The system prompt is resent every request: longer means costlier and rules get buried
- For an ignored rule: prune first, disambiguate second, emphasize last; must-run actions become deterministic gates
答题要点
- 放:角色、边界(写禁止项)、输出风格;整场对话都成立的固定前提
- 不放:会变的信息(时间、用户名、本轮材料)、模型本来就知道的常识、大段文档
- system 每次请求重发,越长越贵,也越容易让关键规则被淹没
- 规则不被遵守先删再改再强调;「每次必须做」的动作改成程序门禁