| name | cjlu-master-thesis-template |
| description | Format WPS DOCX master's thesis drafts according to the China Jiliang University master's thesis template. Use when Codex needs to audit, compare, or automatically reformat a Chinese master's thesis draft against the bundled CJLU template assets, generate a new formatted .docx, create a Markdown formatting report, run A/B sample comparisons between template-based migration and source-copy styling, or prepare optional WPS-based visual checks and PDF export. |
China Jiliang University Master's Thesis Template
Core Rules
- Treat the input thesis as read-only. Never overwrite the user's original draft.
- Treat files in
assets/ as read-only template references. Never modify them in place.
- Generate a new
.docx by default. Generate PDF only when the user explicitly asks, and use WPS for the export whenever possible.
- Generate a Markdown formatting report for every formatting run.
- Prefer automatic fixes for clear formatting issues. Mark but do not invent missing real information such as student ID, supervisor name, signature dates, English title, or missing scholarly content.
- Default output directory: a
排版输出 folder beside the input .docx, unless the user specifies another output directory.
Skill Maintenance Mode
When the user asks to improve, audit, or complete this skill itself, do not run thesis formatting on a real draft and do not create new thesis outputs unless the user explicitly asks for a thesis-formatting test. In maintenance mode, limit execution to skill validation, script syntax checks, asset existence checks, and coverage self-checks.
Use the self-check script after changing the coverage matrix, formatter report logic, validator, or WPS checklist generator:
python scripts/audit_skill_coverage.py
Use the JSON completion audit when deciding whether the skill package itself is complete enough to stop maintenance work:
python scripts/audit_skill_coverage.py --json
In the JSON output, require status: pass, zero failures, zero warnings, and every completion_gates value to be true. This confirms the skill files, template assets, script syntax, template-detail terms, coverage matrix, evidence index, formatter evidence, and spec-section evidence links are internally consistent. It does not replace a separate WPS visual test on a generated DOCX when the user explicitly asks to test thesis formatting.
Bundled Assets
assets/硕士学位论文模板.doc: original WPS/Word template document.
assets/硕士学位论文模板.pdf: visual reference exported from the same template.
Use the .doc asset as the style/template source. Use the .pdf asset for visual comparison only as the official template reference. If a .docx template is needed, create a temporary converted copy outside assets/ and prefer WPS conversion; document the conversion in the report.
Use references/template-evidence-index.md when auditing or extending this skill. It maps the bundled template's source evidence to the canonical spec, checklist, and coverage matrix so new rules remain traceable to the actual template.
Workflow
- Confirm the input is a WPS
.docx draft. If the user provides .doc, convert it to .docx first and keep the original unchanged.
- Create timestamped output names in the default output directory unless the user specifies another location.
- Run a read-only inventory on the input draft with
scripts/docx_inventory.py; use it to identify structure, styles, headings, tables, equations, footnotes, headers, footers, and missing sections.
- If the default strategy has not been settled for this draft family, run
scripts/make_sample_comparison.py using the criteria in references/sample-comparison.md before full formatting.
- Run
scripts/format_thesis_docx.py for the default source-copy formatting pass. It creates a new .docx, normalizes clear formatting issues, runs the built-in validator, and writes Markdown/JSON reports plus a WPS final-check checklist.
- Apply the canonical template specification in
references/template-format-spec.md; use it as the first source of truth for fonts, sizes, spacing, numbering, objects, references, and front/back matter.
- Use
references/template-evidence-index.md to trace major formatting requirements back to the bundled template when adding, changing, or disputing a rule.
- Use
references/coverage-matrix.md to decide whether each template area should be handled automatically, audited, sent to WPS confirmation, or reported as needing user content.
- Apply the checklist in
references/format-checklist.md. Automatically fix unambiguous formatting problems and list uncertain content items in the report.
- Apply the table-focused implementation notes in
references/typography-and-tables.md.
- Use WPS as the visual authority for table-of-contents field refresh, final visual inspection, continuation-table confirmation, and optional PDF export. Follow
references/wps-handling.md.
- Save the formatted
.docx as a new file. Save a Markdown report, formatting JSON, validation JSON, and WPS final-check checklist beside it.
- Verify that automatic validation has no failures. Treat warnings as WPS/user confirmation items, not silent pass/fail.
- Verify that the output opens in WPS, preserves thesis content, and has no obvious layout damage.
Default Sample Test
For the first A/B comparison in a new workspace, use the user-provided real thesis draft or an explicit test copy. Do not bundle, name, or assume a private thesis draft path inside this skill.
Compare:
- Approach A: use the school template as the base document and migrate a front-matter sample plus a Chapter 1 sample into it.
- Approach B: duplicate the draft and apply template styles to the duplicate.
Choose the default approach by judging formatting fidelity in WPS, content preservation, WPS stability, and report clarity. Prefer the approach with fewer content-loss risks when WPS visual fidelity is close.
Default Formatting Strategy
Use source-copy styling as the default route for this thesis draft family:
- Start from a duplicate of the user's
.docx, not from a converted template base.
- Preserve the draft's existing content order, embedded objects, section breaks, headers/footers, captions, fields, and references.
- Normalize styles inside the duplicate toward the template instead of remapping every heading into template auto-numbering styles.
- Avoid applying template heading styles that add automatic numbering when the heading text already contains numbers, because WPS can display duplicated numbers such as
1.2 1.2.
- Use template-base migration only for isolated front-matter reconstruction after user confirmation, especially when a required template page is missing or badly damaged.
- Treat WPS screenshots/opening behavior as the deciding visual evidence. Non-WPS renderers may be used only for technical diagnostics and must be labeled non-authoritative.
Run the default formatting pass with:
python scripts/format_thesis_docx.py "/path/to/thesis.docx"
If the default python/python3 cannot import lxml, use the available Codex/document runtime for the current environment instead of changing the user's system Python.
The script should implement the rules in references/template-format-spec.md as far as they can be safely applied to a source-copy DOCX. It normalizes body paragraphs, heading safety, front/back matter titles and body paragraphs, table/figure captions and notes, in-text citation superscripts, references, data-table fonts/sizes, table borders, table cell alignment, equations where detectable, footnotes where present, repeat-header settings for continuation tables, and WPS field-update settings. It audits figure/table/equation numbering consistency, reference/citation consistency, page layout, and package fields. It does not automatically delete visible template instruction bubbles, reconstruct missing cover/front-page facts, add explicit 续表 labels before WPS pagination is confirmed, silently renumber figures/tables/equations/references, or invent missing thesis information; report those items for user confirmation.
The formatting script automatically calls scripts/validate_formatted_docx.py after generating the output. Use the standalone validator only when checking an already-generated DOCX:
python scripts/validate_formatted_docx.py "/path/to/formatted.docx" --source "/path/to/original.docx"
The formatting script also writes a WPS final-check checklist. Use the standalone checklist generator only when rebuilding the checklist from existing JSON reports:
python scripts/make_wps_final_checklist.py "/path/to/formatted.docx" --validation-json "/path/to/validation.json" --format-json "/path/to/format.json" --output "/path/to/WPS终检清单.md"
Report Requirements
The Markdown report must include:
- Input file and output file paths.
- Template assets used.
- Strategy used, including whether A/B sample comparison was performed.
- Structural checklist: present, missing, automatically repaired, needs user-supplied content.
- Formatting checklist: styles, headings, paragraphs, page setup, headers/footers, page numbers, figures, tables, equations, notes, references, appendices.
- Template coverage checklist: every section in
references/template-format-spec.md should be marked as applied automatically, checked, needs WPS confirmation, needs user content, or not applicable.
- Coverage-matrix status: every row in
references/coverage-matrix.md should be reflected in the run as automatic, audit, WPS-confirmation, user-content, or not-applicable.
- Font and table checklist: body fonts, heading safety, table fonts/sizes, header rows, repeated table headers, and continuation-table items requiring WPS confirmation.
- Template-instruction and semantic audit: visible explanatory/example text, unresolved field errors, figure/table placement, table semantic structure, reference type examples, conclusion risk wording, acknowledgement length, and author-biography facts.
- Automatic validation status: pass/fail, failure count, warning count, and content-length preservation check.
- WPS final-check checklist path and the remaining field-refresh, page-number, continuation-table, cover-placeholder, and user-content confirmations.
- WPS actions performed, if any.
- WPS visual-verification status. Do not treat LibreOffice, Quick Look, or other non-WPS rendering as final visual evidence.
- Items that still need manual confirmation.
Safety Boundaries
- Do not delete thesis files, template files, drafts, or output folders.
- Do not batch-delete or recursively remove anything.
- Do not silently rewrite academic content while doing formatting. Only normalize layout, style, numbering, captions, fields, and other presentation details.
- Ask before adding or replacing substantive thesis text.