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