[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KG0162HGP1J8H4T061DDT8":3,"skill-same:01M6KG0162HGP1J8H4T061DDT8":68},{"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":35,"linkOnly":36,"markdownContent":37,"markdownBody":38,"frontMatter":39,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":14,"repositoryHtmlUrl":43,"repositoryHomepageUrl":6,"ownerHtmlUrl":44,"ownerBlogUrl":45,"ownerDescription":46,"updatedAt":47,"install":48,"resources":61},"01M6KG0162HGP1J8H4T061DDT8","run-shell-python-file-io",null,"Use run_shell with inline Python for reliable file I\u002FO when execute_code_sandbox cannot access working directory files","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\u002Frun-shell-python-file-io\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"python","run","file","shell","io","run shell python file io","directory","sandbox","code","access","execute","use","files","with","for","inline","2026-11-10 10:12:30",false,"---\nname: run-shell-python-file-io\ndescription: Use run_shell with inline Python for reliable file I\u002FO when execute_code_sandbox cannot access working directory files\n---\n\n# Run Shell Python File I\u002FO\n\n## When to Use This Skill\n\nUse this technique when `execute_code_sandbox` cannot access files in your working directory, but you need to perform file operations (read, write, transform) as part of your task execution.\n\n## The Pattern\n\nInstead of using `execute_code_sandbox`, run Python code directly through `run_shell` with explicit path handling. This provides reliable file I\u002FO capabilities within the task workspace.\n\n## How to Apply\n\n### Step 1: Identify File Access Needs\nDetermine which files you need to read from or write to in the working directory.\n\n### Step 2: Write Inline Python via run_shell\nConstruct a Python script that handles your file operations and execute it through `run_shell`:\n\n```bash\npython3 -c \"\nimport os\n\n# Get the working directory\nwork_dir = os.getcwd()\nprint(f'Working directory: {work_dir}')\n\n# Read a file\nwith open('input.txt', 'r') as f:\n    content = f.read()\n\n# Process the content\nprocessed = content.upper()\n\n# Write to output file\nwith open('output.txt', 'w') as f:\n    f.write(processed)\n\nprint('File operation complete')\n\"\n```\n\n### Step 3: Handle Complex Logic\nFor more complex operations, write a temporary Python script file first:\n\n```bash\ncat > \u002Ftmp\u002Fprocess.py \u003C\u003C 'EOF'\nimport os\nimport json\n\nwork_dir = os.getcwd()\n\n# Read input\nwith open('data.json', 'r') as f:\n    data = json.load(f)\n\n# Transform\nresult = {k: v * 2 for k, v in data.items()}\n\n# Write output\nwith open('result.json', 'w') as f:\n    json.dump(result, f, indent=2)\n\nprint(f'Processed {len(data)} items')\nEOF\n\npython3 \u002Ftmp\u002Fprocess.py\n```\n\n### Step 4: Verify File Operations\nAfter execution, verify the files were created\u002Fmodified correctly:\n\n```bash\nls -la\ncat output.txt\n```\n\n## Best Practices\n\n1. **Use Absolute or Relative Paths Explicitly**: Always specify file paths clearly; `os.getcwd()` helps confirm your working directory.\n\n2. **Handle Errors Gracefully**: Add try\u002Fexcept blocks to catch file I\u002FO errors:\n   ```python\n   try:\n       with open('file.txt', 'r') as f:\n           content = f.read()\n   except FileNotFoundError:\n       print('File not found')\n   ```\n\n3. **Use Here-Docs for Complex Scripts**: For scripts longer than a few lines, use bash here-documents to avoid escaping issues.\n\n4. **Clean Up Temporary Files**: If you create temporary scripts, consider removing them after execution.\n\n5. **Check Working Directory First**: Print `os.getcwd()` to confirm you're operating in the expected directory.\n\n## Common Use Cases\n\n- Reading configuration files from the workspace\n- Writing generated reports or outputs\n- Transforming data files (CSV, JSON, XML)\n- Batch processing multiple files\n- Generating structured documents (PDFs, spreadsheets)\n\n## Example: Processing Multiple Files\n\n```bash\npython3 -c \"\nimport os\nimport glob\n\nwork_dir = os.getcwd()\nfiles = glob.glob('*.txt')\n\nfor f in files:\n    with open(f, 'r') as file:\n        content = file.read()\n    # Process each file\n    with open(f'processed_{f}', 'w') as out:\n        out.write(content.strip().upper())\n\nprint(f'Processed {len(files)} files')\n\"\n```\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| File not found | Check `os.getcwd()` output; use absolute paths if needed |\n| Permission denied | Ensure the directory is writable; avoid protected system paths |\n| Encoding errors | Specify encoding explicitly: `open('file.txt', 'r', encoding='utf-8')` |\n| Multi-line script issues | Use here-doc (`\u003C\u003C 'EOF'`) instead of `-c` for complex scripts |","# Run Shell Python File I\u002FO\n\n## When to Use This Skill\n\nUse this technique when `execute_code_sandbox` cannot access files in your working directory, but you need to perform file operations (read, write, transform) as part of your task execution.\n\n## The Pattern\n\nInstead of using `execute_code_sandbox`, run Python code directly through `run_shell` with explicit path handling. This provides reliable file I\u002FO capabilities within the task workspace.\n\n## How to Apply\n\n### Step 1: Identify File Access Needs\nDetermine which files you need to read from or write to in the working directory.\n\n### Step 2: Write Inline Python via run_shell\nConstruct a Python script that handles your file operations and execute it through `run_shell`:\n\n```bash\npython3 -c \"\nimport os\n\n# Get the working directory\nwork_dir = os.getcwd()\nprint(f'Working directory: {work_dir}')\n\n# Read a file\nwith open('input.txt', 'r') as f:\n    content = f.read()\n\n# Process the content\nprocessed = content.upper()\n\n# Write to output file\nwith open('output.txt', 'w') as f:\n    f.write(processed)\n\nprint('File operation complete')\n\"\n```\n\n### Step 3: Handle Complex Logic\nFor more complex operations, write a temporary Python script file first:\n\n```bash\ncat > \u002Ftmp\u002Fprocess.py \u003C\u003C 'EOF'\nimport os\nimport json\n\nwork_dir = os.getcwd()\n\n# Read input\nwith open('data.json', 'r') as f:\n    data = json.load(f)\n\n# Transform\nresult = {k: v * 2 for k, v in data.items()}\n\n# Write output\nwith open('result.json', 'w') as f:\n    json.dump(result, f, indent=2)\n\nprint(f'Processed {len(data)} items')\nEOF\n\npython3 \u002Ftmp\u002Fprocess.py\n```\n\n### Step 4: Verify File Operations\nAfter execution, verify the files were created\u002Fmodified correctly:\n\n```bash\nls -la\ncat output.txt\n```\n\n## Best Practices\n\n1. **Use Absolute or Relative Paths Explicitly**: Always specify file paths clearly; `os.getcwd()` helps confirm your working directory.\n\n2. **Handle Errors Gracefully**: Add try\u002Fexcept blocks to catch file I\u002FO errors:\n   ```python\n   try:\n       with open('file.txt', 'r') as f:\n           content = f.read()\n   except FileNotFoundError:\n       print('File not found')\n   ```\n\n3. **Use Here-Docs for Complex Scripts**: For scripts longer than a few lines, use bash here-documents to avoid escaping issues.\n\n4. **Clean Up Temporary Files**: If you create temporary scripts, consider removing them after execution.\n\n5. **Check Working Directory First**: Print `os.getcwd()` to confirm you're operating in the expected directory.\n\n## Common Use Cases\n\n- Reading configuration files from the workspace\n- Writing generated reports or outputs\n- Transforming data files (CSV, JSON, XML)\n- Batch processing multiple files\n- Generating structured documents (PDFs, spreadsheets)\n\n## Example: Processing Multiple Files\n\n```bash\npython3 -c \"\nimport os\nimport glob\n\nwork_dir = os.getcwd()\nfiles = glob.glob('*.txt')\n\nfor f in files:\n    with open(f, 'r') as file:\n        content = file.read()\n    # Process each file\n    with open(f'processed_{f}', 'w') as out:\n        out.write(content.strip().upper())\n\nprint(f'Processed {len(files)} files')\n\"\n```\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| File not found | Check `os.getcwd()` output; use absolute paths if needed |\n| Permission denied | Ensure the directory is writable; avoid protected system paths |\n| Encoding errors | Specify encoding explicitly: `open('file.txt', 'r', encoding='utf-8')` |\n| Multi-line script issues | Use here-doc (`\u003C\u003C 'EOF'`) instead of `-c` for complex scripts |",{"name":5,"description":7},"main","af1b40a42167d09c30b3a63000aa14ace4c1e229","gdpval_bench\u002Fskills\u002Frun-shell-python-file-io","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":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add xyliu-cs\u002FOpenSpace-GDPval --skill run-shell-python-file-io",{"tool":54,"command":55},"bunx","bunx skills add xyliu-cs\u002FOpenSpace-GDPval --skill run-shell-python-file-io",{"tool":57,"command":58},"pnpm","pnpm dlx skills add xyliu-cs\u002FOpenSpace-GDPval --skill run-shell-python-file-io","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Frun-shell-python-file-io\u002FSKILL.md",true,[62],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},".skill_id","OTHER","其他",38,"https:\u002F\u002Fgithub.com\u002Fxyliu-cs\u002FOpenSpace-GDPval\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Frun-shell-python-file-io\u002F.skill_id",[69,82,90,105,125,140],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":35},"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",[],[76,77,78,79,80,81],"zip export deliverable","zip","export","deliverables","codebase","as",{"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":35},"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",[],[89,77,79,80,81],"zip deliverable finalization",{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":35},"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",[],[97,98,99,100,101,32,102,103,81,104],"failure analysis","ZeRO","analysis","iteration","zero iteration failure analysis","issues","execution","system",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":35},"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",[],[112,113,21,114,115,116,117,118,119,120,121,122,123,124],"fallback","write","report","write file fallback report","domain","professional","sources","retrieval","generate","embedded","documents","data","knowledge",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":35},"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",[],[132,32,112,133,134,22,122,120,21,135,136,137,113,138,117,139,33],"fallback doc with delegation","doc","delegation","markdown","tool","text","simple","formats",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":35},"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",[],[112,114,147,148,120,21,149,150,113,151,152,119,32,153,122],"context","context anchored fallback report","Guardrails","Tools","task","drift","context drift"]