Agent skill

PDF Extraction Fallback 80956b

by HKUDS in HKUDS/OpenSpace

Multi-fallback PDF download and text extraction with early failure detection

MITAuto-check passedDocuments & Office

Install PDF Extraction Fallback 80956b

skills CLI
$ npx skills add HKUDS/OpenSpace --skill pdf-extraction-fallback-80956b -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/OpenSpace pdf-extraction-fallback-80956b --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/pdf-extraction-fallback-80956b .claude/skills/pdf-extraction-fallback-80956b && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
pdf-extraction-fallback-80956b
GitHub stars
7.8k
Token cost
~1.8k tokens
SKILL.md length
313 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Multi-fallback PDF download and text extraction with early failure detection

  • Works in 3 steps: Download with Validation → Sequential Extraction Fallbacks → Content Sanity Validation
  • Tasks that involve PDF
  • SKILL.md covers When to Use, Core Workflow, Complete Workflow Script and Failure Documentation, plus 3 more sections
  • Calls curl, pdftotext and apt-get

What it does

PDF Extraction Fallback 80956b is an agent skill from HKUDS/OpenSpace. Multi-fallback PDF download and text extraction with early failure detection

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

It sits in Documents & Office, covering PDF. It works with JavaScript. The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

When your agent uses it

  • Tasks that involve PDF

Example prompts

  • “/pdf-extraction-fallback-80956b”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Download with Validation
  2. Sequential Extraction Fallbacks
  3. Content Sanity Validation

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl
    • pdftotext
    • apt-get
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use curl and pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

PDF Extraction Fallback 80956b loads about 1.8k tokens when it runs. Until then it costs about 27 tokens; SKILL.md has 313 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~27
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 313 words, ~1,831 tokens.

Download SKILL.mdSave it as .claude/skills/pdf-extraction-fallback-80956b/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
pdf-extraction-fallback-80956b
description
Multi-fallback PDF download and text extraction with early failure detection

PDF Extraction Fallback Workflow

This skill provides a robust, multi-layered approach to downloading and extracting text from PDF documents when sources may be protected, corrupted, or inaccessible via standard methods.

When to Use

  • Downloading regulatory documents, handbooks, or official PDFs from government/enterprise websites
  • Sources that may have JavaScript protection, CORS restrictions, or dynamic content
  • When initial PDF downloads produce suspiciously small files or error content
  • Any scenario requiring reliable text extraction from potentially problematic PDF sources

Core Workflow

Step 1: Download with Validation
bash
# Download PDF with size check
curl -L -o output.pdf "https://example.com/document.pdf"

# Early failure detection: check file size
file_size=$(stat -c%s output.pdf 2>/dev/null || stat -f%z output.pdf)

if [ "$file_size" -lt 1000 ]; then
    echo "WARNING: File size ($file_size bytes) suggests failed download or error page"
    # Check for HTML/JavaScript error content
    if head -c 500 output.pdf | grep -qi "<html\|<script\|error\|access denied"; then
        echo "FAILURE: File contains error message, not PDF content"
        rm output.pdf
        # Proceed to alternative download method
    fi
fi
Step 2: Sequential Extraction Fallbacks

Try extraction methods in order, moving to next on failure:

Fallback 1: pdftotext (command-line)
bash
if command -v pdftotext &> /dev/null; then
    pdftotext output.pdf output.txt
    if [ -s output.txt ] && [ $(wc -c < output.txt) -gt 100 ]; then
        echo "SUCCESS: pdftotext extraction"
        exit 0
    fi
fi
Fallback 2: PyMuPDF (fitz)
python
import fitz  # PyMuPDF

def extract_with_pymupdf(pdf_path):
    try:
        doc = fitz.open(pdf_path)
        text = ""
        for page in doc:
            text += page.get_text()
        doc.close()
        if len(text.strip()) > 100:
            return text
        return None
    except Exception as e:
        print(f"PyMuPDF failed: {e}")
        return None
Fallback 3: pdfplumber
python
import pdfplumber

def extract_with_pdfplumber(pdf_path):
    try:
        text = ""
        with pdfplumber.open(pdf_path) as pdf:
            for page in pdf.pages:
                page_text = page.extract_text()
                if page_text:
                    text += page_text + "\n"
        if len(text.strip()) > 100:
            return text
        return None
    except Exception as e:
        print(f"pdfplumber failed: {e}")
        return None
Step 3: Content Sanity Validation

After any extraction method succeeds:

