jpskill.com
🛠️ 開発・MCP コミュニティ

claude-cookbooks

Claude APIの活用方法を学び、Claudeを活用したアプリケーション開発や機能探求を行う際に、コード例やチュートリアル、ベストプラクティスを提供する、日本人ビジネスパーソンにとって実践的な開発を支援するSkill。

📜 元の英語説明(参考)

Claude AI cookbooks - code examples, tutorials, and best practices for using Claude API. Use when learning Claude API integration, building Claude-powered applications, or exploring Claude capabilities.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Claude APIの活用方法を学び、Claudeを活用したアプリケーション開発や機能探求を行う際に、コード例やチュートリアル、ベストプラクティスを提供する、日本人ビジネスパーソンにとって実践的な開発を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o claude-cookbooks.zip https://jpskill.com/download/16677.zip && unzip -o claude-cookbooks.zip && rm claude-cookbooks.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16677.zip -OutFile "$d\claude-cookbooks.zip"; Expand-Archive "$d\claude-cookbooks.zip" -DestinationPath $d -Force; ri "$d\claude-cookbooks.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して claude-cookbooks.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → claude-cookbooks フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
11

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Claude Cookbooks Skill

公式の Anthropic cookbooks リポジトリから提供された、Claude AI を用いた構築のための包括的なコード例とガイドです。

この Skill を使用するべき時

この Skill は、以下の場合にトリガーされるべきです。

  • Claude API の使い方を学習する
  • Claude の統合を実装する
  • Claude でアプリケーションを構築する
  • ツール使用と関数呼び出しを扱う
  • マルチモーダル機能(ビジョン、画像分析)を実装する
  • RAG (Retrieval Augmented Generation) をセットアップする
  • Claude をサードパーティサービスと統合する
  • Claude で AI エージェントを構築する
  • Claude のプロンプトを最適化する
  • 高度なパターン(キャッシング、サブエージェントなど)を実装する

クイックリファレンス

基本的な API の使い方

import anthropic

client = anthropic.Anthropic(api_key="your-api-key")

# Simple message
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": "Hello, Claude!"
    }]
)

ツール使用 (関数呼び出し)

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

# Use the tool
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the weather in San Francisco?"}]
)

ビジョン (画像分析)

# Analyze an image
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": [
            {
                "type": "image",
                "source": {
                    "type": "base64",
                    "media_type": "image/jpeg",
                    "data": base64_image
                }
            },
            {"type": "text", "text": "Describe this image"}
        ]
    }]
)

プロンプトキャッシング

# Use prompt caching for efficiency
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    system=[{
        "type": "text",
        "text": "Large system prompt here...",
        "cache_control": {"type": "ephemeral"}
    }],
    messages=[{"role": "user", "content": "Your question"}]
)

カバーされる主要な機能

1. 分類

  • テキスト分類テクニック
  • 感情分析
  • コンテンツのカテゴリ分け
  • マルチラベル分類

2. Retrieval Augmented Generation (RAG)

  • ベクトルデータベースの統合
  • セマンティック検索
  • コンテキストの検索
  • 知識ベースのクエリ

3. 要約

  • ドキュメントの要約
  • 会議の議事録
  • 記事の凝縮
  • 複数ドキュメントの合成

4. Text-to-SQL

  • 自然言語から SQL クエリへ
  • データベーススキーマの理解
  • クエリの最適化
  • 結果の解釈

5. ツール使用 & 関数呼び出し

  • ツールの定義とスキーマ
  • パラメータの検証
  • 複数ツールのワークフロー
  • エラー処理

6. マルチモーダル

  • 画像分析と OCR
  • チャート/グラフの解釈
  • 視覚的な質問応答
  • 画像生成の統合

7. 高度なパターン

  • エージェントアーキテクチャ
  • サブエージェントへの委任
  • プロンプトの最適化
  • キャッシングによるコスト最適化

リポジトリ構造

cookbooks は、以下の主要なカテゴリに編成されています。

  • capabilities/ - コア AI 機能 (分類、RAG、要約、text-to-SQL)
  • tool_use/ - 関数呼び出しとツール統合の例
  • multimodal/ - ビジョンと画像関連の例
  • patterns/ - エージェントやワークフローのような高度なパターン
  • third_party/ - 外部サービスとの統合 (Pinecone, LlamaIndex など)
  • claude_agent_sdk/ - Agent SDK の例とテンプレート
  • misc/ - 追加のユーティリティ (PDF アップロード、JSON モード、評価など)

