๐ document-format-skills
๐ก ๆณ่ฆๆ ้่็ฝใไธ้ฎ่ฟ่กไฟฎๅคๆ ผๅผ็ๆก้ขๅบ็จ็ๆฌ๏ผ
็ฐๅทฒๆจๅบ Document Format GUI โโ ๆ ้่็ฝใไธ้ฎไฟฎๅคๅ ฌๆๆ ผๅผ็ๆก้ขๅบ็จ๏ผๅฐ็ฝไน่ฝ่ฝปๆพไธๆ๏ผ
A Word document formatting toolkit for Chinese documents (docx). Diagnose formatting issues, fix punctuation, and apply standardized styles with one command. Available for Claude Code, Codex, OpenCode.
โจ Features
| Module | Description | Script |
|---|---|---|
| Format Analyzer | Detect formatting issues in documents | analyzer.py |
| Punctuation Fixer | Fix mixed Chinese/English punctuation | punctuation.py |
| Style Formatter | Apply preset formatting standards | formatter.py |
๐ Quick Start
Prerequisites
- Python 3.8+
- uv (recommended) or pip
Installation
git clone https://github.com/yourusername/document-format-skills.git
cd document-format-skills
Usage
1. Diagnose formatting issues
uv run --with python-docx python scripts/analyzer.py input.docx
2. Fix punctuation
uv run --with python-docx python scripts/punctuation.py input.docx output.docx
3. Apply formatting preset
# Official document format (GB/T 9704-2012)
uv run --with python-docx python scripts/formatter.py input.docx output.docx --preset official
# Academic paper format
uv run --with python-docx python scripts/formatter.py input.docx output.docx --preset academic
# Legal document format
uv run --with python-docx python scripts/formatter.py input.docx output.docx --preset legal
๐ What It Fixes
Punctuation Issues
The toolkit intelligently converts punctuation based on context:
| Type | Incorrect | Chinese | English |
|---|---|---|---|
| Parentheses | Mixed usage | ๏ผ๏ผ | () |
| Quotes | Straight " |
"" '' | "" '' |
| Colon | Mixed usage | ๏ผ | : |
| Comma | Mixed usage | ๏ผ | , |
| Period | Mixed usage | ใ | . |
| Semicolon | Mixed usage | ๏ผ | ; |
| Ellipsis | ... |
โฆโฆ | ... |
| Dash | -- |
โโ | -- |
Format Issues
- Paragraph indentation โ Detects missing first-line indents
- Line spacing โ Identifies inconsistent spacing
- Font usage โ Flags mixed fonts and sizes
- Numbering โ Catches inconsistent numbering styles (e.g., mixing
1.with1ใ)
๐ Formatting Presets
Official Document (GB/T 9704-2012)
Chinese government document standard:
- Page: A4, margins: top 37mm, bottom 35mm, left 28mm, right 26mm
- Title: FangZheng XiaoBiaoSong, 22pt, centered
- Body: FangSong_GB2312, 16pt, 2-character indent, 28pt line spacing
- Headings: Structured with ไธใ/ ๏ผไธ๏ผ/ 1. / ๏ผ1๏ผ
Academic Paper
Standard academic formatting:
- Page: A4, 25mm margins
- Title: SimHei, 18pt, bold, centered
- Body: SimSun/Times New Roman, 12pt, 1.5x line spacing
Legal Document
Legal document formatting:
- Page: A4, margins: top 30mm, bottom 25mm, left 30mm, right 25mm
- Title: SimSun bold, 22pt, centered
- Body: SimSun, 14pt, 1.5x line spacing
๐ Project Structure
document-format-skills/
โโโ README.md # English documentation
โโโ README_CN.md # Chinese documentation
โโโ SKILL.md # Skill definition file
โโโ scripts/
โโโ analyzer.py # Format diagnostics
โโโ punctuation.py # Punctuation fixer
โโโ formatter.py # Style formatter
๐ง Dependencies
Automatically installed when using uv run --with python-docx.
โ ๏ธ Notes
- Only supports
.docxโ Legacy.docformat is not supported - Backup your files โ Always keep a backup before processing
- Font requirements โ Output files require corresponding fonts installed on the system to display correctly
- Table content โ Text within tables is also processed
๐ License
MIT License
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.