agentleFS
70asunflower70asunflower/70asunflower-skills/strict-docx-audit/SKILL.md

strict-docx-audit

Skill1 starsChanged 13 days agoMITView on GitHub

Post-conversion comprehensive docx quality gate — 12 checks

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run a comprehensive 12-check audit on any .docx file (defaults tuned for Chinese engineering papers) and produce a unified pass/fail report.

    line 16
  2. Very specific:

    All page dimensions, margins, font names, and thresholds are configurable constants at the top of strict_audit.py.

    line 21
  3. Very specific:

    All checks are content-agnostic — no hard-coded document titles, chapter names, or section labels.

    line 23
  4. Distinctive:

    After source Markdown changes and re-conversion

    line 36
  5. Very specific:

    Before delivering the .docx to anyone

    line 37
  6. Distinctive:

    When this skill is invoked, you MUST follow this protocol exactly — no shortcuts, no selective checking, no "looks fine I'll skip the rest":

    line 41
  7. Distinctive:

    Never run individual checks manually or selectively.

    line 46
  8. Distinctive:

    Read ALL output: Do not stop reading after the first failure or after the summary table.

    line 47
  9. Distinctive:

    Every check line must be consumed.

    line 48
  10. Distinctive:

    Do NOT deliver the docx until all ❌ are resolved.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

strict-docx-audit — docx 严格审查

Purpose

Run a comprehensive 12-check audit on any .docx file (defaults tuned for Chinese engineering papers) and produce a unified pass/fail report.

Generality

  • All page dimensions, margins, font names, and thresholds are configurable constants at the top of strict_audit.py. Change them for non-A4 documents, English papers, etc.
  • All checks are content-agnostic — no hard-coded document titles, chapter names, or section labels. The only China-specific default is the 参考文献 heading name for superscript detection (works for any GB/T 7714 sequential-cited paper).
  • Works with any Markdown→DOCX converter, not just md2docx-formal. Check 5 (fidelity) auto-locates verify_fidelity.py if md2docx-formal is installed; skips gracefully if not found. Catches the most common conversion bugs before delivery — from the ones we've actually hit (bullet squares, list numbering continuation) to frequent but subtle issues (missing eastAsia, code/quote font mismatch, table header formatting).

When to use

  • Right after convert_doc.py finishes
  • After source Markdown changes and re-conversion
  • Before delivering the .docx to anyone

🔒 Mandatory execution protocol (DO NOT SKIP OR ABBREVIATE)

When this skill is invoked, you MUST follow this protocol exactly — no shortcuts, no selective checking, no "looks fine I'll skip the rest":

  1. Create a task list with one task per check ([1] through [12]).
  2. Run the full 12-check audit via python scripts/strict_audit.py OUTPUT.docx --source SOURCE.md. Never run individual checks manually or selectively.
  3. Read ALL output. Do not stop reading after the first failure or after the summary table. Every check line must be consumed.
  4. Mark each task in the task list as completed, with its status (✅ / ❌ / ⚠).
  5. If any ❌: report which checks failed, what they mean, and how to fix. Do NOT deliver the docx until all ❌ are resolved.
  6. If --strict mode: ⚠ warnings also block delivery.

HARD RULE: The audit script exits with code 0 only when all ❌ checks pass. Trust the exit code — do not second-guess it or skip re-running after a fix.

Usage

python scripts/strict_audit.py OUTPUT.docx [--source SOURCE.md] [--skip-fidelity]
  • Exit code 0 = all checks pass
  • Exit code 1 = one or more failures
  • --source enables [5] fidelity check (skips if omitted)

与 md2docx-formal 的分工(质检规则单一真相源)

本技能是 docx 质检规则的唯一真相源(12 项交付终检 + 阈值常量);md2docx-formal/scripts/audit_docx.py 是转换侧内置快检(A–F,转换后即时反馈用)。两套不合并代码,但质检口径以本技能为准—— 改阈值、加检查只改这里,md2docx-formal 侧需要对齐时由本技能同步过去。

