Claude Official Skill: claude-api
Build apps with the Claude API or Anthropic SDK. TRIGGER when: code imports `anthropic`/`@anthropic-ai/sdk`/`claude_agent_sdk`, or user asks to use Claude API, Anthropic SDKs, o...
Installation avec revue préalable
Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.
npx -y tokrepo@latest install 2be86b66-71f9-49bc-ae43-fdba086f79ea --target codexDry-run d'abord, confirmez les écritures, puis lancez cette commande.
What it is
The claude-api skill is an official Claude Code skill maintained by Anthropic. It activates automatically when your code imports anthropic, @anthropic-ai/sdk, or claude_agent_sdk, and provides Claude Code with the knowledge to build LLM-powered applications correctly. The skill covers prompt caching, streaming, tool use, vision, and the managed agents API.
This skill targets developers building production applications on the Claude API who want Claude Code to generate correct, idiomatic SDK code rather than guessing at API shapes.
How it saves time or tokens
Without this skill, Claude Code may generate outdated or incorrect API calls for Anthropic-specific features like prompt caching or extended thinking. The skill injects current API patterns so generated code works on first run. It also teaches Claude Code to use prompt caching by default, which can reduce token costs by up to 90% for repeated prefixes.
How to use
- Install the skill in Claude Code:
claude skill install anthropics/skills/claude-api
- Or manually place the skill file:
mkdir -p .claude/skills/claude-api
# Copy SKILL.md content to .claude/skills/claude-api/SKILL.md
- Start coding with the Claude API -- the skill activates automatically:
import anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model='claude-sonnet-4-20250514',
max_tokens=1024,
messages=[{'role': 'user', 'content': 'Hello'}]
)
print(message.content[0].text)
Example
import anthropic
client = anthropic.Anthropic()
# Streaming with tool use
with client.messages.stream(
model='claude-sonnet-4-20250514',
max_tokens=1024,
tools=[{
'name': 'get_weather',
'description': 'Get current weather for a city',
'input_schema': {
'type': 'object',
'properties': {
'city': {'type': 'string'}
},
'required': ['city']
}
}],
messages=[{'role': 'user', 'content': 'Weather in Tokyo?'}]
) as stream:
for text in stream.text_stream:
print(text, end='', flush=True)
Related on TokRepo
- AI tools for coding -- Other developer tools and coding assistants
- Prompt library -- Curated prompts and skill files for AI coding tools
Common pitfalls
- Forgetting to set the ANTHROPIC_API_KEY environment variable before running -- the SDK throws a generic error that does not clearly indicate the missing key
- Using an outdated model identifier; always check the current model names in the Anthropic docs as they change with new releases
- Not enabling prompt caching for repeated system prompts, which wastes tokens on every request
Questions fréquentes
The skill triggers automatically when Claude Code detects imports of anthropic, @anthropic-ai/sdk, or claude_agent_sdk in your codebase. You can also invoke it manually. Once active, it provides Claude Code with current API patterns, model names, and best practices.
Yes. The skill covers both the Python SDK (anthropic) and the TypeScript SDK (@anthropic-ai/sdk). It detects your project language and provides the appropriate code patterns and import styles.
Prompt caching lets you mark portions of your prompt as cacheable. The API stores these portions and reuses them across requests, reducing input token costs by up to 90% for repeated system prompts or context. The skill teaches Claude Code to use cache_control blocks by default.
Yes. The skill includes knowledge of the Claude Agent SDK and managed agents API. It covers patterns for tool handoffs, agent orchestration, and the TeammateTool interface for multi-agent coordination.
Yes. The claude-api skill is from the official anthropics/skills repository on GitHub, maintained by the Claude Code team. It is updated as the API evolves to reflect current model names, parameters, and features.
Sources citées (3)
- Anthropic Skills GitHub— Official Claude Code skill from Anthropic skills repository
- Anthropic Prompt Caching Docs— Prompt caching reduces input token costs by up to 90%
- Anthropic API Reference— Claude API supports streaming, tool use, and vision
En lien sur TokRepo
Source et remerciements
Created by Anthropic. Licensed under MIT. anthropics/skills
Fil de discussion
Actifs similaires
Claude Official Skill: frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or appli...
Claude Official Skill: PPTX — PowerPoint Presentations
Claude Code skill for PowerPoint. Create slide decks, add charts, format layouts, import content, and generate presentations from text.
Claude Official Skill: canvas-design
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other s...
Claude Official Skill: DOCX — Word Document Creation
Claude Code skill for Word documents. Create, read, edit .docx files with formatting, tables, images, headers, and styles.