python
def validate_extracted_text(text, min_length=100):
    """Validate extracted content is meaningful"""
    if not text or len(text.strip()) < min_length:
        return False
    
    # Check for common error patterns
    error_patterns = [
        "access denied", "permission denied", "error", 
        "javascript", "<html", "<script", "404", "403"
    ]
    text_lower = text.lower()[:500]  # Check first 500 chars
    for pattern in error_patterns:
        if pattern in text_lower:
            return False
    
    return True

Complete Workflow Script

python
#!/usr/bin/env python3
"""
Robust PDF extraction with multiple fallbacks
"""
import subprocess
import os
import sys

def download_pdf(url, output_path):
    """Download PDF with validation"""
    subprocess.run(["curl", "-L", "-o", output_path, url], check=True)
    
    # Validate download
    if not os.path.exists(output_path):
        return False
    
    file_size = os.path.getsize(output_path)
    if file_size < 1000:
        with open(output_path, 'r', errors='ignore') as f:
            content = f.read(500).lower()
            if any(x in content for x in ['<html', '<script', 'error', 'denied']):
                os.remove(output_path)
                return False
    return True

def extract_text(pdf_path):
    """Try multiple extraction methods"""
    
    # Method 1: pdftotext
    try:
        result = subprocess.run(
            ["pdftotext", pdf_path, "-"],
            capture_output=True, text=True, timeout=60
        )
        if result.stdout and len(result.stdout.strip()) > 100:
            return result.stdout
    except:
        pass
    
    # Method 2: PyMuPDF
    try:
        import fitz
        doc = fitz.open(pdf_path)
        text = "".join(page.get_text() for page in doc)
        doc.close()
        if len(text.strip()) > 100:
            return text
    except:
        pass
    
    # Method 3: pdfplumber
    try:
        import pdfplumber
        text = ""
        with pdfplumber.open(pdf_path) as pdf:
            for page in pdf.pages:
                page_text = page.extract_text()
                if page_text:
                    text += page_text + "\n"
        if len(text.strip()) > 100:
            return text
    except:
        pass
    
    return None

def main():
    url = sys.argv[1]
    pdf_path = "document.pdf"
    
    if not download_pdf(url, pdf_path):
        print("ERROR: Download failed or invalid content")
        sys.exit(1)
    
    text = extract_text(pdf_path)
    if text:
        with open("extracted.txt", "w") as f:
            f.write(text)
        print(f"SUCCESS: Extracted {len(text)} characters")
    else:
        print("ERROR: All extraction methods failed")
        sys.exit(1)

if __name__ == "__main__":
    main()

Failure Documentation

For each failed attempt, log:

AttemptMethodFailure ReasonFile SizeContent Preview
1Direct downloadJavaScript error page92 bytes<!DOCTYPE html>...
2pdftotextFile not valid PDF--
3PyMuPDFEncrypted/protected--
4pdfplumberSuccess2.4 MB"VA Handbook Chapter 1..."

Best Practices

  1. Always validate downloads immediately - Don't assume a successful HTTP 200 means valid content
  2. Check file size thresholds - Files <1KB are almost always error pages
  3. Scan for error patterns - HTML tags, JavaScript, error messages indicate failed downloads
  4. Try multiple extractors - Different PDFs work better with different libraries
  5. Set minimum content thresholds - Extracted text <100 chars usually indicates failure
  6. Clean up failed artifacts - Remove invalid files before retrying
  7. Document each failure - Helps diagnose patterns in source protection mechanisms

Dependencies

Install required tools:

bash
# Command-line tool
apt-get install poppler-utils  # provides pdftotext

# Python libraries
pip install PyMuPDF pdfplumber

Notes for Regulatory Documents

Government and regulatory websites often:

  • Use JavaScript-based PDF viewers instead of direct links
  • Implement session-based access requiring authentication
  • Serve error pages with 200 status codes
  • Have CORS restrictions on direct downloads

When encountering these, consider:

  • Using browser automation (Selenium/Playwright) as an additional fallback
  • Checking for alternative document repositories
  • Looking for cached versions via search engines

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in benchmarks/gdpval/skills/pdf-extraction-fallback-80956b of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

PDF Extraction Fallback 80956b next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

PDF Extraction Fallback 80956b compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
PDF Extraction Fallback 80956b this skillHKUDS/OpenSpace7.8k—~1.8kAutomated safety check: PassMIT
Jev SEOAgriciDaniel/jev-seo539—~2.5kAutomated safety check: NotesMIT
Analyzing Malicious PDF With Peepdfmukul975/Anthropic-Cybersecurity-Skills34k—~799Automated safety check: PassApache-2.0
PDF Toolkitborghei/Claude-Skills886—~1.4kAutomated safety check: PassMIT
Edit PDFSimplePDF/simplepdf-embed407—~1.5kAutomated safety check: PassMIT
Build With SimplepdfSimplePDF/simplepdf-embed407—~7kAutomated safety check: PassMIT

