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