[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XBYDPDQKDW6F81CGDBJ8XA":3,"skill-same:01M6XBYDPDQKDW6F81CGDBJ8XA":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":28,"linkOnly":29,"markdownContent":30,"markdownBody":31,"frontMatter":32,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":13,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":38,"install":39,"resources":52},"01M6XBYDPDQKDW6F81CGDBJ8XA","robust-pdf-extraction",null,"Multi-method PDF extraction with sequential fallback and OCR for scanned documents","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Frobust-pdf-extraction\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27],"PDF","extraction","pdf extraction","robust pdf extraction","documents","ocr","fallback","multi","with","for","2026-11-10 10:12:30",false,"---\nname: robust-pdf-extraction\ndescription: Multi-method PDF extraction with sequential fallback and OCR for scanned documents\n---\n\n# Robust PDF Extraction Workflow\n\nThis skill provides a systematic approach to extracting text from PDF files, handling both text-based and scanned\u002Fimage-based documents through progressive fallback methods.\n\n## When to Use\n\n- Processing PDFs of unknown or mixed types (text vs. scanned images)\n- Critical document processing where extraction failure is not acceptable\n- Batch processing multiple PDFs with varying formats\n\n## Workflow Steps\n\n### Step 1: Verify File Accessibility\n\nBefore attempting extraction, confirm the PDF exists and is readable:\n\n```bash\n# Check file exists and get basic info\nls -la \u002Fpath\u002Fto\u002Fdocument.pdf\n\n# Or search for files if location uncertain\nfind \u002Fpath -name \"*.pdf\" -type f 2>\u002Fdev\u002Fnull\n```\n\n### Step 2: Attempt Primary Extraction (pdfplumber)\n\nStart with pdfplumber for best text structure preservation:\n\n```python\nimport pdfplumber\n\ndef extract_with_pdfplumber(pdf_path):\n    text = \"\"\n    with pdfplumber.open(pdf_path) as pdf:\n        for page in pdf.pages:\n            page_text = page.extract_text()\n            if page_text:\n                text += page_text + \"\\n\"\n    return text.strip()\n```\n\n### Step 3: Fallback to Secondary Method (pypdfium2)\n\nIf pdfplumber returns empty or incomplete text:\n\n```python\nimport pdfium2\n\ndef extract_with_pypdfium2(pdf_path):\n    pdf = pdfium2.PdfDocument(pdf_path)\n    text = \"\"\n    for page in pdf:\n        text_page = page.get_textpage()\n        page_text = text_page.get_text_bounded()\n        if page_text:\n            text += page_text + \"\\n\"\n    return text.strip()\n```\n\n### Step 4: Fallback to Tertiary Method (pdftotext)\n\nIf pypdfium2 also fails, use command-line pdftotext:\n\n```bash\npdftotext \u002Fpath\u002Fto\u002Fdocument.pdf - 2>\u002Fdev\u002Fnull\n```\n\nOr in Python:\n\n```python\nimport subprocess\n\ndef extract_with_pdftotext(pdf_path):\n    result = subprocess.run(\n        ['pdftotext', pdf_path, '-'],\n        capture_output=True,\n        text=True\n    )\n    return result.stdout.strip()\n```\n\n### Step 5: Detect Scanned\u002FImage-Based PDFs\n\nAfter each extraction attempt, verify text was actually extracted:\n\n```python\ndef is_meaningful_text(text, min_chars=50):\n    \"\"\"Check if extracted text is meaningful (not empty or just whitespace)\"\"\"\n    if not text:\n        return False\n    # Remove whitespace and check length\n    cleaned = ''.join(text.split())\n    return len(cleaned) >= min_chars\n```\n\n### Step 6: OCR Fallback for Scanned Documents\n\nIf all text extraction methods return empty\u002Finsufficient text, the PDF is likely scanned. Use OCR:\n\n```python\nimport pdf2image\nimport pytesseract\nfrom PIL import Image\n\ndef extract_with_ocr(pdf_path, dpi=300):\n    \"\"\"Extract text from scanned PDFs using OCR\"\"\"\n    text = \"\"\n    images = pdf2image.convert_from_path(pdf_path, dpi=dpi)\n    for image in images:\n        page_text = pytesseract.image_to_string(image)\n        text += page_text + \"\\n\"\n    return text.strip()\n```\n\n## Complete Workflow Function\n\n```python\ndef robust_pdf_extract(pdf_path):\n    \"\"\"\n    Extract text from PDF using progressive fallback methods.\n    Returns (text, method_used) tuple.\n    \"\"\"\n    methods = [\n        (\"pdfplumber\", extract_with_pdfplumber),\n        (\"pypdfium2\", extract_with_pypdfium2),\n        (\"pdftotext\", extract_with_pdftotext),\n    ]\n    \n    for method_name, extract_func in methods:\n        try:\n            text = extract_func(pdf_path)\n            if is_meaningful_text(text):\n                return text, method_name\n        except Exception as e:\n            print(f\"{method_name} failed: {e}\")\n            continue\n    \n    # All text methods failed - try OCR\n    try:\n        text = extract_with_ocr(pdf_path)\n        if is_meaningful_text(text):\n            return text, \"ocr\"\n    except Exception as e:\n        print(f\"OCR failed: {e}\")\n    \n    return \"\", \"failed\"\n```\n\n## Dependencies\n\nInstall required packages:\n\n```bash\npip install pdfplumber pypdfium2 pdf2image pytesseract pillow\n# Also need system packages:\n# apt-get install poppler-utils tesseract-ocr  # Debian\u002FUbuntu\n# brew install poppler tesseract  # macOS\n```\n\n## Best Practices\n\n1. **Log which method succeeded** - helps identify document types for future optimization\n2. **Set reasonable character thresholds** - adjust `min_chars` based on expected document content\n3. **Handle exceptions gracefully** - each method may fail for different reasons\n4. **Consider DPI for OCR** - higher DPI (300+) improves accuracy but increases processing time\n5. **Cache results** - if processing same PDFs repeatedly, store successful extraction method per file\n\n## Troubleshooting\n\n| Symptom | Likely Cause | Solution |\n|---------|--------------|----------|\n| All methods return empty | Scanned PDF | OCR fallback should handle this |\n| pdfplumber fails with permission error | File locked or permissions issue | Check file permissions with `ls -la` |\n| OCR returns gibberish | Low quality scan or wrong language | Increase DPI, specify language in pytesseract |\n| pdftotext not found | Missing poppler-utils | Install system package |","# Robust PDF Extraction Workflow\n\nThis skill provides a systematic approach to extracting text from PDF files, handling both text-based and scanned\u002Fimage-based documents through progressive fallback methods.\n\n## When to Use\n\n- Processing PDFs of unknown or mixed types (text vs. scanned images)\n- Critical document processing where extraction failure is not acceptable\n- Batch processing multiple PDFs with varying formats\n\n## Workflow Steps\n\n### Step 1: Verify File Accessibility\n\nBefore attempting extraction, confirm the PDF exists and is readable:\n\n```bash\n# Check file exists and get basic info\nls -la \u002Fpath\u002Fto\u002Fdocument.pdf\n\n# Or search for files if location uncertain\nfind \u002Fpath -name \"*.pdf\" -type f 2>\u002Fdev\u002Fnull\n```\n\n### Step 2: Attempt Primary Extraction (pdfplumber)\n\nStart with pdfplumber for best text structure preservation:\n\n```python\nimport pdfplumber\n\ndef extract_with_pdfplumber(pdf_path):\n    text = \"\"\n    with pdfplumber.open(pdf_path) as pdf:\n        for page in pdf.pages:\n            page_text = page.extract_text()\n            if page_text:\n                text += page_text + \"\\n\"\n    return text.strip()\n```\n\n### Step 3: Fallback to Secondary Method (pypdfium2)\n\nIf pdfplumber returns empty or incomplete text:\n\n```python\nimport pdfium2\n\ndef extract_with_pypdfium2(pdf_path):\n    pdf = pdfium2.PdfDocument(pdf_path)\n    text = \"\"\n    for page in pdf:\n        text_page = page.get_textpage()\n        page_text = text_page.get_text_bounded()\n        if page_text:\n            text += page_text + \"\\n\"\n    return text.strip()\n```\n\n### Step 4: Fallback to Tertiary Method (pdftotext)\n\nIf pypdfium2 also fails, use command-line pdftotext:\n\n```bash\npdftotext \u002Fpath\u002Fto\u002Fdocument.pdf - 2>\u002Fdev\u002Fnull\n```\n\nOr in Python:\n\n```python\nimport subprocess\n\ndef extract_with_pdftotext(pdf_path):\n    result = subprocess.run(\n        ['pdftotext', pdf_path, '-'],\n        capture_output=True,\n        text=True\n    )\n    return result.stdout.strip()\n```\n\n### Step 5: Detect Scanned\u002FImage-Based PDFs\n\nAfter each extraction attempt, verify text was actually extracted:\n\n```python\ndef is_meaningful_text(text, min_chars=50):\n    \"\"\"Check if extracted text is meaningful (not empty or just whitespace)\"\"\"\n    if not text:\n        return False\n    # Remove whitespace and check length\n    cleaned = ''.join(text.split())\n    return len(cleaned) >= min_chars\n```\n\n### Step 6: OCR Fallback for Scanned Documents\n\nIf all text extraction methods return empty\u002Finsufficient text, the PDF is likely scanned. Use OCR:\n\n```python\nimport pdf2image\nimport pytesseract\nfrom PIL import Image\n\ndef extract_with_ocr(pdf_path, dpi=300):\n    \"\"\"Extract text from scanned PDFs using OCR\"\"\"\n    text = \"\"\n    images = pdf2image.convert_from_path(pdf_path, dpi=dpi)\n    for image in images:\n        page_text = pytesseract.image_to_string(image)\n        text += page_text + \"\\n\"\n    return text.strip()\n```\n\n## Complete Workflow Function\n\n```python\ndef robust_pdf_extract(pdf_path):\n    \"\"\"\n    Extract text from PDF using progressive fallback methods.\n    Returns (text, method_used) tuple.\n    \"\"\"\n    methods = [\n        (\"pdfplumber\", extract_with_pdfplumber),\n        (\"pypdfium2\", extract_with_pypdfium2),\n        (\"pdftotext\", extract_with_pdftotext),\n    ]\n    \n    for method_name, extract_func in methods:\n        try:\n            text = extract_func(pdf_path)\n            if is_meaningful_text(text):\n                return text, method_name\n        except Exception as e:\n            print(f\"{method_name} failed: {e}\")\n            continue\n    \n    # All text methods failed - try OCR\n    try:\n        text = extract_with_ocr(pdf_path)\n        if is_meaningful_text(text):\n            return text, \"ocr\"\n    except Exception as e:\n        print(f\"OCR failed: {e}\")\n    \n    return \"\", \"failed\"\n```\n\n## Dependencies\n\nInstall required packages:\n\n```bash\npip install pdfplumber pypdfium2 pdf2image pytesseract pillow\n# Also need system packages:\n# apt-get install poppler-utils tesseract-ocr  # Debian\u002FUbuntu\n# brew install poppler tesseract  # macOS\n```\n\n## Best Practices\n\n1. **Log which method succeeded** - helps identify document types for future optimization\n2. **Set reasonable character thresholds** - adjust `min_chars` based on expected document content\n3. **Handle exceptions gracefully** - each method may fail for different reasons\n4. **Consider DPI for OCR** - higher DPI (300+) improves accuracy but increases processing time\n5. **Cache results** - if processing same PDFs repeatedly, store successful extraction method per file\n\n## Troubleshooting\n\n| Symptom | Likely Cause | Solution |\n|---------|--------------|----------|\n| All methods return empty | Scanned PDF | OCR fallback should handle this |\n| pdfplumber fails with permission error | File locked or permissions issue | Check file permissions with `ls -la` |\n| OCR returns gibberish | Low quality scan or wrong language | Increase DPI, specify language in pytesseract |\n| pdftotext not found | Missing poppler-utils | Install system package |",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","gdpval_bench\u002Fskills\u002Frobust-pdf-extraction","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill robust-pdf-extraction",{"tool":45,"command":46},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill robust-pdf-extraction",{"tool":48,"command":49},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill robust-pdf-extraction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Frobust-pdf-extraction\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},".skill_id","OTHER","其他",35,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Frobust-pdf-extraction\u002F.skill_id",[60,84,100,109,134,150],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":28},"01M6XCCXD3NCM2YKR3WNGBASPC","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[67,68,69,70,71,72,73,74,27,75,76,77,78,79,80,81,82,83],"check","write","write special chars ts check","typescript","filters","characters","Existing","type-checking","errors","script","output","type","files","only","template","file","python",{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":28},"01M6XCCT7E3J922Q345PBGSHPN","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[91,92,68,82,93,83,94,95,96,97,98,81,99,26,72,27,76],"readback","write special chars readback","helper","post","via","scripts","cleanup","read","verification",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":28},"01M6XCCMQX1R8B6FECWB3P63T7","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[107,68,72,108,76,95,81,82,83,27],"write special chars heredoc","shell",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":28},"01M6XCCG41M994JJEX6VN52PEP","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[],[116,117,118,119,120,70,121,122,123,124,125,27,126,127,128,129,130,131,132,133],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","source","extracting","panel","patterns","edge functions","integrations","open","api","data",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":28},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[141,142,143,144,27,145,26,146,147,148,149],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":156,"publishedAt":28},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[157,158,159,160,161,162,82,163,164,165],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]