Token导航 LogoToken导航TokenDH.com
研究检索需要联网clawhub未标认证来源可访问clear审计通过

file-writer文件编写器

Agent Skill

file-writer 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

23,736

周安装

989

GitHub Stars

公开资料未说明

下载量

7,912
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:file-writer(文件编写器)
来源仓库:https://github.com/ykaixu/file-writer
安装命令:
openclaw skills install file-writer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install file-writer

简介

通过读取、增量编辑小部分、验证每个更改以及使用后备恢复方法,安全写入或更新超过 5000 字节的大文件。

SKILL.md

name
file-writer
description
Safe file writing strategy for large files. Use when you need to write or update large files (over 5000 bytes) to avoid truncation. Provides step-by-step approach: (1) Read current state, (2) Use edit tool for precise modifications, (3) Verify results, (4) Repeat until complete. Also provides fallback strategies and error recovery.

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

Problem Analysis

Why Files Get Truncated

Large file writes can fail due to:

  1. Tool limitations - write tool may have byte limits per operation
  2. Network limits - Large file transfers may be truncated during transmission
  3. System limits - OpenClaw may have size limits on single operations

Safe Size Thresholds

OperationSafe SizeRisk Level
write new file< 2000 bytes✅ Safe
write new file2000-5000 bytes⚠️ Moderate
write new file> 5000 bytes❌ High risk
edit modification< 500 bytes✅ Safe
edit modification500-1000 bytes⚠️ Moderate
edit modification> 1000 bytes❌ High risk

Safe Writing Strategy

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:

  1. Modify one section at a time
  2. Verify each modification
  3. Proceed to next section
  4. Repeat until all changes complete

Fallback Strategies

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 -->\
[existing content]\
<!-- SECTION_END: configuration -->"
newText: "<!-- SECTION_START: configuration -->\
[new content]\
<!-- 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

Error Recovery

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:

  1. Re-read the file to get exact content
  2. Use unique markers for large sections
  3. Match whitespace exactly (copy from file read)
  4. Use smaller oldText for more precise matching

Write Tool Truncates

Symptom: File ends abruptly or is incomplete

Solutions:

  1. Use edit tool instead of write
  2. Split content into smaller chunks
  3. Write incrementally (section by section)
  4. Verify file size after each operation

File Corruption

Symptom: File has syntax errors or invalid content

Solutions:

  1. Restore from backup
  2. Re-read and re-verify
  3. Use incremental build strategy
  4. Validate syntax after each modification

Examples

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\
\
Content here"
  newText: "## Existing Section\
\
Content here\
\
## New Section\
\
New 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\
\
## Section 1\
\
Content 1"

Step 2: Add sections incrementally
edit:
  file_path: /path/to/new-file.md
  oldText: "Content 1"
  newText: "Content 1\
\
## Section 2\
\
Content 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 -->\
[old content]\
<!-- END: old-section -->"
  newText: "<!-- START: old-section -->\
[new content]\
<!-- END: old-section -->"

Step 3: Verify
read /path/to/file.md | grep "new content"

Best Practices

  1. Always read before editing - Understand current state
  2. Use edit for modifications - More precise than write
  3. Keep changes small - Under 500 bytes per edit
  4. Verify after each operation - Don't batch operations
  5. Use unique markers - For complex modifications
  6. Create backups - For critical files
  7. Handle errors gracefully - Provide recovery strategies
  8. 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

TaskToolStrategy
Create small filewriteDirect write
Create large filewrite + editIncremental build
Small modificationeditDirect edit
Medium modificationeditEdit with markers
Large modificationeditIncremental edit
Replace sectioneditUnique markers
Append contenteditEdit end of file

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

75.4%
按下载量换算5,966

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills