FortiumPartners avatar

using-anthropic-platform

Claude SDK development with Messages API, Tool Use, Extended Thinking, streaming, and prompt caching

by FortiumPartners|Open Source

Anthropic SDK Skill

Provider: Anthropic Languages: Python, TypeScript Last Updated: 2026-01-01

Overview

Progressive disclosure documentation for Anthropic Claude API development. This skill provides comprehensive patterns for Messages API, Tool Use, Extended Thinking, Agent SDK, Batches API, Computer Use, MCP, Citations, Streaming, Vision, and more.

Architecture

anthropic/
├── README.md              # This file - overview and usage
├── SKILL.md               # Quick reference (<500 lines) - Essential patterns
├── REFERENCE.md           # Comprehensive reference - Advanced patterns
├── VALIDATION.md          # Feature coverage validation matrix
├── templates/             # Code generation templates
│   ├── messages.template.py          # Messages API (Python)
│   ├── messages.template.ts          # Messages API (TypeScript)
│   ├── streaming.template.py         # Streaming patterns
│   ├── tool-use.template.py          # Tool use patterns
│   ├── extended-thinking.template.py # Extended thinking
│   └── README.md                     # Template usage guide
└── examples/              # Real-world implementations
    ├── basic-chat.example.py         # Basic message completion
    ├── tool-use.example.py           # Tool use patterns
    ├── streaming.example.py          # Streaming responses
    ├── vision.example.py             # Image analysis
    └── README.md                     # Examples index

Progressive Disclosure Pattern

SKILL.md (Quick Reference)

  • Size: <500 lines target
  • Use Case: Fast lookups during active development
  • Content: Essential patterns, model specs, common operations
  • Load Time: <100ms

REFERENCE.md (Full Reference)

  • Size: ~1000 lines
  • Use Case: Advanced patterns and detailed implementations
  • Content: Agent SDK, Batches API, Computer Use, MCP, Citations, etc.

When to Use

The backend-developer agent loads this skill when:

  • package.json contains "@anthropic-ai/sdk" dependency
  • requirements.txt or pyproject.toml contains anthropic
  • .env contains ANTHROPIC_API_KEY
  • User explicitly mentions "Anthropic", "Claude", or specific Claude models

Framework Detection

Primary Signals (Confidence: 0.5 each):

  • package.json -> dependencies.@anthropic-ai/sdk
  • requirements.txt contains anthropic
  • pyproject.toml contains anthropic

Secondary Signals (Confidence: 0.3 each):

  • .env contains ANTHROPIC_API_KEY
  • Import statements: from anthropic import or import anthropic

Boost Factors (+0.1 each):

  • Files matching *claude*.py pattern
  • Files matching *anthropic*.py pattern

Minimum Confidence: 0.8 (80%) required for automatic detection

Core Capabilities

1. Messages API

  • Basic message patterns
  • System prompts
  • Multi-turn conversations
  • Temperature and parameters

2. Agent SDK (NEW)

  • Build custom agents powered by Claude
  • Tool access (Task, Read, Write, Edit, Bash, WebSearch)
  • Permission modes (default, plan, acceptEdits)
  • Session management and conversation continuation
  • Context management and automatic compaction

3. Message Batches API (NEW)

  • 50% cost savings for async processing
  • Bulk document processing
  • Up to 10,000 requests per batch
  • 24-hour processing window

4. Streaming

  • Server-sent events (SSE)
  • Async generators
  • Partial responses
  • Content block deltas

5. Tool Use

  • Tool definitions
  • Tool execution loops
  • Parallel tool calls
  • Result handling

6. Extended Thinking

  • Budget tokens configuration
  • Thinking block handling
  • Streaming with thinking
  • Cost optimization

7. Vision/Multimodal

  • Image inputs (base64, URL)
  • PDF document analysis
  • Multiple images
  • Detail analysis

8. Computer Use (Beta) (NEW)

  • Browser/desktop automation
  • Screenshot capture and analysis
  • Mouse and keyboard actions
  • Sandboxed execution patterns

9. MCP Integration (NEW)

  • Model Context Protocol overview
  • Tool exposure patterns
  • Server implementation
  • Client libraries

10. Citations (NEW)

  • Grounded responses from documents
  • Multi-document citations
  • Quote extraction
  • Source verification

11. Prompt Caching

  • Cache control headers
  • Ephemeral caching
  • Cost optimization
  • Cache hit tracking

Platform Differentiators

FeatureAnthropicDescription
Extended ThinkingNativeBudget-controlled deep reasoning
Agent SDKFull SDKBuild agents with multiple tools
Claude CodeBuilt-inTerminal-based coding assistant
Constitutional AICoreSafety-focused training
200K ContextStandardAll models support 200K tokens
MCPOpen ProtocolExtensible tool protocol
Prompt CachingNative90% cost savings
Computer UseBetaBrowser/desktop automation
Message BatchesNative50% cost savings
CitationsNativeGrounded responses

Model Coverage

Claude 4 Family (Latest)

ModelContextMax OutputExtended ThinkingComputer Use
claude-opus-4-5-20251101200K32KYesYes
claude-sonnet-4-20250514200K64KYesYes

Claude 3.5 Family

ModelContextMax OutputExtended ThinkingComputer Use
claude-3-5-sonnet-20241022200K8KNoYes
claude-3-5-haiku-20241022200K8KNoNo

Claude 3 Family

ModelContextMax OutputExtended ThinkingComputer Use
claude-3-opus-20240229200K4KNoYes
claude-3-sonnet-20240229200K4KNoNo
claude-3-haiku-20240307200K4KNoNo

Quick Start

Loading the Skill

// Embedded in backend-developer.yaml
const skill = await skillLoader.loadSkill('anthropic', 'quick');
// Returns SKILL.md content for fast reference

Using Templates

# Generate messages handler
cp templates/messages.template.py src/chat.py
# Replace placeholders

# Generate streaming handler
cp templates/streaming.template.py src/stream.py
# Replace placeholders

File Size Guidelines

  • SKILL.md: Target <=100KB (Quick reference should be fast)
  • Templates: 50-200 lines each (Focused, single responsibility)
  • Examples: 100-300 lines each (Real-world, production-ready)

Integration with Backend-Developer

The backend-developer agent uses this skill by:

  1. Detection Phase: Runs framework-detector to identify Anthropic
  2. Loading Phase: Loads SKILL.md for quick patterns
  3. Code Generation: Uses templates for boilerplate reduction
  4. Learning Phase: References examples for best practices

Maintenance

Updating Content

When Anthropic releases new features:

  1. Update SKILL.md with new APIs
  2. Add templates for new patterns if commonly used
  3. Update model coverage tables
  4. Increment skill version (semantic versioning)

Validation

Before releasing updates:

  • SKILL.md file size <=100KB
  • All templates pass linting
  • Examples demonstrate production-ready code
  • Model information is current

Support

For issues or improvements:

Performance Metrics

Target Metrics:

  • Skill load time: <100ms (SKILL.md)
  • Template generation: <50ms per file
  • Code generation success rate: >=95%
  • User satisfaction: >=90%

Part of Skills-Based Framework Architecture Related: @fortium/ensemble-ai