[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XBWGVF2AJGVPFM7WJ39QH4":3,"skill-same:01M6XBWGVF2AJGVPFM7WJ39QH4":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},"01M6XBWGVF2AJGVPFM7WJ39QH4","python-heredoc-fallback",null,"Use shell Python heredoc as fallback when code sandbox fails","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\u002Fpython-heredoc-fallback\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27],"python","fallback","python heredoc fallback","sandbox","code","shell","use","as","shell python heredoc","when","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","0650921d63895de3997bc81f1ff1d0ac67032072","gdpval_bench\u002Fskills\u002Fpython-heredoc-fallback","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 python-heredoc-fallback",{"tool":45,"command":46},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill python-heredoc-fallback",{"tool":48,"command":49},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill python-heredoc-fallback","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpython-heredoc-fallback\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},".skill_id","OTHER","其他",37,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpython-heredoc-fallback\u002F.skill_id",[60,84,101,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,75,76,77,78,79,80,81,82,83,18],"check","write","write special chars ts check","typescript","filters","characters","Existing","type-checking","for","errors","script","output","type","files","only","template","file",{"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,83,93,18,94,95,96,97,98,82,99,100,72,75,77],"readback","write special chars readback","helper","post","via","scripts","cleanup","read","verification","with",{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"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",[],[108,68,72,23,77,95,82,83,18,75],"write special chars heredoc",{"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,75,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,75,145,100,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,83,163,164,165],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]