Skip to content
Conduit

skill

Word-typesetting

Codex and Claude Code skill for formal Word report formatting.

AllenWang2005/Word-typesettingcommunitylistedunreviewed

Set up

Skills are installed by placing their folder where your agent loads skills.

The download comes from github.com/AllenWang2005/Word-typesetting itself, not from our server, so what you get is exactly what its author published.

Install instructions come from the README

Skills do not use an MCP config. Follow the steps in the README below.

README

synced Oct 22, 2026

Word Typesetting

English · 简体中文

Release License: MIT CI Stars Skill

A reusable Codex / Claude Code skill that formats formal Chinese Word (.docx) reports to a consistent academic standard — course designs, internship reports, thesis-style documents, and engineering calculation reports.

It is two things working together:

  1. A written standard (SKILL.md + references/) that tells the model exactly how a compliant report should look — typography, document structure, tables, figures, formulas, citations, numbers/units.
  2. Tooling (scripts/) that checks a finished .docx against the machine-checkable parts of that standard, and auto-fixes the safest issues.

The model does the actual editing (with the general DOCX tooling); this skill supplies the rules, a completion checklist, and a guardrail so nothing obvious slips through.


What it can do

Typography & language

  • Chinese body text in Songti/SimSun, English/numbers in Times New Roman, level 1–2 headings in Heiti (not bold), level-3 headings in bold Songti.
  • A full font-size hierarchy — see the table below.
  • Dominant-language punctuation normalization (Chinese vs. English), special marks (……, ——, 《 》), while protecting URLs, DOIs, code, formulas, decimals, and citation brackets.
  • Body justified, first-line indent 2 字符, 1.5× line spacing.

Document structure & page setup

  • Standard section order (cover → declarations → abstracts → TOC → body → references → appendix → acknowledgements).
  • A4 page setup, margins/gutter, headers/footers, Roman→Arabic page numbering via section breaks.
  • Auto-generated table of contents (with optional figure/table lists), multilevel heading numbering (1 / 1.1 / 1.1.1), widow/orphan control.
  • Headings left-aligned (title centered), no trailing punctuation, depth ≤ 3–4 levels; heading styles in styles.xml carry explicit fonts so WPS/Word cannot inherit the wrong typeface.

Tables, figures, formulas

  • White three-line tables (top/bottom rules ~1.5 pt, header rule ~0.75 pt), content 五号/10.5 pt (one size below body) and centered, caption above the table, header row repeated across page breaks; OMML formulas inside normal data tables are also 五号, while body display formulas remain 小四.
  • Figures with caption below, by-chapter numbering (图 1-1 / 表 2-3 / (3-1)), the "reference-before-appearance" rule.
  • Formulas authored as LaTeX and rendered to native Word OMML — variables italic, units/operators/functions upright; equation numbers right-aligned per chapter, cited as "由式 (3-1) 可得". For WPS-sensitive layouts, borderless 1×3 formula layout tables are treated as equation layout, not data tables.

Citations & references

  • In-text citations as superscript, field-backed cross-references to the whole bracketed [1] (brackets included, not a bare number).
  • Bibliography entries per GB/T 7714—2015 (numeric sequential-coding by default; author-year supported), with the right type tags ([J] [M] [D] [C] [S] [P] [EB/OL] …).

Numbers, units, appendix code

  • Half-width space between number and unit (20 m³/s) — except %, °, ℃/°C, which attach directly (50%, 30°, 25℃); GB 3100/3101/3102 units, GB/T 15835 numeral usage.
  • Appendix code after the main text with red comments (C00000).

Font-size hierarchy

Defaults below; a school/journal template always takes precedence.

ElementSizeFont / style
Cover title二号 (22 pt)Heiti, bold, centered
Section titles (abstract / TOC / references)小二 (18 pt)Heiti, not bold
Heading 1 (chapter)三号 (16 pt)Heiti, not bold; 0.5-line space before/after
Heading 2 (section)四号 (14 pt)Heiti, not bold
Heading 3 (subsection)小四 (12 pt)Songti, bold
Body小四 (12 pt)Songti (CJK) / Times New Roman (Latin & digits)
Abstract / keywords小四 (12 pt)Songti
Figure / table captions五号 (10.5 pt)Songti (CJK) / Times New Roman (Latin), centered
Table content五号 (10.5 pt)Songti, one size below body
Table notes小五 (9 pt)Songti
Reference entries五号 (10.5 pt)Songti, hanging indent
Header / footer小五 (9 pt)Songti
Footnotes小五 (9 pt)Songti

What the result looks like

A polished, navigable report: a clickable heading outline and an auto-updating TOC; left-aligned Heiti headings over Songti body text at a consistent size; clean white three-line tables with captions above and figures with captions below, all numbered by chapter; real Word equation objects instead of pasted images or plain text; superscript [1]-style citations that renumber themselves because they are Word cross-reference fields; and a GB/T 7714—2015 reference list. Running the auditor on a finished file prints PASS: no machine-detected guardrail issues.

See examples/ for a deliberately non-compliant sample and the audit report it produces — a concrete before/after of what the rules catch.

Install

Install from GitHub:

AllenWang2005/Word-typesetting

Or copy the folder into your skills directory:

~/.codex/skills/word-report-formatting                 # Codex, macOS / Linux
%USERPROFILE%\.codex\skills\word-report-formatting     # Codex, Windows
~/.claude/skills/word-report-formatting                # Claude Code

Use

Ask the assistant to use the skill when creating or polishing a Word report:

Use $word-report-formatting to format this course design report.

It also triggers naturally for formal Chinese Word reports, three-line tables, OMML formulas, figure/table captions, citation cross-references, or appendix code.

The audit script

After formatting a DOCX, run the guardrail:

python scripts/audit_docx_format.py path/to/report.docx
python scripts/audit_docx_format.py path/to/report.docx --json   # machine-readable

It reports FAIL (machine-certain violations) and WARN (needs a human look), ends with a FAIL/WARN summary, and notes any per-code truncation. Checks include:

CodeSeverityWhat it catches
ZH_PUNCT / EN_PUNCTFAILWrong-language punctuation in prose
ABSTRACT_INDENTFAILAbstract/keywords centered or indented
H1_CENTERFAILLevel-1 heading centered instead of left-aligned
H1_GAPWARNLevel-1 heading missing a blank gap before it
HEADING_PUNCTWARNHeading ends with punctuation
HEADING_FONT / BODY_FONTFAIL/WARNHeading resolves to the wrong font / body in Heiti
HEADING_STYLE_FONTFAILA used heading style lacks explicit Heiti/Songti fonts in styles.xml
HEADING_BOLDFAILLevel-1/2 heading is bold, or level-3 heading is not bold
HEADING_NO_STYLEWARNHeading-looking line that uses no Word heading style
TABLE_SIZEFAILOrdinary table text larger than body or not in the accepted table-text size range
TABLE_FORMULA_SIZEFAILIn-table OMML formula/symbol not explicit 五号/10.5 pt (w:sz=21, w:szCs=21); body formulas stay 小四
TABLE_BORDERSFAILTable has vertical/inner borders, incl. grids drawn by the referenced table style
TABLE_SHADINGFAILTable/cell shading, direct or from the table style's firstRow format (three-line tables are white)
TABLE_RULESFAILMissing/wrong three-line rules: no visible top/bottom rules, row-to-row insideH, row-exception/cell-level body borders, or header rule not thinner
TABLE_HEADER_REPEATWARNMulti-row table header not set to repeat across pages (w:tblHeader)
CAPTION_POSITIONWARNTable caption below table / figure caption above figure
CAPTION_ALIGNFAILA 表/图 caption paragraph is not centered
FLOAT_ORDERWARNFigure/table placed before its first in-text reference
COLORWARNStray non-black font color (hyperlinks/theme colors excluded)
CITATION_BRACKETSFAILFull-width citation brackets [1]
CITATION_FIELDSFAILCitations exist but no REF ref_### fields
CITATION_NO_BRACKETSWARNBare superscript number citation missing its brackets
VISIBLE_LATEXFAILVisible LaTeX source instead of OMML
FORMULA_TEXTFAIL/WARNPlain-text formula / quantity symbol that should be OMML
MATH_DUPLICATEFAILRendered OMML whose text still exists as plain text in the same paragraph (append-instead-of-replace)
FORMULA_DIGIT_ITALICFAILA number/operator in a formula is italic, incl. mixed runs like an italic F=44.5
FORMULA_MULTILETTER_ITALICFAIL2+ adjacent letters in a formula at OMML's default italic (unit/function needs m:sty="p"; CI-style coefficient needs splitting)
MANUAL_ITALIC_MATHFAILAn italicized plain-text pseudo-formula (e.g. italic F = 44.5 km²) instead of OMML
NUMBER_UNIT_SPACINGWARN20km glued (needs 20 km) or a space before %/°/℃
EQUATION_NUMBER_CENTERFAILA numbered display formula is centered (the number should be right-aligned)
EQUATION_NUMBER_TABSFAILA numbered display formula has no right tab stop for its number
EQUATION_UNNUMBEREDFAILA display equation has no chapter number (3-1)
EQUATION_NOT_REFERENCEDWARNA numbered equation is never cited in prose (由式 (3-1) 可得)
FORMULA_TEXT_TABLEWARNPlain-text formula/symbol inside a table cell that should be OMML
FIELDS_UPDATEWARNTOC/REF fields present but w:updateFields unset (results may be stale)
FIRSTLINE_FIXEDWARNFirst-line indent in fixed twips instead of characters (firstLineChars)
PACKAGE_INTEGRITYFAILCorrupt zip member or missing required package part

