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

extract-from-pdfs

This skill should be used when extracting structured data from scientific PDFs for systematic reviews, meta-analyses, or database creation. Use when working with collections of research papers that need to be converted into analyzable datasets with validation metrics.

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して extract-from-pdfs.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → extract-from-pdfs フォルダができる
  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
同梱ファイル
18

📖 Skill本文(日本語訳)

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

構造化データを科学論文 PDF から抽出する

目的

Claude のビジョン機能を使用して、科学論文 PDF から標準化された構造化データを抽出します。PDF コレクションを、Python、R、またはその他のフレームワークでの統計分析に対応した、検証済みのデータベースに変換します。

主な機能:

  • BibTeX、RIS、ディレクトリ、または DOI リストからメタデータを整理
  • Claude (Haiku/Sonnet) またはローカルモデル (Ollama) を使用して、アブストラクトで論文をフィルタリング
  • カスタマイズ可能なスキーマで PDF から構造化データを抽出
  • JSON 出力を自動的に修復および検証
  • 外部データベース (GBIF、WFO、GeoNames、PubChem、NCBI) でエンリッチ
  • 品質保証のための適合率/再現率メトリクスを計算
  • Python、R、CSV、Excel、または SQLite にエクスポート

この Skill を使用するタイミング

以下の場合に使用します。

  • データ抽出を必要とする系統的文献レビューを実施する場合
  • 科学出版物からデータベースを構築する場合
  • PDF コレクションを構造化データセットに変換する場合
  • グラウンドトゥルースメトリクスで抽出品質を検証する場合
  • 抽出アプローチ (異なるモデル、プロンプト) を比較する場合

以下の場合には使用しないでください。

  • 単一の PDF の要約 (代わりに基本的な PDF 読み取りを使用)
  • PDF の全文検索 (ドキュメント検索ツールを使用)
  • PDF の編集または操作

はじめに

1. 初期設定

インストールと設定については、セットアップガイドをお読みください。

cat references/setup_guide.md

主な設定手順:

  • 依存関係のインストール: conda env create -f environment.yml
  • API キーの設定: export ANTHROPIC_API_KEY='your-key'
  • オプション: 無料のローカルフィルタリングのために Ollama をインストール

2. 抽出要件の定義

ユーザーに質問:

  • 研究分野と抽出の目標
  • PDF の整理方法 (参考文献管理ツール、ディレクトリ、DOI リスト)
  • おおよそのコレクションサイズ
  • 希望する分析環境 (Python、R など)

構造を分析し、スキーマを設計するために、2〜3 個の PDF の例を提供します。

3. 抽出スキーマの設計

テンプレートからカスタムスキーマを作成します。

cp assets/schema_template.json my_schema.json

特定のドメインに合わせてカスタマイズします。

  • 抽出する内容を記述する objective を設定
  • フィールドタイプと説明を含む output_schema を定義
  • Claude 用のドメイン固有の instructions を追加
  • 目的の形式を示す output_example を提供

実際の生態系の例については、assets/example_flower_visitors_schema.json を参照してください。

ワークフローの実行

完全なパイプライン

6 ステップのパイプラインを実行します (オプションの検証付き)。

# ステップ 1: メタデータを整理
python scripts/01_organize_metadata.py \
  --source-type bibtex \
  --source library.bib \
  --pdf-dir pdfs/ \
  --output metadata.json

# ステップ 2: 論文をフィルタリング (オプション - 推奨)
# バックエンドを選択: anthropic-haiku (安価)、anthropic-sonnet (正確)、ollama (無料)
python scripts/02_filter_abstracts.py \
  --metadata metadata.json \
  --backend anthropic-haiku \
  --use-batches \
  --output filtered_papers.json

# ステップ 3: PDF から抽出
python scripts/03_extract_from_pdfs.py \
  --metadata filtered_papers.json \
  --schema my_schema.json \
  --method batches \
  --output extracted_data.json

# ステップ 4: JSON を修復
python scripts/04_repair_json.py \
  --input extracted_data.json \
  --schema my_schema.json \
  --output cleaned_data.json

# ステップ 5: API で検証
python scripts/05_validate_with_apis.py \
  --input cleaned_data.json \
  --apis my_api_config.json \
  --output validated_data.json

# ステップ 6: 分析形式にエクスポート
python scripts/06_export_database.py \
  --input validated_data.json \
  --format python \
  --output results

検証 (オプションですが推奨)

抽出品質メトリクスを計算します。

# ステップ 7: アノテーション用の論文をサンプリング
python scripts/07_prepare_validation_set.py \
  --extraction-results cleaned_data.json \
  --schema my_schema.json \
  --sample-size 20 \
  --strategy stratified \
  --output validation_set.json

# ステップ 8: 手動でアノテーション (validation_set.json を編集)
# サンプリングされた各論文の ground_truth フィールドに入力

# ステップ 9: メトリクスを計算
python scripts/08_calculate_validation_metrics.py \
  --annotations validation_set.json \
  --output validation_metrics.json \
  --report validation_report.txt

