โ† All skills
Tencent SkillHub ยท Content Creation

File Writer

Safely write or update large files over 5000 bytes by reading, incrementally editing small sections, verifying each change, and using fallback recovery methods.

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Safely write or update large files over 5000 bytes by reading, incrementally editing small sections, verifying each change, and using fallback recovery methods.

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
SKILL.md

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

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.

Upgrade existing

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.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.0

Documentation

ClawHub primary doc Primary doc: SKILL.md 21 sections Open source page

File Writer

Safe file writing strategy for large files to avoid truncation issues.

When to Use

Writing files larger than 5000 bytes Updating existing files with significant changes Modifying specific sections of large files Previous write operations were truncated Need to ensure file integrity

Why Files Get Truncated

Large file writes can fail due to: Tool limitations - write tool may have byte limits per operation Network limits - Large file transfers may be truncated during transmission System limits - OpenClaw may have size limits on single operations

Safe Size Thresholds

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

Step 1: Read Current State

Before making changes, read the current file state: # Read the file to understand current structure read /path/to/file.md # For large files, read specific sections read /path/to/file.md --offset 100 --limit 50 Purpose: Understand file structure Identify exact text to replace `- Determine modification points

Step 2: Use Edit Tool for Precise Modifications

  • For small to medium changes, use edit tool:
  • Use `edit` tool with:
  • `oldText`: Exact text to replace (must match exactly)
  • `newText`: New text to replace with
  • `file_path`: Path to the file
  • Best Practices:
  • Keep modifications under 500 bytes
  • Match oldText exactly (including whitespace)
  • Use unique text markers for large sections
  • Verify oldText exists before editing

Step 3: Verify Results

After each modification, verify the result: # Check file line count wc -l /path/to/file.md # Read modified section read /path/to/file.md --offset <start> --limit <lines> # Verify file ends correctly read /path/to/file.md --offset -10 Success Criteria: File size increased as expected Modified section contains new content File ends correctly (not truncated) No syntax errors (for code files)

Step 4: Repeat Until Complete

For large multi-section updates: Modify one section at a time Verify each modification Proceed to next section Repeat until all changes complete

Strategy 1: Split Large Writes

If write tool fails for large content: Split content into chunks: 1. Write first chunk (header + section 1) 2. Verify and append section 2 3. Verify and append section 3 4. Continue until complete

Strategy 2: Use Unique Markers

For complex modifications, use unique markers: In source file: <!-- SECTION_START: configuration --> [existing content] <!-- SECTION_END: configuration --> Edit operation: oldText: "<!-- SECTION_START: configuration -->\n[existing content]\n<!-- SECTION_END: configuration -->" newText: "<!-- SECTION_START: configuration -->\n[new content]\n<!-- SECTION_END: configuration -->"

Strategy 3: Incremental Build

For creating new large files: 1. Create file with basic structure 2. Add sections one by one using edit 3. Verify after each addition 4. Final verification

Strategy 4: Backup and Restore

For critical file modifications: # Create backup before modification cp /path/to/file.md /path/to/file.md.backup # Attempt modification # ... (write or edit operation) # If modification fails, restore cp /path/to/file.md.backup /path/to/file.md

Edit Tool Fails

Symptom: "Could not find exact text in file" Causes: oldText doesn't match exactly Whitespace differences (spaces vs tabs) File already modified Text doesn't exist in file Solutions: Re-read the file to get exact content Use unique markers for large sections Match whitespace exactly (copy from file read) Use smaller oldText for more precise matching

Write Tool Truncates

Symptom: File ends abruptly or is incomplete Solutions: Use edit tool instead of write Split content into smaller chunks Write incrementally (section by section) Verify file size after each operation

File Corruption

Symptom: File has syntax errors or invalid content Solutions: Restore from backup Re-read and re-verify Use incremental build strategy Validate syntax after each modification

Example 1: Adding Section to Large File

Step 1: Read file to find insertion point read /path/to/large-file.md --offset 50 --limit 10 Step 2: Use edit to add new section edit: file_path: /path/to/large-file.md oldText: "## Existing Section\n\nContent here" newText: "## Existing Section\n\nContent here\n\n## New Section\n\nNew content" Step 3: Verify read /path/to/large-file.md --offset 50 --limit 20

Example 2: Creating Large New File

Step 1: Create basic structure write: file_path: /path/to/new-file.md content: "# Title\n\n## Section 1\n\nContent 1" Step 2: Add sections incrementally edit: file_path: /path/to/new-file.md oldText: "Content 1" newText: "Content 1\n\n## Section 2\n\nContent 2" Step 3: Verify wc -l /path/to/new-file.md

Example 3: Replacing Large Section

Step 1: Read file to find exact text read /path/to/file.md Step 2: Use unique markers edit: file_path: /path/to/file.md oldText: "<!-- START: old-section -->\n[old content]\n<!-- END: old-section -->" newText: "<!-- START: old-section -->\n[new content]\n<!-- END: old-section -->" Step 3: Verify read /path/to/file.md | grep "new content"

Best Practices

Always read before editing - Understand current state Use edit for modifications - More precise than write Keep changes small - Under 500 bytes per edit Verify after each operation - Don't batch operations Use unique markers - For complex modifications Create backups - For critical files Handle errors gracefully - Provide recovery strategies Test incrementally - Verify each step

Decision Tree

Need to write/update file? โ”œโ”€ New file? โ”‚ โ”œโ”€ < 2000 bytes? โ”‚ โ”‚ โ””โ”€ Use write tool โ”‚ โ””โ”€ > 2000 bytes? โ”‚ โ””โ”€ Use incremental build strategy โ””โ”€ Existing file? โ”œโ”€ Small change (< 500 bytes)? โ”‚ โ””โ”€ Use edit tool โ”œโ”€ Medium change (500-1000 bytes)? โ”‚ โ””โ”€ Use edit with unique markers โ””โ”€ Large change (> 1000 bytes)? โ””โ”€ Use incremental edit strategy

Quick Reference

TaskToolStrategyCreate small filewriteDirect writeCreate large filewrite + editIncremental buildSmall modificationeditDirect editMedium modificationeditEdit with markersLarge modificationeditIncremental editReplace sectioneditUnique markersAppend contenteditEdit end of file

Category context

Writing, remixing, publishing, visual generation, and marketing content production.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
1 Docs
  • SKILL.md Primary doc