tool-use-patterns

tool-use-patterns is a skill for Claude Code, Codex from VersoXBT/claude-initial-setup. It costs 60 tokens per session (1,703 once invoked), scanned A, original, MIT.

A guide to defining and coordinating tools for Claude-based software agents. It covers how tools describe their inputs, how several tools work together, and how errors and results are handled.

In plain words
What is it for?
Use it when building an agent that calls external tools, designing tool schemas, coordinating several operations, or formatting tool results.
Why use it?
It helps prevent unclear tool definitions, fragile multi-step workflows, and poorly handled failures. It also explains when parallel tool calls are useful.

Skill for Claude CodeCodex

Part of the claude-initial-setup plugin — 24 skills, 15 commands, 14 agents, 2 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/versoxbt/claude-initial-setup/tool-use-patterns
Any agent
npx skills add VersoXBT/claude-initial-setup --skill tool-use-patterns
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup

Made for: Claude Code, Codex.

Or install claude-initial-setup, the plugin that ships this one along with the rest of its 24 skills, 15 commands, 14 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tool-use-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/tool-use-patterns.svg)](https://agentmods.dev/skills/versoxbt/claude-initial-setup/tool-use-patterns)
Your own site
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/tool-use-patterns"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/tool-use-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,703 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00060 $0.01703
Opus 5 $0.00030 $0.00851
Sonnet 5 $0.00012 $0.00341
Haiku 4.5 $0.00006 $0.00170

Measured 4d ago against content hash a7226dcdb9e2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tool-use-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/claude-api/tool-use-patterns/SKILL.md · 229 lines

How it starts

The opening of the file, as written. The whole thing — 229 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tool Use Patterns

Patterns for defining, orchestrating, and handling Claude tool use. Covers schemas, multi-tool flows, parallel execution, error handling, and result formatting.

When to Use

  • User is defining tools for the Claude API
  • User is building agentic loops with tool calling
  • User needs parallel tool execution
  • User is handling tool errors or formatting results
  • User is designing multi-step tool workflows

Core Patterns

Tool Definition Schema

Tools are defined with a name, description, and JSON Schema for input_schema. The description is critical -- Claude uses it to decide when to call the tool.

tools = [
    {
        "name": "get_weather",
        "description": "Get current weather for a city. Use this when the user asks about weather, temperature, or forecast for a specific location.",
        "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. Default: fahrenheit."
                }
            },
            "required": ["city"]
        }
    }
]

message = client.messages.create(
    model="claude-sonnet-4-6-20250514",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the weather in Tokyo?"}]
)

Agentic Tool Loop

The core pattern: send a message, check if Claude wants to use tools, execute them, return results, and repeat until Claude produces a final text response.

def run_agent(user_message: str, tools: list, system: str = "") -> str:
    messages = [{"role": "user", "content": user_message}]

    while True:
        response = client.messages.create(
            model="claude-sonnet-4-6-20250514",
            max_tokens=4096,
            system=system,
            tools=tools,
            messages=messages,
        )

        # Collect tool use blocks and text
        tool_results = []
        final_text = ""

        for block in response.content:
            if block.type == "tool_use":
                # Execute the tool
                result = execute_tool(block.name, block.input)
                tool_results.append({
                    "type": "tool_result",
                    "tool_use_id": block.id,
                    "content": json.dumps(result)
                })
            elif block.type == "text":
                final_text = block.text

        # If no tool calls, return the final text
        if response.stop_reason == "end_turn":
            return final_text

        # Append assistant response and tool results
        messages.append({"role": "assistant", "content": response.content})
        messages.append({"role": "user", "content": tool_results})

Read the full file on GitHub · 229 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 229 lines · 60 tokens per session scan A a7226dcdb9e2

Subscribe to this mod's changes

tool-use-patterns is a skill published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 3mo ago), licensed MIT. It adds 60 tokens to every session and 1,703 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

extension-creator

Create AiderDesk extensions by setting up extension files, defining metadata, implementing Extension interface methods, and updating documentation. Use when building a new extension, creating extension commands, tools, or event handlers.

hotovo/aider-desk · 44 tokens

theme-factory

Create new AiderDesk UI themes by defining SCSS color variables, registering theme types, and adding i18n display names. Use when adding a theme, creating a color scheme, customizing appearance, or implementing dark mode and light mode variants.

hotovo/aider-desk · 53 tokens

agent-creator

Create and configure AiderDesk agent profiles by defining tool groups, approval rules, system prompts, subagent settings, subagent filtering, and provider/model selection. Use when setting up a new agent, creating a profile, or configuring agent tools, permissions, and subagent behavior.

hotovo/aider-desk · 60 tokens

api-design

REST/GraphQL/gRPC API design best practices. Use when designing APIs, defining contracts, handling versioning. Covers OpenAPI 3.2, GraphQL Federation, gRPC streaming.

majiayu000/spellbook · 42 tokens

incident-slo-runbook

Create or audit SLOs, SLIs, alert rules, incident response steps, escalation paths, postmortems, operational runbooks, and customer-impact communication. Use when defining production reliability, preparing launch readiness, responding to an outage, writing a runbook, tuning alerts, or closing the loop after an…

majiayu000/spellbook · 70 tokens

add-agent-property

Add a new property to the AI agents database. Use when the user wants to add, create, or introduce a new column, property, field, or feature to track across all agents in the comparison matrix. Handles all four required steps - database updates, groups.json, table display, and GitHub issue templates.

PackmindHub/coding-agents-matrix · 67 tokens