[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KJCJMV5HJTV1MB1MQNWBCP":3,"skill-same:01M6KJCJMV5HJTV1MB1MQNWBCP":68},{"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":22,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":13,"repositoryHtmlUrl":44,"repositoryHomepageUrl":6,"ownerHtmlUrl":45,"ownerBlogUrl":6,"ownerDescription":46,"updatedAt":47,"install":48,"resources":61},"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",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35],"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":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add AG064\u002FOpenSpace --skill pdf-read-file-fallback",{"tool":54,"command":55},"bunx","bunx skills add AG064\u002FOpenSpace --skill pdf-read-file-fallback",{"tool":57,"command":58},"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,[62],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},".skill_id","OTHER","其他",36,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-read-file-fallback\u002F.skill_id",[69,92,108,117,146,162],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":36},"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",[],[76,77,78,79,80,81,82,83,84,85,86,87,88,89,24,90,91],"write special chars ts check","check","write","filters","Existing","type-checking","for","errors","script","output","type","files","only","template","python","typescript",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":36},"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",[],[99,100,78,89,101,25,24,90,102,103,104,105,106,82,84,107],"readback","write special chars readback","cleanup","scripts","verification","via","post","helper","with",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":36},"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",[],[78,115,90,82,104,89,116,24,84],"write special chars heredoc","shell",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":128,"publishedAt":36},"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",[123],{"categoryNo":124,"categoryName":125,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[129,130,131,132,91,133,134,135,136,137,82,138,139,140,141,142,143,144,30,145],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","scheduler",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":36},"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",[],[153,154,155,156,82,157,107,158,159,160,161],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":36},"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",[],[169,170,171,172,173,174,24,175,176,177],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]