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