← 返回 Skills 市场
yechao1995

文档格式刷

作者 yechao1995 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
166
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install doc-format-brush
功能描述
文档格式刷 skill。当用户需要将某个文档的格式调整成与另一个模板文档完全一致时使用,支持任意格式文档(Word、Markdown、纯文本)的格式整理。包括字体、字号、对齐方式、首行缩进、行距、段前段后间距、页边距等。更支持智能识别标题层级(标题、一级标题、二级标题、正文),应用不同格式。支持内置公文格式(GB...
使用说明 (SKILL.md)

\r \r

文档格式刷 (Doc Format Brush)\r

\r

概述\r

\r 本 skill 提供多格式文档格式整理功能:提取模板文档的格式 → 应用到任意格式的目标文档。\r \r

核心功能\r

\r

  1. 多格式支持:输入/输出支持 Word(.docx)、Markdown(.md)、纯文本(.txt)\r
  2. 智能标题层级识别:自动识别标题、一级标题("一、")、二级标题("(一)")、正文\r
  3. 格式精确复制:字体、字号、加粗、对齐、首行缩进(字符级)、段前间距、段后间距、行间距、页边距\r
  4. 内置公文格式:支持一键应用 GB/T 9704-2012 国家标准公文格式\r \r ---\r \r

使用方式\r

\r

方式一:使用内置公文格式(推荐)\r

\r 当用户需要将文档调整为标准公文格式时:\r \r

python apply_multi_format.py \x3C输入文档> --official --output \x3C输出文档>\r
```\r
\r
**支持的输入格式**:.docx, .md, .txt\r
**支持的输出格式**:.docx, .md, .txt\r
\r
**示例:**\r
```bash\r
# Markdown 转 Word 公文格式\r
python apply_multi_format.py 报告.md --official --output 报告_公文.docx\r
\r
# 纯文本转 Markdown\r
python apply_multi_format.py 笔记.txt --official --output 笔记.md\r
\r
# Word 转为 Word(使用公文格式)\r
python apply_multi_format.py 财务报告.docx --official --output 财务报告_公文格式.docx\r
```\r
\r
---\r
\r
### 方式二:参照模板文档\r
\r
当用户提供了特定的模板文档时:\r
\r
**从模板提取格式后应用到目标:**\r
```bash\r
python apply_multi_format.py \x3C目标文档> \x3C模板.docx> --output \x3C输出文档>\r
```\r
\r
**示例:**\r
```bash\r
# 参照 Word 模板,调整 Markdown 文件\r
python apply_multi_format.py 报告.md 模板.docx --output 报告_新格式.docx\r
\r
# 参照模板,转换 Word 到 Word\r
python apply_multi_format.py 源文件.docx 模板.docx --output 目标文件.docx\r
```\r
\r
---\r
\r
### 方式三:使用格式描述文件\r
\r
可以先提取模板格式为 JSON,然后复用:\r
\r
```bash\r
# 提取格式\r
python extract_format.py 模板.docx --output 格式.json\r
\r
# 应用格式\r
python apply_multi_format.py 输入.md --format-json 格式.json --输出 输出.docx\r
```\r
\r
---\r
\r
## 内置公文格式规范(GB/T 9704-2012)\r
\r
| 段落类型 | 字体 | 字号 | 对齐 | 缩进 | 段前 | 段后 | 行距 |\r
|---------|------|------|------|------|------|------|------|\r
| 标题 | 方正小标宋体 | 22pt(二号) | 居中 | 0 | 0pt | 0pt | 1.5倍 |\r
| 文号 | 仿宋_GB2312 | 16pt(三号) | 居中 | 0 | 0pt | 0pt | 1.5倍 |\r
| 一级标题 | 黑体 | 16pt(三号) | 左对齐 | 0 | 0pt | 0pt | 1.5倍 |\r
| 二级标题 | 楷体_GB2312 | 16pt(三号) | 左对齐 | 0 | 0pt | 0pt | 1.5倍 |\r
| 正文 | 仿宋_GB2312 | 16pt(三号) | 两端对齐 | 2字符 | 0pt | 0pt | 1.5倍 |\r
\r
**页面设置:**\r
- 纸张:A4(21cm × 29.7cm)\r
- 页边距:上 3.7cm,下 3.5cm,左 2.8cm,右 2.6cm\r
\r
---\r
\r
## 标题层级识别规则\r
\r
### Word/文本识别规则\r
\r
| 类型 | 识别规则 | 示例 |\r
|------|---------|------|\r
| 标题 | 第一个非空段落 | 关于xxx的请示 |\r
| 文号 | 第二个段落,符合公文号格式 | X发〔2024〕10号 |\r
| 一级标题 | 以"一、"、"二、"等开头 | 一、基本情况 |\r
| 二级标题 | 以"(一)"、"(二)"等开头 | (一)主要业绩 |\r
| 正文 | 其他段落 | 正文内容... |\r
\r
### Markdown 识别规则\r
\r
| Markdown 标记 | 对应层级 |\r
|--------------|---------|\r
| # Title | 标题 |\r
| ## Heading | 一级标题 |\r
| ### Subheading | 二级标题 |\r
| - List item | 正文(列表项) |\r
| 普通文本 | 正文 |\r
\r
---\r
\r
## 格式转换矩阵\r
\r
| 输入格式 | 支持的输出格式 | 说明 |\r
|---------|---------------|------|\r
| .docx | .docx, .md, .txt | 保留格式信息 |\r
| .md | .docx, .md, .txt | 识别标题层级 |\r
| .txt | .docx, .md, .txt | 智能识别标题 |\r
\r
---\r
\r
## 脚本位置\r
\r
本 skill 包含以下脚本:\r
\r
| 脚本 | 功能 |\r
|------|------|\r
| `extract_format.py` | 从 Word 模板提取格式 → 输出 JSON |\r
| `apply_format.py` | 应用格式到 Word 文档 |\r
| `apply_multi_format.py` | **【推荐】**多格式统一处理入口 |\r
| `format_bridge.py` | 多格式文档读写核心库 |\r
\r
脚本目录:`C:\Users\14032\.codebuddy\skills\doc-format-brush\scripts\`\r
\r
---\r
\r
## 常见错误与修正\r
\r
| 错误现象 | 原因 | 修正方式 |\r
|----------|------|----------|\r
| 首行缩进显示为厘米而非字符 | 使用了 `Cm()` 而非 XML 属性 | 使用 `w:firstLineChars` 设置字符数 |\r
| 段后间距仍有 10pt | Word Normal 样式默认值未覆盖 | 强制 `pf.space_after = Pt(0)` |\r
| 对齐方式为左对齐而非两端对齐 | 未正确设置 JUSTIFY | 使用 `WD_ALIGN_PARAGRAPH.JUSTIFY` |\r
| 中文字体未变化 | 只设了 `font.name` | 同时设置 `w:eastAsia` 属性 |\r
| 文件保存报 PermissionError | 目标文件在 Word 中打开 | 换一个新文件名保存 |\r
\r
---\r
\r
## 典型对话示例\r
\r
**用户 A:** "把这份 Markdown 报告改成公文格式 Word"\r
\r
**AI:** 使用内置公文格式处理 Markdown:\r
```bash\r
python apply_multi_format.py 报告.md --official --output 报告_公文格式.docx\r
```\r
\r
**用户 B:** "参照这个 Word 模板,调整我的笔记文件"\r
\r
**AI:** 参照模板格式处理:\r
```bash\r
python apply_multi_format.py 我的笔记.md 模板.docx --output 笔记_整理.docx\r
```\r
\r
**用户 C:** "把这个文本文件转成带格式的 Markdown"\r
\r
**AI:** 使用内置格式输出 Markdown:\r
```bash\r
python apply_multi_format.py 原始笔记.txt --official --output 格式化笔记.md\r
```\r
安全使用建议
This skill appears coherent and local-only, but it executes Python code on files you provide. Before installing or allowing autonomous invocation: (1) ensure your environment has python-docx (pip install python-docx) or install in a sandbox; (2) inspect the scripts if you have sensitive files—they operate on local files and will overwrite or create outputs at paths you specify; (3) test first on non-sensitive documents to confirm behavior and formatting; (4) consider disabling autonomous invocation or limiting the skill's access until you are comfortable (agent will run the included scripts when invoked). Note: SKILL.md contains a hardcoded developer path (C:\Users\14032\...), which is likely an artifact and not required for operation.
功能分析
Type: OpenClaw Skill Name: doc-format-brush Version: 1.0.0 The doc-format-brush skill bundle is a legitimate utility for extracting and applying document formatting across Word (.docx), Markdown, and plain text files. The included Python scripts (apply_format.py, extract_format.py, apply_multi_format.py, and format_bridge.py) use the standard python-docx library for document manipulation and contain no evidence of data exfiltration, unauthorized network access, or malicious execution. The instructions in SKILL.md are strictly aligned with the stated purpose of formatting documents according to templates or the GB/T 9704-2012 standard.
能力评估
Purpose & Capability
Name/description describe extracting and applying document formatting; the included scripts (extract_format.py, apply_format.py, apply_multi_format.py, format_bridge.py) implement exactly that functionality and do not request unrelated credentials or binaries.
Instruction Scope
SKILL.md instructs running the included Python scripts on user-supplied files and describes expected CLI arguments and outputs. The instructions operate on local files only and do not direct the agent to read unrelated system files, environment variables, or to transmit data to external endpoints. The SKILL.md does include a Windows path to the skill folder (likely a build-time artifact), which is informational but not action-oriented.
Install Mechanism
There is no install spec (no downloads or package installs). The scripts import python-docx (and standard libs). The skill doesn't declare dependencies up front; running extract_format.py will print a Pip hint if python-docx is missing. Note: missing explicit dependency declaration means the runtime environment must already have python-docx or the user must install it manually.
Credentials
The skill does not require environment variables, credentials, or config paths. The code reads only files provided as CLI arguments and writes output files; no secrets or external service tokens are requested.
Persistence & Privilege
always is false and the skill does not attempt to modify other skills or system-wide agent settings. Scripts create output files only at user-specified locations.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install doc-format-brush
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /doc-format-brush 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
支持Word、Markdown、纯文本格式互转
元数据
Slug doc-format-brush
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

文档格式刷 是什么?

文档格式刷 skill。当用户需要将某个文档的格式调整成与另一个模板文档完全一致时使用,支持任意格式文档(Word、Markdown、纯文本)的格式整理。包括字体、字号、对齐方式、首行缩进、行距、段前段后间距、页边距等。更支持智能识别标题层级(标题、一级标题、二级标题、正文),应用不同格式。支持内置公文格式(GB... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 166 次。

如何安装 文档格式刷?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install doc-format-brush」即可一键安装,无需额外配置。

文档格式刷 是免费的吗?

是的,文档格式刷 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

文档格式刷 支持哪些平台?

文档格式刷 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 文档格式刷?

由 yechao1995(@yechao1995)开发并维护,当前版本 v1.0.0。

💬 留言讨论