tool-design
它能做什么
这个技能说明如何设计 AI 智能体调用的工具,包括描述、模式、响应格式、命名和错误信息。适合构建智能体所使用的工具或 MCP 服务器的开发者。
适用场景
- ✓当你为 AI 智能体编写新工具或新的 MCP 服务器描述时。
- ✓当智能体总是选错工具,或发出格式错误的调用时。
- ✓当你的工具列表越来越长,功能重叠的工具让智能体感到困惑时。
技能链接
https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/tool-design/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的 AI 智能体总是从我的十七个工具中选错工具。请帮我重写工具描述,并合并功能重叠的工具。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能把每个工具视为一份契约,因此它的描述和错误信息必须足够清楚,使智能体能够正确选择并自行恢复。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Tool Design for Agents
Design every tool as a contract between a deterministic system and a non-deterministic agent. Unlike human-facing APIs, agent-facing tools must make the contract unambiguous through the description alone: agents infer intent from descriptions and generate calls that must match expected formats. Every ambiguity becomes a potential failure mode that no amount of prompt engineering can fix.
The unit of work for this skill is a single tool or a tool catalog. Project-shape, pipeline architecture, task-model-fit, and cost-at-the-project-level decisions belong to project-development. Deciding whether to introduce sub-agents belongs to multi-agent-patterns. This skill owns the interface layer that connects deterministic code to the agent.
When to Activate
Activate this skill when the unit of work is a tool:
- Writing a new tool description, schema, or response format.
- Debugging cases where the agent picked the wrong tool or generated malformed calls.
- Consolidating an overlapping tool catalog (the classic "we have 17 tools, the agent picks wrong half the time" case).
- Designing actionable error messages so the agent can self-correct.
- Naming tools and parameters consistently across a catalog (MCP namespacing, verb-noun naming).
- Evaluating a third-party tool against the consolidation principle before adding it.
Do not activate this skill for adjacent work owned by other skills:
- Deciding whether the project should use LLMs at all, or what the pipeline stages should be:
project-development. - Deciding whether to split work across sub-agents or run a single agent with more tools:
multi-agent-patterns. - Reducing the token weight of tool outputs at the trajectory level (observation masking, format-option choice at scale):
context-optimization.
Core Concepts
Design tools around the consolidation principle: if a human engineer cannot definitively say which tool should be used in a given situation, an agent cannot be expected to do better. Reduce the tool set until each tool has one unambiguous purpose, because agents select tools by comparing descriptions and any overlap introduces selection errors.
Treat every tool description as prompt engineering that shapes agent behavior. The description is not documentation for humans -- it is injected into the agent's context and directly steers reasoning. Write descriptions that answer what the tool does, when to use it, and what it returns, because these three questions are exactly what agents evaluate during tool selection.
Detailed Topics
The Tool-Agent Interface
Tools as Contracts Design each tool as a self-contained contract. When humans call APIs, they read docs, understand conventions, and make appropriate requests. Agents must infer the entire contract from a single description block. Make the contract unambiguous by including format examples, expected patterns, and explicit constraints. Omit nothing that a caller needs to know, because agents cannot ask clarifying questions before making a call.
Tool Description as Prompt Write tool descriptions knowing they load directly into agent context and collectively steer behavior. A vague description like "Search the database" with cryptic parameter names forces the agent to guess -- and guessing produces incorrect calls. Instead, include usage context, parameter format examples, and sensible defaults. Every word in the description either helps or hurts tool selection accuracy.
Namespacing and Organization
Namespace tools under common prefixes as the collection grows, because agents benefit from hierarchical grouping. When an agent needs database operations, it routes to the db_* namespace; when it needs web interactions, it routes to web_*. Without namespacing, agents must evaluate every tool in a flat list, which degrades selection accuracy as the count grows.
The Consolidation Principle
Single Comprehensive Tools
Build single comprehensive tools instead of multiple narrow tools that overlap. Rather than implementing list_users, list_events, and create_event separately, implement schedule_event that finds availability and schedules in one call. The comprehensive tool handles the full workflow internally, removing the agent's burden of chaining calls in the correct order.
Why Consolidation Works Apply consolidation because agents have limited context and attention. Each tool in the collection competes for attention during tool se
常见问题
为什么工具描述如此重要?
智能体根据描述来选择工具,因此措辞不清会导致错误的选择或错误的调用。
错误信息应该做什么?
它应该清楚地告诉智能体出了什么问题,以及接下来该尝试什么,使它能够自行纠正。
什么时候应该删除某个工具?
当工具目录让智能体经常选错时,该技能建议合并功能重叠的工具。
详情
作者的原始描述
This skill should be used for the tool-interface layer of an agent system specifically: writing tool descriptions agents can route on, designing tool schemas and response formats, naming conventions, actionable error recovery messages, MCP server design, tool-set consolidation, and deciding when to add or remove an individual tool. Use this when the unit of work is a single tool or a set of tools. Route project-shape, pipeline architecture, and task-model-fit decisions to project-development; route deciding whether to introduce sub-agents to multi-agent-patterns.
热度
- GitHub 星标
- 18k
- 排名
- #10652
- 许可证
- MIT
- 更新时间
- 2026/10/11
评论
- …
同一仓库的更多技能
context-engineering-collection
18k帮你的智能体管理输入 AI 模型上下文窗口的内容,涵盖记忆、工具、多智能体配置以及评估。
advanced-evaluation
18k教你的智能体如何用另一个 AI 来评判 AI 的回答,包括打分、并排比较和偏差检查。
bdi-mental-states
18k教你的智能体用 BDI 方法对信念、目标和计划进行建模,使其决策可以被追溯和解释。
context-compression
18k帮你的智能体把很长的 AI 会话压缩成摘要,保留决策、文件、风险和下一步。