anth-core-workflow-a
Build Claude tool use (function calling) workflows with the Messages API. Use when implementing tool use, function calling, agent loops, or building AI assistants that interact with external systems. Trigger with phrases like "claude tool use", "anthropic function calling", "claude tools", "agent loop anthropic", "tool_use blocks".
Best use case
anth-core-workflow-a is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Build Claude tool use (function calling) workflows with the Messages API. Use when implementing tool use, function calling, agent loops, or building AI assistants that interact with external systems. Trigger with phrases like "claude tool use", "anthropic function calling", "claude tools", "agent loop anthropic", "tool_use blocks".
Teams using anth-core-workflow-a should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/anth-core-workflow-a/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How anth-core-workflow-a Compares
| Feature / Agent | anth-core-workflow-a | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Build Claude tool use (function calling) workflows with the Messages API. Use when implementing tool use, function calling, agent loops, or building AI assistants that interact with external systems. Trigger with phrases like "claude tool use", "anthropic function calling", "claude tools", "agent loop anthropic", "tool_use blocks".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# Anthropic Core Workflow A — Tool Use (Function Calling)
## Overview
Implement Claude's tool use capability where the model can call functions you define. Claude returns `tool_use` content blocks with structured JSON inputs; your code executes the function and returns `tool_result` blocks. This is the foundation for building AI agents.
## Prerequisites
- Completed `anth-install-auth` setup
- Understanding of the Messages API request/response cycle
- Functions or APIs you want Claude to call
## Instructions
### Step 1: Define Tools
```python
import anthropic
client = anthropic.Anthropic()
tools = [
{
"name": "get_weather",
"description": "Get current weather for a city. Use when the user asks about weather conditions.",
"input_schema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "City name, e.g. 'San Francisco, CA'"
},
"units": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "Temperature units"
}
},
"required": ["city"]
}
},
{
"name": "search_database",
"description": "Search product database by query string. Returns matching products.",
"input_schema": {
"type": "object",
"properties": {
"query": {"type": "string"},
"max_results": {"type": "integer", "default": 10}
},
"required": ["query"]
}
}
]
```
### Step 2: Send Request with Tools
```python
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
tools=tools,
messages=[{"role": "user", "content": "What's the weather in Tokyo?"}]
)
# Claude responds with stop_reason="tool_use"
# message.content contains both text and tool_use blocks:
# [
# {"type": "text", "text": "I'll check the weather for you."},
# {"type": "tool_use", "id": "toolu_01A...", "name": "get_weather",
# "input": {"city": "Tokyo", "units": "celsius"}}
# ]
```
### Step 3: Execute Tool and Return Result
```python
def execute_tool(name: str, input_data: dict) -> str:
"""Route tool calls to actual implementations."""
if name == "get_weather":
# Call your weather API
return '{"temp": 22, "condition": "partly cloudy", "humidity": 65}'
elif name == "search_database":
return '{"results": [{"name": "Widget A", "price": 29.99}]}'
raise ValueError(f"Unknown tool: {name}")
# Extract tool_use blocks and execute
tool_results = []
for block in message.content:
if block.type == "tool_use":
result = execute_tool(block.name, block.input)
tool_results.append({
"type": "tool_result",
"tool_use_id": block.id, # Must match the tool_use block id
"content": result
})
# Continue conversation with tool results
follow_up = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
tools=tools,
messages=[
{"role": "user", "content": "What's the weather in Tokyo?"},
{"role": "assistant", "content": message.content},
{"role": "user", "content": tool_results}
]
)
print(follow_up.content[0].text)
# "The current weather in Tokyo is 22°C and partly cloudy with 65% humidity."
```
### Step 4: Agentic Loop (Multiple Tool Calls)
```python
def run_agent(user_message: str, tools: list, max_turns: int = 10) -> str:
"""Run an agentic loop that handles multiple sequential tool calls."""
messages = [{"role": "user", "content": user_message}]
for _ in range(max_turns):
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4096,
tools=tools,
messages=messages
)
# If Claude is done (no more tool calls), return final text
if response.stop_reason == "end_turn":
return next(
(b.text for b in response.content if b.type == "text"), ""
)
# Process tool calls
messages.append({"role": "assistant", "content": response.content})
tool_results = []
for block in response.content:
if block.type == "tool_use":
result = execute_tool(block.name, block.input)
tool_results.append({
"type": "tool_result",
"tool_use_id": block.id,
"content": result
})
messages.append({"role": "user", "content": tool_results})
return "Max turns reached"
```
## Output
- Tool definitions with JSON Schema input validation
- Agent loop handling sequential tool calls
- Proper `tool_use` / `tool_result` message threading
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `invalid_request_error`: tool schema invalid | Malformed `input_schema` | Validate against JSON Schema spec |
| `tool_use_id` mismatch | Result ID doesn't match tool_use ID | Copy `block.id` exactly |
| Claude ignores tools | Description too vague | Add clear "Use when..." descriptions |
| Infinite loop | Claude keeps calling tools | Add `max_turns` guard + `tool_choice: {"type": "auto"}` |
## Tool Choice Options
```python
# Let Claude decide (default)
tool_choice={"type": "auto"}
# Force Claude to use a specific tool
tool_choice={"type": "tool", "name": "get_weather"}
# Force Claude to use any tool (must call at least one)
tool_choice={"type": "any"}
```
## Resources
- [Tool Use Guide](https://docs.anthropic.com/en/docs/build-with-claude/tool-use)
- [Tool Use API Reference](https://docs.anthropic.com/en/api/messages)
- [Tool Use Examples](https://docs.anthropic.com/en/docs/build-with-claude/tool-use/examples)
## Next Steps
For streaming with tools, see `anth-core-workflow-b`.Related Skills
calendar-to-workflow
Converts calendar events and schedules into Claude Code workflows, meeting prep documents, and standup notes. Use when the user mentions calendar events, meeting prep, standup generation, or scheduling workflows. Trigger with phrases like "prep for my meetings", "generate standup notes", "create workflow from calendar", or "summarize today's schedule".
workhuman-core-workflow-b
Workhuman core workflow b for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman core workflow b".
workhuman-core-workflow-a
Workhuman core workflow a for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman core workflow a".
wispr-core-workflow-b
Wispr Flow core workflow b for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr core workflow b".
wispr-core-workflow-a
Wispr Flow core workflow a for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr core workflow a".
windsurf-core-workflow-b
Execute Windsurf's secondary workflow: Workflows, Memories, and reusable automation. Use when creating reusable Cascade workflows, managing persistent memories, or automating repetitive development tasks. Trigger with phrases like "windsurf workflow", "windsurf automation", "windsurf memories", "cascade workflow", "windsurf slash command".
windsurf-core-workflow-a
Execute Windsurf's primary workflow: Cascade Write mode for multi-file agentic coding. Use when building features, refactoring across files, or performing complex code tasks. Trigger with phrases like "windsurf cascade write", "windsurf agentic coding", "windsurf multi-file edit", "cascade write mode", "windsurf build feature".
webflow-core-workflow-b
Execute Webflow secondary workflows — Sites management, Pages API, Forms submissions, Ecommerce (products/orders/inventory), and Custom Code via the Data API v2. Use when managing sites, reading pages, handling form data, or working with Webflow Ecommerce products and orders. Trigger with phrases like "webflow sites", "webflow pages", "webflow forms", "webflow ecommerce", "webflow products", "webflow orders".
webflow-core-workflow-a
Execute the primary Webflow workflow — CMS content management: list collections, CRUD items, publish items, and manage content lifecycle via the Data API v2. Use when working with Webflow CMS collections and items, managing blog posts, team members, or any dynamic content. Trigger with phrases like "webflow CMS", "webflow collections", "webflow items", "create webflow content", "manage webflow CMS", "webflow content management".
veeva-core-workflow-b
Veeva Vault core workflow b for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva core workflow b".
veeva-core-workflow-a
Veeva Vault core workflow a for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva core workflow a".
vastai-core-workflow-b
Execute Vast.ai secondary workflow: multi-instance orchestration, spot recovery, and cost optimization. Use when running distributed training, handling spot preemption, or optimizing GPU spend across multiple instances. Trigger with phrases like "vastai distributed training", "vastai spot recovery", "vastai multi-gpu", "vastai cost optimization".