[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KJCJMV5HJTV1MB1MQNWBCP":3,"skill-same:01M6KJCJMV5HJTV1MB1MQNWBCP":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":34,"frontMatter":35,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":13,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":41,"updatedAt":42,"install":43,"resources":56},"01M6KJCJMV5HJTV1MB1MQNWBCP","pdf-read-file-fallback",null,"Extract text from PDFs using pdftotext when read_file returns binary data","AG064\u002FOpenSpace","AG064","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184930299?v=4","01M6KHVFG7TB73NHX3RDYSTMH2","01M6KHVFMM7XA2PZA9Z83PHS3V",0,"MIT","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-read-file-fallback\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30],"PDF","file","read","fallback","pdf read","read file","pdf read file fallback","data","text","returns","extract","binary","pdftotext","2026-11-10 10:12:30",false,"---\nname: pdf-read-file-fallback\ndescription: Extract text from PDFs using pdftotext when read_file returns binary data\n---\n\n# PDF Text Extraction Fallback\n\n## When to Use\n\nUse this pattern when `read_file` with `filetype=\"pdf\"` returns binary image data instead of extractable text content. This commonly occurs with PDFs that contain scanned images or complex formatting.\n\n## Steps\n\n### 1. Attempt Primary Extraction\n\nFirst, try using `read_file`:\n\n```python\nresult = read_file(file_path=\"document.pdf\", filetype=\"pdf\")\n```\n\n**Important**: Use `filetype` (not `file_type`) - incorrect parameter naming will cause execution failures.\n\n### 2. Detect Binary\u002FImage Data\n\nCheck if the result contains unusable content:\n\n```python\n# Indicators of binary\u002Fimage data:\n# - Contains null bytes: '\\x00'\n# - Very short or empty\n# - Contains image markers (PNG\u002FJPEG headers)\n# - Unreadable character sequences\n\nif not result or len(result) \u003C 50 or '\\x00' in str(result):\n    # Proceed to fallback\n```\n\n### 3. Use pdftotext via run_shell\n\nExtract text using the `pdftotext` command-line tool:\n\n```python\nshell_result = run_shell(command=\"pdftotext -layout document.pdf -\")\ntext_content = shell_result.stdout\n```\n\nThe `-` flag outputs to stdout for easy capture. The `-layout` flag preserves original formatting.\n\n### 4. Handle pdftotext Unavailable\n\nIf `pdftotext` is not installed, try Python-based extraction:\n\n```python\nresult = execute_code_sandbox(code=\"\"\"\nimport pdfplumber\ntext = ''\nwith pdfplumber.open('document.pdf') as pdf:\n    for page in pdf.pages:\n        extracted = page.extract_text()\n        if extracted:\n            text += extracted + '\\\\n'\nprint(text)\n\"\"\")\n```\n\n## Complete Example\n\n```python\nfile_path = \"report.pdf\"\n\n# Primary attempt\nresult = read_file(file_path=file_path, filetype=\"pdf\")\n\n# Validate and fallback if needed\nif not result or len(str(result)) \u003C 100 or '\\x00' in str(result):\n    # Fallback to pdftotext\n    shell_result = run_shell(command=f\"pdftotext -layout {file_path} -\")\n    text_content = shell_result.stdout\n    \n    # If pdftotext fails, try Python extraction\n    if not text_content or len(text_content) \u003C 50:\n        code_result = execute_code_sandbox(code=f\"\"\"\nimport pdfplumber\ntext = ''\nwith pdfplumber.open('{file_path}') as pdf:\n    for page in pdf.pages:\n        extracted = page.extract_text()\n        if extracted:\n            text += extracted + '\\\\n'\nprint(text)\n\"\"\")\n        text_content = code_result\n```\n\n## Notes\n\n- `pdftotext` is part of the `poppler-utils` package on most Linux systems\n- For scanned\u002Fimage-only PDFs, consider OCR tools (tesseract) instead\n- Always validate parameter names against tool documentation (`filetype` vs `file_type`)","# PDF Text Extraction Fallback\n\n## When to Use\n\nUse this pattern when `read_file` with `filetype=\"pdf\"` returns binary image data instead of extractable text content. This commonly occurs with PDFs that contain scanned images or complex formatting.\n\n## Steps\n\n### 1. Attempt Primary Extraction\n\nFirst, try using `read_file`:\n\n```python\nresult = read_file(file_path=\"document.pdf\", filetype=\"pdf\")\n```\n\n**Important**: Use `filetype` (not `file_type`) - incorrect parameter naming will cause execution failures.\n\n### 2. Detect Binary\u002FImage Data\n\nCheck if the result contains unusable content:\n\n```python\n# Indicators of binary\u002Fimage data:\n# - Contains null bytes: '\\x00'\n# - Very short or empty\n# - Contains image markers (PNG\u002FJPEG headers)\n# - Unreadable character sequences\n\nif not result or len(result) \u003C 50 or '\\x00' in str(result):\n    # Proceed to fallback\n```\n\n### 3. Use pdftotext via run_shell\n\nExtract text using the `pdftotext` command-line tool:\n\n```python\nshell_result = run_shell(command=\"pdftotext -layout document.pdf -\")\ntext_content = shell_result.stdout\n```\n\nThe `-` flag outputs to stdout for easy capture. The `-layout` flag preserves original formatting.\n\n### 4. Handle pdftotext Unavailable\n\nIf `pdftotext` is not installed, try Python-based extraction:\n\n```python\nresult = execute_code_sandbox(code=\"\"\"\nimport pdfplumber\ntext = ''\nwith pdfplumber.open('document.pdf') as pdf:\n    for page in pdf.pages:\n        extracted = page.extract_text()\n        if extracted:\n            text += extracted + '\\\\n'\nprint(text)\n\"\"\")\n```\n\n## Complete Example\n\n```python\nfile_path = \"report.pdf\"\n\n# Primary attempt\nresult = read_file(file_path=file_path, filetype=\"pdf\")\n\n# Validate and fallback if needed\nif not result or len(str(result)) \u003C 100 or '\\x00' in str(result):\n    # Fallback to pdftotext\n    shell_result = run_shell(command=f\"pdftotext -layout {file_path} -\")\n    text_content = shell_result.stdout\n    \n    # If pdftotext fails, try Python extraction\n    if not text_content or len(text_content) \u003C 50:\n        code_result = execute_code_sandbox(code=f\"\"\"\nimport pdfplumber\ntext = ''\nwith pdfplumber.open('{file_path}') as pdf:\n    for page in pdf.pages:\n        extracted = page.extract_text()\n        if extracted:\n            text += extracted + '\\\\n'\nprint(text)\n\"\"\")\n        text_content = code_result\n```\n\n## Notes\n\n- `pdftotext` is part of the `poppler-utils` package on most Linux systems\n- For scanned\u002Fimage-only PDFs, consider OCR tools (tesseract) instead\n- Always validate parameter names against tool documentation (`filetype` vs `file_type`)",{"name":5,"description":7},"main","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Fpdf-read-file-fallback","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace","https:\u002F\u002Fgithub.com\u002FAG064","AG064, E.Mi.\r\n\r\nA person who thinks all the time, yet all they have to think about is nothing. I want to improve the world and work on open source projects","2026-10-08 06:53:48",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add AG064\u002FOpenSpace --skill pdf-read-file-fallback",{"tool":49,"command":50},"bunx","bunx skills add AG064\u002FOpenSpace --skill pdf-read-file-fallback",{"tool":52,"command":53},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill pdf-read-file-fallback","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-read-file-fallback\u002FSKILL.md",true,[57],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},".skill_id","OTHER","其他",36,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-read-file-fallback\u002F.skill_id",[64,87,103,112,136,152],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":31},"01M6KKMPWA0B5SCCH766F8M5EA","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[71,72,73,74,75,76,77,78,79,80,81,82,83,84,19,85,86],"write special chars ts check","check","write","filters","Existing","type-checking","for","errors","script","output","type","files","only","template","python","typescript",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":31},"01M6KKMJXVBNVEY3TRK055F4A7","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[94,95,73,84,96,20,19,85,97,98,99,100,101,77,79,102],"readback","write special chars readback","cleanup","scripts","verification","via","post","helper","with",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":31},"01M6KKMEGX9M9NC105J0W3Q5B9","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[73,110,85,77,99,84,111,19,79],"write special chars heredoc","shell",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":31},"01M6KKM8EJ2AATVHZBNB916WT0","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[],[119,120,121,122,86,123,124,125,126,127,77,128,129,130,131,132,133,134,25,135],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","scheduler",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":31},"01M6KKM39PHYK627F19GE2B9XN","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[143,144,145,146,77,147,102,148,149,150,151],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":31},"01M6KKKY7T2P61Y0JH54CDEJKQ","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[159,160,161,162,163,164,19,165,166,167],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]