[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KFYAX64XSKSZSA5S11NAP0":3,"skill-same:01M6KFYAX64XSKSZSA5S11NAP0":60},{"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":18,"publishedAt":27,"linkOnly":28,"markdownContent":29,"markdownBody":30,"frontMatter":31,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":14,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":37,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M6KFYAX64XSKSZSA5S11NAP0","reliable-script-execution",null,"Execute Python scripts reliably using file-first approach instead of heredoc","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\u002Freliable-script-execution\u002FSKILL.md",[],[19,20,21,22,23,24,25,26],"execution","script","reliable script execution","python","file","first","execute","scripts","2026-11-10 10:12:30",false,"---\nname: reliable-script-execution\ndescription: Execute Python scripts reliably using file-first approach instead of heredoc\n---\n\n# Reliable Script Execution\n\nWhen executing Python code via shell commands, avoid inline heredoc execution which can fail unpredictably with 'unknown error'. Use this two-step file-first approach for more reliable script execution.\n\n## Problem\n\nDirect heredoc Python execution like:\n\n```bash\npython3 \u003C\u003C 'EOF'\n# complex code here\nEOF\n```\n\nCan fail with 'unknown error', especially when:\n- Script contains multiple lines or complex logic\n- Special characters or quotes are present\n- Working directory context matters\n\n## Solution: File-First Approach\n\n### Step 1: Write Python Script to File\n\nUse `write_file` to save your Python code to a `.py` file:\n\n```\nwrite_file(path=\".\u002Ftemp_script.py\", content=\"\"\"\nimport json\n\ndata = {\"key\": \"value\"}\nprint(json.dumps(data))\n\"\"\")\n```\n\n### Step 2: Execute via Shell\n\nUse `run_shell` with explicit working directory:\n\n```\nrun_shell(command=\"python3 .\u002Ftemp_script.py\", timeout=60)\n```\n\n### Step 3: Clean Up (Optional)\n\nRemove temporary files after execution:\n\n```\nrun_shell(command=\"rm .\u002Ftemp_script.py\")\n```\n\n## Complete Example\n\n**Task**: Generate a JSON report with calculations\n\n```\n# Step 1: Write the script\nwrite_file(\n    path=\".\u002Fgenerate_report.py\",\n    content=\"\"\"\nimport json\nfrom datetime import datetime\n\nrevenue = 500000.00\nexpenses = 379577.06\nnet_income = revenue - expenses\n\nreport = {\n    \"generated\": datetime.now().isoformat(),\n    \"revenue\": revenue,\n    \"expenses\": expenses,\n    \"net_income\": net_income\n}\n\nprint(json.dumps(report, indent=2))\n\"\"\"\n)\n\n# Step 2: Execute\nrun_shell(command=\"python3 .\u002Fgenerate_report.py\", timeout=60)\n\n# Step 3: Clean up\nrun_shell(command=\"rm .\u002Fgenerate_report.py\")\n```\n\n## Best Practices\n\n1. **Use descriptive filenames**: Name scripts according to their purpose (e.g., `calculate_pnl.py`, `transform_data.py`)\n\n2. **Set appropriate timeouts**: For data processing scripts, use longer timeouts (60-300 seconds)\n\n3. **Specify working directory**: If the script depends on relative paths, include `cd \u002Fpath && python3 script.py`\n\n4. **Handle errors gracefully**: Check shell output for errors and retry if needed\n\n5. **Clean up temporary files**: Don't leave `.py` files cluttering the workspace unless they need to persist\n\n## When to Use This Pattern\n\n- Executing multi-line Python code via shell\n- Scripts with complex string handling or special characters\n- When heredoc execution has failed previously\n- Any scenario where reliability matters more than brevity\n\n## Anti-Pattern to Avoid\n\nDo NOT rely on heredoc for production-critical scripts:\n\n```bash\n# Unreliable - may fail with 'unknown error'\npython3 \u003C\u003C 'EOF'\n# Your code here\nEOF\n```\n\nUse file-first approach instead for consistent, debuggable execution.","# Reliable Script Execution\n\nWhen executing Python code via shell commands, avoid inline heredoc execution which can fail unpredictably with 'unknown error'. Use this two-step file-first approach for more reliable script execution.\n\n## Problem\n\nDirect heredoc Python execution like:\n\n```bash\npython3 \u003C\u003C 'EOF'\n# complex code here\nEOF\n```\n\nCan fail with 'unknown error', especially when:\n- Script contains multiple lines or complex logic\n- Special characters or quotes are present\n- Working directory context matters\n\n## Solution: File-First Approach\n\n### Step 1: Write Python Script to File\n\nUse `write_file` to save your Python code to a `.py` file:\n\n```\nwrite_file(path=\".\u002Ftemp_script.py\", content=\"\"\"\nimport json\n\ndata = {\"key\": \"value\"}\nprint(json.dumps(data))\n\"\"\")\n```\n\n### Step 2: Execute via Shell\n\nUse `run_shell` with explicit working directory:\n\n```\nrun_shell(command=\"python3 .\u002Ftemp_script.py\", timeout=60)\n```\n\n### Step 3: Clean Up (Optional)\n\nRemove temporary files after execution:\n\n```\nrun_shell(command=\"rm .\u002Ftemp_script.py\")\n```\n\n## Complete Example\n\n**Task**: Generate a JSON report with calculations\n\n```\n# Step 1: Write the script\nwrite_file(\n    path=\".\u002Fgenerate_report.py\",\n    content=\"\"\"\nimport json\nfrom datetime import datetime\n\nrevenue = 500000.00\nexpenses = 379577.06\nnet_income = revenue - expenses\n\nreport = {\n    \"generated\": datetime.now().isoformat(),\n    \"revenue\": revenue,\n    \"expenses\": expenses,\n    \"net_income\": net_income\n}\n\nprint(json.dumps(report, indent=2))\n\"\"\"\n)\n\n# Step 2: Execute\nrun_shell(command=\"python3 .\u002Fgenerate_report.py\", timeout=60)\n\n# Step 3: Clean up\nrun_shell(command=\"rm .\u002Fgenerate_report.py\")\n```\n\n## Best Practices\n\n1. **Use descriptive filenames**: Name scripts according to their purpose (e.g., `calculate_pnl.py`, `transform_data.py`)\n\n2. **Set appropriate timeouts**: For data processing scripts, use longer timeouts (60-300 seconds)\n\n3. **Specify working directory**: If the script depends on relative paths, include `cd \u002Fpath && python3 script.py`\n\n4. **Handle errors gracefully**: Check shell output for errors and retry if needed\n\n5. **Clean up temporary files**: Don't leave `.py` files cluttering the workspace unless they need to persist\n\n## When to Use This Pattern\n\n- Executing multi-line Python code via shell\n- Scripts with complex string handling or special characters\n- When heredoc execution has failed previously\n- Any scenario where reliability matters more than brevity\n\n## Anti-Pattern to Avoid\n\nDo NOT rely on heredoc for production-critical scripts:\n\n```bash\n# Unreliable - may fail with 'unknown error'\npython3 \u003C\u003C 'EOF'\n# Your code here\nEOF\n```\n\nUse file-first approach instead for consistent, debuggable execution.",{"name":5,"description":7},"main","af1b40a42167d09c30b3a63000aa14ace4c1e229","gdpval_bench\u002Fskills\u002Freliable-script-execution","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":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add xyliu-cs\u002FOpenSpace-GDPval --skill reliable-script-execution",{"tool":46,"command":47},"bunx","bunx skills add xyliu-cs\u002FOpenSpace-GDPval --skill reliable-script-execution",{"tool":49,"command":50},"pnpm","pnpm dlx skills add xyliu-cs\u002FOpenSpace-GDPval --skill reliable-script-execution","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Freliable-script-execution\u002FSKILL.md",true,[54],{"path":55,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":58,"sourceHtmlUrl":59},".skill_id","OTHER","其他",39,"https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Freliable-script-execution\u002F.skill_id",[61,74,82,97,122,144],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":27},"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",[],[68,69,70,71,72,73],"zip export deliverable","zip","export","deliverables","codebase","as",{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":27},"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",[],[81,69,71,72,73],"zip deliverable finalization",{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":27},"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",[],[89,90,91,92,93,94,95,19,73,96],"failure analysis","ZeRO","analysis","iteration","zero iteration failure analysis","with","issues","system",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":108,"publishedAt":27},"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",[103],{"categoryNo":104,"categoryName":105,"taxonomyType":106,"taxonomyTypeDesc":107},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[109,110,23,111,112,113,114,115,116,117,118,119,120,121],"fallback","write","report","write file fallback report","domain","professional","sources","retrieval","generate","embedded","documents","data","knowledge",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":133,"publishedAt":27},"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",[128],{"categoryNo":129,"categoryName":130,"taxonomyType":131,"taxonomyTypeDesc":132},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[134,94,109,135,136,137,119,117,23,138,139,140,110,141,114,142,143],"fallback doc with delegation","doc","delegation","shell","markdown","tool","text","simple","formats","for",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":151,"publishedAt":27},"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",[150],{"categoryNo":104,"categoryName":105,"taxonomyType":106,"taxonomyTypeDesc":107},[109,111,152,153,117,23,154,155,110,156,157,116,94,158,119],"context","context anchored fallback report","Guardrails","Tools","task","drift","context drift"]