Find formatting drift in a Word docx by comparing the document against itself: resolve each paragraph's effective formatting through the docDefaults and based-on style chain, with direct formatting last, group paragraphs by style, and report grouped defects with the fix for each kind, plus an explicit list of what was not inspected. Ships a tested standard library resolver and a planted defect test document with a scored answer key. Use when a docx looks inconsistent, pasted text brought foreign fonts or sizes, headings or body text drift between sections, or a document needs a formatting cleanup before it ships.
./install.sh document-formatting-auditname: document_formatting_audit description: Find formatting drift in a Word docx by comparing the document against itself: resolve each paragraph's effective formatting through the docDefaults and based-on style chain, with direct formatting last, group paragraphs by style, and report grouped defects with the fix for each kind, plus an explicit list of what was not inspected. Ships a tested standard library resolver and a planted defect test document with a scored answer key. Use when a docx looks inconsistent, pasted text brought foreign fonts or sizes, headings or body text drift between sections, or a document needs a formatting cleanup before it ships.
Find where a Word document disagrees with itself. A docx stores formatting in layers: document defaults, a chain of styles linked by Based On, and direct formatting pasted or typed on top. The visible fault, one paragraph in the wrong size, is usually a direct value beating the style, and it will not move when the style is fixed. This skill resolves every paragraph's effective formatting through those layers, groups paragraphs by the style they claim to follow, and reports the ones that break their own group's pattern. No external style guide is needed, and none is invented. The document is its own standard.
python3 bin/audit_docx.py FILE.docx --json report.json from this skill's folder. It reads word/styles.xml and word/document.xml with the Python standard library only, resolves effective paragraph properties and the effective properties of each paragraph's longest run, and prints defects grouped by kind plus the uninspected list. Exit 0 means no defects in what was inspected, exit 1 means defects found, exit 2 means the file could not be read. Read references/resolution-order.md before arguing with its output: it sets out the layer order, the units (spacing in twentieths of a point, font size in half points), and the toggle property trap.group_outlier, look at the group value, the paragraph's value, and its text preview. A group under 3 paragraphs is not scored, and a property with no strict majority has no consensus to drift from, so neither appears. If a style group splits evenly between two values, write that split up as a finding in your own words: two different uses are sharing one style name.direct_run_override on a whole pasted paragraph is drift. A direct_run_override on one bold word mid sentence is usually deliberate emphasis. The defect list shows a text sample for every run finding. Sort findings into confirmed drift, deliberate exception, and needs a human call. Never present raw tool output as confirmed faults without this pass.references/defect-kinds.md. The short version: style value intended means clear the direct formatting (Ctrl+Q for paragraph formatting, Ctrl+Space for character formatting in Word), everyone should change means edit the style, one paragraph is special means keep it and record it as a deliberate exception. Direct overrides and outliers on the same paragraph and property are one fault seen two ways. Count them once.python3 tests/make_test_docx.py rebuilds the planted test document and its answer key, then run the audit on tests/test_document.docx and score it with python3 tests/score_audit.py report.json. The expected result is 9 of 9 planted defects, no false positives, and no defects on clean paragraphs. Run this before trusting the tool on a new Python version or after editing it.publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.