Thesis DOCX
Overview
Use this skill for thesis-oriented .docx work where content quality and
format fidelity both matter. Prefer Microsoft Word desktop automation over
WPS-like alternatives whenever the task involves batch formatting, styles,
captions, pagination, tables of contents, or cross-references.
This skill is designed to avoid the most common thesis-editing failure mode:
the agent makes broad formatting changes too early, introduces new layout
problems, and then forces the user to catch them one by one. The default
behavior should therefore be:
- audit first,
- separate explicit school requirements from unspecified formatting,
- fix only what is justified,
- re-check page by page before claiming completion.
Workflow
- Check Microsoft Word and COM/DOM automation first.
powershell -ExecutionPolicy Bypass -File scripts/check_word_com.ps1 -Json
- If Word is missing, COM is unavailable, or DOM access fails:
- Stop the automation-heavy plan.
- Tell the user to install desktop Microsoft Word.
- Explain briefly that WPS or similar tools are likely to degrade layout
fidelity for thesis formatting.
- Read the user's real constraints before editing.
- Collect the thesis template, school formatting guide, screenshots,
existing document, sample pages, and any explicit chapter rules.
- If the user gave formal requirements, follow them strictly.
- If the user did not give requirements, do not invent school-specific
standards. Use conservative academic defaults and say that they are
defaults.
- Explicitly classify requirements into two buckets before editing:
must enforce: school guide, template, user-confirmed style rules
preserve current state: anything the school guide does not define
- Audit the DOCX / OOXML before risky bulk edits.
- Prefer
scripts/audit_docx_ooxml.py before large-scale formatting.
- Use it to detect hidden indentation, section drift, stale REF display
text, and style-ID mismatches before deciding on a repair strategy.
- Standardize with styles, not scattered direct formatting.
- Reuse and repair existing styles whenever possible.
- Create missing styles only when no matching style exists.
- Keep body text, headings, figure captions, table captions, references,
abstract, and appendix styles separate and consistent.
- Before changing any style globally, inspect whether the document contains
direct paragraph formatting or OOXML overrides that will survive the style
change.
- Edit content only from user-provided facts.
- Expand, polish, or reorganize thesis text only within the user's topic,
evidence, codebase, notes, or source material.
- Do not invent experimental data, system structure, entities, or results.
- Do not expose agent reasoning or data-feeding context inside the thesis
prose. Forbidden patterns include thesis-language such as:
- "根据已有工程"
- "根据现有代码"
- "将任务书和代码喂给模型后"
- "通过分析用户提供的代码"
- any wording that sounds like an AI workflow note instead of thesis prose
- Write in normal thesis voice, not in prompt-engineering voice, review
voice, or chain-of-thought voice.
- Prefer neutral academic narration that reads like student writing, e.g.
"本文设计并实现了……", "系统采用了……", "在该模块中……"
- Avoid first-order meta-explanations about how the text was generated,
inferred, or assembled.
- Generate figures only when the source material is sufficient.
- Use Mermaid for architecture diagrams, E-R diagrams, flow charts, state
diagrams, and similar thesis figures.
- Base every node, field, relation, and dependency on real materials from
the user, such as code, SQL schema, API docs, project docs, or the thesis
draft itself.
- If the materials are insufficient, refuse to fabricate the figure and ask
for the missing source information.
- Typeset code with LaTeX conventions when thesis code excerpts are needed.
- Keep only the code relevant to the argument.
- Preserve real identifiers from the user's code or design.
- Avoid synthetic filler code written only to look complete.
- Audit before you claim completion.
- Run a structure audit first: styles, sections, captions, references,
page number scheme, cross-references, hidden paragraph overrides.
- Then export the document to PDF from Word and review page by page.
- Only say the task is complete after the PDF-level audit passes or after
you clearly state the remaining manual visual checks.
Style Strategy
- Treat styles as the single source of truth for formatting.
- Prefer these logical style buckets:
Body Text
Heading 1 / Heading 2 / Heading 3
Figure Caption
Table Caption
References
Abstract
Keywords
Appendix Title
- If the document already has equivalent styles, map to them and normalize
their font, spacing, indentation, and numbering behavior.
- If direct formatting conflicts with styles, reduce the direct formatting and
bring the document back under style control.
- Do not globally normalize sections that the school guide does not specify.
Examples of high-risk overreach:
- page header/footer redesign when the user only asked for headings
- changing code box appearance when the task is only about references
- normalizing table internals when the school guide does not regulate them
- When a visual issue remains after style normalization, inspect hidden OOXML
state such as
firstLineChars, numbering indentation, titlePg,
differentFirstPageHeaderFooter, REF field display text, and direct run
formatting.
Audit-First Discipline
Before bulk editing, produce and internally follow a checklist like this:
- Which parts are explicitly regulated by the school guide?
- Which parts are user-defined house rules?
- Which parts are currently acceptable and must be preserved?
- Which problems are structural vs. visual-only?
- Which fixes can be done safely through styles?
- Which fixes require Word COM or OOXML-level patching?
Do not say "finished" merely because a structural audit looks good. For thesis
work, pagination and page-level rendering are part of correctness.
High-Risk Pitfalls
Read references/failure-patterns-and-quality-gates.md before large-scale
formatting work. In particular, guard against:
- style names that look correct but map to the wrong style IDs
- paragraph-level direct formatting that overrides the intended style
firstLineChars or numbering indentation creating invisible extra indents
- TOC fields or cross-reference fields showing stale display text
- section-level first-page settings causing missing headers or page numbers
- Word vs. WPS differences for table row height, vertical alignment, and code
box title clipping
- punctuation normalization that accidentally rewrites DOI, URLs, code, or
English references
Visual Review Rule
For school-format-sensitive thesis work, final verification should prefer this
order:
- Word COM/DOM structural checks
- Word export to PDF
- page-by-page PDF review
- only then final delivery language
If page rendering cannot be verified, say so explicitly instead of implying the
formatting is fully validated.
Figure Rules
- Use Mermaid when a thesis figure is needed and the structure can be traced to
real source material.
- Keep the diagram academically neutral and concise.
- Avoid decorative labels, chatty callouts, and speculative entities.
- Match the user's terminology unless it conflicts with the real materials.
- Read
references/figure-and-code-rules.md before generating diagrams.
Thesis Voice Rule
Read references/thesis-voice-and-style.md before generating or rewriting
body text. In particular:
- thesis prose must sound like thesis prose, not like notes about how the AI
reasoned
- student-facing academic narration is preferred over review-style meta
commentary
- do not leak the existence of source-feeding, code-ingestion, or analysis
steps into the final paper text
Before finalizing thesis prose, quickly self-check:
- Does the paragraph describe the system/research itself, rather than how the
assistant inferred it?
- Does the paragraph sound like thesis narration instead of prompt notes?
- Does the paragraph avoid phrases like "根据现有代码", "根据已有工程",
"通过分析用户提供的代码", or similar workflow-language?
- Would the sentence still make sense if the reader had no idea an AI helped
draft it?
Code Listing Rules
- Prefer LaTeX-oriented code presentation when the thesis includes code
listings.
- Keep the listing faithful to the actual code.
- Trim non-essential boilerplate when it does not support the thesis argument.
- If the user requests a specific LaTeX package or listing style, follow it.
Resource Guide
scripts/check_word_com.ps1
- Detect whether Microsoft Word desktop and COM/DOM automation are available.
scripts/audit_docx_ooxml.py
- Audit DOCX styles, direct indentation, section settings, numbering, and REF
field behavior before making risky formatting changes.
scripts/normalize_word_styles.ps1
- Batch-normalize thesis body text, Heading 1-3, figure captions, and table
captions through Word COM automation.
scripts/export_word_pdf.ps1
- Export the current thesis document to PDF through Word COM for page-level
review.
scripts/render_mermaid_figure.ps1
- Render Mermaid source into thesis-ready SVG, PNG, or PDF figure assets.
references/paper-format-workflow.md
- Read for the standard Word thesis formatting workflow.
references/figure-and-code-rules.md
- Read before generating Mermaid figures or LaTeX code listings.
references/thesis-voice-and-style.md
- Read before generating or rewriting thesis prose.
references/failure-patterns-and-quality-gates.md
- Read before large-scale formatting or before claiming the thesis is fully
checked.
references/script-usage.md
- Read for command examples and config file conventions.
Final Checks
- Confirm the document is still style-driven after edits.
- Confirm captions, numbering, page breaks, and table of contents are coherent.
- Confirm cross-references display the current target labels, not stale field
text.
- Confirm section settings do not silently remove page headers or page numbers
from first pages.
- Confirm references are formatted according to the school rules and that
punctuation normalization did not damage DOI or English references.
- Confirm every diagram and code block is grounded in user-provided material.
- Export to PDF and inspect every page before saying the format is complete.
- If Word automation or PDF verification was unavailable, explicitly warn that
layout fidelity was not guaranteed.
Source: the-shy123456/thesis-docx — distributed by TomeVault.
1---2name: thesis-docx3description: Create, revise, and format thesis or dissertation Word documents with strict academic formatting control. Use when an AI agent needs to generate or revise thesis content, normalize Word styles, follow a school template, fix captions or page numbers or section levels, or produce evidence-based Mermaid figures and LaTeX-formatted code listings for a thesis document. Use when this capability is needed.4---56# Thesis DOCX78## Overview910Use this skill for thesis-oriented `.docx` work where content quality and11format fidelity both matter. Prefer Microsoft Word desktop automation over12WPS-like alternatives whenever the task involves batch formatting, styles,13captions, pagination, tables of contents, or cross-references.1415This skill is designed to avoid the most common thesis-editing failure mode:16the agent makes broad formatting changes too early, introduces new layout17problems, and then forces the user to catch them one by one. The default18behavior should therefore be:19201. audit first,212. separate explicit school requirements from unspecified formatting,223. fix only what is justified,234. re-check page by page before claiming completion.2425## Workflow26271. Check Microsoft Word and COM/DOM automation first.28 - On Windows, run:29 ```powershell30 powershell -ExecutionPolicy Bypass -File scripts/check_word_com.ps1 -Json31 ```32 - If Word is missing, COM is unavailable, or DOM access fails:33 - Stop the automation-heavy plan.34 - Tell the user to install desktop Microsoft Word.35 - Explain briefly that WPS or similar tools are likely to degrade layout36 fidelity for thesis formatting.372. Read the user's real constraints before editing.38 - Collect the thesis template, school formatting guide, screenshots,39 existing document, sample pages, and any explicit chapter rules.40 - If the user gave formal requirements, follow them strictly.41 - If the user did not give requirements, do not invent school-specific42 standards. Use conservative academic defaults and say that they are43 defaults.44 - Explicitly classify requirements into two buckets before editing:45 - `must enforce`: school guide, template, user-confirmed style rules46 - `preserve current state`: anything the school guide does not define473. Audit the DOCX / OOXML before risky bulk edits.48 - Prefer `scripts/audit_docx_ooxml.py` before large-scale formatting.49 - Use it to detect hidden indentation, section drift, stale REF display50 text, and style-ID mismatches before deciding on a repair strategy.514. Standardize with styles, not scattered direct formatting.52 - Reuse and repair existing styles whenever possible.53 - Create missing styles only when no matching style exists.54 - Keep body text, headings, figure captions, table captions, references,55 abstract, and appendix styles separate and consistent.56 - Before changing any style globally, inspect whether the document contains57 direct paragraph formatting or OOXML overrides that will survive the style58 change.595. Edit content only from user-provided facts.60 - Expand, polish, or reorganize thesis text only within the user's topic,61 evidence, codebase, notes, or source material.62 - Do not invent experimental data, system structure, entities, or results.63 - Do not expose agent reasoning or data-feeding context inside the thesis64 prose. Forbidden patterns include thesis-language such as:65 - "根据已有工程"66 - "根据现有代码"67 - "将任务书和代码喂给模型后"68 - "通过分析用户提供的代码"69 - any wording that sounds like an AI workflow note instead of thesis prose70 - Write in normal thesis voice, not in prompt-engineering voice, review71 voice, or chain-of-thought voice.72 - Prefer neutral academic narration that reads like student writing, e.g.73 "本文设计并实现了……", "系统采用了……", "在该模块中……"74 - Avoid first-order meta-explanations about how the text was generated,75 inferred, or assembled.766. Generate figures only when the source material is sufficient.77 - Use Mermaid for architecture diagrams, E-R diagrams, flow charts, state78 diagrams, and similar thesis figures.79 - Base every node, field, relation, and dependency on real materials from80 the user, such as code, SQL schema, API docs, project docs, or the thesis81 draft itself.82 - If the materials are insufficient, refuse to fabricate the figure and ask83 for the missing source information.847. Typeset code with LaTeX conventions when thesis code excerpts are needed.85 - Keep only the code relevant to the argument.86 - Preserve real identifiers from the user's code or design.87 - Avoid synthetic filler code written only to look complete.888. Audit before you claim completion.89 - Run a structure audit first: styles, sections, captions, references,90 page number scheme, cross-references, hidden paragraph overrides.91 - Then export the document to PDF from Word and review page by page.92 - Only say the task is complete after the PDF-level audit passes or after93 you clearly state the remaining manual visual checks.9495## Style Strategy9697- Treat styles as the single source of truth for formatting.98- Prefer these logical style buckets:99 - `Body Text`100 - `Heading 1` / `Heading 2` / `Heading 3`101 - `Figure Caption`102 - `Table Caption`103 - `References`104 - `Abstract`105 - `Keywords`106 - `Appendix Title`107- If the document already has equivalent styles, map to them and normalize108 their font, spacing, indentation, and numbering behavior.109- If direct formatting conflicts with styles, reduce the direct formatting and110 bring the document back under style control.111- Do not globally normalize sections that the school guide does not specify.112 Examples of high-risk overreach:113 - page header/footer redesign when the user only asked for headings114 - changing code box appearance when the task is only about references115 - normalizing table internals when the school guide does not regulate them116- When a visual issue remains after style normalization, inspect hidden OOXML117 state such as `firstLineChars`, numbering indentation, `titlePg`,118 `differentFirstPageHeaderFooter`, REF field display text, and direct run119 formatting.120121## Audit-First Discipline122123Before bulk editing, produce and internally follow a checklist like this:1241251. Which parts are explicitly regulated by the school guide?1262. Which parts are user-defined house rules?1273. Which parts are currently acceptable and must be preserved?1284. Which problems are structural vs. visual-only?1295. Which fixes can be done safely through styles?1306. Which fixes require Word COM or OOXML-level patching?131132Do not say "finished" merely because a structural audit looks good. For thesis133work, pagination and page-level rendering are part of correctness.134135## High-Risk Pitfalls136137Read `references/failure-patterns-and-quality-gates.md` before large-scale138formatting work. In particular, guard against:139140- style names that look correct but map to the wrong style IDs141- paragraph-level direct formatting that overrides the intended style142- `firstLineChars` or numbering indentation creating invisible extra indents143- TOC fields or cross-reference fields showing stale display text144- section-level first-page settings causing missing headers or page numbers145- Word vs. WPS differences for table row height, vertical alignment, and code146 box title clipping147- punctuation normalization that accidentally rewrites DOI, URLs, code, or148 English references149150## Visual Review Rule151152For school-format-sensitive thesis work, final verification should prefer this153order:1541551. Word COM/DOM structural checks1562. Word export to PDF1573. page-by-page PDF review1584. only then final delivery language159160If page rendering cannot be verified, say so explicitly instead of implying the161 formatting is fully validated.162163## Figure Rules164165- Use Mermaid when a thesis figure is needed and the structure can be traced to166 real source material.167- Keep the diagram academically neutral and concise.168- Avoid decorative labels, chatty callouts, and speculative entities.169- Match the user's terminology unless it conflicts with the real materials.170- Read `references/figure-and-code-rules.md` before generating diagrams.171172## Thesis Voice Rule173174Read `references/thesis-voice-and-style.md` before generating or rewriting175body text. In particular:176177- thesis prose must sound like thesis prose, not like notes about how the AI178 reasoned179- student-facing academic narration is preferred over review-style meta180 commentary181- do not leak the existence of source-feeding, code-ingestion, or analysis182 steps into the final paper text183184Before finalizing thesis prose, quickly self-check:1851861. Does the paragraph describe the system/research itself, rather than how the187 assistant inferred it?1882. Does the paragraph sound like thesis narration instead of prompt notes?1893. Does the paragraph avoid phrases like "根据现有代码", "根据已有工程",190 "通过分析用户提供的代码", or similar workflow-language?1914. Would the sentence still make sense if the reader had no idea an AI helped192 draft it?193194## Code Listing Rules195196- Prefer LaTeX-oriented code presentation when the thesis includes code197 listings.198- Keep the listing faithful to the actual code.199- Trim non-essential boilerplate when it does not support the thesis argument.200- If the user requests a specific LaTeX package or listing style, follow it.201202## Resource Guide203204- `scripts/check_word_com.ps1`205 - Detect whether Microsoft Word desktop and COM/DOM automation are available.206- `scripts/audit_docx_ooxml.py`207 - Audit DOCX styles, direct indentation, section settings, numbering, and REF208 field behavior before making risky formatting changes.209- `scripts/normalize_word_styles.ps1`210 - Batch-normalize thesis body text, Heading 1-3, figure captions, and table211 captions through Word COM automation.212- `scripts/export_word_pdf.ps1`213 - Export the current thesis document to PDF through Word COM for page-level214 review.215- `scripts/render_mermaid_figure.ps1`216 - Render Mermaid source into thesis-ready SVG, PNG, or PDF figure assets.217- `references/paper-format-workflow.md`218 - Read for the standard Word thesis formatting workflow.219- `references/figure-and-code-rules.md`220 - Read before generating Mermaid figures or LaTeX code listings.221- `references/thesis-voice-and-style.md`222 - Read before generating or rewriting thesis prose.223- `references/failure-patterns-and-quality-gates.md`224 - Read before large-scale formatting or before claiming the thesis is fully225 checked.226- `references/script-usage.md`227 - Read for command examples and config file conventions.228229## Final Checks230231- Confirm the document is still style-driven after edits.232- Confirm captions, numbering, page breaks, and table of contents are coherent.233- Confirm cross-references display the current target labels, not stale field234 text.235- Confirm section settings do not silently remove page headers or page numbers236 from first pages.237- Confirm references are formatted according to the school rules and that238 punctuation normalization did not damage DOI or English references.239- Confirm every diagram and code block is grounded in user-provided material.240- Export to PDF and inspect every page before saying the format is complete.241- If Word automation or PDF verification was unavailable, explicitly warn that242 layout fidelity was not guaranteed.243244---245> Source: [the-shy123456/thesis-docx](https://github.com/the-shy123456/thesis-docx) — distributed by [TomeVault](https://tomevault.io).246<!-- tomevault:4.0:skill_md:2026-06-17 -->