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.
Best use case
extract-from-pdfs is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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.
Teams using extract-from-pdfs should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/extract_from_pdfs/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How extract-from-pdfs Compares
| Feature / Agent | extract-from-pdfs | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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: ```bash 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: ```bash 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): ```bash # 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: ```bash # 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:** ```bash cat references/setup_guide.md ``` **Complete workflow with examples:** ```bash cat references/workflow_guide.md ``` **Validation methodology:** ```bash cat references/validation_guide.md ``` **API integration details:** ```bash 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
Related Skills
busco-phylogeny
Generate phylogenies from genome assemblies using BUSCO/compleasm-based single-copy orthologs with scheduler-aware workflow generation
lab-ordering
Place lab supply orders from member requests — route by request header to Amazon Business, the Pritzker Lab Google Form, or a direct vendor; stage the cart/form and stop for human review before any purchase. Use when the user pastes an order request or asks to order supplies, place an order, or fill the Pritzker form.
document-ocr
Convert scanned PDFs and document images into clean Markdown using docling for layout (figures, tables, reading order) plus a vision-language OCR model. Use when a user needs high-quality OCR of scanned documents, historical literature, or photographed pages — preserving multi-column reading order, diacritics, special characters, and figures. Supports local vLLM/Ollama servers and cloud vision APIs (OpenAI, Anthropic). Assumes an OCR backend already exists.
biogeobears
Set up and execute phylogenetic biogeographic analyses using BioGeoBEARS in R. Use when users request biogeographic reconstruction, ancestral range estimation, or want to analyze species distributions on phylogenies. Handles input file validation, data reformatting, RMarkdown workflow generation, and result visualization.
accounting
Process receipts, track expenses in Google Sheets, reconcile records, and generate entertainment supplement tables for Field Museum procurement card accounting
emu-bulk-upload
Help museum insect curators bulk upload specimen data to the Emu database. Maps any input format to Emu's template, matches localities to existing records, finds parent sites, creates bulk upload tables, and walks users through the upload process.
extract-webpage-data
Extract structured data from web pages using AI
pdf-asset-extractor
MCP tools for PDF ingestion → extract figures, tables, sections → build knowledge graph. Transforms PDF into queryable assets (images, tables, text) with cross-document RAG. Triggers: PDF, ingest, extract, 圖片, 表格, figure, table, manifest, knowledge graph, 知識圖譜, RAG, 文獻分析.
qa-element-extraction
Extract and capture screenshots of specific UI elements mentioned in QA test procedures. Use when creating visual references for test steps to show exactly what buttons, fields, and components look like.
extract
Extract and consolidate reusable components, design tokens, and patterns into your design system. Identifies opportunities for systematic reuse and enriches your component library. Use when the user asks to create components, refactor repeated UI patterns, build a design system, or extract tokens.
performing-malware-ioc-extraction
恶意软件 IOC(失陷指标)提取是指通过分析恶意软件,识别可操作的失陷指标,包括文件哈希、网络指标(C2 域名、IP 地址、URL)、注册表修改、互斥体名称、嵌入字符串和行为产物。
extracting-windows-event-logs-artifacts
使用 Chainsaw、Hayabusa 和 EvtxECmd 提取、解析和分析 Windows 事件日志(EVTX),以检测横向移动、持久化和权限提升。