vision-multimodal
画像分析・PDF処理・ドキュメント理解などのビジョンおよびマルチモーダル機能をClaudeに提供します。画像入力、base64エンコード、複数画像の処理、視覚的な分析が必要な場面で活用できます。
description の原文を見る
Vision and multimodal capabilities for Claude including image analysis, PDF processing, and document understanding. Activate for image input, base64 encoding, multiple images, and visual analysis.
SKILL.md 本文
ビジョン & マルチモーダルスキル
Claude のビジョン機能を活用して、画像分析、ドキュメント処理、マルチモーダル理解を実現します。
このスキルを使う場合
- 画像分析と説明
- ドキュメント/PDF 処理
- スクリーンショット分析
- OCR 的なテキスト抽出
- ビジュアル比較
- グラフと図表の解釈
サポートされているフォーマット
| フォーマット | ステータス | 最適用途 |
|---|---|---|
| JPEG | ✓ | 写真、自然のシーン |
| PNG | ✓ | スクリーンショット、UI、テキスト |
| GIF | ✓ | アニメーション(最初のフレーム) |
| WebP | ✓ | モダン、圧縮 |
| ✓ | ドキュメント(Files API 経由) |
画像サイズガイドライン
- 最小: 200 ピクセル(小さいほど精度が低下)
- 最適: 1000x1000 ピクセル
- 最大: 8000x8000 ピクセル
- トークンコスト: 約(幅 × 高さ)/ 1000
- ヒント: 最大寸法を 1568px にリサイズして、30~50% のトークン節約が可能
コアパターン
パターン 1: 単一画像分析
import anthropic
import base64
client = anthropic.Anthropic()
# 画像をロードしてエンコード
with open("image.jpg", "rb") as f:
image_data = base64.standard_b64encode(f.read()).decode("utf-8")
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": image_data
}
},
{
"type": "text",
"text": "Describe this image in detail."
}
]
}]
)
パターン 2: URL からの画像
import httpx
# URL からフェッチしてエンコード
image_url = "https://example.com/image.jpg"
response = httpx.get(image_url)
image_data = base64.standard_b64encode(response.content).decode("utf-8")
# 上記と同じパターンを使用
パターン 3: 複数画像
# 複数画像を比較(リクエストあたり最大 100 枚)
messages = [{
"role": "user",
"content": [
{"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": image1}},
{"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": image2}},
{"type": "text", "text": "Compare these two images and list the differences."}
]
}]
パターン 4: 画像を使った Few-Shot
# 例で教える
messages = [
# 例 1
{"role": "user", "content": [
{"type": "image", "source": {...}},
{"type": "text", "text": "Classify this image."}
]},
{"role": "assistant", "content": "Category: Landscape\nElements: Mountains, lake, trees"},
# 例 2
{"role": "user", "content": [
{"type": "image", "source": {...}},
{"type": "text", "text": "Classify this image."}
]},
{"role": "assistant", "content": "Category: Portrait\nElements: Person, indoor, professional"},
# ターゲット画像
{"role": "user", "content": [
{"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": target_image}},
{"type": "text", "text": "Classify this image."}
]}
]
パターン 5: PDF 処理
# Files API を使用(ベータ版)
with open("document.pdf", "rb") as f:
pdf_data = base64.standard_b64encode(f.read()).decode("utf-8")
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4096,
messages=[{
"role": "user",
"content": [
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": pdf_data
}
},
{"type": "text", "text": "Summarize this document."}
]
}]
)
ビジョンのプロンプトエンジニアリング
戦略 1: ロール割り当て
prompt = """You have perfect vision and exceptional attention to detail,
making you an expert at analyzing technical diagrams.
Analyze this architecture diagram and identify:
1. All components
2. Data flow between components
3. Potential bottlenecks"""
戦略 2: ステップバイステップの思考
prompt = """Before answering, analyze the image systematically:
<thinking>
1. What is the overall subject?
2. What are the key elements?
3. How do elements relate to each other?
4. What details stand out?
</thinking>
Then provide your answer based on this analysis."""
戦略 3: 構造化された出力
prompt = """Extract information from this receipt and return as JSON:
{
"vendor": "",
"date": "",
"items": [{"name": "", "price": 0}],
"total": 0
}"""
画像の最適化
from PIL import Image
import io
def optimize_for_claude(image_path, max_dimension=1568):
"""トークン使用量を 30~50% 削減するために画像をリサイズ"""
with Image.open(image_path) as img:
# 新しい寸法を計算
ratio = min(max_dimension / img.width, max_dimension / img.height)
if ratio < 1:
new_size = (int(img.width * ratio), int(img.height * ratio))
img = img.resize(new_size, Image.LANCZOS)
# バイト列に変換
buffer = io.BytesIO()
img.save(buffer, format="JPEG", quality=85)
return base64.standard_b64encode(buffer.getvalue()).decode("utf-8")
一般的な使用例
テキスト抽出(OCR 的)
prompt = """Extract all text from this image.
Preserve the original formatting and structure as much as possible.
If text is unclear, indicate with [unclear]."""
テーブル抽出
prompt = """Extract the table data from this image.
Return as a markdown table with proper headers and alignment."""
グラフ分析
prompt = """Analyze this chart:
1. What type of chart is this?
2. What are the axes/labels?
3. What are the key data points?
4. What trends or patterns are visible?"""
ベストプラクティス
すべきこと:
- 高品質な画像を使用(≥1000px)
- トークン節約のため大きな画像をリサイズ
- 何を探すべきかについてコンテキストを提供
- 一貫した出力のため few-shot の例を使用
してはいけないこと:
- 200px より小さい画像を送信
- 手書きに対する完璧な OCR を期待
- 非常に大きな画像を送信(>8000px)
- 複数画像のトークンコストを無視
制限事項
- 特定の個人を識別できない
- 非常に小さなテキストではうまくいかないことがある
- アニメーション GIF: 最初のフレームのみ分析
- 一部の特殊な記号は誤読される可能性がある
参照
- [[llm-integration]] - API の基本
- [[extended-thinking]] - 複雑な推論
- [[citations-retrieval]] - ドキュメント引用
ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ
詳細情報
- 作者
- lobbi-docs
- リポジトリ
- lobbi-docs/claude
- ライセンス
- MIT
- 最終更新
- 不明
Source: https://github.com/lobbi-docs/claude / ライセンス: MIT
関連スキル
agent-browser
AI エージェント向けのブラウザ自動化 CLI です。ウェブサイトとの対話が必要な場合に使用します。ページ遷移、フォーム入力、ボタンクリック、スクリーンショット取得、データ抽出、ウェブアプリのテスト、ブラウザ操作の自動化など、あらゆるブラウザタスクに対応できます。「ウェブサイトを開く」「フォームに記入する」「ボタンをクリックする」「スクリーンショットを取得する」「ページからデータを抽出する」「このウェブアプリをテストする」「サイトにログインする」「ブラウザ操作を自動化する」といった要求や、プログラマティックなウェブ操作が必要なタスクで起動します。
anyskill
AnySkill — あなたのプライベート・スキルクラウド。GitHubを基盤としたリポジトリからエージェントスキルを管理、同期、動的にロードできます。自然言語でクラウドスキルを検索し、オンデマンドでプロンプトを自動ロード、カスタムスキルのアップロードと共有、スキルバンドルの一括インストールが可能です。OpenClaw、Antigravity、Claude Code、Cursorに対応しています。
engram
AIエージェント向けの永続的なメモリシステムです。バグ修正、意思決定、発見、設定変更の後はmem_saveを使用してください。ユーザーが「覚えている」「記憶している」と言及した場合、または以前のセッションと重複する作業を開始する際はmem_searchを使用します。セッション終了前にmem_session_summaryを使用して、コンテキストを保持してください。
skyvern
AI駆動のブラウザ自動化により、任意のウェブサイトを自動化できます。フォーム入力、データ抽出、ファイルダウンロード、ログイン、複数ステップのワークフロー実行など、ユーザーがウェブサイトと連携する必要があるときに使用します。Skyvernは、LLMとコンピュータビジョンを活用して、未知のサイトも自動操作可能です。Python SDK、TypeScript SDK、REST API、MCPサーバー、またはCLIを通じて統合できます。
pinchbench
PinchBenchベンチマークを実行して、OpenClawエージェントの実世界タスクにおけるパフォーマンスを評価できます。モデルの機能テスト、モデル間の比較、ベンチマーク結果のリーダーボード提出、またはOpenClawのセットアップがカレンダー、メール、リサーチ、コーディング、複数ステップのワークフローにどの程度対応しているかを確認する際に使用します。
openui
OpenUIとOpenUI Langを使用してジェネレーティブUIアプリを構築できます。これらはLLM生成インターフェースのためのトークン効率的なオープン標準です。OpenUI、@openuidev、ジェネレーティブUI、LLMからのストリーミングUI、AI向けコンポーネントライブラリ、またはjson-render/A2UIの置き換えについて述べる際に使用します。スキャフォルディング、defineComponent、システムプロンプト、Renderer、およびOpenUI Lang出力のデバッグに対応しています。