[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XC88HV5XVRKH05XT00E4P9":3,"skill-same:01M6XC88HV5XVRKH05XT00E4P9":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":48,"linkOnly":49,"markdownContent":50,"markdownBody":51,"frontMatter":52,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":13,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":58,"install":59,"resources":72},"01M6XC88HV5XVRKH05XT00E4P9","large-file-write-via-temp-script",null,"Reliable fallback technique for writing large or special-character-heavy file content when inline write_file or shell_agent calls fail with unknown errors — uses a Python helper script written to a temp file to avoid escaping and truncation pitfalls.","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Flarge-file-write-via-temp-script\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"large file write via temp script","file","write","via","script","with","when","unknown","inline","for","calls","pitfalls","errors","writing","helper","character","fallback","shell","content","python","2026-11-10 10:12:30",false,"---\nname: large-file-write-via-temp-script\ndescription: Reliable fallback technique for writing large or special-character-heavy file content when inline write_file or shell_agent calls fail with unknown errors — uses a Python helper script written to a temp file to avoid escaping and truncation pitfalls.\n---\n\n# Large File Write via Temp Script\n\n## Problem\n\nWriting large files — especially TypeScript, TSX, or any content containing\nUnicode emoji, backticks, `${}` template literals, or multi-line heredoc\nconflicts — can silently fail or truncate content when passed inline.\n\n**Failure modes observed:**\n- `write_file` returns `[ERROR] unknown error` on large payloads\n- `node -e '...'` with backtick template literals silently empties the target file\n- `python3 -c '...'` breaks on unescaped quotes or special characters\n- `shell_agent` may time out or fail when the inline content is too large\n\n---\n\n## Solution: Write a Python Script to a Temp File First\n\nInstead of passing file content inline, write a small Python helper script to\n`\u002Ftmp\u002Fwrite_task.py` (or similar), then execute it. The helper script holds\nthe target file content as a raw Python string or via base64 decoding.\n\n---\n\n## Approach A — Python Triple-Quoted String (preferred for readability)\n\nUse `write_file` or a heredoc to create the helper, then run it:\n\n```bash\n# Step 1: Write the helper script to \u002Ftmp\ncat > \u002Ftmp\u002Fwrite_task.py \u003C\u003C 'PYEOF'\nimport pathlib\n\ncontent = r\"\"\"\n\u002F\u002F Your TypeScript \u002F file content goes here\n\u002F\u002F Backticks `like this`, ${template} literals, and emoji ? are all safe\nexport const MyComponent = () => {\n  const msg = `Hello, world!`;\n  return \u003Cdiv>{msg}\u003C\u002Fdiv>;\n};\n\"\"\"\n\npathlib.Path(\"\u002Fpath\u002Fto\u002Ftarget\u002Ffile.ts\").write_text(content.lstrip(\"\\n\"), encoding=\"utf-8\")\nprint(\"Written successfully.\")\nPYEOF\n\n# Step 2: Execute the helper\npython3 \u002Ftmp\u002Fwrite_task.py\n```\n\n> **Why `r\"\"\"`?** A raw triple-quoted string avoids all backslash escaping\n> issues. The only content that cannot appear verbatim is `\"\"\"` itself — if\n> needed, split the string or escape that sequence only.\n\n---\n\n## Approach B — Base64-Encoded Content (most robust for binary\u002Fcomplex content)\n\nWhen the content contains `\"\"\"` or other Python string edge cases:\n\n```bash\n# Step 1: Base64-encode your content (done once, outside the target system)\n# python3 -c \"import base64; print(base64.b64encode(open('file.ts').read().encode()).decode())\"\n\n# Step 2: Embed the base64 blob in the helper script\ncat > \u002Ftmp\u002Fwrite_task.py \u003C\u003C 'PYEOF'\nimport base64, pathlib\n\nb64 = (\n    \"aW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JzsKCmV4cG9ydCBjb25zdCBNeUNvbXBvbmVudCA9\"\n    \"ICgpID0+IHsKICByZXR1cm4gPGRpdj5IZWxsbzwvZGl2PjsKfTsK\"\n    # ... more lines if needed\n)\n\ncontent = base64.b64decode(b64).decode(\"utf-8\")\npathlib.Path(\"\u002Fpath\u002Fto\u002Ftarget\u002Ffile.ts\").write_text(content, encoding=\"utf-8\")\nprint(f\"Written {len(content)} bytes successfully.\")\nPYEOF\n\npython3 \u002Ftmp\u002Fwrite_task.py\n```\n\n---\n\n## Approach C — shell_agent Delegation (simplest for agents)\n\nAsk `shell_agent` to perform the write using the temp-script pattern:\n\n> \"Write the following TypeScript content to `\u002Fsrc\u002Fcomponents\u002FMyPanel.ts`.\n> Do NOT use `node -e` or inline Python. Instead write a Python script to\n> `\u002Ftmp\u002Fwrite_panel.py` using a triple-quoted raw string, then execute it.\"\n\n---\n\n## Decision Guide\n\n| Situation | Recommended Approach |\n|---|---|\n| Content has backticks \u002F `${}` template literals | Approach A (raw `r\"\"\"`) |\n| Content has `\"\"\"` sequences | Approach B (base64) |\n| Content is binary or non-UTF-8 | Approach B (base64) |\n| Delegating to shell_agent | Approach C with explicit instructions |\n| Quick small file | Direct `write_file` (no workaround needed) |\n\n---\n\n## Anti-Patterns to Avoid\n\n```bash\n# ❌ DANGEROUS — backtick template literals will break node -e\nnode -e \"const fs = require('fs'); fs.writeFileSync('out.ts', \\`${content}\\`);\"\n\n# ❌ FRAGILE — breaks on unescaped quotes and special characters\npython3 -c \"open('out.ts','w').write('${content}')\"\n\n# ❌ UNRELIABLE for large payloads — may silently truncate\necho \"${large_content}\" > out.ts\n```\n\n---\n\n## Verification Step\n\nAlways verify the write succeeded:\n\n```bash\n# Check file exists and has non-zero size\npython3 -c \"\nimport pathlib\np = pathlib.Path('\u002Fpath\u002Fto\u002Ftarget\u002Ffile.ts')\nassert p.exists() and p.stat().st_size > 0, f'Write failed: {p}'\nprint(f'OK — {p.stat().st_size} bytes written to {p}')\n\"\n```\n\n---\n\n## Notes\n\n- The temp script approach works for **any file type**: `.ts`, `.tsx`, `.js`, `.json`, `.md`, `.py`, etc.\n- Always `lstrip(\"\\n\")` the triple-quoted string to avoid a leading blank line.\n- For very large files (>50 KB), prefer base64 to avoid any risk of heredoc conflicts.\n- Clean up temp scripts after use: `rm \u002Ftmp\u002Fwrite_task.py`","# Large File Write via Temp Script\n\n## Problem\n\nWriting large files — especially TypeScript, TSX, or any content containing\nUnicode emoji, backticks, `${}` template literals, or multi-line heredoc\nconflicts — can silently fail or truncate content when passed inline.\n\n**Failure modes observed:**\n- `write_file` returns `[ERROR] unknown error` on large payloads\n- `node -e '...'` with backtick template literals silently empties the target file\n- `python3 -c '...'` breaks on unescaped quotes or special characters\n- `shell_agent` may time out or fail when the inline content is too large\n\n---\n\n## Solution: Write a Python Script to a Temp File First\n\nInstead of passing file content inline, write a small Python helper script to\n`\u002Ftmp\u002Fwrite_task.py` (or similar), then execute it. The helper script holds\nthe target file content as a raw Python string or via base64 decoding.\n\n---\n\n## Approach A — Python Triple-Quoted String (preferred for readability)\n\nUse `write_file` or a heredoc to create the helper, then run it:\n\n```bash\n# Step 1: Write the helper script to \u002Ftmp\ncat > \u002Ftmp\u002Fwrite_task.py \u003C\u003C 'PYEOF'\nimport pathlib\n\ncontent = r\"\"\"\n\u002F\u002F Your TypeScript \u002F file content goes here\n\u002F\u002F Backticks `like this`, ${template} literals, and emoji ? are all safe\nexport const MyComponent = () => {\n  const msg = `Hello, world!`;\n  return \u003Cdiv>{msg}\u003C\u002Fdiv>;\n};\n\"\"\"\n\npathlib.Path(\"\u002Fpath\u002Fto\u002Ftarget\u002Ffile.ts\").write_text(content.lstrip(\"\\n\"), encoding=\"utf-8\")\nprint(\"Written successfully.\")\nPYEOF\n\n# Step 2: Execute the helper\npython3 \u002Ftmp\u002Fwrite_task.py\n```\n\n> **Why `r\"\"\"`?** A raw triple-quoted string avoids all backslash escaping\n> issues. The only content that cannot appear verbatim is `\"\"\"` itself — if\n> needed, split the string or escape that sequence only.\n\n---\n\n## Approach B — Base64-Encoded Content (most robust for binary\u002Fcomplex content)\n\nWhen the content contains `\"\"\"` or other Python string edge cases:\n\n```bash\n# Step 1: Base64-encode your content (done once, outside the target system)\n# python3 -c \"import base64; print(base64.b64encode(open('file.ts').read().encode()).decode())\"\n\n# Step 2: Embed the base64 blob in the helper script\ncat > \u002Ftmp\u002Fwrite_task.py \u003C\u003C 'PYEOF'\nimport base64, pathlib\n\nb64 = (\n    \"aW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JzsKCmV4cG9ydCBjb25zdCBNeUNvbXBvbmVudCA9\"\n    \"ICgpID0+IHsKICByZXR1cm4gPGRpdj5IZWxsbzwvZGl2PjsKfTsK\"\n    # ... more lines if needed\n)\n\ncontent = base64.b64decode(b64).decode(\"utf-8\")\npathlib.Path(\"\u002Fpath\u002Fto\u002Ftarget\u002Ffile.ts\").write_text(content, encoding=\"utf-8\")\nprint(f\"Written {len(content)} bytes successfully.\")\nPYEOF\n\npython3 \u002Ftmp\u002Fwrite_task.py\n```\n\n---\n\n## Approach C — shell_agent Delegation (simplest for agents)\n\nAsk `shell_agent` to perform the write using the temp-script pattern:\n\n> \"Write the following TypeScript content to `\u002Fsrc\u002Fcomponents\u002FMyPanel.ts`.\n> Do NOT use `node -e` or inline Python. Instead write a Python script to\n> `\u002Ftmp\u002Fwrite_panel.py` using a triple-quoted raw string, then execute it.\"\n\n---\n\n## Decision Guide\n\n| Situation | Recommended Approach |\n|---|---|\n| Content has backticks \u002F `${}` template literals | Approach A (raw `r\"\"\"`) |\n| Content has `\"\"\"` sequences | Approach B (base64) |\n| Content is binary or non-UTF-8 | Approach B (base64) |\n| Delegating to shell_agent | Approach C with explicit instructions |\n| Quick small file | Direct `write_file` (no workaround needed) |\n\n---\n\n## Anti-Patterns to Avoid\n\n```bash\n# ❌ DANGEROUS — backtick template literals will break node -e\nnode -e \"const fs = require('fs'); fs.writeFileSync('out.ts', \\`${content}\\`);\"\n\n# ❌ FRAGILE — breaks on unescaped quotes and special characters\npython3 -c \"open('out.ts','w').write('${content}')\"\n\n# ❌ UNRELIABLE for large payloads — may silently truncate\necho \"${large_content}\" > out.ts\n```\n\n---\n\n## Verification Step\n\nAlways verify the write succeeded:\n\n```bash\n# Check file exists and has non-zero size\npython3 -c \"\nimport pathlib\np = pathlib.Path('\u002Fpath\u002Fto\u002Ftarget\u002Ffile.ts')\nassert p.exists() and p.stat().st_size > 0, f'Write failed: {p}'\nprint(f'OK — {p.stat().st_size} bytes written to {p}')\n\"\n```\n\n---\n\n## Notes\n\n- The temp script approach works for **any file type**: `.ts`, `.tsx`, `.js`, `.json`, `.md`, `.py`, etc.\n- Always `lstrip(\"\\n\")` the triple-quoted string to avoid a leading blank line.\n- For very large files (>50 KB), prefer base64 to avoid any risk of heredoc conflicts.\n- Clean up temp scripts after use: `rm \u002Ftmp\u002Fwrite_task.py`",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","showcase\u002Fskills\u002Flarge-file-write-via-temp-script","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill large-file-write-via-temp-script",{"tool":65,"command":66},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill large-file-write-via-temp-script",{"tool":68,"command":69},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill large-file-write-via-temp-script","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Flarge-file-write-via-temp-script\u002FSKILL.md",true,[73],{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},".skill_id","OTHER","其他",46,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Flarge-file-write-via-temp-script\u002F.skill_id",[80,99,113,121,149,165],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":48},"01M6XCCXD3NCM2YKR3WNGBASPC","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\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[87,30,88,89,90,91,92,93,37,40,32,94,95,96,97,98,29,47],"check","write special chars ts check","typescript","filters","characters","Existing","type-checking","output","type","files","only","template",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":48},"01M6XCCT7E3J922Q345PBGSHPN","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\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[106,107,30,29,42,47,108,31,109,110,111,98,112,33,91,37,32],"readback","write special chars readback","post","scripts","cleanup","read","verification",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":48},"01M6XCCMQX1R8B6FECWB3P63T7","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\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[120,30,91,45,32,31,98,29,47,37],"write special chars heredoc",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":130,"publishedAt":48},"01M6XCCG41M994JJEX6VN52PEP","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\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[127],{"categoryNo":128,"categoryName":129,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000033","数据分析师",[131,132,133,134,135,89,136,137,138,139,140,37,141,142,143,144,145,146,147,148],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","source","extracting","panel","patterns","edge functions","integrations","open","api","data",{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":48},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[156,157,158,159,37,160,33,161,162,163,164],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":48},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[172,173,174,175,176,177,29,178,179,180],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]