[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HY60TCKBQN0HSG0TJC36Y9":3,"skill-same:01M6HY60TCKBQN0HSG0TJC36Y9":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":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":6,"ownerHtmlUrl":45,"ownerBlogUrl":46,"ownerDescription":6,"updatedAt":47,"install":48,"resources":61},"01M6HY60TCKBQN0HSG0TJC36Y9","large-file-write-heredoc",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.","HKUDS\u002FAgentPilot","HKUDS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118165258?v=4","01M6HW8VRNZP64G0P4MVJW2KKQ","✨Data Intelligence Lab@HKU✨","01M6HW8VWZVHBRHYH3T330PFWV",8029,"MIT","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Flarge-file-write-heredoc\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"file","write","large file write heredoc","writing","python","run","constraints","shell","tool","payload","fallback","error","with","size","for","unknown","2026-11-10 10:12:30",false,"---\nname: large-file-write-heredoc\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.\n---\n\n# Large File Write Fallback\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\n## Solution\n\nUse `run_shell` with a **Python heredoc** pattern. This streams the file\ncontent through stdin directly into Python's `open()`, bypassing the payload\nconstraints of the other tools.\n\n## Template\n\n```\npython3 - \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## 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   - 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 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```\npython3 - \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` + Python heredoc |\n| `shell_agent` also fails on large inline content | `run_shell` + Python heredoc |\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.","# Large File Write Fallback\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\n## Solution\n\nUse `run_shell` with a **Python heredoc** pattern. This streams the file\ncontent through stdin directly into Python's `open()`, bypassing the payload\nconstraints of the other tools.\n\n## Template\n\n```\npython3 - \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## 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   - 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 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```\npython3 - \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` + Python heredoc |\n| `shell_agent` also fails on large inline content | `run_shell` + Python heredoc |\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.",{"name":5,"description":7},"main","6b84b0689ca0d9e7b1e4061188ff6b60758e0f8a","openspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Flarge-file-write-heredoc",944,"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":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add HKUDS\u002FAgentPilot --skill large-file-write-heredoc",{"tool":54,"command":55},"bunx","bunx skills add HKUDS\u002FAgentPilot --skill large-file-write-heredoc",{"tool":57,"command":58},"pnpm","pnpm dlx skills add HKUDS\u002FAgentPilot --skill large-file-write-heredoc","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Flarge-file-write-heredoc\u002FSKILL.md",true,[62],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},".skill_id","OTHER","其他",39,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Flarge-file-write-heredoc\u002F.skill_id",[69,87,106,131,153,173],{"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},"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",[],[71,76,77,31,78,79,80,81,82,83,84,85,24,86],"prepare","requests","missing","installation","rsi","up","use","user","work","SET","experiments",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":35},"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",[],[89,94,95,96,97,98,99,100,101,102,103,104,105],"memory","review","auto","openspace","changes","facts","detect","entries","local","conflicts","stale","duplicates",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":117,"publishedAt":35},"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",[112],{"categoryNo":113,"categoryName":114,"taxonomyType":115,"taxonomyTypeDesc":116},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[118,119,120,97,121,122,123,124,125,126,127,128,129,130],"skill discovery","discovery","reusable","step by step","tokens","packages","help","cloud","reliability","capabilities","browse","search","Tools",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":138,"publishedAt":35},"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",[137],{"categoryNo":113,"categoryName":114,"taxonomyType":115,"taxonomyTypeDesc":116},[139,140,141,97,142,143,144,145,146,120,96,82,147,27,148,33,149,150,151,152],"delegate","task","delegate task","time","improve","desktop automation","worker","community","autonomous","stack","share","tasks","automation","MCP",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":35},"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",[],[160,20,161,162,163,164,165,166,19,23,167,168,169,170,33,171,172],"write special chars ts check","check","type","files","filters","only","template","typescript","output","Existing","type-checking","errors","script",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":35},"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",[],[180,181,20,31,33,172,182,183,184,185,186,166,19,187,188,23],"write special chars readback","readback","helper","post","via","scripts","read","verification","cleanup"]