[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HX91NCT4HVVC2KFJYTZAVN":3,"skill-same:01M6HX91NCT4HVVC2KFJYTZAVN":70},{"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":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":45,"repositoryHtmlUrl":46,"repositoryHomepageUrl":6,"ownerHtmlUrl":47,"ownerBlogUrl":48,"ownerDescription":6,"updatedAt":49,"install":50,"resources":63},"01M6HX91NCT4HVVC2KFJYTZAVN","large-file-write-mkdir",null,"Reliable fallback technique for writing large file contents when write_file and shell_agent both fail with 'unknown error' due to payload size limits — uses run_shell with a Python heredoc to bypass tool constraints, with an explicit mkdir -p step to ensure the target directory exists before writing.","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\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Flarge-file-write-mkdir\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],"large file write mkdir","file","mkdir","write","payload","unknown","for","size","with","error","fallback","writing","tool","shell","constraints","run","python","directory","2026-11-10 10:12:30",false,"---\nname: large-file-write-mkdir\ndescription: Reliable fallback technique for writing large file contents when write_file and shell_agent both fail with 'unknown error' due to payload size limits — uses run_shell with a Python heredoc to bypass tool constraints, with an explicit mkdir -p step to ensure the target directory exists before writing.\n---\n\n# Large File Write Fallback (with Directory Pre-creation)\n\n## Problem\n\nWhen writing large files (typically several KB or more), two common tools may\nfail with `unknown error` due to internal payload size limits:\n\n- `write_file` — has a maximum content size it can handle in a single call.\n- `shell_agent` — may also hit payload limits when the task description\n  includes large inline content.\n\nA second class of failure occurs when the **target directory does not exist**:\nPython's `open()` will raise `FileNotFoundError` if any intermediate directory\nis missing.  Always pre-create the parent directory to prevent this.\n\n## Solution\n\nUse `run_shell` with a **`mkdir -p` prefix and a Python heredoc** pattern.\nThe `mkdir -p` ensures the target directory exists; the heredoc streams the\nfile content through stdin directly into Python's `open()`, bypassing the\npayload constraints of the other tools.\n\n## Template\n\n```bash\nmkdir -p \"\u003CPARENT DIRECTORY OF TARGET PATH>\" && python3 - \u003C\u003C 'EOF'\ncontent = \"\"\"\u003CFILE CONTENTS HERE>\"\"\"\nwith open(\"\u003CTARGET PATH>\", \"w\") as f:\n    f.write(content)\nEOF\n```\n\nPass this as the `command` parameter to `run_shell`.\n\n> **Tip:** If the parent directory is not known in advance, use the shell\n> `dirname` helper:\n> `mkdir -p \"$(dirname '\u003CTARGET PATH>')\" && python3 - \u003C\u003C 'EOF'`\n\n## Step-by-Step Instructions\n\n1. **Attempt the normal write** using `write_file` first. If it succeeds, you\n   are done.\n\n2. **If `write_file` fails** (especially with `unknown error` or a timeout on\n   large content), do NOT retry with `shell_agent` using inline content —\n   it will likely fail for the same reason.\n\n3. **Use the `run_shell` heredoc fallback:**\n\n   - **Pre-create the parent directory** with `mkdir -p \u003Cparent_dir>`.  This\n     is a no-op when the directory already exists, so it is always safe to\n     include.  Skipping this step causes Python's `open()` to raise\n     `FileNotFoundError` for any new or deeply-nested path.\n   - Embed the full file content inside a Python triple-quoted string.\n   - Specify the target path inside the `open()` call.\n   - Pass the entire block (mkdir + heredoc) as the `command` to `run_shell`.\n\n4. **Escape carefully** inside the heredoc:\n   - Backslashes that should be literal in the file must be doubled (`\\\\`).\n   - Triple-quotes inside the content must be escaped (`\\\"\\\"\\\"`).\n   - The heredoc delimiter `EOF` must not appear on a line by itself inside\n     the content (rename it to `PYEOF` or `FILEEOF` if needed).\n\n5. **Verify the write** by following up with a `run_shell` call such as:\n   ```bash\n   wc -l \u003CTARGET PATH> && head -5 \u003CTARGET PATH>\n   ```\n\n## Full Example\n\nSuppose you need to write a large TypeScript file to\n`src\u002Fcomponents\u002FDashboard.ts`:\n\n```bash\nmkdir -p \"src\u002Fcomponents\" && python3 - \u003C\u003C 'PYEOF'\ncontent = \"\"\"import { foo } from '.\u002Ffoo';\n\nexport interface DashboardData {\n  title: string;\n  items: string[];\n}\n\nexport function createDashboard(data: DashboardData): string {\n  return `\u003Cdiv>${data.title}\u003C\u002Fdiv>`;\n}\n\"\"\"\nwith open(\"src\u002Fcomponents\u002FDashboard.ts\", \"w\") as f:\n    f.write(content)\nPYEOF\n```\n\nPass the above (without the surrounding code fence) as the `command`\nargument to `run_shell`.\n\n## When to Use This Pattern\n\n| Situation | Recommended tool |\n|---|---|\n| Small file (\u003C ~2 KB) | `write_file` |\n| Medium file, no errors yet | `write_file` (try first) |\n| Large file or `write_file` failed | `run_shell` + `mkdir -p` + Python heredoc |\n| `shell_agent` also fails on large inline content | `run_shell` + `mkdir -p` + Python heredoc |\n| Target directory may not exist | Always add `mkdir -p \u003Cparent_dir>` first |\n\n## Notes\n\n- This pattern works for **any text-based file** (TypeScript, Python, JSON,\n  YAML, Markdown, etc.).\n- For binary files, adapt the approach to use `base64` decoding inside the\n  Python script.\n- The heredoc delimiter (`EOF`, `PYEOF`, `FILEEOF`) can be any string not\n  present as a standalone line in your content — choose accordingly.\n- This technique is also useful when content contains characters that would\n  need heavy shell escaping in a plain `echo` or `printf` approach.\n- The `mkdir -p` command is idempotent: it succeeds whether or not the\n  directory already exists, so it is always safe to include.\n- To derive the parent directory from a target path in shell:\n  `mkdir -p \"$(dirname '\u003CTARGET PATH>')\"` works as a generic alternative\n  when the parent path is not already known.\n","# Large File Write Fallback (with Directory Pre-creation)\n\n## Problem\n\nWhen writing large files (typically several KB or more), two common tools may\nfail with `unknown error` due to internal payload size limits:\n\n- `write_file` — has a maximum content size it can handle in a single call.\n- `shell_agent` — may also hit payload limits when the task description\n  includes large inline content.\n\nA second class of failure occurs when the **target directory does not exist**:\nPython's `open()` will raise `FileNotFoundError` if any intermediate directory\nis missing.  Always pre-create the parent directory to prevent this.\n\n## Solution\n\nUse `run_shell` with a **`mkdir -p` prefix and a Python heredoc** pattern.\nThe `mkdir -p` ensures the target directory exists; the heredoc streams the\nfile content through stdin directly into Python's `open()`, bypassing the\npayload constraints of the other tools.\n\n## Template\n\n```bash\nmkdir -p \"\u003CPARENT DIRECTORY OF TARGET PATH>\" && python3 - \u003C\u003C 'EOF'\ncontent = \"\"\"\u003CFILE CONTENTS HERE>\"\"\"\nwith open(\"\u003CTARGET PATH>\", \"w\") as f:\n    f.write(content)\nEOF\n```\n\nPass this as the `command` parameter to `run_shell`.\n\n> **Tip:** If the parent directory is not known in advance, use the shell\n> `dirname` helper:\n> `mkdir -p \"$(dirname '\u003CTARGET PATH>')\" && python3 - \u003C\u003C 'EOF'`\n\n## Step-by-Step Instructions\n\n1. **Attempt the normal write** using `write_file` first. If it succeeds, you\n   are done.\n\n2. **If `write_file` fails** (especially with `unknown error` or a timeout on\n   large content), do NOT retry with `shell_agent` using inline content —\n   it will likely fail for the same reason.\n\n3. **Use the `run_shell` heredoc fallback:**\n\n   - **Pre-create the parent directory** with `mkdir -p \u003Cparent_dir>`.  This\n     is a no-op when the directory already exists, so it is always safe to\n     include.  Skipping this step causes Python's `open()` to raise\n     `FileNotFoundError` for any new or deeply-nested path.\n   - Embed the full file content inside a Python triple-quoted string.\n   - Specify the target path inside the `open()` call.\n   - Pass the entire block (mkdir + heredoc) as the `command` to `run_shell`.\n\n4. **Escape carefully** inside the heredoc:\n   - Backslashes that should be literal in the file must be doubled (`\\\\`).\n   - Triple-quotes inside the content must be escaped (`\\\"\\\"\\\"`).\n   - The heredoc delimiter `EOF` must not appear on a line by itself inside\n     the content (rename it to `PYEOF` or `FILEEOF` if needed).\n\n5. **Verify the write** by following up with a `run_shell` call such as:\n   ```bash\n   wc -l \u003CTARGET PATH> && head -5 \u003CTARGET PATH>\n   ```\n\n## Full Example\n\nSuppose you need to write a large TypeScript file to\n`src\u002Fcomponents\u002FDashboard.ts`:\n\n```bash\nmkdir -p \"src\u002Fcomponents\" && python3 - \u003C\u003C 'PYEOF'\ncontent = \"\"\"import { foo } from '.\u002Ffoo';\n\nexport interface DashboardData {\n  title: string;\n  items: string[];\n}\n\nexport function createDashboard(data: DashboardData): string {\n  return `\u003Cdiv>${data.title}\u003C\u002Fdiv>`;\n}\n\"\"\"\nwith open(\"src\u002Fcomponents\u002FDashboard.ts\", \"w\") as f:\n    f.write(content)\nPYEOF\n```\n\nPass the above (without the surrounding code fence) as the `command`\nargument to `run_shell`.\n\n## When to Use This Pattern\n\n| Situation | Recommended tool |\n|---|---|\n| Small file (\u003C ~2 KB) | `write_file` |\n| Medium file, no errors yet | `write_file` (try first) |\n| Large file or `write_file` failed | `run_shell` + `mkdir -p` + Python heredoc |\n| `shell_agent` also fails on large inline content | `run_shell` + `mkdir -p` + Python heredoc |\n| Target directory may not exist | Always add `mkdir -p \u003Cparent_dir>` first |\n\n## Notes\n\n- This pattern works for **any text-based file** (TypeScript, Python, JSON,\n  YAML, Markdown, etc.).\n- For binary files, adapt the approach to use `base64` decoding inside the\n  Python script.\n- The heredoc delimiter (`EOF`, `PYEOF`, `FILEEOF`) can be any string not\n  present as a standalone line in your content — choose accordingly.\n- This technique is also useful when content contains characters that would\n  need heavy shell escaping in a plain `echo` or `printf` approach.\n- The `mkdir -p` command is idempotent: it succeeds whether or not the\n  directory already exists, so it is always safe to include.\n- To derive the parent directory from a target path in shell:\n  `mkdir -p \"$(dirname '\u003CTARGET PATH>')\"` works as a generic alternative\n  when the parent path is not already known.\n",{"name":5,"description":7},"main","6b84b0689ca0d9e7b1e4061188ff6b60758e0f8a","openspace\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Flarge-file-write-mkdir",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":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add HKUDS\u002FAgentPilot --skill large-file-write-mkdir",{"tool":56,"command":57},"bunx","bunx skills add HKUDS\u002FAgentPilot --skill large-file-write-mkdir",{"tool":59,"command":60},"pnpm","pnpm dlx skills add HKUDS\u002FAgentPilot --skill large-file-write-mkdir","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Flarge-file-write-mkdir\u002FSKILL.md",true,[64],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},".skill_id","OTHER","其他",48,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Flarge-file-write-mkdir\u002F.skill_id",[71,89,108,133,155,175],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":37},"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",[],[73,78,79,27,80,81,82,83,84,85,86,87,34,88],"prepare","requests","missing","installation","rsi","up","use","user","work","SET","experiments",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":37},"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",[],[91,96,97,98,99,100,101,102,103,104,105,106,107],"memory","review","auto","openspace","changes","facts","detect","entries","local","conflicts","stale","duplicates",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":119,"publishedAt":37},"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",[114],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[120,121,122,99,123,124,125,126,127,128,129,130,131,132],"skill discovery","discovery","reusable","step by step","tokens","packages","help","cloud","reliability","capabilities","browse","search","Tools",{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":140,"publishedAt":37},"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",[139],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},[141,142,143,99,144,145,146,147,148,122,98,84,149,31,150,25,151,152,153,154],"delegate","task","delegate task","time","improve","desktop automation","worker","community","autonomous","stack","share","tasks","automation","MCP",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":161,"publishedAt":37},"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",[],[162,22,163,164,165,166,167,168,20,35,169,170,171,172,25,173,174],"write special chars ts check","check","type","files","filters","only","template","typescript","output","Existing","type-checking","errors","script",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":181,"publishedAt":37},"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",[],[182,183,22,27,25,174,184,185,186,187,188,168,20,189,190,35],"write special chars readback","readback","helper","post","via","scripts","read","verification","cleanup"]