文档格式刷

v1.0.0

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

0· 160·1 current·1 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for yechao1995/doc-format-brush.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "文档格式刷" (yechao1995/doc-format-brush) from ClawHub.
Skill page: https://clawhub.ai/yechao1995/doc-format-brush
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install doc-format-brush

ClawHub CLI

Package manager switcher

npx clawhub@latest install doc-format-brush
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
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.
Assessment
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.

Like a lobster shell, security has layers — review code before you run it.

latestvk97b6rd8zkr7cc8zqmgjr4jxk9837v3p
160downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

文档格式刷 (Doc Format Brush)

概述

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

核心功能

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

使用方式

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

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

python apply_multi_format.py <输入文档> --official --output <输出文档>

支持的输入格式:.docx, .md, .txt 支持的输出格式:.docx, .md, .txt

示例:

# Markdown 转 Word 公文格式
python apply_multi_format.py 报告.md --official --output 报告_公文.docx

# 纯文本转 Markdown
python apply_multi_format.py 笔记.txt --official --output 笔记.md

# Word 转为 Word(使用公文格式)
python apply_multi_format.py 财务报告.docx --official --output 财务报告_公文格式.docx

方式二:参照模板文档

当用户提供了特定的模板文档时:

从模板提取格式后应用到目标:

python apply_multi_format.py <目标文档> <模板.docx> --output <输出文档>

示例:

# 参照 Word 模板,调整 Markdown 文件
python apply_multi_format.py 报告.md 模板.docx --output 报告_新格式.docx

# 参照模板,转换 Word 到 Word
python apply_multi_format.py 源文件.docx 模板.docx --output 目标文件.docx

方式三:使用格式描述文件

可以先提取模板格式为 JSON,然后复用:

# 提取格式
python extract_format.py 模板.docx --output 格式.json

# 应用格式
python apply_multi_format.py 输入.md --format-json 格式.json --输出 输出.docx

内置公文格式规范(GB/T 9704-2012)

段落类型字体字号对齐缩进段前段后行距
标题方正小标宋体22pt(二号)居中00pt0pt1.5倍
文号仿宋_GB231216pt(三号)居中00pt0pt1.5倍
一级标题黑体16pt(三号)左对齐00pt0pt1.5倍
二级标题楷体_GB231216pt(三号)左对齐00pt0pt1.5倍
正文仿宋_GB231216pt(三号)两端对齐2字符0pt0pt1.5倍

页面设置:

  • 纸张:A4(21cm × 29.7cm)
  • 页边距:上 3.7cm,下 3.5cm,左 2.8cm,右 2.6cm

标题层级识别规则

Word/文本识别规则

类型识别规则示例
标题第一个非空段落关于xxx的请示
文号第二个段落,符合公文号格式X发〔2024〕10号
一级标题以"一、"、"二、"等开头一、基本情况
二级标题以"(一)"、"(二)"等开头(一)主要业绩
正文其他段落正文内容...

Markdown 识别规则

Markdown 标记对应层级
# Title标题
## Heading一级标题
### Subheading二级标题
- List item正文(列表项)
普通文本正文

格式转换矩阵

输入格式支持的输出格式说明
.docx.docx, .md, .txt保留格式信息
.md.docx, .md, .txt识别标题层级
.txt.docx, .md, .txt智能识别标题

脚本位置

本 skill 包含以下脚本:

脚本功能
extract_format.py从 Word 模板提取格式 → 输出 JSON
apply_format.py应用格式到 Word 文档
apply_multi_format.py**【推荐】**多格式统一处理入口
format_bridge.py多格式文档读写核心库

脚本目录:C:\Users\14032\.codebuddy\skills\doc-format-brush\scripts\


常见错误与修正

错误现象原因修正方式
首行缩进显示为厘米而非字符使用了 Cm() 而非 XML 属性使用 w:firstLineChars 设置字符数
段后间距仍有 10ptWord Normal 样式默认值未覆盖强制 pf.space_after = Pt(0)
对齐方式为左对齐而非两端对齐未正确设置 JUSTIFY使用 WD_ALIGN_PARAGRAPH.JUSTIFY
中文字体未变化只设了 font.name同时设置 w:eastAsia 属性
文件保存报 PermissionError目标文件在 Word 中打开换一个新文件名保存

典型对话示例

用户 A: "把这份 Markdown 报告改成公文格式 Word"

AI: 使用内置公文格式处理 Markdown:

python apply_multi_format.py 报告.md --official --output 报告_公文格式.docx

用户 B: "参照这个 Word 模板,调整我的笔记文件"

AI: 参照模板格式处理:

python apply_multi_format.py 我的笔记.md 模板.docx --output 笔记_整理.docx

用户 C: "把这个文本文件转成带格式的 Markdown"

AI: 使用内置格式输出 Markdown:

python apply_multi_format.py 原始笔记.txt --official --output 格式化笔记.md

Comments

Loading comments...