Loading...
  • ビルド
  • 管理
  • モデルと料金
  • クライアントSDK
  • APIリファレンス
Search...
⌘K
Log in
クイックスタート
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
ビルド/スキル

APIでAgent Skillsを始める

Claude APIを使用してAgent Skillsでドキュメントを作成する方法を10分以内に学びます。

このチュートリアルでは、Agent Skillsを使用してPowerPointプレゼンテーションを作成する方法を説明します。Skillsを有効にする方法、簡単なリクエストを行う方法、生成されたファイルにアクセスする方法を学びます。

前提条件

  • Claude APIキー
  • Python 3.7以上またはcurlがインストールされていること
  • APIリクエストを行う基本的な知識

Agent Skillsの概要

事前構築されたAgent Skillsは、ドキュメント作成、データ分析、ファイル処理などのタスク用の専門的な専門知識でClaudeの機能を拡張します。Anthropicは、APIで以下の事前構築されたAgent Skillsを提供しています。

  • PowerPoint (pptx): プレゼンテーションを作成および編集
  • Excel (xlsx): スプレッドシートを作成および分析
  • Word (docx): ドキュメントを作成および編集
  • PDF (pdf): PDFドキュメントを生成

カスタムSkillsを作成したいですか? ドメイン固有の専門知識を持つ独自のSkillsを構築する例については、Agent Skills Cookbookを参照してください。

ステップ1: 利用可能なSkillsをリストアップ

まず、利用可能なSkillsを確認します。Skills APIを使用して、すべてのAnthropicが管理するSkillsをリストアップします。

ant beta:skills list --source anthropic

次のSkillsが表示されます: pptx、xlsx、docx、およびpdf。

このAPIは各Skillのメタデータ(名前と説明)を返します。Claudeはこのメタデータをスタートアップ時に読み込んで、利用可能なSkillsを認識します。これは段階的な情報開示の最初のレベルであり、Claudeはまだ完全な指示を読み込まずにSkillsを発見します。

ステップ2: プレゼンテーションを作成

次に、PowerPoint Skillを使用して再生可能エネルギーに関するプレゼンテーションを作成します。Messages APIでcontainerパラメータを使用してSkillsを指定します。

import anthropic

client = anthropic.Anthropic()

# PowerPoint Skillを使用してメッセージを作成
response = client.beta.messages.create(
    model="claude-opus-4-7",
    max_tokens=4096,
    betas=["code-execution-2025-08-25", "skills-2025-10-02"],
    container={
        "skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]
    },
    messages=[
        {
            "role": "user",
            "content": "Create a presentation about renewable energy with 5 slides",
        }
    ],
    tools=[{"type": "code_execution_20250825", "name": "code_execution"}],
)

print(response.content)

各部分の機能を詳しく説明します。

  • container.skills: Claudeが使用できるSkillsを指定
  • type: "anthropic": これがAnthropicが管理するSkillであることを示す
  • skill_id: "pptx": PowerPoint Skillの識別子
  • version: "latest": Skillバージョンを最新公開版に設定
  • tools: コード実行を有効にする(Skillsに必須)
  • ベータヘッダー: code-execution-2025-08-25およびskills-2025-10-02

このリクエストを行うと、Claudeは自動的にタスクを関連するSkillにマッチングします。プレゼンテーションをリクエストしたため、Claudeはそれが関連していると判断し、PowerPoint Skillの完全な指示を読み込みます。これは段階的な情報開示の2番目のレベルです。その後、Claudeはプレゼンテーションを作成するためにSkillのコードを実行します。

ステップ3: 作成されたファイルをダウンロード

プレゼンテーションはコード実行コンテナで作成され、ファイルとして保存されました。レスポンスにはファイルIDを含むファイル参照が含まれています。ファイルIDを抽出し、Files APIを使用してダウンロードします。

from typing import Any

response: Any = None
# レスポンスからファイルIDを抽出
file_id = None
for block in response.content:
    if block.type == "tool_use" and block.name == "code_execution":
        # ファイルIDはツール結果に含まれています
        for result_block in block.content:
            if hasattr(result_block, "file_id"):
                file_id = result_block.file_id
                break

if file_id:
    # ファイルをダウンロード
    file_content = client.beta.files.download(
        file_id=file_id, betas=["files-api-2025-04-14"]
    )

    # ディスクに保存
    with open("renewable_energy.pptx", "wb") as f:
        file_content.write_to_file(f.name)

    print(f"Presentation saved to renewable_energy.pptx")

生成されたファイルの操作に関する詳細については、コード実行ツールのドキュメントを参照してください。

さらに多くの例を試す

Skillsで最初のドキュメントを作成したので、これらのバリエーションを試してください。

スプレッドシートを作成

response = client.beta.messages.create(
    model="claude-opus-4-7",
    max_tokens=4096,
    betas=["code-execution-2025-08-25", "skills-2025-10-02"],
    container={
        "skills": [{"type": "anthropic", "skill_id": "xlsx", "version": "latest"}]
    },
    messages=[
        {
            "role": "user",
            "content": "Create a quarterly sales tracking spreadsheet with sample data",
        }
    ],
    tools=[{"type": "code_execution_20250825", "name": "code_execution"}],
)

Wordドキュメントを作成

response = client.beta.messages.create(
    model="claude-opus-4-7",
    max_tokens=4096,
    betas=["code-execution-2025-08-25", "skills-2025-10-02"],
    container={
        "skills": [{"type": "anthropic", "skill_id": "docx", "version": "latest"}]
    },
    messages=[
        {
            "role": "user",
            "content": "Write a 2-page report on the benefits of renewable energy",
        }
    ],
    tools=[{"type": "code_execution_20250825", "name": "code_execution"}],
)

PDFを生成

response = client.beta.messages.create(
    model="claude-opus-4-7",
    max_tokens=4096,
    betas=["code-execution-2025-08-25", "skills-2025-10-02"],
    container={
        "skills": [{"type": "anthropic", "skill_id": "pdf", "version": "latest"}]
    },
    messages=[{"role": "user", "content": "Generate a PDF invoice template"}],
    tools=[{"type": "code_execution_20250825", "name": "code_execution"}],
)

次のステップ

事前構築されたAgent Skillsを使用したので、以下のことができます。

APIガイド

Claude APIでSkillsを使用

カスタムSkillsを作成

専門的なタスク用に独自のSkillsをアップロード

オーサリングガイド

効果的なSkillsを書くためのベストプラクティスを学ぶ

Claude CodeでSkillsを使用

Claude CodeのSkillsについて学ぶ

Agent Skills Cookbook

例のSkillsと実装パターンを探索

Was this page helpful?

  • Agent Skillsの概要
  • ステップ1: 利用可能なSkillsをリストアップ
  • ステップ2: プレゼンテーションを作成
  • ステップ3: 作成されたファイルをダウンロード
  • Wordドキュメントを作成
  • PDFを生成