pdf-extract-shell-first
Skill by HKUDS
Extracts text from PDF files, local or downloaded, by trying read_file, then pdftotext via run_shell, then PyMuPDF. Built for agents that need reliable PDF text extraction in automated workflows.
Install pdf-extract-shell-first
Built from the published package, never by AI.
git clone --depth 1 https://github.com/HKUDS/AgentPilot /tmp/AgentPilot && mkdir -p ~/.claude/skills && cp -r /tmp/AgentPilot/openspace/benchmarks/gdpval/skills/pdf-download-extract-fallback-enhanced-e27e0c ~/.claude/skills/pdf-extract-shell-firstRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install pdf-extract-shell-first in Claude Code
git clone --depth 1 https://github.com/HKUDS/AgentPilot /tmp/AgentPilot && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/AgentPilot/openspace/benchmarks/gdpval/skills/pdf-download-extract-fallback-enhanced-e27e0c ~/.gemini/antigravity-cli/skills/pdf-extract-shell-firstAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install pdf-extract-shell-first in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
The pdf-extract-shell-first skill extracts text from PDF documents, whether they are local files or downloaded from a URL. It runs a tool cascade in a fixed order. It first tries the read_file tool, then run_shell with pdftotext, then execute_code_sandbox with PyMuPDF. If every method fails, it tells the assistant to document each failure and fill gaps from domain knowledge, marking which parts came from the source.
The skill is based on observed behavior. read_file sometimes returns binary or image data, and execute_code_sandbox can fail with an unknown error. It includes a decision tree, a failure report template, and a bash script that automates the cascade. It is aimed at workflows that need reliable PDF text extraction, such as automated pipelines. It is a migration from the pdf-download-extract-fallback skill and focuses less on downloads.
Written from the project's SKILL.md and checked against it.
What it can do
- read_file on PDFsTries read_file first and moves on if it returns binary, image, garbled, or error output.
- run_shell with pdftotextRuns pdftotext as the preferred fallback and reads the resulting output.txt file.
- execute_code_sandbox with PyMuPDFUses a Python PyMuPDF script as the last extraction resort inside the sandbox.
- URL downloadDownloads a PDF from a web URL with curl, following redirects and using a browser user-agent.
- Failure reportingDocuments which tool failed and how, and marks content taken from domain knowledge.
- Automated scriptProvides a bash script that runs the full cascade and checks the output is non-empty.
What you need
- poppler-utils for pdftotext (apt-get or brew install)
- Shell access through run_shell
- Python with PyMuPDF for the fallback step
- curl for downloading PDFs from URLs
Try asking
- Extract the text from this PDF file: report.pdf
- Download this PDF URL and extract its text: [paste URL]
- Extract text from this PDF and mark any content not taken from the source.
Good to know
- read_file may return binary or image data instead of text.
- execute_code_sandbox may fail with an unknown error in some environments.
- pdftotext can produce an empty file for password-protected or scanned PDFs.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: openspace/benchmarks/gdpval/skills/pdf-download-extract-fallback-enhanced-e27e0c/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
.skill_id59 B -
SKILL.md11 KB
Alternatives to pdf-extract-shell-first
All alternatives →Creates importable JSON templates for the Obsidian Web Clipper. It is for users who want to clip a site, understand the available variables, or format clipped content.
Harness Creator builds, audits, and improves the instruction and state files that help AI coding agents stay reliable across sessions. It is for developers whose agents forget context, drift out of scope, or claim work is done too early.
Guides an assistant through extracting text from scanned PDFs, photographed pages, and images with OCR. Covers backends, language packs, force-OCR, and performance tuning.
Edits a named local file in place to remove AI-writing patterns, using minimal targeted changes and post-edit verification. Built for users who explicitly ask to clean, rewrite, or humanize that specific file.
Polishes, translates, or tightens existing academic manuscript prose while preserving facts, terminology, and evidence boundaries. Made for researchers revising drafts, including Chinese-to-English translation and LaTeX layout fixes.
Adds PDF form analysis and filling, table extraction, OCR, validation and batch processing to an AI assistant. Aimed at developers who run complex or high-volume PDF workflows.
Compare with obsidian-clipper-template-creator, harness-creator or xberg-extracting-with-ocr
pdf-extract-shell-first: common questions
Does it try pdftotext before PyMuPDF?
Yes. The skill prefers run_shell with pdftotext and uses PyMuPDF through execute_code_sandbox only as a last resort.
What happens with scanned PDFs?
The source says pdftotext may produce an empty file for scanned or password-protected PDFs. It suggests trying PyMuPDF or OCR tools in that case.
Can it download PDFs from a URL?
Yes. The first step uses curl with a browser user-agent and follows redirects to save the PDF locally.
How do I install pdf-extract-shell-first?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is pdf-extract-shell-first free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is pdf-extract-shell-first safe to use?
It scores 89 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to pdf-extract-shell-first?
Similar skills: obsidian-clipper-template-creator, harness-creator, xberg-extracting-with-ocr, file-edit-in-place.
