[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HWTQ3PARSZ6EB436ADF07Z":3,"skill-same:01M6HWTQ3PARSZ6EB436ADF07Z":73},{"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":23,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":6,"updatedAt":52,"install":53,"resources":66},"01M6HWTQ3PARSZ6EB436ADF07Z","python-debug-pattern",null,"Debug Python script execution failures by capturing full output with exit codes and verifying working directory before file operations","HKUDS\u002FAgentPilot","HKUDS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118165258?v=4","01M6HW8VRNZP64G0P4MVJW2KKQ","✨Data Intelligence Lab@HKU✨","01M6HW8VWZVHBRHYH3T330PFWV",7996,"MIT","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fbenchmarks\u002Fgdpval\u002Fskills\u002Fpython-debug-pattern\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"python","debug","pattern","python debug pattern","directory","file","execution","file operations","operations","exit","python script","full","codes","output","with","script","2026-11-10 10:12:30",false,"---\nname: python-debug-pattern\ndescription: Debug Python script execution failures by capturing full output with exit codes and verifying working directory before file operations\n---\n\n# Python Debug Pattern\n\nThis skill provides a reusable pattern for debugging Python script execution failures. It ensures you capture actual tracebacks instead of opaque errors and verify the working directory before file operations.\n\n## Core Technique\n\n### 1. Execute Python Scripts with Full Error Capture\n\nWhen running Python scripts, always use this command pattern to surface actual tracebacks:\n\n```bash\npython3 script.py 2>&1 ; echo Exit code: $?\n```\n\n**Why this works:**\n- `2>&1` redirects stderr to stdout, capturing both regular output and errors\n- `; echo Exit code: $?` displays the actual exit code after execution\n- This reveals the full Python traceback instead of opaque failure messages\n\n**Examples:**\n\n```bash\n# Good: Full error capture\npython3 process_data.py 2>&1 ; echo Exit code: $?\n\n# Bad: Opaque error (no stderr capture, no exit code)\npython3 process_data.py\n```\n\n### 2. Verify Working Directory Before File Operations\n\nBefore any file read\u002Fwrite operations in Python, verify the current working directory:\n\n```python\nimport os\n\n# At script start, log the working directory\nprint(f\"Working directory: {os.getcwd()}\")\n\n# For file operations, use absolute paths or log the resolved path\nfile_path = \"output\u002Fresult.csv\"\nabs_path = os.path.abspath(file_path)\nprint(f\"Writing to: {abs_path}\")\n```\n\n**Why this works:**\n- Many failures occur because scripts run from unexpected directories\n- Logging the working directory immediately surfaces path-related issues\n- Absolute paths prevent ambiguity in file operations\n\n**Full example script structure:**\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\nimport os\nimport sys\n\ndef main():\n    # Debug: verify working directory\n    print(f\"Working directory: {os.getcwd()}\", file=sys.stderr)\n    \n    # Debug: list directory contents if dealing with files\n    print(f\"Directory contents: {os.listdir('.')}\", file=sys.stderr)\n    \n    # Your actual logic here\n    # ...\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## When to Apply This Pattern\n\n- Python script fails with an opaque error message\n- File operations (read\u002Fwrite) fail unexpectedly\n- Script works locally but fails in automated execution\n- Debugging CI\u002FCD pipeline failures\n- Investigating \"file not found\" or permission errors\n\n## Quick Checklist\n\n- [ ] Run script with `2>&1 ; echo Exit code: $?` pattern\n- [ ] Add `os.getcwd()` logging at script start\n- [ ] Use `os.path.abspath()` for file paths\n- [ ] Log directory contents with `os.listdir('.')` if relevant\n- [ ] Check for missing dependencies (capture full traceback)\n\n## Common Failure Modes This Pattern Surfaces\n\n| Symptom | Without Pattern | With Pattern |\n|---------|-----------------|--------------|\n| File not found | \"Error: failed\" | Full traceback showing exact path attempted |\n| Permission denied | Script exits silently | stderr shows permission error |\n| Missing module | Opaque exit | ImportError with module name |\n| Wrong directory | Confusing path errors | cwd logged, reveals directory mismatch |","# Python Debug Pattern\n\nThis skill provides a reusable pattern for debugging Python script execution failures. It ensures you capture actual tracebacks instead of opaque errors and verify the working directory before file operations.\n\n## Core Technique\n\n### 1. Execute Python Scripts with Full Error Capture\n\nWhen running Python scripts, always use this command pattern to surface actual tracebacks:\n\n```bash\npython3 script.py 2>&1 ; echo Exit code: $?\n```\n\n**Why this works:**\n- `2>&1` redirects stderr to stdout, capturing both regular output and errors\n- `; echo Exit code: $?` displays the actual exit code after execution\n- This reveals the full Python traceback instead of opaque failure messages\n\n**Examples:**\n\n```bash\n# Good: Full error capture\npython3 process_data.py 2>&1 ; echo Exit code: $?\n\n# Bad: Opaque error (no stderr capture, no exit code)\npython3 process_data.py\n```\n\n### 2. Verify Working Directory Before File Operations\n\nBefore any file read\u002Fwrite operations in Python, verify the current working directory:\n\n```python\nimport os\n\n# At script start, log the working directory\nprint(f\"Working directory: {os.getcwd()}\")\n\n# For file operations, use absolute paths or log the resolved path\nfile_path = \"output\u002Fresult.csv\"\nabs_path = os.path.abspath(file_path)\nprint(f\"Writing to: {abs_path}\")\n```\n\n**Why this works:**\n- Many failures occur because scripts run from unexpected directories\n- Logging the working directory immediately surfaces path-related issues\n- Absolute paths prevent ambiguity in file operations\n\n**Full example script structure:**\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\nimport os\nimport sys\n\ndef main():\n    # Debug: verify working directory\n    print(f\"Working directory: {os.getcwd()}\", file=sys.stderr)\n    \n    # Debug: list directory contents if dealing with files\n    print(f\"Directory contents: {os.listdir('.')}\", file=sys.stderr)\n    \n    # Your actual logic here\n    # ...\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## When to Apply This Pattern\n\n- Python script fails with an opaque error message\n- File operations (read\u002Fwrite) fail unexpectedly\n- Script works locally but fails in automated execution\n- Debugging CI\u002FCD pipeline failures\n- Investigating \"file not found\" or permission errors\n\n## Quick Checklist\n\n- [ ] Run script with `2>&1 ; echo Exit code: $?` pattern\n- [ ] Add `os.getcwd()` logging at script start\n- [ ] Use `os.path.abspath()` for file paths\n- [ ] Log directory contents with `os.listdir('.')` if relevant\n- [ ] Check for missing dependencies (capture full traceback)\n\n## Common Failure Modes This Pattern Surfaces\n\n| Symptom | Without Pattern | With Pattern |\n|---------|-----------------|--------------|\n| File not found | \"Error: failed\" | Full traceback showing exact path attempted |\n| Permission denied | Script exits silently | stderr shows permission error |\n| Missing module | Opaque exit | ImportError with module name |\n| Wrong directory | Confusing path errors | cwd logged, reveals directory mismatch |",{"name":5,"description":7},"main","6b84b0689ca0d9e7b1e4061188ff6b60758e0f8a","openspace\u002Fbenchmarks\u002Fgdpval\u002Fskills\u002Fpython-debug-pattern",941,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot","https:\u002F\u002Fgithub.com\u002FHKUDS","https:\u002F\u002Fsites.google.com\u002Fview\u002Fchaoh","2026-11-12 22:26:39",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add HKUDS\u002FAgentPilot --skill python-debug-pattern",{"tool":59,"command":60},"bunx","bunx skills add HKUDS\u002FAgentPilot --skill python-debug-pattern",{"tool":62,"command":63},"pnpm","pnpm dlx skills add HKUDS\u002FAgentPilot --skill python-debug-pattern","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fbenchmarks\u002Fgdpval\u002Fskills\u002Fpython-debug-pattern\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},".skill_id","OTHER","其他",34,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fbenchmarks\u002Fgdpval\u002Fskills\u002Fpython-debug-pattern\u002F.skill_id",[74,93,112,137,161,180],{"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":40},"01M6HYB297NDABRERJRVG0K8R0","agentpilot","Set up AgentPilot and use its single entry to prepare missing inputs and run configured RSI experiments. Use when the user requests AgentPilot installation or work with AgentPilot.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fplugins\u002Fagentpilot\u002Fskills\u002Fagentpilot\u002FSKILL.md",[],[76,81,82,38,83,84,85,86,87,88,89,90,91,92],"prepare","requests","missing","installation","rsi","up","use","user","work","SET","run","experiments",{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":40},"01M6HYAYWXTTE1J7DJM0MFNQ4H","remember","Review auto-memory entries and propose promotions to OPENSPACE.md, OPENSPACE.local.md, or retained auto-memory topics; detect duplicates, stale facts, conflicts, and ambiguous entries before making changes.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fskills\u002Fremember\u002FSKILL.md",[],[95,100,101,102,103,104,105,106,107,108,109,110,111],"memory","review","auto","openspace","changes","facts","detect","entries","local","conflicts","stale","duplicates",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":123,"publishedAt":40},"01M6HYAVMPM4SBDV60R2B5HPV8","skill-discovery","Search reusable OpenSpace skills locally, and browse cloud packages step by step when a cloud skill may help. Reusing proven skills saves tokens, improves reliability, and extends your capabilities beyond built-in tools.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fskill-discovery\u002FSKILL.md",[118],{"categoryNo":119,"categoryName":120,"taxonomyType":121,"taxonomyTypeDesc":122},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[124,125,126,103,127,128,129,130,131,132,133,134,135,136],"skill discovery","discovery","reusable","step by step","tokens","packages","help","cloud","reliability","capabilities","browse","search","Tools",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":144,"publishedAt":40},"01M6HYAR811B3RB0M50RBEDGN6","delegate-task","Delegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fdelegate-task\u002FSKILL.md",[143],{"categoryNo":119,"categoryName":120,"taxonomyType":121,"taxonomyTypeDesc":122},[145,146,147,103,148,149,150,151,152,126,102,87,153,154,155,156,157,158,159,160],"delegate","task","delegate task","time","improve","desktop automation","worker","community","autonomous","tool","stack","for","share","tasks","automation","MCP",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":167,"publishedAt":40},"01M6HYAM9FSGV6E52AYENDQXYH","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\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[168,169,170,171,172,173,174,175,29,24,176,37,177,178,156,179,39],"write special chars ts check","write","check","type","files","filters","only","template","typescript","Existing","type-checking","errors",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":40},"01M6HYAH05HGV7SVWSVR8PJRQD","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\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[187,188,169,38,156,39,189,190,191,192,193,175,29,194,195,24],"write special chars readback","readback","helper","post","via","scripts","read","verification","cleanup"]