gostyan/docx-skill-4-cn-paper/docx-editor-cn
Claude Code and agent skill by gostyan/docx-skill-4-cn-paper
- community
Checking that the SKILL.md file is still in the repository.
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of \"Word doc\", \"word document\", \".docx\", or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a \"report\", \"memo\", \"letter\", \"template\", or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
Install
npx vskill@latest install gostyan/docx-skill-4-cn-paper/docx-editor-cnSKILL.md
DOCX creation, editing, and analysis
Overview
A .docx file is a ZIP archive containing XML files.
Quick Reference
| Task | Approach | |
|---|---|---|
| Read/analyze content | pandoc or unpack for raw XML | |
| Create new document | node scripts/new_doc.js (edit CONTENT section first) | |
| Edit existing document | Unpack → edit XML → repack - see Editing Existing Documents below | |
| Insert 三线表 (XML editing) | python scripts/table.py unpacked/ "1-1" "标题" --headers … --rows … | |
| Insert block formula (XML editing) | python scripts/formula.py unpacked/ "LaTeX" 1 --anchor "锚文本" |
Converting .doc to .docx
Legacy .doc files must be converted before editing:
Reading Content
Converting to Images
Accepting Tracked Changes
To produce a clean document with all tracked changes accepted (requires LibreOffice):
Creating New Documents
Generate .docx files with JavaScript, then validate. Install: npm install -g docx
Setup
Validation
After creating the file, validate it. If validation fails, unpack, fix the XML, and repack.
Page Size
Common page sizes (DXA units, 1440 DXA = 1 inch, 567 DXA = 1 cm):
| Paper | Width | Height | Content Width (2.5cm margins) | |
|---|---|---|---|---|
| A4 (Chinese standard) | 11,906 | 16,838 | 9,070 | |
| US Letter | 12,240 | 15,840 | 9,404 |
Landscape orientation: docx-js swaps width/height internally, so pass portrait dimensions and let it handle the swap:
Styles (Academic Thesis Formatting)
CRITICAL: When generating academic papers, course designs, or mathematical documents, strictly adhere to the following Chinese academic formatting standards.
1. Global Page & Normal Text (【全局页面与正文规范】)
- Page: A4 (11906 × 16838 DXA), margins all 2.5cm (
1418DXA). - Fonts: Chinese = SimSun (宋体), English/Math/Code = Cambria Math (default); Times New Roman is an acceptable alternative for English text.
- Size: 12pt (小四) ->
size: 24in docx-js (half-points). - Paragraph: First-line indent 2 characters (
firstLine: 480DXA), Line spacing single (line: 240, lineRule: LineRuleType.AUTO) by default; alternatives: fixed 20pt (line: 400, lineRule: LineRuleType.EXACT) or 1.5x (line: 360, lineRule: LineRuleType.AUTO). Before/After spacing 0pt.
2. Headings (【标题规范】)
- Heading 1 (一级标题): SimHei (黑体), 16pt (三号,
size: 32), Bold, Centered, 1.2x line spacing (line: 288). Auto-numbering: Arabic1,2,3(displayed in heading text or prefixed manually as 一、二、). See Heading & Reference Auto-Numbering below. - Heading 2 (二级标题): SimHei (黑体), 14pt (四号,
size: 28), Bold, Left-aligned, 1.5x line spacing (line: 360). Auto-numbering:1.1,1.2,2.1(chapter-tracking Arabic decimal). - Heading 3 (三级标题): SimHei (黑体), 12pt (小四,
size: 24), Bold, Left-aligned, 1.1x line spacing (line: 264). Auto-numbering:1.1.1,2.4.1.
⚠️ Heading Numbering Rule: Use a single all-decimal multi-level numbering config for all three heading levels. This is the ONLY way to get correct cross-chapter tracking (1.1, 2.1, 2.4 etc.) while keeping H2/H3 numbers purely Arabic. If CHINESE_COUNTING is used for H1 level, H2 will render as 二.4 instead of 2.4 — this is a known OOXML rendering issue.
3. Figures, Tables & Math (【图表与公式规范】)
- Figure Captions (图标题): SimSun (宋体), 11pt (
size: 22), Centered, Bold. Spacing: Single spacing, 0.5 lines before (before: 120), 3pt after (after: 60). Position: Below the figure. Format: "图 章-图序" e.g. "图 1-1". - Table Captions (表标题): SimSun (宋体), 11pt (
size: 22), Centered, no indent, Bold. Spacing: Single spacing, 0.5 lines before (before: 120), 3pt after (after: 60). Position: Above the table. Format: "表 章-表序" e.g. "表 1-1". Tables MUST use 三线表 (three-line table) style (thick top/bottom, thin after header, no other borders). - Block Math Formulas: Use the formula table layout — a 3-column borderless table: [1cm spacer | formula centered | equation number right-aligned 1cm]. Use
scripts/formula.pyto generate the XML. Inline math: write as plain text with italic formatting.
Creating a new document — use the template script:
scripts/new_doc.js provides ready-to-use helper functions: h1/h2/h3(text), body(text), tableCaption/figCaption(label), threeLineTable(headers, rows, colWidths), ref(text), blank(). The STYLES / NUMBERING / page constants at the top of the file are the canonical implementation of all specs below; refer to that file for exact docx-js values.
Lists (NEVER use unicode bullets)
Tables (三线表 / Three-Line Table)
Chinese academic papers MUST use 三线表: thick top/bottom (1.5pt), thin after header (0.75pt), no other borders. Caption goes above the table.
For new documents — use `threeLineTable()` helper in `scripts/new_doc.js`:
For editing existing documents (XML) — use `scripts/table.py`:
Key rules:
- Content width = 9070 DXA (A4 2.5cm margins);
columnWidthsmust sum exactly to 9070 - Always use
WidthType.DXA— neverWidthType.PERCENTAGE - Table width = sum of
columnWidths; set matchingwidthon each cell too
Images
Page Breaks
Table of Contents
Headers/Footers
Heading Auto-Numbering (Word per-chapter reset)
H1 uses Chinese numerals written literally in text (一、二、三). H2/H3 use Word auto-numbering via per-chapter numbering references (sections_c1, sections_c2, ...). Each chapter boundary resets H2/H3 counters automatically — adding/removing sections within a chapter triggers full auto-update.
CRITICAL — numbering format rule:
NEVER use LevelFormat.CHINESE_COUNTING for H1 in a multi-level config — %1 in H2 text expands to "二", giving 二.4. Always use LevelFormat.DECIMAL for every level.
Numbering references are generated dynamically by buildNumberingConfig(chapterCount). Each chapter gets its own sections_c{N} reference with 2 levels (H2, H3). This ensures H2/H3 reset per chapter while Word handles all numbering.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdocx-editor-cn/SKILL.md
Popularity
- Repository stars
- 276
- Repository forks
- 8
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/gostyan/docx-skill-4-cn-paper/docx-editor-cn)