docx
Skill1 starsChanged 7 months agoMITView on GitHub
Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When GLM needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks
- Installs packages
We split this skill into the rules it gives an agent
4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 189 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Step 6: Run the post-generation checklist
- Very specific: line 38
All CLI tools live in scripts/ relative to this skill's directory.
- Distinctive: line 185
Default: matplotlib template library generates PNG for embedding.
- Distinctive: line 189
Default palette: Morandi low-saturation (see design-system.md).
“Common” is measured: kept by at least 6 in 10 of the 189 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DOCX Creation, Editing, and Analysis
Quick Setup
bash "$SKILL_DIR/setup.sh" # Interactive environment check + installOverview
A .docx file is a ZIP archive containing XML files. This skill provides tools for creating, editing, reading, and reviewing Word documents.
Quick Route — Read This First
Step 1: Determine task type → load the corresponding route file
Step 2: Determine business scene → load the corresponding scene file (if applicable)
Step 3: Load references/design-system.md for cover recipes, palettes, and chart colors
Step 4: Load references/common-rules.md for shared layout, font, and quality rules
Step 5: Execute per route instructions
Step 6: Run the post-generation checklist
⚠️ MANDATORY — Cover Recipe Enforcement (Step 3):
When creating a document that needs a cover page, you MUST use one of the 7 validated cover recipes (R1–R7) from design-system.md. Free-form cover code is FORBIDDEN. The recipe provides the wrapper table, background, layout structure, border settings, and spacing — do not reinvent any of these.
Workflow: (1) Call selectCoverRecipe(docType, industry) to get recipe + palette → (2) Use the corresponding buildCoverRX() function code from design-system.md → (3) Pass your config (title, subtitle, metaLines, etc.) into the recipe builder. If you skip this and write cover code from scratch, the cover WILL have compatibility issues (blank pages in MS Office, missing borders, overflow, etc.).
Script Path Setup (MANDATORY before any script call)
All CLI tools live in scripts/ relative to this skill's directory. Before calling any script, resolve the absolute path once:
DOCX_SCRIPTS="<skill_directory>/scripts" # ← parent directory of this SKILL.md
# Then all commands use $DOCX_SCRIPTS:
python3 "$DOCX_SCRIPTS/postcheck.py" output.docx
python3 "$DOCX_SCRIPTS/add_toc_placeholders.py" output.docx --autoFor Python imports (when generation code needs to import skill modules):
import sys, os
DOCX_SCRIPTS = os.path.join("<skill_directory>", "scripts")
if DOCX_SCRIPTS not in sys.path:
sys.path.insert(0, DOCX_SCRIPTS)⚠️ NEVER use bare python3 scripts/... — it only works if cwd happens to be the skill directory. Always use the absolute $DOCX_SCRIPTS path.
Task Router
| User Intent | Route | Files to Load |
| Create/write/generate (no attachment) | Create | routes/create.md + references/docx-js-core.md |
| Edit/modify/revise (has attachment) | Edit | routes/edit.md + references/ooxml.md |
| Format/layout/font/margin | Format | routes/format.md |
| Comment/annotate/review | Comment | routes/comment.md |
| Read/analyze/extract | Read | routes/read.md |
Scene Router (Optional — load after route)
| User Keywords | Scene | File |
| thesis, academic, research, paper, dissertation, abstract, journal | Academic | scenes/academic.md |
| report, analysis, experiment, testing, survey, review, summary, proposal, feasibility, competitor, industry, operations | Report | scenes/report.md |
| contract, agreement, terms, transfer, NDA, confidential, framework, cooperation, service terms, user agreement, procurement | Contract | scenes/contract.md |
| resume, CV, job application | Resume | scenes/resume.md |
| exam, test, quiz, paper (exam context), lesson plan | Exam | scenes/exam.md |
| official document, notice, letter, reply, minutes, red header, government, issuance | Official | scenes/official-doc.md |
| broadcast script, product copy, livestream, speech, presentation script, video script | Copywriting | scenes/copywriting.md |
| plan, proposal (if not report context) | Report | scenes/report.md |
| policy, regulation, standard, management rules | Official | scenes/official-doc.md |
If no scene matches, use default design rules from references/design-system.md and references/common-rules.md.
Formatting Standards (Always Apply)
→ See references/common-rules.md for full font profiles, spacing, indent, and layout rules.
Key rules (quick reference):
- Line spacing: 1.3x (
line: 312) — MANDATORY. Exceptions: resume 1.15x, official doc 28pt fixed, copywriting400, contract 1.5x - CJK body: Justified + 2-char indent (
firstLine: 480SimSun /420YaHei) - Tables:
marginsset,ShadingType.CLEAR,tableHeader: true,cantSplit: true, titlekeepNext: true - Images:
typeparameter required, preserve aspect ratio viaimage-size, PageBreak inside Paragraph - Full-page Table row:
rule: "exact"with 1200 twips safety margin
Unit Quick Reference
| Unit | Value |
| 1 cm | 567 twips |
| 1 inch | 1440 twips |
| 1 pt | 20 half-points |
| A4 | 11906 × 16838 twips |
For Chinese font size table and common margins, see references/common-rules.md.
Post-Generation — Two-Layer Verification
Layer 1: Manual Checklist (self-check during generation)
Basic Format
- Line spacing is 1.3x (
line: 312) or scene-specific override - CJK body has 2-char indent (
firstLine: 480or420) - Tables have margins set
- Images preserve aspect ratio via
image-size— NEVER hardcode both width and height - PageBreak inside Paragraph
- ShadingType uses CLEAR
- Each numbered list uses unique
reference - ⚠️ CRITICAL — Quotation marks in JS strings properly escaped. Chinese curly quotes (
""'') MUST use Unicode escapes (\u201c\u201d\u2018\u2019); straight quotes ("') use\"\'or alternate delimiters. This is the #1 most common code generation bug. Chinese text frequently contains""for emphasis or proper nouns (e.g., "双11", "前低后高", "618") — every occurrence MUST be escaped. Failure to escape produces JS syntax errors that silently break document generation. - ImageRun includes
typeparameter - Header/footer present (unless scene says otherwise)
Heading Styles
- All body chapter headings use
heading: HeadingLevel.HEADING_X(never simulate with bold + large font) - Cover title may skip Heading style (not in TOC), but body headings MUST use Heading style
Page Break & Blank Page Prevention
- Cover/content in separate sections
- Three rules to prevent blank pages:
- ① When using section(NEXT_PAGE), previous section must NOT end with PageBreak (double break = blank page)
- ② PageBreak paragraph SHOULD contain visible text — exception: section-ending empty para + PageBreak is allowed (normal section separator, e.g., after cover page)
- ③ No more than 3 consecutive empty paragraphs
- Full-page Table row height uses
rule: "exact"(never"atLeast"for tall tables) - No unwanted blank pages (check each section ending)
TOC
→ See references/toc.md for the complete TOC reference and checklist.
- If TOC title exists →
TableOfContentselement must be present - ⚠️ MANDATORY PageBreak after TableOfContents — a Paragraph containing PageBreak MUST immediately follow the
TableOfContentselement; without it, TOC and body content will render on the same page. This is the #1 TOC formatting failure — never omit it add_toc_placeholders.py --autoruns after generation; exit code = 0- TOC MUST be in its own section — body section sets
page: { pageNumbers: { start: 1, formatType: NumberFormat.DECIMAL } }so page numbers start from the first body page, not from the TOC pages - Page number API nesting —
pageNumbersMUST be insidepage: {}, NOT at properties top level (see toc.md § Page Number API) - 3-section page numbering — Cover (no page#) → Front matter (Roman i,ii,iii, start=1) → Body (Arabic 1,2,3, start=1)
- Post-process footers — Roman section footer instrText must contain
PAGE \* ROMAN \* MERGEFORMAT; Arabic sectionPAGE \* arabic \* MERGEFORMAT(WPS ignores pgNumType fmt). ⚠️ NEVER use\* decimalin instrText —decimalis a docx-js API enum value (NumberFormat.DECIMAL), NOT a valid Word field format switch; using it causes page numbers to render as "1decimal", "2decimal". The correct Word field switch for Arabic numerals is\* arabic. - Remove empty pgNumType — Post-process to strip
<w:pgNumType/>from cover section (docx-js emits empty element that confuses WPS)
Table Cross-Page
- Header rows:
tableHeader: true - All rows:
cantSplit: true - Title paragraph:
keepNext: true
Cover
- Cover MUST use a validated recipe (R1–R7) from
design-system.md— free-form cover code is forbidden - Cover recipe matches document type (per
selectCoverRecipe()indesign-system.md) - Cover uses the 16838 outer wrapper table with
allNoBorders(all recipes provide this) - Cover title uses
calcTitleLayout()— never hardcoded font size above 40pt - Cover spacing uses
calcCoverSpacing()— never hardcoded large spacing values - Cover content does not overflow (total height ≤ 15638 twips, Table uses
rule: "exact") - Every TextRun on dark/colored background has explicit
colorset (Rule 9 — never rely on default black) - Cover section has no trailing PageBreak or empty paragraphs
- Title lines split at semantic boundaries (no mid-word breaks, no single-char orphan lines)
- No text-character decorative lines (
───,━━━) — use paragraph borders only
Layer 2: Automated Post-Check Script
python3 "$DOCX_SCRIPTS/postcheck.py" output.docxAutomatically checks 14 business rules: blank pages, cover overflow (font size/spacing/trailing content), line spacing consistency, table margins, table cross-page control (cantSplit/tblHeader), image overflow, image aspect ratio distortion, font fallback, CJK indent, heading hierarchy, ShadingType misuse, TOC quality, document cleanliness (placeholder text/Markdown/HTML residuals), report content quality (abstract presence/heading specificity/vague conclusion detection).
⚠️ After generating any document, MUST run postcheck.py and fix all ❌ errors.
Math Formulas
Formula input uses LaTeX syntax, internally converted to docx-js Math objects.
- Basic formulas (fractions, sub/superscript, roots, summation) → docx-js Math components
- Complex formulas (3+ nesting, matrices, piecewise functions) → matplotlib PNG fallback
See references/math-formulas.md.
Charts
Default: matplotlib template library generates PNG for embedding.
6 ready-to-use templates: bar, line, pie, box, radar, heatmap. Colors auto-derived from document palette.accent for style consistency. Default palette: Morandi low-saturation (see design-system.md).
See references/chart-templates.md.
Dependencies
- pandoc: Text extraction
- docx:
bun add docxornpm install docx(creating) - LibreOffice: PDF conversion, .doc support
- Poppler: PDF to image (
pdftoppm) - defusedxml: Secure XML parsing
- python-docx: Simple comment operations
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- choupiyang/ZAI_SKILLS★ 1398% same
Wrote their own version · 193
- anthropics/skills★ 186ksame name
- spinabot/brigade★ 11ksame name
- netease-youdao/LobsterAI★ 6.2ksame name
- OpenBMB/PilotDeck★ 4.5ksame name
- nextlevelbuilder/goclaw★ 3.7ksame name
- jjyaoao/HelloAgents★ 3.2ksame name
- anthropics/claude-agent-sdk-demos★ 2.8ksame name
- K-Dense-AI/claude-scientific-writer★ 2.4ksame name
- OpenCoworkAI/open-cowork★ 2.2ksame name
- ChenglinPoly/infiAgent★ 1.2ksame name
183 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use file-reading and pdf-reading.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SeifBenayedSkillfile-reading
Use this skill when a file has been uploaded but its content is NOT in your context — only its path at /mnt/user-data/uploads/ is listed in an uploaded_files block. This skill is a router: it tells you which tool to use for each file type (pdf, docx, xlsx, csv, json, images, archives, ebooks) so you read the right amount the right way instead of blindly running cat on a binary. Triggers: any mention of /mnt/user-data/uploads/, an uploaded_files section, a file_path tag, or a user asking about an uploaded file you have not yet read. Do NOT use this skill if the file content is already visible in your context inside a documents block — you already have it.
Also in 5 projects that use this
SeifBenayedSkillpdf-reading
Use this skill when you need to read, inspect, or extract content from PDF files — especially when file content is NOT in your context and you need to read it from disk. Covers content inventory, text extraction, page rasterization for visual inspection, embedded image/attachment/table/form-field extraction, and choosing the right reading strategy for different document types (text-heavy, scanned, slide-decks, forms, data-heavy). Do NOT use this skill for PDF creation, form filling, merging, splitting, watermarking, or encryption — use the pdf skill instead.
Also in 6 projects that use this
In this repository46 other files it gives its agents.
- Agent BrowserSkill
- ai-news-collectorSkill
- aminer-data-searchSkill
- ASRSkill
- auto-target-trackerSkill
- blog-writerSkill
- chartsSkill
- coding-agentSkill
- ExtractWisdomSkill
- ContentAnalysisSkill
- content-strategySkill
- dream-interpreterSkill
- financeSkill
- fullstack-devSkill
- get-fortune-analysisSkill
- gift-evaluatorSkill
- image-editSkill
- image-generationSkill
- image-understandSkill
- interview-designerSkill
- LLMSkill
- marketing-modeSkill
- market-research-reportsSkill
- mindfulness-meditationSkill
- multi-search-engineSkill
- pdfSkill
- Podcast GenerateSkill
- pptxSkill
- qingyan_research_reportSkill
- seo-content-writerSkill
- skill-creatorSkill
- skill-finder-cnSkill
- skill-vetterSkill
- stock_analysisSkill
- storyboard-managerSkill
- TTSSkill
- ui-ux-pro-maxSkill
- Video GenerationSkill
- video-understandSkill
- visual-design-foundationsSkill
- VLMSkill
- web-readerSkill
- web-searchSkill
- web-shader-extractorSkill
- writing-plansSkill
- xlsxSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

