Anthropic Sdk logo

Anthropic Sdk

Organization
TerminalSkills
anthropic-sdk

Integrate Claude AI into applications with the Anthropic SDK. Use when a user asks to add Claude to an app, use Claude for text generation, build a chatbot with Claude, use Claude's long context window, implement tool use with Claude, stream Claude responses, use Claude for code generation, document analysis, or reasoning tasks. Covers Messages API, streaming, tool use, vision, system prompts, extended thinking, and batch processing.

Overview

PublisherTerminalSkills
Repositoryskills
Skill nameanthropic-sdk
Stars
155
Forks
21
Bundled files
1
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by TerminalSkills on GitHub. Read the source before you install it.

Installation

Install the Anthropic Sdk AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/TerminalSkills/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/anthropic-sdk .claude/skills/anthropic-sdk
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Anthropic Sdk in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Anthropic Sdk on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Anthropic Sdk is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Anthropic SDK

Overview

The Anthropic SDK provides access to Claude models (Opus, Sonnet, Haiku) for text generation, analysis, coding, and reasoning. Claude excels at long-context understanding (200K tokens), careful instruction following, code generation, and complex reasoning. This skill covers the Messages API, streaming, tool use (function calling), vision, extended thinking, system prompts, and best practices for prompt engineering with Claude.

Instructions

Step 1: Installation

bash
# Node.js
npm install @anthropic-ai/sdk

# Python
pip install anthropic
typescript
// lib/anthropic.ts — Client initialization
import Anthropic from '@anthropic-ai/sdk'

const anthropic = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
})

Step 2: Messages API

typescript
// chat.ts — Basic message creation
const message = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  system: 'You are a senior software engineer. Provide clear, production-ready code with comments.',
  messages: [
    { role: 'user', content: 'Write a rate limiter middleware for Express.js using a sliding window algorithm.' },
  ],
})

console.log(message.content[0].type === 'text' ? message.content[0].text : '')
// message.usage: { input_tokens: 42, output_tokens: 512 }
python
# Python equivalent
import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    system="You are a senior software engineer.",
    messages=[
        {"role": "user", "content": "Write a rate limiter for Express.js."}
    ],
)
print(message.content[0].text)

Step 3: Streaming

typescript
// stream.ts — Stream responses for real-time UI
const stream = anthropic.messages.stream({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Explain how B-trees work.' }],
})

for await (const event of stream) {
  if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
    process.stdout.write(event.delta.text)
  }
}

// Or using the helper
const stream2 = anthropic.messages.stream({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Explain B-trees.' }],
})

stream2.on('text', (text) => process.stdout.write(text))
await stream2.finalMessage()

Step 4: Tool Use (Function Calling)

typescript
// tools.ts — Let Claude call your functions
const tools: Anthropic.Tool[] = [
  {
    name: 'get_stock_price',
    description: 'Get the current stock price for a ticker symbol. Use when the user asks about stock prices.',
    input_schema: {
      type: 'object',
      properties: {
        ticker: { type: 'string', description: 'Stock ticker symbol (e.g., AAPL, GOOGL)' },
      },
      required: ['ticker'],
    },
  },
  {
    name: 'execute_sql',
    description: 'Execute a read-only SQL query against the analytics database.',
    input_schema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'SQL SELECT query to execute' },
      },
      required: ['query'],
    },
  },
]

const response = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  tools,
  messages: [{ role: 'user', content: 'What is Apple stock at right now?' }],
})

// Process tool use
if (response.stop_reason === 'tool_use') {
  const toolUse = response.content.find(b => b.type === 'tool_use')!
  const result = await executeFunction(toolUse.name, toolUse.input)

  // Send result back to Claude
  const finalResponse = await anthropic.messages.create({
    model: 'claude-sonnet-4-20250514',
    max_tokens: 1024,
    tools,
    messages: [
      { role: 'user', content: 'What is Apple stock at right now?' },
      { role: 'assistant', content: response.content },
      { role: 'user', content: [{ type: 'tool_result', tool_use_id: toolUse.id, content: JSON.stringify(result) }] },
    ],
  })
}

Step 5: Vision

typescript
// vision.ts — Analyze images with Claude
import { readFileSync } from 'fs'

