Standard Word Doc Skill
Core Principle
This skill is a document template engine. Format consistency has priority over
content richness. Prefer deterministic .docx generation and repair over
manual visual tweaks.
assets/standard-word-template.docx is the formatting authority for headings,
body text, lists, page setup, headers, footers, numbering, and spacing. It is
based on the Pudong feasibility-study document style. Tables are the explicit
exception: always use the standard blue-header table style described in
references/style-guide.md. Do not hard-code blue headings, Arial/微软雅黑, or
other fallback styles when the template exists.
If the template is missing, use the fallback style specification in
references/style-guide.md instead of stopping.
Workflow Decision
Classify the task before acting:
| User request |
Pipeline |
| User provides requirements, notes, outline, or asks for a new Word document |
Pipeline A: Generate |
User provides Markdown text, .md, LLMWiki output, API design Markdown, or asks to convert to Word |
Pipeline B: Markdown to DOCX |
User provides an existing .docx and asks to check, fix, repair, standardize, or audit formatting |
Pipeline C: Audit and Repair |
If the request mixes pipelines, run them in order. For example: convert Markdown
to .docx, then audit/repair the generated .docx.
Pipeline A: Generate
- Identify document type: implementation plan, construction plan, test report,
summary report, API detail design, data governance report, or other.
- Organize content into H1-H7 structure. Do not hard-code chapter numbers in
body text; use Word Heading styles.
- Write a temporary Markdown file with frontmatter when useful:
---
title: 大数据平台接口详细设计
document_type: 详细设计文档
organization: XXXX单位
version: V1.0
date: 2026年05月15日
---
- Run:
python3 scripts/render_standard_docx.py input.md --output-dir "$HOME/Documents/AI-Stack-Outputs/word-docs"
- Return the output path and state whether TOC/page fields need refreshing in
Word/WPS or via
scripts/finalize_docx.sh.
Pipeline B: Markdown To DOCX
- If the user pasted Markdown, save it to a temporary
.md file.
- Preserve semantic structure:
# to #### for H1-H4, Markdown tables for
tables, -/*/+ for bullets, and 1. for ordered lists.
- For LLMWiki or API detail design content, normalize overly wide tables and
fenced JSON/SQL/Java blocks before rendering. Prefer formal tables for API
metadata, request parameters, response fields, error codes, and examples.
- Run
scripts/render_standard_docx.py. The script handles frontmatter,
headings, body paragraphs, bullet lists, ordered lists, tables, and fenced
code blocks.
- For parallel items, use the approved black-diamond marker
◆ followed by
the item text. Do not use other decorative bullet characters such as •,
·, ▪, or — as manual bullets.
- Strip manual heading numbers such as
一、, 第一章, 1.1, and 1.1.1
before applying Word Heading styles. Word/WPS heading numbering supplies the
visible number.
Pipeline C: Audit And Repair
For audit only:
python3 scripts/audit_standard_docx.py input.docx --output "$HOME/Documents/AI-Stack-Outputs/word-docs/input_audit.md"
For direct repair:
python3 scripts/repair_standard_docx.py input.docx
Repair output must not overwrite the source file. When the template exists,
repair rebuilds the document from assets/standard-word-template.docx: it
extracts source content, recreates paragraphs and tables in document order, and
applies the template's styles instead of preserving source direct formatting.
The repaired file uses the _repaired.docx suffix and a companion
_repair_summary.md explains what was changed and what still requires human
confirmation.
Format Checklist
Use this checklist for both auditing and repair. See
references/style-guide.md for exact numeric style values.
Errors: Repair Automatically
- Unicode bullet characters at paragraph start -> remove the character and
apply Word
List Bullet.
- Parallel list paragraphs -> normalize to
◆内容.
- Body paragraph using inline bold plus size >= 14pt as a fake heading -> apply
the matching Heading style.
- Manual numbering at the start of Heading paragraphs, such as
一、, 第一章,
1.1, or 1.1.1 -> remove the manual number and keep the Heading style.
- Symbol, Wingdings, Wingdings 2, or Wingdings 3 fonts -> replace with
Arial/微软雅黑.
- Hard line breaks inside a paragraph -> split into independent paragraphs.
Warnings: Repair When Safe And Report
- Body text uses more than two different font sizes -> rebuild from template
when available; otherwise normalize body runs to the fallback body size.
- Table width uses percent values -> convert tables to fixed DXA widths.
- Consecutive empty paragraphs -> keep one and remove extras.
Needs Human Confirmation: Report Only
- Manual numbering such as
1., (一), or 第一章 written in body style.
Heading-style manual numbering is repaired automatically.
- Heading hierarchy jumps, such as H1 directly followed by H3.
- Missing page-number field.
- Full-width spaces or missing Chinese-English spacing in body text.
Template Formatting Rules
When assets/standard-word-template.docx exists:
- Treat the template as the only visual standard.
- Use template styles such as
Title, Heading 1 through Heading 7,
Body Ref, List Paragraph, Table Grid, and Footer when present.
- Keep template page sections, headers, footers, numbering, fonts, colors,
paragraph spacing, table style, and margins.
- Override tables with the standard table style: blue header with white bold
centered text, black regular-weight body text, light-blue/white alternating body rows,
and light-gray borders.
- Do not apply direct run formatting unless needed to preserve code blocks in a
no-template fallback or to enforce the standard table style.
- Do not keep source-document direct formatting during repair. Source content is
the input; template formatting is the output.
Default Style Fallback
When no template exists, scripts must create a valid .docx using:
- Body: Arial/微软雅黑, 11pt, black, 0pt before, 8pt after, 1.15 line spacing.
- H1: 22pt bold, black, 24pt before, 4pt after.
- H2: 16pt bold, black, 8pt before, 4pt after.
- H3: 15pt bold, black, 8pt before, 4pt after.
- H4: 14pt bold, black, 4pt before, 2pt after.
- Page: A4, top/bottom 2.54cm, left/right 3.17cm.
- Table header:
#1F5FAE background, white bold centered text.
- Table body: alternating
#F3F6FB and #FFFFFF rows, black regular-weight text.
Hard Rules
- Never use unapproved Unicode bullets. Use
◆ only for parallel list items.
- Never simulate headings with bold body text. Use Heading styles.
- Never use Symbol or Wingdings fonts.
- Never overwrite user source
.docx files during repair.
- Default output directory is
$HOME/Documents/AI-Stack-Outputs/word-docs.
- Do not require LibreOffice, Word, WPS, or Pandoc for default generation.
- If LibreOffice is available and the user asks to refresh fields, run
scripts/finalize_docx.sh.
Dependencies
Required:
pip install python-docx
scripts/check_dependencies.sh
Optional field refresh:
brew install --cask libreoffice
1---2name: standard-word-doc3description: Apply or repair this skill's standard Chinese Word document house style, including headings, lists, tables, fonts, spacing, and page numbers. Use only when the user asks for standardized Word formatting or this house format; use docx-win for general native Word work and docx-template-translator for a supplied template.4---56# Standard Word Doc Skill78## Core Principle910This skill is a document template engine. Format consistency has priority over11content richness. Prefer deterministic `.docx` generation and repair over12manual visual tweaks.1314`assets/standard-word-template.docx` is the formatting authority for headings,15body text, lists, page setup, headers, footers, numbering, and spacing. It is16based on the Pudong feasibility-study document style. Tables are the explicit17exception: always use the standard blue-header table style described in18`references/style-guide.md`. Do not hard-code blue headings, Arial/微软雅黑, or19other fallback styles when the template exists.2021If the template is missing, use the fallback style specification in22`references/style-guide.md` instead of stopping.2324## Workflow Decision2526Classify the task before acting:2728| User request | Pipeline |29| --- | --- |30| User provides requirements, notes, outline, or asks for a new Word document | Pipeline A: Generate |31| User provides Markdown text, `.md`, LLMWiki output, API design Markdown, or asks to convert to Word | Pipeline B: Markdown to DOCX |32| User provides an existing `.docx` and asks to check, fix, repair, standardize, or audit formatting | Pipeline C: Audit and Repair |3334If the request mixes pipelines, run them in order. For example: convert Markdown35to `.docx`, then audit/repair the generated `.docx`.3637## Pipeline A: Generate38391. Identify document type: implementation plan, construction plan, test report,40 summary report, API detail design, data governance report, or other.412. Organize content into H1-H7 structure. Do not hard-code chapter numbers in42 body text; use Word Heading styles.433. Write a temporary Markdown file with frontmatter when useful:4445```markdown46---47title: 大数据平台接口详细设计48document_type: 详细设计文档49organization: XXXX单位50version: V1.051date: 2026年05月15日52---53```54554. Run:5657```bash58python3 scripts/render_standard_docx.py input.md --output-dir "$HOME/Documents/AI-Stack-Outputs/word-docs"59```60615. Return the output path and state whether TOC/page fields need refreshing in62 Word/WPS or via `scripts/finalize_docx.sh`.6364## Pipeline B: Markdown To DOCX65661. If the user pasted Markdown, save it to a temporary `.md` file.672. Preserve semantic structure: `#` to `####` for H1-H4, Markdown tables for68 tables, `-`/`*`/`+` for bullets, and `1.` for ordered lists.693. For LLMWiki or API detail design content, normalize overly wide tables and70 fenced JSON/SQL/Java blocks before rendering. Prefer formal tables for API71 metadata, request parameters, response fields, error codes, and examples.724. Run `scripts/render_standard_docx.py`. The script handles frontmatter,73 headings, body paragraphs, bullet lists, ordered lists, tables, and fenced74 code blocks.755. For parallel items, use the approved black-diamond marker `◆` followed by76 the item text. Do not use other decorative bullet characters such as `•`,77 `·`, `▪`, or `—` as manual bullets.786. Strip manual heading numbers such as `一、`, `第一章`, `1.1`, and `1.1.1`79 before applying Word Heading styles. Word/WPS heading numbering supplies the80 visible number.8182## Pipeline C: Audit And Repair8384For audit only:8586```bash87python3 scripts/audit_standard_docx.py input.docx --output "$HOME/Documents/AI-Stack-Outputs/word-docs/input_audit.md"88```8990For direct repair:9192```bash93python3 scripts/repair_standard_docx.py input.docx94```9596Repair output must not overwrite the source file. When the template exists,97repair rebuilds the document from `assets/standard-word-template.docx`: it98extracts source content, recreates paragraphs and tables in document order, and99applies the template's styles instead of preserving source direct formatting.100The repaired file uses the `_repaired.docx` suffix and a companion101`_repair_summary.md` explains what was changed and what still requires human102confirmation.103104## Format Checklist105106Use this checklist for both auditing and repair. See107`references/style-guide.md` for exact numeric style values.108109### Errors: Repair Automatically110111- Unicode bullet characters at paragraph start -> remove the character and112 apply Word `List Bullet`.113- Parallel list paragraphs -> normalize to `◆内容`.114- Body paragraph using inline bold plus size >= 14pt as a fake heading -> apply115 the matching Heading style.116- Manual numbering at the start of Heading paragraphs, such as `一、`, `第一章`,117 `1.1`, or `1.1.1` -> remove the manual number and keep the Heading style.118- Symbol, Wingdings, Wingdings 2, or Wingdings 3 fonts -> replace with119 Arial/微软雅黑.120- Hard line breaks inside a paragraph -> split into independent paragraphs.121122### Warnings: Repair When Safe And Report123124- Body text uses more than two different font sizes -> rebuild from template125 when available; otherwise normalize body runs to the fallback body size.126- Table width uses percent values -> convert tables to fixed DXA widths.127- Consecutive empty paragraphs -> keep one and remove extras.128129### Needs Human Confirmation: Report Only130131- Manual numbering such as `1.`, `(一)`, or `第一章` written in body style.132 Heading-style manual numbering is repaired automatically.133- Heading hierarchy jumps, such as H1 directly followed by H3.134- Missing page-number field.135- Full-width spaces or missing Chinese-English spacing in body text.136137## Template Formatting Rules138139When `assets/standard-word-template.docx` exists:140141- Treat the template as the only visual standard.142- Use template styles such as `Title`, `Heading 1` through `Heading 7`,143 `Body Ref`, `List Paragraph`, `Table Grid`, and `Footer` when present.144- Keep template page sections, headers, footers, numbering, fonts, colors,145 paragraph spacing, table style, and margins.146- Override tables with the standard table style: blue header with white bold147 centered text, black regular-weight body text, light-blue/white alternating body rows,148 and light-gray borders.149- Do not apply direct run formatting unless needed to preserve code blocks in a150 no-template fallback or to enforce the standard table style.151- Do not keep source-document direct formatting during repair. Source content is152 the input; template formatting is the output.153154## Default Style Fallback155156When no template exists, scripts must create a valid `.docx` using:157158- Body: Arial/微软雅黑, 11pt, black, 0pt before, 8pt after, 1.15 line spacing.159- H1: 22pt bold, black, 24pt before, 4pt after.160- H2: 16pt bold, black, 8pt before, 4pt after.161- H3: 15pt bold, black, 8pt before, 4pt after.162- H4: 14pt bold, black, 4pt before, 2pt after.163- Page: A4, top/bottom 2.54cm, left/right 3.17cm.164- Table header: `#1F5FAE` background, white bold centered text.165- Table body: alternating `#F3F6FB` and `#FFFFFF` rows, black regular-weight text.166167## Hard Rules168169- Never use unapproved Unicode bullets. Use `◆` only for parallel list items.170- Never simulate headings with bold body text. Use Heading styles.171- Never use Symbol or Wingdings fonts.172- Never overwrite user source `.docx` files during repair.173- Default output directory is `$HOME/Documents/AI-Stack-Outputs/word-docs`.174- Do not require LibreOffice, Word, WPS, or Pandoc for default generation.175- If LibreOffice is available and the user asks to refresh fields, run176 `scripts/finalize_docx.sh`.177178## Dependencies179180Required:181182```bash183pip install python-docx184scripts/check_dependencies.sh185```186187Optional field refresh:188189```bash190brew install --cask libreoffice191```