tool-use
БесплатноБез исполняемых скриптовНе проверенTool use patterns for Claude including schema design, tool_choice modes, result handling, parallel execution, error recovery, and extended thinking integration.
Об этом скилле
Tool Use Skill
Comprehensive guide to implementing tool use with Claude, covering schema design, tool choice modes, multi-turn conversations, error handling patterns, and advanced features like extended thinking and strict schema conformance.
When to Use This Skill
Activate this skill when:
- Defining custom tools with JSON schemas
- Building agentic workflows with tool use
- Implementing tool result handling
- Building parallel vs sequential tool orchestration
- Requiring guaranteed schema conformance
- Implementing error recovery patterns
- Combining tools with extended thinking
Core Concepts
Tool Definition Schema
Every tool requires a JSON Schema input definition with:
- name: Tool identifier (regex:
^[a-zA-Z0-9_-]{1,64}$) - description: Detailed explanation of purpose, when to use, behavior (3-4+ sentences)
- input_schema: JSON Schema defining parameters
- input_examples (optional, beta): Concrete examples of valid inputs
Best Practices for Tool Definitions
{
"name": "get_stock_price",
"description": "Retrieves the current stock price for a given ticker symbol. The ticker symbol must be a valid symbol for a publicly traded company on a major US stock exchange like NYSE or NASDAQ. The tool will return the latest trade price in USD. Use this when the user asks about the current or most recent price of a specific stock. It will not provide any other information about the stock or company beyond the price.",
"input_schema": {
"type": "object",
"properties": {
"ticker": {
"type": "string",
"description": "The stock ticker symbol, e.g. AAPL for Apple Inc. Must be uppercase."
},
"include_historical": {
"type": "boolean",
"description": "Optional. Whether to include 52-week high/low prices.",
"default": false
}
},
"required": ["ticker"],
"additionalProperties": false
},
"input_examples": [
{"ticker": "AAPL"},
{"ticker": "MSFT", "include_historical": true},
{"ticker": "GOOGL"}
]
}
Key Guidelines:
- Descriptions should be 3-4+ sentences minimum
- Explain what the tool does, when to use it, what it returns, limitations
- Use
input_examplesfor complex nested objects or format-sensitive parameters - Set
additionalProperties: falsefor strict validation - Use enums for constrained parameters
Tool Choice Modes
Control how Claude decides whether and how to use tools:
| Mode | Behavior | Use Case |
|---|---|---|
"auto" |
Claude decides to use tools or not (default) | General tool use, letting Claude decide |
"any" |
Claude must use one tool but can choose which | Forcing tool use without specific tool |
"tool" |
Force specific tool (e.g., {"type": "tool", "name": "get_weather"}) |
Structured JSON output, specific tool required |
"none" |
Prevent all tool use | Normal text-only responses |
# Allow Claude to decide
# tool_choice="auto" (default)
# Force any tool to be used
tool_choice={"type": "any"}
# Force specific tool (useful for JSON output)
tool_choice={"type": "tool", "name": "record_summary"}
# Prevent tool use
tool_choice={"type": "none"}
Important Constraints with Extended Thinking:
- Extended thinking only supports
tool_choice: {"type": "auto"}or{"type": "none"} - Cannot use
{"type": "any"}or{"type": "tool"}with extended thinking - Use the separate "think" tool instead for complex reasoning with tool use
Strict Schema Conformance (Beta)
Enable guaranteed schema validation with strict: true:
tools=[{
"name": "search_flights",
"strict": True, # Enable strict mode
"input_schema": {
"type": "object",
"properties": {
"destination": {"type": "string"},
"departure_date": {"type": "string", "format": "date"},
"passengers": {"type": "integer"}
},
"required": ["destination", "departure_date"],
"additionalProperties": False
}
}]
Benefits:
- Guaranteed type-safe parameters (never
"2"instead of2) - No missing required fields
- No runtime schema validation needed
- Production-ready reliability
Limitations:
- Refusals override schema (safety takes precedence)
- Token limit truncation may break schema
- Some recursive schemas not supported
- Requires
structured-outputs-2025-11-13beta header
Single Tool Use Pattern
Basic pattern: Define tool → Claude calls tool → Return result → Claude responds
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
tools=[{
"name": "get_weather",
"description": "Get current weather in a location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and state, e.g
Установить tool-use в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadWriteEditGlobGrepВложенные файлы
FAQ
Что делает скилл tool-use?
Tool use patterns for Claude including schema design, tool_choice modes, result handling, parallel execution, error recovery, and extended thinking integration.
Как установить скилл tool-use?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tool-use запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic