opendataloader-pdf
Parse PDFs into AI-ready structured data — extract text, tables, images, and metadata with high accuracy. Use when: processing PDF documents for RAG, extracting data from invoices/contracts, building document processing pipelines.
What this skill does
# OpenDataLoader PDF — AI-Ready Document Parsing
## Overview
Parse PDF documents into clean, structured data optimized for AI consumption. Extract text with layout preservation, tables as structured JSON, images with captions, and rich metadata. Ideal for RAG pipelines, document analysis, and data extraction workflows.
## Instructions
### Step 1: Choose Your Parsing Strategy
| PDF Type | Best Approach | Tool |
|----------|---------------|------|
| Text-native (digital) | Direct text extraction | pdfplumber, PyMuPDF |
| Scanned / image-based | OCR pipeline | Tesseract, EasyOCR |
| Tables-heavy | Table-aware extraction | Camelot, pdfplumber |
| Complex layouts | Vision LLM | Claude/GPT-4o vision |
### Step 2: Set Up the Python Pipeline
```bash
pip install pdfplumber pymupdf camelot-py[cv] Pillow
# For OCR: pip install pytesseract easyocr
```
### Step 3: Extract Text with Layout Awareness
```python
import pdfplumber
def extract_text_structured(pdf_path):
"""Extract text preserving document structure."""
pages = []
with pdfplumber.open(pdf_path) as pdf:
for i, page in enumerate(pdf.pages):
text = page.extract_text(layout=True)
words = page.extract_words(keep_blank_chars=True, extra_attrs=['fontname', 'size'])
headers = [w for w in words if w['size'] > 14]
pages.append({
'page': i + 1, 'text': text,
'headers': [h['text'] for h in headers],
'word_count': len(words)
})
return pages
```
### Step 4: Extract Tables as Structured Data
```python
def extract_tables(pdf_path):
"""Extract tables as list of dicts."""
results = []
with pdfplumber.open(pdf_path) as pdf:
for i, page in enumerate(pdf.pages):
tables = page.extract_tables({"vertical_strategy": "text",
"horizontal_strategy": "text", "snap_tolerance": 5})
for j, table in enumerate(tables):
if not table or len(table) < 2:
continue
headers = [str(h).strip() for h in table[0]]
rows = []
for row in table[1:]:
row_dict = {}
for k, cell in enumerate(row):
key = headers[k] if k < len(headers) else f'col_{k}'
row_dict[key] = str(cell).strip() if cell else ''
rows.append(row_dict)
results.append({'page': i+1, 'table_index': j, 'headers': headers,
'rows': rows, 'row_count': len(rows)})
return results
```
### Step 5: Extract Images and Metadata
```python
import fitz # PyMuPDF
def extract_images(pdf_path, output_dir='./images'):
"""Extract embedded images from PDF."""
import os
os.makedirs(output_dir, exist_ok=True)
doc = fitz.open(pdf_path)
images = []
for page_num in range(len(doc)):
page = doc[page_num]
for img_idx, img in enumerate(page.get_images(full=True)):
base_image = doc.extract_image(img[0])
filename = f'page{page_num+1}_img{img_idx+1}.{base_image["ext"]}'
filepath = os.path.join(output_dir, filename)
with open(filepath, 'wb') as f:
f.write(base_image['image'])
images.append({'page': page_num+1, 'file': filepath,
'format': base_image['ext'],
'width': base_image.get('width'),
'height': base_image.get('height')})
return images
def extract_metadata(pdf_path):
"""Extract PDF metadata."""
doc = fitz.open(pdf_path)
meta = doc.metadata
return {'title': meta.get('title', ''), 'author': meta.get('author', ''),
'pages': len(doc), 'encrypted': doc.is_encrypted}
```
### Step 6: Build RAG-Ready Chunks
```python
def chunk_for_rag(pages, chunk_size=500, overlap=50):
"""Split pages into overlapping chunks for RAG."""
chunks = []
for page in pages:
text = page['text']
if not text:
continue
words = text.split()
for i in range(0, len(words), chunk_size - overlap):
chunk_words = words[i:i + chunk_size]
if len(chunk_words) < 20:
continue
chunks.append({'text': ' '.join(chunk_words), 'page': page['page'],
'chunk_index': len(chunks), 'word_count': len(chunk_words)})
return chunks
```
### Step 7: Full Pipeline — PDF to AI-Ready JSON
```python
import json
def pdf_to_ai_ready(pdf_path, output_path=None):
"""Complete pipeline: PDF to structured AI-ready data."""
result = {
'source': pdf_path,
'metadata': extract_metadata(pdf_path),
'pages': extract_text_structured(pdf_path),
'tables': extract_tables(pdf_path),
'images': extract_images(pdf_path),
}
result['chunks'] = chunk_for_rag(result['pages'])
result['stats'] = {
'total_pages': len(result['pages']),
'total_tables': len(result['tables']),
'total_images': len(result['images']),
'total_chunks': len(result['chunks']),
}
if output_path:
with open(output_path, 'w') as f:
json.dump(result, f, indent=2, default=str)
return result
```
### Step 8: Handle Scanned PDFs with OCR
```python
import pytesseract
from PIL import Image
def ocr_pdf(pdf_path):
"""OCR scanned PDF pages."""
doc = fitz.open(pdf_path)
pages = []
for i in range(len(doc)):
pix = doc[i].get_pixmap(dpi=300)
img = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
text = pytesseract.image_to_string(img)
pages.append({'page': i + 1, 'text': text, 'method': 'ocr'})
return pages
```
## Examples
### Example 1: Extract Data from a Quarterly Financial Report
A finance team processes a 48-page quarterly report PDF to feed into their analysis pipeline:
```python
result = pdf_to_ai_ready('Q4-2025-Annual-Report-Acme-Corp.pdf', 'acme_q4.json')
print(result['stats'])
# {'total_pages': 48, 'total_tables': 12, 'total_images': 7, 'total_chunks': 34}
# Extract the revenue table from page 8
revenue_table = [t for t in result['tables'] if t['page'] == 8][0]
print(revenue_table['headers'])
# ['Quarter', 'Revenue ($M)', 'Growth (%)', 'Operating Margin']
print(revenue_table['rows'][0])
# {'Quarter': 'Q4 2025', 'Revenue ($M)': '847.3', 'Growth (%)': '12.4', 'Operating Margin': '23.1%'}
# Feed chunks into RAG system
for chunk in result['chunks']:
embed_and_store(chunk['text'], metadata={'page': chunk['page'], 'source': 'acme_q4'})
```
### Example 2: Batch Process Legal Contracts for Clause Extraction
A legal team processes a directory of scanned contract PDFs to identify key clauses:
```python
import os
contract_dir = './contracts/vendor-agreements/'
for filename in os.listdir(contract_dir):
if not filename.endswith('.pdf'):
continue
pdf_path = os.path.join(contract_dir, filename)
# Try text extraction first, fall back to OCR for scanned docs
result = pdf_to_ai_ready(pdf_path)
total_text = sum(len(p['text'] or '') for p in result['pages'])
if total_text < 100: # likely scanned
result['pages'] = ocr_pdf(pdf_path)
result['chunks'] = chunk_for_rag(result['pages'])
print(f"{filename}: {result['stats']['total_pages']} pages, "
f"{result['stats']['total_chunks']} chunks, "
f"{result['stats']['total_tables']} tables")
# Output: "vendor-agreement-globaltech-2025.pdf: 24 pages, 18 chunks, 3 tables"
# Save structured output for downstream AI analysis
pdf_to_ai_ready(pdf_path, pdf_path.replace('.pdf', '.json'))
```
## Guidelines
- **Always check font encoding** — some PDFs produce garbled text; try PyMuPDF if pdfplumber fails
- **Use Camelot for bordered tables** — pdfplumber works better for borderless tables
- **Process large PDFs page-by-page** — stream resulRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.