12 检查全览

#检查类型检测什么可调常量
[1]Bullet 字体❌ 阻断Symbol 字体 → • 变方框 □—
[2]List Number 段落❌ 阻断Word 内置自动编号残留 → 跨列表续号—
[3]有序列表编号⚠ 信息每组编号是否从 1 开始—
[4]引用上标❌ 阻断GB/T 7714:正文 [n] 上标 / 参考文献平体—
[5]内容保真❌ 阻断委托 verify_fidelity 逐块比对,<100% 即失败—
[6]标题层级❌ 阻断numPr 双重编号 + H1-H5 统计—
[7]表格审计⚠ 信息表头加粗率 / 空单元格TABLE_HEADER_BOLD_RATIO TABLE_EMPTY_CELL_RATIO
[8]引用块字体⚠ 信息Quote 段字体一致性EXPECTED_QUOTE_FONT
[9]TOC / 页眉页脚⚠ 信息TOC 域 + PAGE/NUMPAGES 域—
[10]页面布局⚠ 信息纸张尺寸 / 页边距PAGE_W/H_CM MARGIN_*_CM(None=跳过)
[11]中文字体完整性❌ 阻断eastAsia 是否被清空—
[12]空段落⚠ 信息≥N 连续空段EMPTY_PARAGRAPH_THRESHOLD
  • ❌ 失败 = 触发退出码 1,应修复后重转
  • ⚠ 信息 = 仅报告,不触发失败(可能是正常场景)

Key design decisions

  • [3] ordered lists: informational — continuous numbering across sub-sections is legitimate.
  • [5] fidelity: hard fail when --source is provided. Delegates to verify_fidelity.py (auto-located via relative path). Skips without --source.
  • [8] quote font: informational — change EXPECTED_QUOTE_FONT at script top.
  • [10] page layout: tunable — set any margin to None to skip; set PAGE_W_CM=None to skip entire page check.
  • [11] eastAsia: correctly skips runs that inherit from paragraph style; only flags runs where eastAsia was explicitly wiped (the "全选改字体" symptom).
  • All ⚠ checks are informational; only ❌ checks block delivery.
  • Pure python-docx — sandbox-compatible, no Word/Office dependency.

Output example

=================================================================
  docx 严格审查报告
  C:/path/to/output.docx
=================================================================

[1]  Bullet 字体(□ 方框)
  ✅ 通过 — 4 个 bullet 级别,0 Symbol

[2]  List Number 段落(续号)
  ✅ 通过 — 0 条 List Number 段落

[3]  有序列表编号
  ⚠ 3/16 组不是从 1 开始(可能源文件连续编号,属正常)

[4]  引用上标(GB/T 7714)
  ✅ 通过 — 正文上标 68,误标 0,漏标 0

[5]  内容保真
  合计 2338 个单元,命中 2338,缺失 0,覆盖率 100.00%
  结论: ✅ 内容一致(源无遗漏)

[6]  标题层级
  H1=10  H2=36  H3=61  H4=11  H5=23
  ✅ numPr=0

[7]  表格审计
  表数量: 45
  ✅ 通过

[8]  代码 & 引用块字体
  ✅ 引用块字体正确 (14 个 Quote 段落)

[9]  TOC & 页眉页脚
  ⚠ 未找到 TOC 域(可能未生成目录页)
  ✅ 页脚含 PAGE + NUMPAGES 域

[10] 页面布局
  ✅ A4 + 标准边距

[11] 中文字体完整性(eastAsia)
  ✅ 通过 — 362 个含中文段落 eastAsia 完整

[12] 空段落
  ⚠ 1 处连续空段落(≥3个)

=================================================================
  ✅ 全部检查通过
=================================================================

Pipeline integration

源 .md  ──convert_doc.py──▶  .docx
                               │
                               ▼
                        strict_audit.py
                               │
                       ┌───────┴───────┐
                       ▼               ▼
                    ✅ 通过          ❌ 失败
                    → 交付          → 修复 → 重转 → 重审

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.