参照ファイル

この Skill には、references/ に包括的なドキュメントが含まれています。

  • main_readme.md - メインリポジトリの概要
  • capabilities.md - コア機能のドキュメント
  • tool_use.md - ツール使用と関数呼び出しのガイド
  • multimodal.md - ビジョンとマルチモーダル機能
  • third_party.md - サードパーティの統合
  • patterns.md - 高度なパターンとエージェント
  • index.md - 完全な参照インデックス

一般的なユースケース

カスタマーサービスエージェントの構築

  1. CRM アクセス、チケット作成、ナレッジベース検索のためのツールを定義する
  2. 関数呼び出しを処理するためにツール使用 API を使用する
  3. 会話の記憶を実装する
  4. フォールバックメカニズムを追加する

参照: references/tool_use.md#customer-service

RAG の実装

  1. ドキュメントの埋め込みを作成する
  2. ベクトルデータベース (Pinecone など) に保存する
  3. クエリに関連するコンテキストを取得する
  4. コンテキストで Claude の応答を拡張する

参照: references/capabilities.md#rag

ビジョンによるドキュメントの処理

  1. ドキュメントを画像または PDF に変換する
  2. ビジョン API を使用してコンテンツを抽出する
  3. 抽出されたデータを構造化する
  4. 検証と後処理を行う

参照: references/multimodal.md#vision

マルチエージェントシステムの構築

  1. さまざまなタスクに対して特化したエージェントを定義する
  2. ルーティングロジックを実装する
  3. 委任にサブエージェントを使用する
  4. 結果を集約する

参照: references/patterns.md#agents

ベストプラクティス

API の使い方

  • タスクに適したモデルを使用する (バランスの取れた Sonnet、高速な Haiku、複雑なタスクには Opus)
  • 指数バックオフで再試行ロジックを実装する
  • レート制限を適切に処理する
  • コスト最適化のためにトークン使用量を監視する

プロンプトエンジニアリング

  • 指示は具体的かつ明確にする
  • 必要に応じて例を提供する
  • 一貫した動作のためにシステムプロンプトを使用する
  • 必要に応じて JSON モードで出力を構造化する

ツール使用

  • 明確で具体的なツールスキーマを定義する
  • 入力と出力を検証する
  • エラーを適切に処理する
  • ツールの説明は簡潔かつ有益にする

マルチモーダル

  • 高品質の画像を使用する (高解像度 = より良い結果)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Claude Cookbooks Skill

Comprehensive code examples and guides for building with Claude AI, sourced from the official Anthropic cookbooks repository.

When to Use This Skill

This skill should be triggered when:

  • Learning how to use Claude API
  • Implementing Claude integrations
  • Building applications with Claude
  • Working with tool use and function calling
  • Implementing multimodal features (vision, image analysis)
  • Setting up RAG (Retrieval Augmented Generation)
  • Integrating Claude with third-party services
  • Building AI agents with Claude
  • Optimizing prompts for Claude
  • Implementing advanced patterns (caching, sub-agents, etc.)

Quick Reference

Basic API Usage

import anthropic

client = anthropic.Anthropic(api_key="your-api-key")

# Simple message
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": "Hello, Claude!"
    }]
)

Tool Use (Function Calling)

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

# Use the tool
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the weather in San Francisco?"}]
)

Vision (Image Analysis)

# Analyze an image
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": [
            {
                "type": "image",
                "source": {
                    "type": "base64",
                    "media_type": "image/jpeg",
                    "data": base64_image
                }
            },
            {"type": "text", "text": "Describe this image"}
        ]
    }]
)

Prompt Caching

# Use prompt caching for efficiency
response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=1024,
    system=[{
        "type": "text",
        "text": "Large system prompt here...",
        "cache_control": {"type": "ephemeral"}
    }],
    messages=[{"role": "user", "content": "Your question"}]
)

Key Capabilities Covered

1. Classification

  • Text classification techniques
  • Sentiment analysis
  • Content categorization
  • Multi-label classification

2. Retrieval Augmented Generation (RAG)

  • Vector database integration
  • Semantic search
  • Context retrieval
  • Knowledge base queries

3. Summarization

  • Document summarization
  • Meeting notes
  • Article condensing
  • Multi-document synthesis

4. Text-to-SQL

  • Natural language to SQL queries
  • Database schema understanding
  • Query optimization
  • Result interpretation

5. Tool Use & Function Calling

  • Tool definition and schema
  • Parameter validation
  • Multi-tool workflows
  • Error handling

