[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KFWKV0W32DR1AQN5H5TERF":3,"skill-same:01M6KFWKV0W32DR1AQN5H5TERF":66},{"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":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":14,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M6KFWKV0W32DR1AQN5H5TERF","python-heredoc-fallback",null,"Use shell Python heredoc as fallback when code sandbox fails","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\u002Fpython-heredoc-fallback\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32],"python","fallback","python heredoc fallback","sandbox","code","shell","use","as","shell python heredoc","2026-11-10 10:12:30",false,"---\nname: python-heredoc-fallback\ndescription: Use shell Python heredoc as fallback when code sandbox fails\n---\n\n# Python Heredoc Fallback for Code Execution\n\n## When to Use\n\nUse this pattern when `execute_code_sandbox` fails with e2b initialization errors, sandbox connection issues, or other execution environment problems. This is especially reliable for file generation tasks.\n\n## Core Pattern\n\nInstead of `execute_code_sandbox`, run Python code directly in the shell using a heredoc:\n\n```bash\npython3 \u003C\u003C 'EOF'\n# Your Python code here\nimport sys\nprint(\"Python code executing in shell\")\nEOF\n```\n\n## Key Syntax Rules\n\n1. **Use single-quoted EOF** (`\u003C\u003C 'EOF'`) to prevent shell variable expansion within the Python code\n2. **No indentation before EOF** - the closing delimiter must be at the start of the line\n3. **Install packages first** if needed, before the Python heredoc block\n\n## Common Use Cases\n\n### 1. Matplotlib Graph Generation\n\n```bash\npython3 \u003C\u003C 'EOF'\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\n# Load data\ndata = pd.read_excel('input.xlsx')\n\n# Create visualization\nplt.figure(figsize=(10, 6))\nplt.plot(data['x'], data['y'])\nplt.xlabel('X Label')\nplt.ylabel('Y Label')\nplt.title('Graph Title')\nplt.savefig('output_graph.png', dpi=300, bbox_inches='tight')\nplt.close()\n\nprint(\"Graph saved successfully\")\nEOF\n```\n\n### 2. Python-docx Document Creation\n\n```bash\npip install python-docx -q\n\npython3 \u003C\u003C 'EOF'\nfrom docx import Document\nfrom docx.shared import Inches, Pt\nfrom docx.enum.text import WD_ALIGN_PARAGRAPH\n\ndoc = Document()\n\n# Add title\ntitle = doc.add_heading('Document Title', 0)\ntitle.alignment = WD_ALIGN_PARAGRAPH.CENTER\n\n# Add sections\ndoc.add_heading('Section 1', level=1)\ndoc.add_paragraph('Content for section 1.')\n\n# Add table\ntable = doc.add_table(rows=3, cols=3)\ntable.style = 'Table Grid'\n\n# Save document\ndoc.save('output.docx')\nprint(\"Document created successfully\")\nEOF\n```\n\n### 3. General File Operations\n\n```bash\npython3 \u003C\u003C 'EOF'\nimport json\nimport os\n\n# Read input file\nwith open('input.json', 'r') as f:\n    data = json.load(f)\n\n# Process data\nresult = {'processed': True, 'items': len(data)}\n\n# Write output\nwith open('output.json', 'w') as f:\n    json.dump(result, f, indent=2)\n\nprint(f\"Processed {result['items']} items\")\nEOF\n```\n\n## Best Practices\n\n1. **Install dependencies first**: Run `pip install package-name -q` before the Python block if packages aren't guaranteed to be available\n2. **Verify file paths**: Files are read from and written to the current working directory\n3. **Add print statements**: Include progress\u002Foutput messages to verify execution succeeded\n4. **Close resources**: Explicitly close matplotlib figures and file handles\n5. **Handle errors gracefully**: Add try\u002Fexcept blocks for production code\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| Module not found | Add `pip install \u003Cmodule> -q` before Python block |\n| File not found | Verify file exists in current directory with `ls` |\n| Permission denied | Check file permissions and directory write access |\n| Syntax errors | Ensure proper Python indentation within heredoc |\n\n## Advantages Over execute_code_sandbox\n\n- **No initialization overhead** - runs immediately in existing shell\n- **Persistent environment** - maintains state across multiple commands\n- **Direct file system access** - no sandbox isolation issues\n- **Full system Python** - access to all installed packages\n- **Reliable for large files** - no sandbox size restrictions","# Python Heredoc Fallback for Code Execution\n\n## When to Use\n\nUse this pattern when `execute_code_sandbox` fails with e2b initialization errors, sandbox connection issues, or other execution environment problems. This is especially reliable for file generation tasks.\n\n## Core Pattern\n\nInstead of `execute_code_sandbox`, run Python code directly in the shell using a heredoc:\n\n```bash\npython3 \u003C\u003C 'EOF'\n# Your Python code here\nimport sys\nprint(\"Python code executing in shell\")\nEOF\n```\n\n## Key Syntax Rules\n\n1. **Use single-quoted EOF** (`\u003C\u003C 'EOF'`) to prevent shell variable expansion within the Python code\n2. **No indentation before EOF** - the closing delimiter must be at the start of the line\n3. **Install packages first** if needed, before the Python heredoc block\n\n## Common Use Cases\n\n### 1. Matplotlib Graph Generation\n\n```bash\npython3 \u003C\u003C 'EOF'\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\n# Load data\ndata = pd.read_excel('input.xlsx')\n\n# Create visualization\nplt.figure(figsize=(10, 6))\nplt.plot(data['x'], data['y'])\nplt.xlabel('X Label')\nplt.ylabel('Y Label')\nplt.title('Graph Title')\nplt.savefig('output_graph.png', dpi=300, bbox_inches='tight')\nplt.close()\n\nprint(\"Graph saved successfully\")\nEOF\n```\n\n### 2. Python-docx Document Creation\n\n```bash\npip install python-docx -q\n\npython3 \u003C\u003C 'EOF'\nfrom docx import Document\nfrom docx.shared import Inches, Pt\nfrom docx.enum.text import WD_ALIGN_PARAGRAPH\n\ndoc = Document()\n\n# Add title\ntitle = doc.add_heading('Document Title', 0)\ntitle.alignment = WD_ALIGN_PARAGRAPH.CENTER\n\n# Add sections\ndoc.add_heading('Section 1', level=1)\ndoc.add_paragraph('Content for section 1.')\n\n# Add table\ntable = doc.add_table(rows=3, cols=3)\ntable.style = 'Table Grid'\n\n# Save document\ndoc.save('output.docx')\nprint(\"Document created successfully\")\nEOF\n```\n\n### 3. General File Operations\n\n```bash\npython3 \u003C\u003C 'EOF'\nimport json\nimport os\n\n# Read input file\nwith open('input.json', 'r') as f:\n    data = json.load(f)\n\n# Process data\nresult = {'processed': True, 'items': len(data)}\n\n# Write output\nwith open('output.json', 'w') as f:\n    json.dump(result, f, indent=2)\n\nprint(f\"Processed {result['items']} items\")\nEOF\n```\n\n## Best Practices\n\n1. **Install dependencies first**: Run `pip install package-name -q` before the Python block if packages aren't guaranteed to be available\n2. **Verify file paths**: Files are read from and written to the current working directory\n3. **Add print statements**: Include progress\u002Foutput messages to verify execution succeeded\n4. **Close resources**: Explicitly close matplotlib figures and file handles\n5. **Handle errors gracefully**: Add try\u002Fexcept blocks for production code\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| Module not found | Add `pip install \u003Cmodule> -q` before Python block |\n| File not found | Verify file exists in current directory with `ls` |\n| Permission denied | Check file permissions and directory write access |\n| Syntax errors | Ensure proper Python indentation within heredoc |\n\n## Advantages Over execute_code_sandbox\n\n- **No initialization overhead** - runs immediately in existing shell\n- **Persistent environment** - maintains state across multiple commands\n- **Direct file system access** - no sandbox isolation issues\n- **Full system Python** - access to all installed packages\n- **Reliable for large files** - no sandbox size restrictions",{"name":5,"description":7},"main","af1b40a42167d09c30b3a63000aa14ace4c1e229","gdpval_bench\u002Fskills\u002Fpython-heredoc-fallback","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":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add xyliu-cs\u002FOpenSpace-GDPval --skill python-heredoc-fallback",{"tool":52,"command":53},"bunx","bunx skills add xyliu-cs\u002FOpenSpace-GDPval --skill python-heredoc-fallback",{"tool":55,"command":56},"pnpm","pnpm dlx skills add xyliu-cs\u002FOpenSpace-GDPval --skill python-heredoc-fallback","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpython-heredoc-fallback\u002FSKILL.md",true,[60],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},".skill_id","OTHER","其他",37,"https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpython-heredoc-fallback\u002F.skill_id",[67,79,87,103,128,147],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":33},"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",[],[74,75,76,77,78,31],"zip export deliverable","zip","export","deliverables","codebase",{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":33},"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",[],[86,75,77,78,31],"zip deliverable finalization",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":33},"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",[],[94,95,96,97,98,99,100,101,31,102],"failure analysis","ZeRO","analysis","iteration","zero iteration failure analysis","with","issues","execution","system",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":114,"publishedAt":33},"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",[109],{"categoryNo":110,"categoryName":111,"taxonomyType":112,"taxonomyTypeDesc":113},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[25,115,116,117,118,119,120,121,122,123,124,125,126,127],"write","file","report","write file fallback report","domain","professional","sources","retrieval","generate","embedded","documents","data","knowledge",{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":137,"publishedAt":33},"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",[134],{"categoryNo":135,"categoryName":136,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[138,99,25,139,140,29,125,123,116,141,142,143,115,144,120,145,146],"fallback doc with delegation","doc","delegation","markdown","tool","text","simple","formats","for",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":154,"publishedAt":33},"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",[153],{"categoryNo":110,"categoryName":111,"taxonomyType":112,"taxonomyTypeDesc":113},[25,117,155,156,123,116,157,158,115,159,160,122,99,161,125],"context","context anchored fallback report","Guardrails","Tools","task","drift","context drift"]