{
  "schemaVersion": "1.0",
  "item": {
    "slug": "file-writer",
    "name": "File Writer",
    "source": "tencent",
    "type": "skill",
    "category": "内容创作",
    "sourceUrl": "https://clawhub.ai/YKaiXu/file-writer",
    "canonicalUrl": "https://clawhub.ai/YKaiXu/file-writer",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/file-writer",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=file-writer",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/file-writer"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/file-writer",
    "agentPageUrl": "https://openagent3.xyz/skills/file-writer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/file-writer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/file-writer/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "File Writer",
        "body": "Safe file writing strategy for large files to avoid truncation issues."
      },
      {
        "title": "When to Use",
        "body": "Writing files larger than 5000 bytes\nUpdating existing files with significant changes\nModifying specific sections of large files\nPrevious write operations were truncated\nNeed to ensure file integrity"
      },
      {
        "title": "Why Files Get Truncated",
        "body": "Large file writes can fail due to:\n\nTool limitations - write tool may have byte limits per operation\nNetwork limits - Large file transfers may be truncated during transmission\nSystem limits - OpenClaw may have size limits on single operations"
      },
      {
        "title": "Safe Size Thresholds",
        "body": "OperationSafe SizeRisk Levelwrite new file< 2000 bytes✅ Safewrite new file2000-5000 bytes⚠️ Moderatewrite new file> 5000 bytes❌ High riskedit modification< 500 bytes✅ Safeedit modification500-1000 bytes⚠️ Moderateedit modification> 1000 bytes❌ High risk"
      },
      {
        "title": "Step 1: Read Current State",
        "body": "Before making changes, read the current file state:\n\n# Read the file to understand current structure\nread /path/to/file.md\n\n# For large files, read specific sections\nread /path/to/file.md --offset 100 --limit 50\n\nPurpose:\n\nUnderstand file structure\nIdentify exact text to replace\n`- Determine modification points"
      },
      {
        "title": "Step 2: Use Edit Tool for Precise Modifications",
        "body": "For small to medium changes, use edit tool:\n\nUse `edit` tool with:\n- `oldText`: Exact text to replace (must match exactly)\n- `newText`: New text to replace with\n- `file_path`: Path to the file\n\nBest Practices:\n\nKeep modifications under 500 bytes\nMatch oldText exactly (including whitespace)\nUse unique text markers for large sections\nVerify oldText exists before editing"
      },
      {
        "title": "Step 3: Verify Results",
        "body": "After each modification, verify the result:\n\n# Check file line count\nwc -l /path/to/file.md\n\n# Read modified section\nread /path/to/file.md --offset <start> --limit <lines>\n\n# Verify file ends correctly\nread /path/to/file.md --offset -10\n\nSuccess Criteria:\n\nFile size increased as expected\nModified section contains new content\nFile ends correctly (not truncated)\nNo syntax errors (for code files)"
      },
      {
        "title": "Step 4: Repeat Until Complete",
        "body": "For large multi-section updates:\n\nModify one section at a time\nVerify each modification\nProceed to next section\nRepeat until all changes complete"
      },
      {
        "title": "Strategy 1: Split Large Writes",
        "body": "If write tool fails for large content:\n\nSplit content into chunks:\n\n1. Write first chunk (header + section 1)\n2. Verify and append section 2\n3. Verify and append section 3\n4. Continue until complete"
      },
      {
        "title": "Strategy 2: Use Unique Markers",
        "body": "For complex modifications, use unique markers:\n\nIn source file:\n<!-- SECTION_START: configuration -->\n[existing content]\n<!-- SECTION_END: configuration -->\n\nEdit operation:\noldText: \"<!-- SECTION_START: configuration -->\\n[existing content]\\n<!-- SECTION_END: configuration -->\"\nnewText: \"<!-- SECTION_START: configuration -->\\n[new content]\\n<!-- SECTION_END: configuration -->\""
      },
      {
        "title": "Strategy 3: Incremental Build",
        "body": "For creating new large files:\n\n1. Create file with basic structure\n2. Add sections one by one using edit\n3. Verify after each addition\n4. Final verification"
      },
      {
        "title": "Strategy 4: Backup and Restore",
        "body": "For critical file modifications:\n\n# Create backup before modification\ncp /path/to/file.md /path/to/file.md.backup\n\n# Attempt modification\n# ... (write or edit operation)\n\n# If modification fails, restore\ncp /path/to/file.md.backup /path/to/file.md"
      },
      {
        "title": "Edit Tool Fails",
        "body": "Symptom: \"Could not find exact text in file\"\n\nCauses:\n\noldText doesn't match exactly\nWhitespace differences (spaces vs tabs)\nFile already modified\nText doesn't exist in file\n\nSolutions:\n\nRe-read the file to get exact content\nUse unique markers for large sections\nMatch whitespace exactly (copy from file read)\nUse smaller oldText for more precise matching"
      },
      {
        "title": "Write Tool Truncates",
        "body": "Symptom: File ends abruptly or is incomplete\n\nSolutions:\n\nUse edit tool instead of write\nSplit content into smaller chunks\nWrite incrementally (section by section)\nVerify file size after each operation"
      },
      {
        "title": "File Corruption",
        "body": "Symptom: File has syntax errors or invalid content\n\nSolutions:\n\nRestore from backup\nRe-read and re-verify\nUse incremental build strategy\nValidate syntax after each modification"
      },
      {
        "title": "Example 1: Adding Section to Large File",
        "body": "Step 1: Read file to find insertion point\nread /path/to/large-file.md --offset 50 --limit 10\n\nStep 2: Use edit to add new section\nedit:\n  file_path: /path/to/large-file.md\n  oldText: \"## Existing Section\\n\\nContent here\"\n  newText: \"## Existing Section\\n\\nContent here\\n\\n## New Section\\n\\nNew content\"\n\nStep 3: Verify\nread /path/to/large-file.md --offset 50 --limit 20"
      },
      {
        "title": "Example 2: Creating Large New File",
        "body": "Step 1: Create basic structure\nwrite:\n  file_path: /path/to/new-file.md\n  content: \"# Title\\n\\n## Section 1\\n\\nContent 1\"\n\nStep 2: Add sections incrementally\nedit:\n  file_path: /path/to/new-file.md\n  oldText: \"Content 1\"\n  newText: \"Content 1\\n\\n## Section 2\\n\\nContent 2\"\n\nStep 3: Verify\nwc -l /path/to/new-file.md"
      },
      {
        "title": "Example 3: Replacing Large Section",
        "body": "Step 1: Read file to find exact text\nread /path/to/file.md\n\nStep 2: Use unique markers\nedit:\n  file_path: /path/to/file.md\n  oldText: \"<!-- START: old-section -->\\n[old content]\\n<!-- END: old-section -->\"\n  newText: \"<!-- START: old-section -->\\n[new content]\\n<!-- END: old-section -->\"\n\nStep 3: Verify\nread /path/to/file.md | grep \"new content\""
      },
      {
        "title": "Best Practices",
        "body": "Always read before editing - Understand current state\nUse edit for modifications - More precise than write\nKeep changes small - Under 500 bytes per edit\nVerify after each operation - Don't batch operations\nUse unique markers - For complex modifications\nCreate backups - For critical files\nHandle errors gracefully - Provide recovery strategies\nTest incrementally - Verify each step"
      },
      {
        "title": "Decision Tree",
        "body": "Need to write/update file?\n├─ New file?\n│  ├─ < 2000 bytes?\n│  │  └─ Use write tool\n│  └─ > 2000 bytes?\n│     └─ Use incremental build strategy\n└─ Existing file?\n   ├─ Small change (< 500 bytes)?\n   │  └─ Use edit tool\n   ├─ Medium change (500-1000 bytes)?\n   │  └─ Use edit with unique markers\n   └─ Large change (> 1000 bytes)?\n      └─ Use incremental edit strategy"
      },
      {
        "title": "Quick Reference",
        "body": "TaskToolStrategyCreate small filewriteDirect writeCreate large filewrite + editIncremental buildSmall modificationeditDirect editMedium modificationeditEdit with markersLarge modificationeditIncremental editReplace sectioneditUnique markersAppend contenteditEdit end of file"
      }
    ],
    "body": "File Writer\n\nSafe file writing strategy for large files to avoid truncation issues.\n\nWhen to Use\nWriting files larger than 5000 bytes\nUpdating existing files with significant changes\nModifying specific sections of large files\nPrevious write operations were truncated\nNeed to ensure file integrity\nProblem Analysis\nWhy Files Get Truncated\n\nLarge file writes can fail due to:\n\nTool limitations - write tool may have byte limits per operation\nNetwork limits - Large file transfers may be truncated during transmission\nSystem limits - OpenClaw may have size limits on single operations\nSafe Size Thresholds\nOperation\tSafe Size\tRisk Level\nwrite new file\t< 2000 bytes\t✅ Safe\nwrite new file\t2000-5000 bytes\t⚠️ Moderate\nwrite new file\t> 5000 bytes\t❌ High risk\nedit modification\t< 500 bytes\t✅ Safe\nedit modification\t500-1000 bytes\t⚠️ Moderate\nedit modification\t> 1000 bytes\t❌ High risk\nSafe Writing Strategy\nStep 1: Read Current State\n\nBefore making changes, read the current file state:\n\n# Read the file to understand current structure\nread /path/to/file.md\n\n# For large files, read specific sections\nread /path/to/file.md --offset 100 --limit 50\n\n\nPurpose:\n\nUnderstand file structure\nIdentify exact text to replace `- Determine modification points\nStep 2: Use Edit Tool for Precise Modifications\n\nFor small to medium changes, use edit tool:\n\nUse `edit` tool with:\n- `oldText`: Exact text to replace (must match exactly)\n- `newText`: New text to replace with\n- `file_path`: Path to the file\n\n\nBest Practices:\n\nKeep modifications under 500 bytes\nMatch oldText exactly (including whitespace)\nUse unique text markers for large sections\nVerify oldText exists before editing\nStep 3: Verify Results\n\nAfter each modification, verify the result:\n\n# Check file line count\nwc -l /path/to/file.md\n\n# Read modified section\nread /path/to/file.md --offset <start> --limit <lines>\n\n# Verify file ends correctly\nread /path/to/file.md --offset -10\n\n\nSuccess Criteria:\n\nFile size increased as expected\nModified section contains new content\nFile ends correctly (not truncated)\nNo syntax errors (for code files)\nStep 4: Repeat Until Complete\n\nFor large multi-section updates:\n\nModify one section at a time\nVerify each modification\nProceed to next section\nRepeat until all changes complete\nFallback Strategies\nStrategy 1: Split Large Writes\n\nIf write tool fails for large content:\n\nSplit content into chunks:\n\n1. Write first chunk (header + section 1)\n2. Verify and append section 2\n3. Verify and append section 3\n4. Continue until complete\n\nStrategy 2: Use Unique Markers\n\nFor complex modifications, use unique markers:\n\nIn source file:\n<!-- SECTION_START: configuration -->\n[existing content]\n<!-- SECTION_END: configuration -->\n\nEdit operation:\noldText: \"<!-- SECTION_START: configuration -->\\n[existing content]\\n<!-- SECTION_END: configuration -->\"\nnewText: \"<!-- SECTION_START: configuration -->\\n[new content]\\n<!-- SECTION_END: configuration -->\"\n\nStrategy 3: Incremental Build\n\nFor creating new large files:\n\n1. Create file with basic structure\n2. Add sections one by one using edit\n3. Verify after each addition\n4. Final verification\n\nStrategy 4: Backup and Restore\n\nFor critical file modifications:\n\n# Create backup before modification\ncp /path/to/file.md /path/to/file.md.backup\n\n# Attempt modification\n# ... (write or edit operation)\n\n# If modification fails, restore\ncp /path/to/file.md.backup /path/to/file.md\n\nError Recovery\nEdit Tool Fails\n\nSymptom: \"Could not find exact text in file\"\n\nCauses:\n\noldText doesn't match exactly\nWhitespace differences (spaces vs tabs)\nFile already modified\nText doesn't exist in file\n\nSolutions:\n\nRe-read the file to get exact content\nUse unique markers for large sections\nMatch whitespace exactly (copy from file read)\nUse smaller oldText for more precise matching\nWrite Tool Truncates\n\nSymptom: File ends abruptly or is incomplete\n\nSolutions:\n\nUse edit tool instead of write\nSplit content into smaller chunks\nWrite incrementally (section by section)\nVerify file size after each operation\nFile Corruption\n\nSymptom: File has syntax errors or invalid content\n\nSolutions:\n\nRestore from backup\nRe-read and re-verify\nUse incremental build strategy\nValidate syntax after each modification\nExamples\nExample 1: Adding Section to Large File\nStep 1: Read file to find insertion point\nread /path/to/large-file.md --offset 50 --limit 10\n\nStep 2: Use edit to add new section\nedit:\n  file_path: /path/to/large-file.md\n  oldText: \"## Existing Section\\n\\nContent here\"\n  newText: \"## Existing Section\\n\\nContent here\\n\\n## New Section\\n\\nNew content\"\n\nStep 3: Verify\nread /path/to/large-file.md --offset 50 --limit 20\n\nExample 2: Creating Large New File\nStep 1: Create basic structure\nwrite:\n  file_path: /path/to/new-file.md\n  content: \"# Title\\n\\n## Section 1\\n\\nContent 1\"\n\nStep 2: Add sections incrementally\nedit:\n  file_path: /path/to/new-file.md\n  oldText: \"Content 1\"\n  newText: \"Content 1\\n\\n## Section 2\\n\\nContent 2\"\n\nStep 3: Verify\nwc -l /path/to/new-file.md\n\nExample 3: Replacing Large Section\nStep 1: Read file to find exact text\nread /path/to/file.md\n\nStep 2: Use unique markers\nedit:\n  file_path: /path/to/file.md\n  oldText: \"<!-- START: old-section -->\\n[old content]\\n<!-- END: old-section -->\"\n  newText: \"<!-- START: old-section -->\\n[new content]\\n<!-- END: old-section -->\"\n\nStep 3: Verify\nread /path/to/file.md | grep \"new content\"\n\nBest Practices\nAlways read before editing - Understand current state\nUse edit for modifications - More precise than write\nKeep changes small - Under 500 bytes per edit\nVerify after each operation - Don't batch operations\nUse unique markers - For complex modifications\nCreate backups - For critical files\nHandle errors gracefully - Provide recovery strategies\nTest incrementally - Verify each step\nDecision Tree\nNeed to write/update file?\n├─ New file?\n│  ├─ < 2000 bytes?\n│  │  └─ Use write tool\n│  └─ > 2000 bytes?\n│     └─ Use incremental build strategy\n└─ Existing file?\n   ├─ Small change (< 500 bytes)?\n   │  └─ Use edit tool\n   ├─ Medium change (500-1000 bytes)?\n   │  └─ Use edit with unique markers\n   └─ Large change (> 1000 bytes)?\n      └─ Use incremental edit strategy\n\nQuick Reference\nTask\tTool\tStrategy\nCreate small file\twrite\tDirect write\nCreate large file\twrite + edit\tIncremental build\nSmall modification\tedit\tDirect edit\nMedium modification\tedit\tEdit with markers\nLarge modification\tedit\tIncremental edit\nReplace section\tedit\tUnique markers\nAppend content\tedit\tEdit end of file"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/YKaiXu/file-writer",
    "publisherUrl": "https://clawhub.ai/YKaiXu/file-writer",
    "owner": "YKaiXu",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/file-writer",
    "downloadUrl": "https://openagent3.xyz/downloads/file-writer",
    "agentUrl": "https://openagent3.xyz/skills/file-writer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/file-writer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/file-writer/agent.md"
  }
}