[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KFRBKXMNMNPSMAEGDN33DV":3,"skill-same:01M6KFRBKXMNMNPSMAEGDN33DV":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":14,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M6KFRBKXMNMNPSMAEGDN33DV","pdf-text-extraction-9424c5",null,"Extract text from PDF files using pdftotext when read_file returns binary data","xyliu-cs\u002FOpenSpace-GDPval","xyliu-cs","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F89236536?v=4","01M6KF8Z1V4TXS86CKSH48BY8T","xy","01M6KF8Z67443W0SHXM85JEF0B",0,"MIT","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36],"PDF","extraction","text","pdf text extraction 9424c5","pdf text extraction","file","data","returns","read","extract","files","binary","pdftotext","2026-11-10 10:12:30",false,"---\nname: pdf-text-extraction-9424c5\ndescription: Extract text from PDF files using pdftotext when read_file returns binary data\n---\n\n# PDF Text Extraction via pdftotext\n\n## Problem\n\nWhen using `read_file` on PDF documents, the function may return binary image data or garbled content instead of readable text. This occurs because PDFs can contain scanned images or complex binary structures that `read_file` cannot properly parse as text.\n\n## Solution\n\nUse the `pdftotext` command-line utility via `run_shell` to extract clean text content from PDF files.\n\n## Steps\n\n### 1. Verify PDF file exists\n\n```python\nimport os\n\npdf_path = \"path\u002Fto\u002Fdocument.pdf\"\nif not os.path.exists(pdf_path):\n    raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n```\n\n### 2. Extract text using pdftotext\n\n```python\nfrom tools import run_shell\n\n# Extract text to stdout\nresult = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\npdf_text = result.stdout\n\n# Alternative: extract to a temporary file\ntemp_txt = \"\u002Ftmp\u002Fextracted.txt\"\nrun_shell(command=f\"pdftotext '{pdf_path}' '{temp_txt}'\", timeout=60)\nwith open(temp_txt, 'r') as f:\n    pdf_text = f.read()\n```\n\n### 3. Handle parameter naming carefully\n\nWhen calling `read_file`, be aware of the parameter name:\n- Use `filetype=\"pdf\"` (not `file_type`)\n- Some tool implementations may use different parameter names\n\n```python\n# Correct parameter usage\ncontent = read_file(file_path=\"doc.pdf\", filetype=\"pdf\")\n\n# If this returns binary\u002Fgarbled data, fall back to pdftotext\n```\n\n## Common pdftotext Options\n\n| Option | Description |\n|--------|-------------|\n| `-` | Output to stdout |\n| `-layout` | Maintain original layout |\n| `-f \u003Cn>` | Start from page n |\n| `-l \u003Cn>` | End at page n |\n| `-q` | Quiet mode |\n\nExample with options:\n```python\nresult = run_shell(command=f\"pdftotext -layout -q '{pdf_path}' -\", timeout=60)\n```\n\n## Error Handling\n\n```python\nfrom tools import run_shell\n\ndef extract_pdf_text(pdf_path):\n    \"\"\"Extract text from PDF using pdftotext with error handling.\"\"\"\n    import os\n    \n    if not os.path.exists(pdf_path):\n        raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n    \n    result = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\n    \n    if result.returncode != 0:\n        raise RuntimeError(f\"pdftotext failed: {result.stderr}\")\n    \n    return result.stdout.strip()\n```\n\n## When to Use This Pattern\n\n- `read_file` returns binary data, garbled text, or image content for a PDF\n- You need searchable\u002Fprocessable text from PDF documents\n- The PDF contains text (not just scanned images - for those, consider OCR tools)\n\n## Prerequisites\n\n- `pdftotext` must be installed (part of `poppler-utils` on Debian\u002FUbuntu, `poppler` on macOS via Homebrew)\n- Verify availability: `run_shell(command=\"which pdftotext\")`","# PDF Text Extraction via pdftotext\n\n## Problem\n\nWhen using `read_file` on PDF documents, the function may return binary image data or garbled content instead of readable text. This occurs because PDFs can contain scanned images or complex binary structures that `read_file` cannot properly parse as text.\n\n## Solution\n\nUse the `pdftotext` command-line utility via `run_shell` to extract clean text content from PDF files.\n\n## Steps\n\n### 1. Verify PDF file exists\n\n```python\nimport os\n\npdf_path = \"path\u002Fto\u002Fdocument.pdf\"\nif not os.path.exists(pdf_path):\n    raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n```\n\n### 2. Extract text using pdftotext\n\n```python\nfrom tools import run_shell\n\n# Extract text to stdout\nresult = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\npdf_text = result.stdout\n\n# Alternative: extract to a temporary file\ntemp_txt = \"\u002Ftmp\u002Fextracted.txt\"\nrun_shell(command=f\"pdftotext '{pdf_path}' '{temp_txt}'\", timeout=60)\nwith open(temp_txt, 'r') as f:\n    pdf_text = f.read()\n```\n\n### 3. Handle parameter naming carefully\n\nWhen calling `read_file`, be aware of the parameter name:\n- Use `filetype=\"pdf\"` (not `file_type`)\n- Some tool implementations may use different parameter names\n\n```python\n# Correct parameter usage\ncontent = read_file(file_path=\"doc.pdf\", filetype=\"pdf\")\n\n# If this returns binary\u002Fgarbled data, fall back to pdftotext\n```\n\n## Common pdftotext Options\n\n| Option | Description |\n|--------|-------------|\n| `-` | Output to stdout |\n| `-layout` | Maintain original layout |\n| `-f \u003Cn>` | Start from page n |\n| `-l \u003Cn>` | End at page n |\n| `-q` | Quiet mode |\n\nExample with options:\n```python\nresult = run_shell(command=f\"pdftotext -layout -q '{pdf_path}' -\", timeout=60)\n```\n\n## Error Handling\n\n```python\nfrom tools import run_shell\n\ndef extract_pdf_text(pdf_path):\n    \"\"\"Extract text from PDF using pdftotext with error handling.\"\"\"\n    import os\n    \n    if not os.path.exists(pdf_path):\n        raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n    \n    result = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\n    \n    if result.returncode != 0:\n        raise RuntimeError(f\"pdftotext failed: {result.stderr}\")\n    \n    return result.stdout.strip()\n```\n\n## When to Use This Pattern\n\n- `read_file` returns binary data, garbled text, or image content for a PDF\n- You need searchable\u002Fprocessable text from PDF documents\n- The PDF contains text (not just scanned images - for those, consider OCR tools)\n\n## Prerequisites\n\n- `pdftotext` must be installed (part of `poppler-utils` on Debian\u002FUbuntu, `poppler` on macOS via Homebrew)\n- Verify availability: `run_shell(command=\"which pdftotext\")`",{"name":5,"description":7},"main","af1b40a42167d09c30b3a63000aa14ace4c1e229","gdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval","https:\u002F\u002Fgithub.com\u002Fxyliu-cs","https:\u002F\u002Fxyliu-cs.github.io","PhD Student in CS, CUHK-Shenzhen.","2026-04-06 20:32:15",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add xyliu-cs\u002FOpenSpace-GDPval --skill pdf-text-extraction-9424c5",{"tool":56,"command":57},"bunx","bunx skills add xyliu-cs\u002FOpenSpace-GDPval --skill pdf-text-extraction-9424c5",{"tool":59,"command":60},"pnpm","pnpm dlx skills add xyliu-cs\u002FOpenSpace-GDPval --skill pdf-text-extraction-9424c5","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5\u002FSKILL.md",true,[64],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},".skill_id","OTHER","其他",40,"https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5\u002F.skill_id",[71,84,92,108,132,151],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":37},"01M6KG8MF1S664SWBDENYRSCK8","zip-export-deliverable","Ensures codebase deliverables are properly exported as ZIP archives through a dedicated finalization step","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fzip-export-deliverable\u002FSKILL.md",[],[78,79,80,81,82,83],"zip export deliverable","zip","export","deliverables","codebase","as",{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":37},"01M6KG8GAZWHHEK7VNJDW0ME21","zip-deliverable-finalization","Ensure codebase deliverables are properly packaged as ZIP exports in a dedicated final step","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fzip-deliverable-finalization\u002FSKILL.md",[],[91,79,81,82,83],"zip deliverable finalization",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":37},"01M6KG8CMQQ1PYMNTSRZ9VS1MD","zero-iteration-failure-analysis","Identify and handle agent failures with 0 iterations as pre-execution system issues","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fzero-iteration-failure-analysis\u002FSKILL.md",[],[99,100,101,102,103,104,105,106,83,107],"failure analysis","ZeRO","analysis","iteration","zero iteration failure analysis","with","issues","execution","system",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":119,"publishedAt":37},"01M6KG86W3PA07FT9W58YHHERM","write-file-fallback-report","Generate professional documents using write_file when primary data sources fail, leveraging embedded domain knowledge instead of external retrieval","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fwrite-file-fallback-report\u002FSKILL.md",[114],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[120,121,29,122,123,124,125,126,127,128,129,130,30,131],"fallback","write","report","write file fallback report","domain","professional","sources","retrieval","generate","embedded","documents","knowledge",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":141,"publishedAt":37},"01M6KG82GAEY3GG77CMGCK1C2T","fallback-doc-with-delegation","Generate professional documents after tool failures using shell_agent for complex formats or write_file for simple text\u002Fmarkdown","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fwrite-file-fallback-report-enhanced\u002FSKILL.md",[138],{"categoryNo":139,"categoryName":140,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[142,104,120,143,144,145,130,128,29,146,147,26,121,148,125,149,150],"fallback doc with delegation","doc","delegation","shell","markdown","tool","simple","formats","for",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":158,"publishedAt":37},"01M6KG7WT7GX5NYCGEFHW22NV7","context-anchored-fallback-report","Generate documents with write_file when retrieval tools fail, with explicit guardrails against task context drift","https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fwrite-file-fallback-report-enhanced-4bc5c2\u002FSKILL.md",[157],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},[120,122,159,160,128,29,161,162,121,163,164,127,104,165,130],"context","context anchored fallback report","Guardrails","Tools","task","drift","context drift"]