検証では、フィールドごとおよび全体的な適合率、再現率、および F1 メトリクスが生成されます。

詳細なドキュメント

references/ ディレクトリにある包括的なガイドにアクセスしてください。

セットアップとインストール:

cat references/setup_guide.md

例を含む完全なワークフロー:

cat references/workflow_guide.md

検証方法:

cat references/validation_guide.md

API 統合の詳細:

cat references/api_reference.md

カスタマイズ

スキーマのカスタマイズ

研究分野に合わせて my_schema.json を変更します。

  1. Objective: 抽出するデータを記述
  2. Instructions: ステップごとの抽出ガイダンス
  3. Output schema: 構造を定義する JSON スキーマ
  4. Important notes: ドメイン固有のルール
  5. Examples: 目的の出力形式を表示

命令的な言語を instructions で使用します。データ型、必須フィールドとオプションフィールド、およびエッジケースについて具体的に記述します。

API の設定

my_api_config.json で外部データベースの検証を設定します。

抽出されたフィールドを検証 API にマッピングします。

  • gbif_taxonomy - 生物分類
  • wfo_plants - 特に植物名
  • geonames - 地理的な場所
  • geocode - 住所から座標
  • pubchem - 化学化合物
  • ncbi_gene - 遺伝子識別子

生態系固有の例については、assets/example_api_config_ecology.json を参照してください。

フィルタリングのカスタマイズ

scripts/02_filter_abstracts.py (74 行目) でフィルタリング条件を編集します。

TODO セクションをドメイン固有の条件に置き換えます。

  • 一次データとレビューを構成するものは何か?
  • どのようなデータ型が関連するか?
  • どのような範囲 (地理的、時間的、分類学的) が必要か?

誤検出を避けるために、保守的な条件 (疑わしい場合は論文を含める) を使用します。

コスト最適化

フィルタリングのバックエンドの選択 (ステップ 2):

  • Ollama (ローカル): $0 - プライバシーと大量の処理に最適
  • Ha
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Extract Structured Data from Scientific PDFs

Purpose

Extract standardized, structured data from scientific PDF literature using Claude's vision capabilities. Transform PDF collections into validated databases ready for statistical analysis in Python, R, or other frameworks.

Core capabilities:

  • Organize metadata from BibTeX, RIS, directories, or DOI lists
  • Filter papers by abstract using Claude (Haiku/Sonnet) or local models (Ollama)
  • Extract structured data from PDFs with customizable schemas
  • Repair and validate JSON outputs automatically
  • Enrich with external databases (GBIF, WFO, GeoNames, PubChem, NCBI)
  • Calculate precision/recall metrics for quality assurance
  • Export to Python, R, CSV, Excel, or SQLite

When to Use This Skill

Use when:

  • Conducting systematic literature reviews requiring data extraction
  • Building databases from scientific publications
  • Converting PDF collections to structured datasets
  • Validating extraction quality with ground truth metrics
  • Comparing extraction approaches (different models, prompts)

Do not use for:

  • Single PDF summarization (use basic PDF reading instead)
  • Full-text PDF search (use document search tools)
  • PDF editing or manipulation

Getting Started

1. Initial Setup

Read the setup guide for installation and configuration:

cat references/setup_guide.md

Key setup steps:

  • Install dependencies: conda env create -f environment.yml
  • Set API keys: export ANTHROPIC_API_KEY='your-key'
  • Optional: Install Ollama for free local filtering

2. Define Extraction Requirements

Ask the user:

  • Research domain and extraction goals
  • How PDFs are organized (reference manager, directory, DOI list)
  • Approximate collection size
  • Preferred analysis environment (Python, R, etc.)

Provide 2-3 example PDFs to analyze structure and design schema.

3. Design Extraction Schema

Create custom schema from template:

cp assets/schema_template.json my_schema.json

Customize for the specific domain:

  • Set objective describing what to extract
  • Define output_schema with field types and descriptions
  • Add domain-specific instructions for Claude
  • Provide output_example showing desired format

See assets/example_flower_visitors_schema.json for real-world ecology example.

Workflow Execution

Complete Pipeline

Run the 6-step pipeline (plus optional validation):

# Step 1: Organize metadata
python scripts/01_organize_metadata.py \
  --source-type bibtex \
  --source library.bib \
  --pdf-dir pdfs/ \
  --output metadata.json

# Step 2: Filter papers (optional - recommended)
# Choose backend: anthropic-haiku (cheap), anthropic-sonnet (accurate), ollama (free)
python scripts/02_filter_abstracts.py \
  --metadata metadata.json \
  --backend anthropic-haiku \
  --use-batches \
  --output filtered_papers.json

# Step 3: Extract from PDFs
python scripts/03_extract_from_pdfs.py \
  --metadata filtered_papers.json \
  --schema my_schema.json \
  --method batches \
  --output extracted_data.json

# Step 4: Repair JSON
python scripts/04_repair_json.py \
  --input extracted_data.json \
  --schema my_schema.json \
  --output cleaned_data.json

