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