Similar skills

  • Jev SEO

    AgriciDaniel/jev-seo

    Full live SEO audit of any website from its homepage URL, powered by Jev (TypeSafe's System One model).

    539 GitHub stars~2.5k tokensUpdated 18 days ago
    Documents & OfficeAuto-check: notes
  • Analyzing Malicious PDF With Peepdf

    mukul975/Anthropic-Cybersecurity-Skills

    Perform static analysis of malicious PDF documents using peepdf, pdfid, and pdf-parser to extract embedded JavaScript, shellcode, and suspicious objects.

    34k GitHub stars~799 tokensUpdated 1 mo ago
    Documents & OfficeAuto-check passed
  • PDF Toolkit

    borghei/Claude-Skills

    Audit PDF files for metadata leakage, page count, encryption, JavaScript, embedded files, and version.

    886 GitHub stars~1.4k tokensUpdated 2 days ago
    Documents & OfficeAuto-check passed
  • Edit PDF

    SimplePDF/simplepdf-embed

    Edit and fill PDF documents. An agent skill from SimplePDF/simplepdf-embed.

    407 GitHub stars~1.5k tokensUpdated 9 days ago
    Documents & OfficeAuto-check passed
  • Build With Simplepdf

    SimplePDF/simplepdf-embed

    Integrate SimplePDF into a web application for PDF viewing, editing, filling, signing, programmatic control, AI-agent interaction, human-in-the-loop form prefilling, submissions, webhooks, or…

    407 GitHub stars~7k tokensUpdated 9 days ago
    Documents & OfficeAuto-check passed
  • Markitdown

    ImCa0/just-laws

    Convert files and office documents to Markdown. An agent skill from ImCa0/just-laws.

    782 GitHub starsUsed in 14 repos~3.2k tokens
    Documents & OfficeAuto-check: notes

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.8k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.8k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.8k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.8k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about PDF Extraction Fallback 80956b

What does PDF Extraction Fallback 80956b do?

Multi-fallback PDF download and text extraction with early failure detection. PDF Extraction Fallback 80956b is an agent skill from HKUDS/OpenSpace.

When should I use PDF Extraction Fallback 80956b?

PDF Extraction Fallback 80956b fits situations like: tasks that involve PDF.

How do I install PDF Extraction Fallback 80956b in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill pdf-extraction-fallback-80956b -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/pdf-extraction-fallback-80956b in HKUDS/OpenSpace) into .claude/skills/pdf-extraction-fallback-80956b in your project. Claude Code loads it when a task matches its description.

How do I install PDF Extraction Fallback 80956b in Codex?

Run `npx skills add HKUDS/OpenSpace --skill pdf-extraction-fallback-80956b -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/pdf-extraction-fallback-80956b in HKUDS/OpenSpace) into .agents/skills/pdf-extraction-fallback-80956b in your project. Codex loads it when a task matches its description.

Can I use PDF Extraction Fallback 80956b in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/OpenSpace --skill pdf-extraction-fallback-80956b -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pdf-extraction-fallback-80956b, .gemini/skills/pdf-extraction-fallback-80956b, .github/skills/pdf-extraction-fallback-80956b and .opencode/skills/pdf-extraction-fallback-80956b in your project.

What does PDF Extraction Fallback 80956b need to run?

Going by SKILL.md and its folder, PDF Extraction Fallback 80956b needs the command-line tools its instructions call (curl, pdftotext, apt-get and pip). Our summary lists: Python 3.

Does PDF Extraction Fallback 80956b access the network?

SKILL.md contains no URLs. Its commands use curl and pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is PDF Extraction Fallback 80956b safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does PDF Extraction Fallback 80956b use?

PDF Extraction Fallback 80956b is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does PDF Extraction Fallback 80956b use?

About 1.8k tokens (SKILL.md is roughly 7.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to PDF Extraction Fallback 80956b?

Skills that share tags, products or a category with PDF Extraction Fallback 80956b: Jev SEO (AgriciDaniel/jev-seo, 539 stars), Analyzing Malicious PDF With Peepdf (mukul975/Anthropic-Cybersecurity-Skills, 34k stars), PDF Toolkit (borghei/Claude-Skills, 886 stars) and Edit PDF (SimplePDF/simplepdf-embed, 407 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains PDF Extraction Fallback 80956b?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,750 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

Source: HKUDS/OpenSpace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.