博客文章
像 Agent 一样思考:Claude Code 团队的设计哲学
设计 Agent 工具之前,先学会像 Agent 一样思考。
·3 分钟阅读·👀 2·更新于 2026/3/4

像 Agent 一样思考
Lessons from Building Claude Code
Designing the tools for your models is as much an art as it is a science.
作者 Thariq 来自 Claude Code 团队。这篇文章的核心就一句话:
**设计 Agent 工具之前,先学会像 Agent 一样思考。**
中心思想
找到甜点区(Sweet Spot):
太松散 太 rigid 甜点区
↓ ↓ ↓
模型自由但不可控 限制模型能力 结构化 + 可组合
格式难以解析 问题问得太晚 清晰的 UI 界面工具设计需要在"给模型自由"和"保证可控性"之间找到平衡。
核心观点
1. 工具需要匹配模型能力
想象你被给定一个困难的数学问题:
- 用纸笔 → 最基础,但效率低
- 用计算器 → 更快,但需要会操作
- 用电脑 → 最强大,但需要会写代码
You pay attention, read its outputs, experiment. **You learn to see like an agent.**
2. 工具会过期,需要随模型进化
TodoWrite 工具 → 模型变强 → Task Tool
(保持专注) (Todo 反而成了限制)As model capabilities increase, the tools that your models once needed might now be constraining them.
3. 渐进式披露:不增加工具的扩张方式
Claude Code 团队用 **Guide 子 Agent** 处理元问题(如"如何添加 MCP"),而不是:
- ❌ 全部写入 system prompt(上下文膨胀)
- ❌ 给文档链接让 Claude 搜索(加载无关内容)
We were able to add things to Claude's action space without adding a tool.
方法论:三次迭代找到对的方案
AskUserQuestion 工具的演进:
| 尝试 | 方案 | 结果 |
|------|------|------|
| #1 | 修改 ExitPlanTool 加 `questions` 参数 | ❌ 模型 confused |
| #2 | 让 Claude 输出特殊 Markdown 格式 | ⚠️ 不稳定,格式混乱 |
| #3 | 创建独立的 AskUserQuestion 工具 | ✅ 成功 |
关键教训:
- 单一职责原则:一个工具只做一件事
- 结构化输出比格式约定更可靠
- 工具设计不只是给人类看的,也是给模型看的
总结
Experiment often, read your outputs, try new things. **See like an agent.**
核心框架:
- 1. 观察模型行为
- 2. 理解模型能力
- 3. 设计匹配能力的工具
- 4. 持续迭代和优化
- 5. 随模型进化调整工具集
原文链接:
https://x.com/trq212/status/2027463795355095314
最后更新:2026-03-04
点个赞