6. Multimodal

  • Image analysis and OCR
  • Chart/graph interpretation
  • Visual question answering
  • Image generation integration

7. Advanced Patterns

  • Agent architectures
  • Sub-agent delegation
  • Prompt optimization
  • Cost optimization with caching

Repository Structure

The cookbooks are organized into these main categories:

  • capabilities/ - Core AI capabilities (classification, RAG, summarization, text-to-SQL)
  • tool_use/ - Function calling and tool integration examples
  • multimodal/ - Vision and image-related examples
  • patterns/ - Advanced patterns like agents and workflows
  • third_party/ - Integrations with external services (Pinecone, LlamaIndex, etc.)
  • claude_agent_sdk/ - Agent SDK examples and templates
  • misc/ - Additional utilities (PDF upload, JSON mode, evaluations, etc.)

Reference Files

This skill includes comprehensive documentation in references/:

  • main_readme.md - Main repository overview
  • capabilities.md - Core capabilities documentation
  • tool_use.md - Tool use and function calling guides
  • multimodal.md - Vision and multimodal capabilities
  • third_party.md - Third-party integrations
  • patterns.md - Advanced patterns and agents
  • index.md - Complete reference index

Common Use Cases

Building a Customer Service Agent

  1. Define tools for CRM access, ticket creation, knowledge base search
  2. Use tool use API to handle function calls
  3. Implement conversation memory
  4. Add fallback mechanisms

See: references/tool_use.md#customer-service

Implementing RAG

  1. Create embeddings of your documents
  2. Store in vector database (Pinecone, etc.)
  3. Retrieve relevant context on query
  4. Augment Claude's response with context

See: references/capabilities.md#rag

Processing Documents with Vision

  1. Convert document to images or PDF
  2. Use vision API to extract content
  3. Structure the extracted data
  4. Validate and post-process

See: references/multimodal.md#vision

Building Multi-Agent Systems

  1. Define specialized agents for different tasks
  2. Implement routing logic
  3. Use sub-agents for delegation
  4. Aggregate results

See: references/patterns.md#agents

Best Practices

API Usage

  • Use appropriate model for task (Sonnet for balance, Haiku for speed, Opus for complex tasks)
  • Implement retry logic with exponential backoff
  • Handle rate limits gracefully
  • Monitor token usage for cost optimization

Prompt Engineering

  • Be specific and clear in instructions
  • Provide examples when needed
  • Use system prompts for consistent behavior
  • Structure outputs with JSON mode when needed

Tool Use

  • Define clear, specific tool schemas
  • Validate inputs and outputs
  • Handle errors gracefully
  • Keep tool descriptions concise but informative

Multimodal

  • Use high-quality images (higher resolution = better results)
  • Be specific about what to extract/analyze
  • Respect size limits (5MB per image)
  • Use appropriate image formats (JPEG, PNG, GIF, WebP)

Performance Optimization

Prompt Caching

  • Cache large system prompts
  • Cache frequently used context
  • Monitor cache hit rates
  • Balance caching vs. fresh content

Cost Optimization

  • Use Haiku for simple tasks
  • Implement prompt caching for repeated context
  • Set appropriate max_tokens
  • Batch similar requests

Latency Optimization

  • Use streaming for long responses
  • Minimize message history
  • Optimize image sizes
  • Use appropriate timeout values

Resources

Official Documentation

Community

Learning Resources

Working with This Skill

For Beginners

Start with references/main_readme.md and explore basic examples in references/capabilities.md

For Specific Features

  • Tool use → references/tool_use.md
  • Vision → references/multimodal.md
  • RAG → references/capabilities.md#rag
  • Agents → references/patterns.md#agents

For Code Examples

Each reference file contains practical, copy-pasteable code examples

Examples Available

The cookbook includes 50+ practical examples including:

  • Customer service chatbot with tool use
  • RAG with Pinecone vector database
  • Document summarization
  • Image analysis and OCR
  • Chart/graph interpretation
  • Natural language to SQL
  • Content moderation filter
  • Automated evaluations
  • Multi-agent systems
  • Prompt caching optimization

Notes

  • All examples use official Anthropic Python SDK
  • Code is production-ready with error handling
  • Examples follow current API best practices
  • Regular updates from Anthropic team
  • Community contributions welcome

Skill Source

This skill was created from the official Anthropic Claude Cookbooks repository: https://github.com/anthropics/claude-cookbooks

Repository cloned and processed on: 2025-10-29

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。