← 返回 Skills 市场
435
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install enterprise-file-writer
功能描述
写入内容到本地文件,支持企业安全策略环境。支持文本文件、Word 文档 (.docx)、Excel 表格 (.xlsx) 等 80+ 种格式,通过正确的编码处理避免乱码问题。
使用说明 (SKILL.md)
Enterprise File Writer - 企业安全策略兼容文件写入器
写入内容到本地文件,支持企业安全策略环境,正确处理编码避免乱码
功能特性
- 多格式支持: 80+ 种文件类型(文本、代码、配置、Office 文档)
- 编码安全: 自动使用 UTF-8 编码,避免乱码问题
- 企业兼容: 支持企业安全策略环境下的授权文件写入
- 灵活模式: 支持覆盖写入和追加模式
- 标准输入: 支持从管道或标准输入读取内容
- 目录自动创建: 目标目录不存在时自动创建
- Office 支持: 直接创建/编辑 .docx 和 .xlsx(无需安装 Office)
激活条件
当用户提到以下关键词时激活:
- "写入文件"
- "保存文件"
- "创建文件"
- "写入受保护的文件"
- "避免乱码写入"
- "企业安全策略写入"
- "写入 docx/xlsx 文件"
使用方法
通过 exec 工具调用
# 覆盖写入
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "文件路径" "内容"
# 追加写入
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "文件路径" "内容" --append
# 从标准输入读取
echo "内容" | python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "文件路径" --stdin
# 指定编码
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "文件路径" "内容" --encoding gbk
示例
# 写入文本文件
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "E:\data est.txt" "Hello World"
# 写入日志(追加模式)
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "E:\logs\app.log" "2026-03-08 10:00:00 - 系统启动" --append
# 写入代码文件
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "D:\project\main.py" "print('Hello')"
# 写入配置文件
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "D:\config\app.json" "{\"name\": \"test\"}"
# 写入 Word 文档
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "E:\docs\report.docx" "第一行内容"
# 追加到 Word 文档
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "E:\docs\report.docx" "追加内容" --append
# 写入 Excel 文件(CSV 格式)
python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "E:\data\data.xlsx" "姓名,年龄,城市
张三,25,北京
李四,30,上海"
# 从管道写入
echo "多行内容" | python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "E:\data\input.txt" --stdin
在 OpenClaw 中使用
# 写入文件并获取结果
exec:
command: python D:\ai\workspace\skills\enterprise-file-writer\write_file.py "文件路径" "内容"
支持的文件格式
| 类型 | 扩展名 | 写入方式 |
|---|---|---|
| 文本类 | .txt, .md, .markdown, .rst, .log, .csv, .tsv | UTF-8 文本写入 |
| 代码类 | .java, .py, .js, .ts, .jsx, .tsx, .c, .cpp, .h, .cs, .go, .rs, .rb, .php, .vue | UTF-8 文本写入 |
| 配置类 | .json, .xml, .yaml, .yml, .toml, .ini, .cfg, .properties, .gradle, .config, .env | UTF-8 文本写入 |
| 样式类 | .html, .htm, .css, .scss, .sass, .less | UTF-8 文本写入 |
| 脚本类 | .sh, .bash, .bat, .cmd, .ps1, .sql | UTF-8 文本写入 |
| Office | .docx (Word), .xlsx (Excel) | OpenXML ZIP 格式写入 |
写入模式
| 模式 | 参数 | 说明 |
|---|---|---|
| 覆盖写入 | (默认) | 如果文件存在则覆盖,不存在则创建 |
| 追加写入 | --append 或 -a |
在文件末尾追加内容 |
追加模式行为
- 文本文件: 直接在文件末尾追加字节
- .docx 文件: 在文档末尾添加新段落
- .xlsx 文件: 在表格末尾添加新行
编码选项
| 编码 | 参数 | 适用场景 |
|---|---|---|
| UTF-8 | (默认) | 推荐,国际通用编码 |
| GBK | --encoding gbk |
中文 Windows 系统兼容 |
| GB2312 | --encoding gb2312 |
简体中文旧文件 |
| Latin-1 | --encoding latin1 |
西欧语言文件 |
技术原理
| 文件类型 | 处理方式 |
|---|---|
| 文本文件 | 内容先编码为 UTF-8 字节,再以二进制模式写入,避免编码转换问题 |
| Word (.docx) | 使用 zipfile 创建/修改 OpenXML 格式,在 document.xml 中添加段落 |
| Excel (.xlsx) | 使用 zipfile 创建/修改 OpenXML 格式,生成 sharedStrings 和 worksheet |
.docx 写入细节
- 创建新文件: 生成最小 OpenXML 结构([Content_Types].xml, _rels/, word/document.xml)
- 追加内容: 解压读取 document.xml,在
\x3C/w:body>前插入新段落,重新打包
.xlsx 写入细节
- 创建新文件: 生成最小 OpenXML 结构(workbook.xml, worksheets/, sharedStrings.xml)
- 数据格式: 支持 CSV 格式输入(逗号或制表符分隔)
- 字符串处理: 自动去重并构建共享字符串表
依赖要求
- Python 3.x(仅需标准库:sys, os, argparse, zipfile, shutil, tempfile, datetime, re, io, json)
- 无需安装额外依赖
输出格式
成功输出:
[OK] 成功写入 XXX 字节到:文件路径
FILE_PATH=文件路径
BYTES_WRITTEN=字节数
失败输出:
[ERROR] 错误信息
使用场景
1. 日志记录
python write_file.py "E:\logs\app.log" "[INFO] 操作完成" --append
2. 配置文件更新
python write_file.py "D:\config\settings.json" "{\"debug\": true}"
3. 代码生成
python write_file.py "D:\project\output.py" "def main():\
print('Hello')"
4. Word 文档创建/编辑
# 创建新文档
python write_file.py "E:\docs\report.docx" "报告标题
报告内容第一行
报告内容第二行"
# 追加到现有文档
python write_file.py "E:\docs\report.docx" "新增段落" --append
5. Excel 数据导出
python write_file.py "E:\exports\data.xlsx" "姓名,年龄,城市
张三,25,北京
李四,30,上海"
6. 临时文件创建
python write_file.py "C: emp ask_123.txt" "任务数据..."
注意事项
⚠️ 重要说明:
- 本工具仅写入用户有权限访问的本地文件
- 不支持绕过合法的文件访问控制
- 适用于企业环境中授权的文件写入场景
- 默认使用 UTF-8 编码,如需其他编码请指定
--encoding参数 - 写入前会自动创建不存在的目录
- .docx/.xlsx 使用 OpenXML 标准格式,兼容 Microsoft Office 和 LibreOffice
⚠️ Office 文件限制:
- .docx 追加模式会在文档末尾添加新段落,不保留原有格式
- .xlsx 追加模式会重新构建整个文件,适合小数据量场景
- 复杂格式(样式、公式、图表)需要专用库(python-docx/openpyxl)
法律说明
- 本工具仅用于向用户有合法访问权限的本地文件写入内容
- 不支持绕过任何合法的文件访问控制或权限管理
- 用户应确保使用本工具符合所在组织的政策和法律法规
- 本工具通过标准的文件写入 API 操作,不涉及任何安全绕过
版本
| 版本 | 日期 | 变更 |
|---|---|---|
| 1.0.0 | 2026-03-08 | 初始版本,支持文本/代码/配置文件写入,UTF-8 编码保护 |
| 1.1.0 | 2026-03-09 | 新增 .docx 和 .xlsx 写入支持 |
| 1.2.0 | 2026-03-09 | 重命名为 enterprise-file-writer,澄清功能描述 |
安全使用建议
This skill appears to implement the advertised file-writing capabilities and uses only Python stdlib, but take these precautions before enabling it:
- Verify provenance: the package metadata (owner ID and version) in the repository files does not match the registry metadata shown. Confirm the author and repository before trusting it in production.
- Code review: inspect the full write_file.py for any hidden network calls, exec/spawn usage, or logic that manipulates paths (symlink handling, absolute paths, traversal) — the truncated file looks benign but I could not see the complete implementation.
- Principle of least privilege: run the skill under an account with minimal filesystem permissions and avoid giving it access to system or sensitive directories. Consider sandboxing (container or VM) for testing.
- Limit autonomous use: if you do not want the agent to write files automatically, disable autonomous invocation for this skill or remove/adjust its activation keywords.
- Test in a safe environment: try writing to benign test directories first to confirm behavior for .docx/.xlsx append and edge cases (large files, special characters, symlinks).
If you want, I can scan the remainder of write_file.py (full source) for any further suspicious patterns (network, subprocess, unusual file writes) and re-evaluate.
功能分析
Type: OpenClaw Skill
Name: enterprise-file-writer
Version: 1.2.1
The skill is a utility for writing text, Word (.docx), and Excel (.xlsx) files using Python's standard library. The core logic in `write_file.py` manually constructs OpenXML structures for Office documents to avoid external dependencies, and the instructions in `SKILL.md` align with this functionality. While the tool lacks path sanitization (a potential path traversal vulnerability), there is no evidence of malicious intent, data exfiltration, or prompt injection.
能力评估
Purpose & Capability
The name/description match the included Python implementation: the script writes many text formats and constructs minimal .docx/.xlsx OpenXML packages. However there are small supply-metadata inconsistencies (registry metadata lists version 1.2.1 and owner A, while package/_meta.json and package.json show version 1.2.0 and a different ownerId/homepage). These mismatches don't prove malice but reduce trust in provenance.
Instruction Scope
SKILL.md instructs running write_file.py with a target path and content — that is consistent with purpose. But the tool accepts arbitrary file paths and will create/overwrite files the agent user has access to; I see no documented or enforced path sanitization, symlink protections, or restrictions on overwriting sensitive paths. Because the skill can be invoked by keywords and the agent may run it autonomously, this raises a risk of unintended modification of important files if misused or triggered accidentally.
Install Mechanism
No install spec; skill is instruction + a Python script using only standard library modules. There are no external downloads or third-party packages. This is low-risk from an install/execution provenance perspective, aside from the earlier metadata provenance inconsistencies.
Credentials
The skill requests no environment variables, no credentials, and the code shows only local filesystem operations and stdlib imports. There are no obvious network calls or external endpoints in the visible code. Required permissions are limited to whatever the user account running the agent already has.
Persistence & Privilege
always is false and disable-model-invocation is false (normal). The SKILL.md lists activation keywords; that means the agent could autonomously invoke the writer when those phrases appear. Combined with the ability to write arbitrary paths, consider whether you want the skill enabled for autonomous invocation or restricted to explicit user commands.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install enterprise-file-writer - 安装完成后,直接呼叫该 Skill 的名称或使用
/enterprise-file-writer触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.1
## v1.2.1 (2026-03-09)
### English
**Renamed** - Changed skill name from "encrypted-file-writer" to "enterprise-file-writer" for better clarity.
**Changes**:
- Renamed skill to accurately describe its purpose
- Updated all file references and documentation
- Clarified that this skill handles file writing with proper encoding, not encryption
**Features**:
- Support for 80+ file formats (text, code, config, Office documents)
- UTF-8 encoding by default, with GBK/GB2312/Latin-1 options
- Overwrite and append write modes
- Automatic directory creation
- .docx and .xlsx file support
### 中文
**重命名** - 将技能名称从 "encrypted-file-writer" 改为 "enterprise-file-writer" 以更清晰描述功能。
**变更内容**:
- 重命名技能以准确描述其用途
- 更新所有文件引用和文档
- 澄清此技能处理正确编码的文件写入,而非加密功能
**功能特性**:
- 支持 80+ 种文件格式(文本、代码、配置、Office 文档)
- 默认 UTF-8 编码,支持 GBK/GB2312/Latin-1
- 覆盖写入和追加写入两种模式
- 自动创建目标目录
- 支持 .docx 和 .xlsx 文件
v1.2.0
## v1.2.0 (2026-03-09)
### English
**Renamed & Clarified** - Renamed from "Encrypted File Writer" to "Enterprise File Writer" for clarity.
**Changes**:
- Renamed skill from "encrypted-file-writer" to "enterprise-file-writer"
- Clarified description: this skill handles file writing in enterprise security policy environments, not encryption
- Updated documentation to accurately reflect functionality
- Improved description alignment with actual capabilities
**Note**: This skill provides compatible file writing under enterprise security policies, with proper encoding handling to avoid garbled text. It does not implement encryption algorithms.
### 中文
**重命名与澄清** - 从 "Encrypted File Writer" 重命名为 "Enterprise File Writer" 以更准确描述功能。
**变更内容**:
- 将技能名称从 "encrypted-file-writer" 重命名为 "enterprise-file-writer"
- 澄清描述:此技能处理企业安全策略环境下的文件写入,而非实现加密功能
- 更新文档以准确反映功能
- 改进描述与实际能力的一致性
**说明**: 此技能提供企业安全策略兼容的文件写入功能,通过正确的编码处理避免乱码问题,但不实现加密算法。
---
## v1.1.0 (2026-03-08)
### English
- Added .docx (Word) document write support
- Added .xlsx (Excel) spreadsheet write support
- Implemented append mode for Office documents
- Improved encoding handling for UTF-8 compatibility
### 中文
- 新增 .docx (Word) 文档写入支持
- 新增 .xlsx (Excel) 表格写入支持
- 实现 Office 文档的追加模式
- 改进 UTF-8 编码处理兼容性
元数据
常见问题
Enterprise File Writer 是什么?
写入内容到本地文件,支持企业安全策略环境。支持文本文件、Word 文档 (.docx)、Excel 表格 (.xlsx) 等 80+ 种格式,通过正确的编码处理避免乱码问题。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 435 次。
如何安装 Enterprise File Writer?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install enterprise-file-writer」即可一键安装,无需额外配置。
Enterprise File Writer 是免费的吗?
是的,Enterprise File Writer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Enterprise File Writer 支持哪些平台?
Enterprise File Writer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Enterprise File Writer?
由 endcy(@endcy)开发并维护,当前版本 v1.2.1。
推荐 Skills