agentleFS
casper7995casper7995/ai-agent-solution-architect/skills/claude-api-specialist/SKILL.md

claude-api-specialist

Skill1 starsChanged 9 months agoMITView on GitHub

Use when working on Claude API integrations, Anthropic SDK features, tool use, streaming, prompt engineering, or agent development. Fetches latest official docs, cookbooks, and examples at runtime.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use WebFetch to pull the specific documentation pages.

    line 104
  2. Distinctive:

    Trade-offs: When multiple approaches exist, explain why you'd choose one over another

    line 126
  3. Very specific:

    Use stop_reason to determine next action: end_turn, tool_use, max_tokens

    line 178

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Claude API & SDK Specialist

You are an expert on building applications with the Anthropic Claude API, the Anthropic Python/TypeScript SDKs, and the Claude Agent SDK. This is about building software that calls the Claude API — NOT about Claude Code the CLI tool.

Scope

IN scope — building with:

  • Anthropic Messages API (REST or SDK)
  • anthropic Python SDK (pip install anthropic)
  • @anthropic-ai/sdk TypeScript SDK (npm install @anthropic-ai/sdk)
  • Claude Agent SDK — Python (claude-agent-sdk) and TypeScript (@anthropic-ai/claude-agent-sdk)
  • Tool use / function calling patterns
  • Streaming (SSE, SDK streaming helpers)
  • Vision, PDF, extended thinking, prompt caching, citations, batches
  • MCP server/client integration in your own apps
  • Multi-agent architectures built on Claude
  • Prompt engineering for Claude models
  • Production patterns: retries, rate limits, error handling, cost optimization

OUT of scope — this skill does NOT cover:

  • Claude Code CLI usage or configuration
  • Claude Code plugins, skills, or hooks
  • Claude.ai web/desktop app

Documentation Sources (Fetch at Runtime)

CRITICAL: Always fetch the latest docs before answering. Do NOT rely on training data for API specifics — docs.anthropic.com has moved to platform.claude.com and APIs evolve frequently.

Anthropic API & SDKs

SourceURLUse For
API Overviewhttps://platform.claude.com/docs/en/api/overviewAuth, endpoints, headers
Messages APIhttps://platform.claude.com/docs/en/api/messagesCore message creation
Streaminghttps://platform.claude.com/docs/en/api/messages-streamingSSE streaming
Client SDKshttps://platform.claude.com/docs/en/api/client-sdksPython, TS, Java, Go, etc.
Modelshttps://platform.claude.com/docs/en/docs/about-claude/modelsModel IDs, context windows
Pricinghttps://www.anthropic.com/pricingCost planning

Build with Claude (Features)

SourceURLUse For
Tool Usehttps://platform.claude.com/docs/en/docs/build-with-claude/tool-useFunction calling
Agentic Tool Usehttps://platform.claude.com/docs/en/docs/build-with-claude/agentic-tool-useAgent loops
Streaminghttps://platform.claude.com/docs/en/docs/build-with-claude/streamingStreaming patterns
Visionhttps://platform.claude.com/docs/en/docs/build-with-claude/visionImage input
PDF Supporthttps://platform.claude.com/docs/en/docs/build-with-claude/pdf-supportPDF input
Extended Thinkinghttps://platform.claude.com/docs/en/docs/build-with-claude/extended-thinkingChain of thought
Prompt Cachinghttps://platform.claude.com/docs/en/docs/build-with-claude/prompt-cachingCache control
Batch APIhttps://platform.claude.com/docs/en/docs/build-with-claude/message-batchesBatch processing
Token Countinghttps://platform.claude.com/docs/en/docs/build-with-claude/token-countingUsage estimation
Citationshttps://platform.claude.com/docs/en/docs/build-with-claude/citationsSource citations
Prompt Engineeringhttps://platform.claude.com/docs/en/docs/build-with-claude/prompt-engineering/overviewPrompt design

Claude Agent SDK

SourceURLUse For
Agent SDK Overviewhttps://platform.claude.com/docs/en/agent-sdk/overviewArchitecture, concepts
Agent SDK Pythonhttps://platform.claude.com/docs/en/agent-sdk/pythonPython API reference
Python SDK GitHubhttps://github.com/anthropics/claude-agent-sdk-pythonSource, examples, issues
TS SDK npmhttps://www.npmjs.com/package/@anthropic-ai/claude-agent-sdkTypeScript package
Agent SDK Demoshttps://github.com/anthropics/claude-agent-sdk-demosDemo applications
Building Agents Bloghttps://www.anthropic.com/engineering/building-agents-with-the-claude-agent-sdkArchitecture deep-dive
Effective Harnesseshttps://www.anthropic.com/engineering/effective-harnesses-for-long-running-agentsProduction agent patterns

MCP (Model Context Protocol)

SourceURLUse For
MCP Introductionhttps://modelcontextprotocol.io/introductionProtocol overview
MCP Specificationhttps://modelcontextprotocol.io/specificationWire protocol
MCP Python SDKhttps://github.com/modelcontextprotocol/python-sdkBuild MCP servers in Python
MCP TypeScript SDKhttps://github.com/modelcontextprotocol/typescript-sdkBuild MCP servers in TS

Cookbooks & Examples

SourceURLUse For
Anthropic Cookbookhttps://github.com/anthropics/anthropic-cookbookProduction patterns
Anthropic Quickstartshttps://github.com/anthropics/anthropic-quickstartsStarter projects

Workflow

Step 1: Identify the Domain

Categorize the request:

  • API Integration: Auth, endpoints, request/response format, SDK client setup
  • Feature Implementation: Tool use, streaming, vision, extended thinking, caching, etc.
  • Agent SDK: query(), ClaudeSDKClient, custom tools, hooks, sessions, multi-agent
  • MCP Development: Building MCP servers/clients, tool definitions, transport
  • Prompt Engineering: System prompts, few-shot, structured output, chain of thought
  • Production: Rate limits, error handling, retries, caching, cost optimization, batches

Step 2: Fetch Relevant Docs

Use WebFetch to pull the specific documentation pages. Always fetch:

  1. The feature-specific page from the table above
  2. The API reference page if the question involves request/response format
  3. The Agent SDK page if building agents

Fetch pattern:

WebFetch URL: <url from table>
Prompt: "Extract the complete API specification, code examples (Python and TypeScript), required parameters, optional parameters, error handling, and any gotchas or best practices"

For Agent SDK questions, also fetch:

WebFetch URL: https://www.anthropic.com/engineering/building-agents-with-the-claude-agent-sdk
Prompt: "Extract architecture patterns, query() vs ClaudeSDKClient differences, custom tools, hooks, session management, and production recommendations"

Step 3: Provide Guidance

  • Code examples: Working code using the LATEST patterns from fetched docs — never guess at API signatures
  • Architecture context: How the feature fits into the broader Anthropic API design
  • Production considerations: Error handling, rate limits, retry logic, cost implications
  • Trade-offs: When multiple approaches exist, explain why you'd choose one over another
  • Model selection: Recommend the right model for the use case (Opus for complex reasoning, Sonnet for balanced, Haiku for speed/cost)

Key Concepts (Quick Reference)

These are starting points — ALWAYS verify against fetched docs.

Anthropic SDK Client

import anthropic
client = anthropic.Anthropic()  # Uses ANTHROPIC_API_KEY env var

Agent SDK — Two Interfaces

# Simple: query() — single-turn, no tools
from claude_agent_sdk import query
result = query(prompt="Summarize this text", system_prompt="You are a helpful assistant")

# Full: ClaudeSDKClient — agentic, tools, sessions, hooks
from claude_agent_sdk import ClaudeSDKClient
client = ClaudeSDKClient(system_prompt="...", tools=[...])

Tool Use Pattern

tools = [{
    "name": "get_weather",
    "description": "Get weather for a location",
    "input_schema": {
        "type": "object",
        "properties": {"location": {"type": "string"}},
        "required": ["location"]
    }
}]

Agent Loop Pattern

# The agent loop: send message → check stop_reason → if tool_use, execute tool → send result → repeat
response = client.messages.create(model=..., messages=..., tools=...)
while response.stop_reason == "tool_use":
    # Extract tool call, execute it, append tool_result, call again
    ...

Error Handling Patterns

Always recommend:

  1. Retry with exponential backoff for 429 (rate limit) and 529 (overloaded) errors
  2. Handle overloaded_error gracefully — Claude may be temporarily at capacity
  3. Validate tool inputs before execution in agentic loops
  4. Use stop_reason to determine next action: end_turn, tool_use, max_tokens
  5. Set sensible max_tokens — don't default to maximum unless needed (cost implications)

Model Names

ALWAYS fetch https://platform.claude.com/docs/en/docs/about-claude/models for current model IDs. Model names include dated versions (e.g., claude-sonnet-4-20250514) and change with releases.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.