# Step 5: Validate with APIs
python scripts/05_validate_with_apis.py \
  --input cleaned_data.json \
  --apis my_api_config.json \
  --output validated_data.json

# Step 6: Export to analysis format
python scripts/06_export_database.py \
  --input validated_data.json \
  --format python \
  --output results

Validation (Optional but Recommended)

Calculate extraction quality metrics:

# Step 7: Sample papers for annotation
python scripts/07_prepare_validation_set.py \
  --extraction-results cleaned_data.json \
  --schema my_schema.json \
  --sample-size 20 \
  --strategy stratified \
  --output validation_set.json

# Step 8: Manually annotate (edit validation_set.json)
# Fill ground_truth field for each sampled paper

# Step 9: Calculate metrics
python scripts/08_calculate_validation_metrics.py \
  --annotations validation_set.json \
  --output validation_metrics.json \
  --report validation_report.txt

Validation produces precision, recall, and F1 metrics per field and overall.

Detailed Documentation

Access comprehensive guides in the references/ directory:

Setup and installation:

cat references/setup_guide.md

Complete workflow with examples:

cat references/workflow_guide.md

Validation methodology:

cat references/validation_guide.md

API integration details:

cat references/api_reference.md

Customization

Schema Customization

Modify my_schema.json to match the research domain:

  1. Objective: Describe what data to extract
  2. Instructions: Step-by-step extraction guidance
  3. Output schema: JSON schema defining structure
  4. Important notes: Domain-specific rules
  5. Examples: Show desired output format

Use imperative language in instructions. Be specific about data types, required vs optional fields, and edge cases.

API Configuration

Configure external database validation in my_api_config.json:

Map extracted fields to validation APIs:

  • gbif_taxonomy - Biological taxonomy
  • wfo_plants - Plant names specifically
  • geonames - Geographic locations
  • geocode - Address to coordinates
  • pubchem - Chemical compounds
  • ncbi_gene - Gene identifiers

See assets/example_api_config_ecology.json for ecology-specific example.

Filtering Customization

Edit filtering criteria in scripts/02_filter_abstracts.py (line 74):

Replace TODO section with domain-specific criteria:

  • What constitutes primary data vs review?
  • What data types are relevant?
  • What scope (geographic, temporal, taxonomic) is needed?

Use conservative criteria (when in doubt, include paper) to avoid false negatives.

Cost Optimization

Backend selection for filtering (Step 2):

  • Ollama (local): $0 - Best for privacy and high volume
  • Haiku (API): ~$0.25/M tokens - Best balance of cost/quality
  • Sonnet (API): ~$3/M tokens - Best for complex filtering

Typical costs for 100 papers:

  • With filtering (Haiku + Sonnet): ~$4
  • With local Ollama + Sonnet: ~$3.75
  • Without filtering (Sonnet only): ~$7.50

Optimization strategies:

  • Use abstract filtering to reduce PDF processing
  • Use local Ollama for filtering (free)
  • Enable prompt caching with --use-caching
  • Process in batches with --use-batches

Quality Assurance

Validation workflow provides:

  • Precision: % of extracted items that are correct
  • Recall: % of true items that were extracted
  • F1 score: Harmonic mean of precision and recall
  • Per-field metrics: Identify weak fields

Use metrics to:

  • Establish baseline extraction quality
  • Compare different approaches (models, prompts, schemas)
  • Identify areas for improvement
  • Report extraction quality in publications

Recommended sample sizes:

  • Small projects (<100 papers): 10-20 papers
  • Medium projects (100-500 papers): 20-50 papers
  • Large projects (>500 papers): 50-100 papers

Iterative Improvement

  1. Run initial extraction with baseline schema
  2. Validate on sample using Steps 7-9
  3. Analyze field-level metrics and error patterns
  4. Revise schema, prompts, or model selection
  5. Re-extract and re-validate
  6. Compare metrics to verify improvement
  7. Repeat until acceptable quality achieved

See references/validation_guide.md for detailed guidance on interpreting metrics and improving extraction quality.

Available Scripts

Data organization:

  • scripts/01_organize_metadata.py - Standardize PDFs and metadata

Filtering:

  • scripts/02_filter_abstracts.py - Filter by abstract (Haiku/Sonnet/Ollama)

Extraction:

  • scripts/03_extract_from_pdfs.py - Extract from PDFs with Claude vision

Processing:

  • scripts/04_repair_json.py - Repair and validate JSON
  • scripts/05_validate_with_apis.py - Enrich with external databases
  • scripts/06_export_database.py - Export to analysis formats

Validation:

  • scripts/07_prepare_validation_set.py - Sample papers for annotation
  • scripts/08_calculate_validation_metrics.py - Calculate P/R/F1 metrics

Assets

Templates:

  • assets/schema_template.json - Blank extraction schema template
  • assets/api_config_template.json - API validation configuration template

Examples:

  • assets/example_flower_visitors_schema.json - Ecology extraction example
  • assets/example_api_config_ecology.json - Ecology API validation example

同梱ファイル

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