// URL-based image
const response = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  messages: [{
    role: 'user',
    content: [
      { type: 'image', source: { type: 'url', url: 'https://example.com/chart.png' } },
      { type: 'text', text: 'Analyze this chart. What trends do you see?' },
    ],
  }],
})

// Base64 image (from file)
const imageData = readFileSync('screenshot.png').toString('base64')
const response2 = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  messages: [{
    role: 'user',
    content: [
      { type: 'image', source: { type: 'base64', media_type: 'image/png', data: imageData } },
      { type: 'text', text: 'Extract all text and data from this screenshot.' },
    ],
  }],
})

Step 6: Extended Thinking

typescript
// thinking.ts — Enable extended thinking for complex reasoning tasks
const response = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 16000,
  thinking: {
    type: 'enabled',
    budget_tokens: 10000,    // tokens allocated for internal reasoning
  },
  messages: [{
    role: 'user',
    content: 'Analyze this codebase for security vulnerabilities and provide a prioritized remediation plan.',
  }],
})

// Response contains both thinking blocks and text blocks
for (const block of response.content) {
  if (block.type === 'thinking') {
    console.log('Reasoning:', block.thinking)
  } else if (block.type === 'text') {
    console.log('Response:', block.text)
  }
}

Step 7: Multi-Turn Conversations

typescript
// conversation.ts — Maintain conversation history
const messages: Anthropic.MessageParam[] = []

async function chat(userMessage: string): Promise<string> {
  messages.push({ role: 'user', content: userMessage })

  const response = await anthropic.messages.create({
    model: 'claude-sonnet-4-20250514',
    max_tokens: 2048,
    system: 'You are a helpful assistant for a project management app.',
    messages,
  })

  const assistantContent = response.content
  messages.push({ role: 'assistant', content: assistantContent })

  return assistantContent.filter(b => b.type === 'text').map(b => b.text).join('')
}

Examples

Example 1: Build a code review bot

User prompt: "Build a bot that reviews pull requests. It should analyze the diff, check for bugs, security issues, and style problems, then post inline comments."

The agent will:

  1. Fetch PR diff via GitHub API.
  2. Send the diff to Claude with a system prompt tuned for code review.
  3. Use structured output to get file-specific comments with line numbers.
  4. Post comments back to GitHub using the PR review API.

Example 2: Document analysis pipeline with tool use

User prompt: "Build a system where users upload contracts and ask questions about them. The AI should be able to search across multiple documents and cite specific sections."

The agent will:

  1. Store document chunks with embeddings in a vector database.
  2. Define a search_documents tool that Claude can call.
  3. Claude formulates search queries, retrieves relevant chunks, and synthesizes answers with citations.
  4. Use Claude's 200K context window for full-document analysis when documents are small enough.

Guidelines

  • Claude Sonnet is the best default for most tasks — it balances quality, speed, and cost. Use Opus for the most complex reasoning and Haiku for high-volume, simple tasks.
  • Write detailed system prompts — Claude follows instructions carefully. Specify output format, constraints, tone, and edge case handling in the system prompt.
  • Use extended thinking for complex reasoning (math, multi-step analysis, code architecture). The thinking budget controls how much Claude reasons before responding.
  • Claude supports 200K token context windows — use this for long document analysis, large codebases, and conversations with extensive history.
  • For tool use, provide clear descriptions and examples in the tool definition. Claude uses descriptions (not just parameter names) to decide when and how to call tools.
  • Always handle the stop_reason field: end_turn means done, tool_use means Claude wants to call a function, max_tokens means the response was truncated.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Anthropic Sdk AI skill do?

Integrate Claude AI into applications with the Anthropic SDK. Use when a user asks to add Claude to an app, use Claude for text generation, build a chatbot with Claude, use Claude's long context window, implement tool use with Claude, stream Claude responses, use Claude for code generation, document analysis, or reasoning tasks. Covers Messages API, streaming, tool use, vision, system prompts, extended thinking, and batch processing.

Why use Anthropic Sdk on TypingMind?

Because you install it once and use it with any model. Anthropic Sdk is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Anthropic Sdk in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/TerminalSkills/skills/tree/main/skills/anthropic-sdk. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Anthropic Sdk?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Anthropic Sdk?

As many as you like. As long as a model supports skills, you can use Anthropic Sdk with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Anthropic Sdk AI skill free?

Yes. It is published on GitHub by TerminalSkills under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