It is intentionally domain-neutral — no hard-coded field-specific symbol list.

Audit scope: the script inspects the main document story in word/document.xml, plus word/styles.xml (table-style shading/borders) and word/settings.xml (field updating). It does not audit headers, footers, footnotes, endnotes, comments, or embedded parts — verify those visually or with a deeper OOXML pass when they matter. Table-cell text is checked for font size, borders, shading, and plain-text formulas (WARN level), not punctuation/headings (this avoids false positives from numbers and short fragments in cells).

The auto-fix script

scripts/normalize_docx.py mechanically fixes the safe issues, preserving every other byte of the package. Always on: full-width citation brackets ([1] → [1]) and ASCII sentence punctuation between CJK characters (中文,中文 → 中文,中文). Opt-in: --units (20km → 20 km, 50 % → 50%), --tables (clear in-table shading, zero w:tblLook, repeat header rows across pages, stamp OMML formulas inside normal data tables to 五号), --update-fields (MS Word refreshes TOC/REF fields on open), --all:

python scripts/normalize_docx.py report.docx -o report.fixed.docx
python scripts/normalize_docx.py report.docx --all --in-place

The delivery gate

scripts/finalize_docx.py is the one command to run before delivering: it applies every safe mechanical fix in place, runs the full audit, and prints DELIVERY GATE: PASS/FAIL (non-zero exit on FAIL). Every Must-Fix rule is enforced at FAIL level, so a FAIL verdict blocks delivery:

python scripts/finalize_docx.py report.docx            # fix + audit + verdict
python scripts/finalize_docx.py report.docx --no-fix   # audit only

The formula replacement script

scripts/replace_math.py is the deterministic tool behind the formula rules: it converts LaTeX to native OMML (Pandoc, one batch) and splices each equation at the exact position of its plain-text original — cross-run tokens handled, surrounding characters preserved, font size stamped by context (body 小四, table 五号), display equations laid out with a center tab and a right-aligned number. Its JSON summary reports not_found and still_plain_text; both must be empty.

python scripts/replace_math.py report.docx registry.json --in-place
python scripts/replace_math.py --convert 'Q = \\frac{W}{T}'   # print OMML for one formula

It deliberately does not touch fonts, styles, formulas, or cross-references; those need judgement and stay with the model + the main standard.

Tests

Standard library only (no third-party dependencies):

python -m unittest discover -s tests -v

CI runs py_compile plus the test suite on Python 3.9 and 3.12 on every push (see .github/workflows/ci.yml).

Repository structure

.
├── SKILL.md
├── LICENSE
├── CHANGELOG.md
├── agents/
│   └── openai.yaml
├── references/
│   ├── formatting-standard.md                  # main checklist
│   ├── document-structure-and-page-setup.md    # structure, page setup, TOC, font sizes
│   ├── latex-omml-formula-workflow.md          # LaTeX → Word OMML workflow
│   ├── reference-style-gbt7714.md              # GB/T 7714—2015 bibliography format
│   ├── citation-crossrefs-ooxml.md             # in-text REF cross-reference OOXML
│   └── three-line-table-ooxml.md               # three-line table OOXML recipe
├── scripts/
│   ├── finalize_docx.py                        # delivery gate: fix + audit + verdict
│   ├── replace_math.py                         # LaTeX→OMML in-place formula replacement
│   ├── audit_docx_format.py                    # read-only guardrail
│   └── normalize_docx.py                       # safe auto-fixer
├── examples/
│   ├── README.md
│   ├── make_sample.py                          # builds compliant / non-compliant samples
│   ├── sample-audit-output.txt
│   └── sample-compliant-audit-output.txt
└── tests/
    ├── test_audit_docx_format.py
    ├── test_finalize_docx.py
    ├── test_normalize_docx.py
    └── test_replace_math.py

See CHANGELOG.md for the version history.

Maintenance notes

  • Keep SKILL.md concise so it loads quickly when the skill triggers.
  • Put detailed rules in references/.
  • Keep the auditor conservative: FAIL only for machine-checkable violations, WARN for items needing visual review.
  • Do not store private information, credentials, or one-off chat history in this repository.
  • When the standard changes, update the relevant reference file and refresh the summary/paths in SKILL.md.

License

MIT.

↑↓ navigate openesc close