DOCX
Overview
This skill covers the design and generation of structured Microsoft Word-compatible documents (.docx format). It helps users translate raw content, outlines, or requirements into well-organized professional documents with consistent heading hierarchy, table structures, numbered sections, formatting conventions, headers/footers, styles, and page layout. This skill applies whether the output is a narrative document written in prose form (for human formatting in Word) or a structured description intended for programmatic generation using libraries like python-docx.
When to Use
- Generating a complete DOCX document from an outline or brief
- Planning the structure and section hierarchy for a business report or proposal
- Describing table layouts, heading structures, and content for Word documents
- Converting raw meeting notes, bullet points, or data into a polished document
- Creating templates for recurring document types (reports, proposals, contracts)
- Planning multi-section documents with front matter, body, and appendices
- Describing DOCX structure for programmatic generation via
python-docx or docxtpl
When NOT to Use
- Editing an existing DOCX file's binary content (use Word application or python-docx directly)
- Designing a PDF layout with precise page positioning (use pdf skill)
- Creating presentation slides (use pptx skill)
- Generating spreadsheet workbooks (use xlsx skill)
- Writing long-form articles or blog posts without specific document structure requirements
Quick Reference
| Task |
Approach |
| Define document structure |
Use heading levels H1 (title), H2 (sections), H3 (subsections) |
| Format tables |
Specify column headers, data rows, alignment, and whether header row is bold/shaded |
| Add front matter |
Cover page, table of contents, executive summary before body sections |
| Number sections |
Use "1. Introduction", "1.1 Background", "1.1.1 Context" hierarchy |
| Style body text |
Specify font (Calibri 11pt default), line spacing (1.15 or 1.5), paragraph spacing |
| Insert figures/charts |
Describe position (inline vs float), caption text, and reference in body |
| Page layout |
Specify margins (Normal: 1in all sides), orientation (portrait/landscape), page size |
Instructions
Define the document purpose and audience — Before writing, clarify: Who will read this document? What decisions should it support? What is the expected length? This determines the appropriate formality, section depth, and level of detail required.
Plan the document hierarchy — Outline the heading structure first:
- H1 (Title/Document Title): One per document, on the cover page
- H2 (Main Sections): Major divisions (e.g., Executive Summary, Background, Methodology)
- H3 (Subsections): Supporting content within each H2 section
- H4 (Sub-subsections): Only if necessary; avoid going deeper than H4
Structure the front matter — Professional documents typically include: cover page (title, author, date, version), table of contents (auto-generated in Word from heading styles), and an executive summary (1–2 pages for decision-makers who won't read the full document).
Write section content — For each section, plan: opening paragraph (what this section covers), body content (details, analysis, data), and closing statement or transition. Use numbered paragraphs for regulatory or legal documents; use flowing prose for reports and proposals.
Design tables — For each table: provide a title/caption, define column headers and their alignment (left, center, right), specify data types per column, and indicate if the header row should have background shading. Mark any cells that should be merged.
Plan visual elements — For figures, charts, or images: write the caption text, specify where in the text the figure is referenced, and describe the content. In a description for programmatic generation, also specify the image file path or chart data source.
Add lists and callouts — Bullet lists for unordered items (features, considerations), numbered lists for ordered items (steps, rankings), and callout boxes or shaded text boxes for important notes, warnings, or key findings.
Define headers and footers — Specify: left/center/right content in the header (company logo, document title, section name), left/center/right content in the footer (confidentiality notice, page number, date), and whether the first page has a different header/footer.
Specify styles and formatting — Define the style guide: body font (Calibri 11pt or Times New Roman 12pt), heading fonts and sizes, line spacing, paragraph spacing before/after, color scheme for headings. Consistent styles make the document look professional and are critical if others will extend the template.
Add back matter — Include as needed: appendices (labeled A, B, C), references/bibliography, glossary of terms, and revision history table.
Examples
Example 1: Project Proposal Document
Input: A consulting firm needs a project proposal for a client presenting a 6-month data platform modernization engagement.
Output:
Document structure:
Cover Page
Title: "Data Platform Modernization: Project Proposal"
Client: Acme Corp
Prepared by: TechConsult LLC
Date: [Month Year]
Version: 1.0 | Confidential
Table of Contents (auto-generated)
1. Executive Summary (H2)
One-page summary of the problem, proposed solution, timeline, and investment.
2. Background and Context (H2)
2.1 Current State Assessment (H3)
Description of existing data infrastructure, pain points.
2.2 Business Drivers (H3)
Why this project is necessary; business KPIs affected.
3. Proposed Solution (H2)
3.1 Solution Architecture (H3)
High-level architecture diagram (Figure 1). Description of components.
3.2 Technology Stack (H3)
Table: Component | Selected Technology | Rationale
3.3 Data Migration Approach (H3)
4. Project Plan (H2)
4.1 Phases and Milestones (H3)
Table: Phase | Duration | Deliverables | Key Milestones
4.2 Assumptions and Dependencies (H3)
4.3 Risk Register (H3)
Table: Risk | Likelihood | Impact | Mitigation
5. Team and Governance (H2)
Table: Role | Name | Responsibility | Allocation (%)
6. Investment (H2)
6.1 Fee Summary (H3)
Table: Phase | Professional Fees | Expenses | Total
6.2 Payment Terms (H3)
7. Terms and Conditions (H2)
Appendix A: Team Biographies
Appendix B: Client References
Appendix C: Revision History
Table: Version | Date | Author | Changes
Formatting conventions:
Body text: Calibri 11pt, 1.15 line spacing, 6pt spacing after paragraph
H2 headings: Calibri 16pt Bold, Dark Blue (#1F3864), 12pt space before
H3 headings: Calibri 13pt Bold, Medium Blue (#2E75B6), 6pt space before
Table header rows: Bold, light blue background (#D6E4F0), centered
Page margins: 1 inch all sides
Header: Left = company logo | Right = "Confidential"
Footer: Left = document title | Center = page number | Right = date
Example 2: Business Report with Executive Summary — python-docx Generation
Input: Generate a monthly operations report programmatically using python-docx.
Output:
python-docx implementation:
from docx import Document
from docx.shared import Inches, Pt, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
import datetime
def create_operations_report(month: str, data: dict) -> Document:
doc = Document()
# Set page margins
section = doc.sections[0]
section.top_margin = Inches(1)
section.bottom_margin = Inches(1)
section.left_margin = Inches(1.25)
section.right_margin = Inches(1.25)
# Title
title = doc.add_heading(f'Operations Report — {month}', level=0)
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
# Metadata
doc.add_paragraph(f'Prepared: {datetime.date.today().strftime("%B %d, %Y")}')
doc.add_paragraph(f'Department: Operations | Status: FINAL')
doc.add_page_break()
# Executive Summary
doc.add_heading('Executive Summary', level=1)
doc.add_paragraph(data['executive_summary'])
# KPI Summary Table
doc.add_heading('Key Performance Indicators', level=2)
table = doc.add_table(rows=1, cols=4)
table.style = 'Table Grid'
headers = ['Metric', 'Target', 'Actual', 'Status']
hdr_cells = table.rows[0].cells
for i, header in enumerate(headers):
hdr_cells[i].text = header
hdr_cells[i].paragraphs[0].runs[0].bold = True
for kpi in data['kpis']:
row_cells = table.add_row().cells
row_cells[0].text = kpi['metric']
row_cells[1].text = str(kpi['target'])
row_cells[2].text = str(kpi['actual'])
row_cells[3].text = '✓' if kpi['met'] else '✗'
# Operational Highlights
doc.add_heading('Operational Highlights', level=1)
for highlight in data['highlights']:
doc.add_paragraph(highlight, style='List Bullet')
# Issues and Risks
doc.add_heading('Issues and Risks', level=1)
for issue in data['issues']:
p = doc.add_paragraph(style='List Number')
p.add_run(issue['title']).bold = True
p.add_run(f' — {issue["description"]}')
return doc
# Usage
report = create_operations_report('January 2025', report_data)
report.save('operations_report_jan2025.docx')
Best Practices
- Always define heading styles before writing content — consistent styles enable auto-TOC and navigation
- Use built-in Word/python-docx styles rather than manual formatting — they are portable and maintainable
- Keep tables simple — avoid merged cells when possible; they are hard to read and maintain
- Place the executive summary at the front — decision-makers often read only this section
- Use numbered sections for formal documents (government, legal, technical specs); prose headings for business reports
- Include a revision history table in all documents that will go through multiple review cycles
- Set
Track Changes expectation up front if the document will be edited collaboratively
Common Mistakes
- Inconsistent heading levels — skipping from H2 to H4 breaks table of contents and navigation
- Using manual bold/font changes instead of styles — breaks when the template is updated
- Overly wide tables that don't fit the page margins — always verify column widths sum to page width minus margins
- Forgetting page breaks between major sections — makes the document look unprofessional
- Using spaces for indentation instead of paragraph indent settings — breaks on different printers and screen sizes
- Creating a table of contents manually instead of using Word's auto-generate feature
Tips & Tricks
- Use
docxtpl for template-based generation — fill a Word template with Jinja2 syntax, much easier than building from scratch
- For complex tables, design in Excel first, then describe the structure for DOCX
- The
python-mammoth library converts DOCX to clean HTML for web publishing
- Word's "Navigation Pane" is the best test: if headings show correctly there, the structure is right
- Use
styles.xml in the DOCX to define a corporate style guide once and reuse across documents
- For very long documents, split into multiple DOCX files and use Word's Master Document feature
- PDF export from Word preserves all styles and is the safest format for sharing with external parties
Related Skills
1---2name: docx3description: Use this skill when generating, planning, or describing structured Word-compatible documents from outlines, raw content, or templates including heading hierarchy, table structures, and formatting conventions. Not for editing existing DOCX files programmatically. Not for PDF layout or presentation slide design.4license: MIT5---67# DOCX89## Overview10This skill covers the design and generation of structured Microsoft Word-compatible documents (.docx format). It helps users translate raw content, outlines, or requirements into well-organized professional documents with consistent heading hierarchy, table structures, numbered sections, formatting conventions, headers/footers, styles, and page layout. This skill applies whether the output is a narrative document written in prose form (for human formatting in Word) or a structured description intended for programmatic generation using libraries like `python-docx`.1112## When to Use13- Generating a complete DOCX document from an outline or brief14- Planning the structure and section hierarchy for a business report or proposal15- Describing table layouts, heading structures, and content for Word documents16- Converting raw meeting notes, bullet points, or data into a polished document17- Creating templates for recurring document types (reports, proposals, contracts)18- Planning multi-section documents with front matter, body, and appendices19- Describing DOCX structure for programmatic generation via `python-docx` or `docxtpl`2021## When NOT to Use22- Editing an existing DOCX file's binary content (use Word application or python-docx directly)23- Designing a PDF layout with precise page positioning (use pdf skill)24- Creating presentation slides (use pptx skill)25- Generating spreadsheet workbooks (use xlsx skill)26- Writing long-form articles or blog posts without specific document structure requirements2728## Quick Reference29| Task | Approach |30|------|----------|31| Define document structure | Use heading levels H1 (title), H2 (sections), H3 (subsections) |32| Format tables | Specify column headers, data rows, alignment, and whether header row is bold/shaded |33| Add front matter | Cover page, table of contents, executive summary before body sections |34| Number sections | Use "1. Introduction", "1.1 Background", "1.1.1 Context" hierarchy |35| Style body text | Specify font (Calibri 11pt default), line spacing (1.15 or 1.5), paragraph spacing |36| Insert figures/charts | Describe position (inline vs float), caption text, and reference in body |37| Page layout | Specify margins (Normal: 1in all sides), orientation (portrait/landscape), page size |3839## Instructions40411. **Define the document purpose and audience** — Before writing, clarify: Who will read this document? What decisions should it support? What is the expected length? This determines the appropriate formality, section depth, and level of detail required.42432. **Plan the document hierarchy** — Outline the heading structure first:44 - **H1 (Title/Document Title)**: One per document, on the cover page45 - **H2 (Main Sections)**: Major divisions (e.g., Executive Summary, Background, Methodology)46 - **H3 (Subsections)**: Supporting content within each H2 section47 - **H4 (Sub-subsections)**: Only if necessary; avoid going deeper than H448493. **Structure the front matter** — Professional documents typically include: cover page (title, author, date, version), table of contents (auto-generated in Word from heading styles), and an executive summary (1–2 pages for decision-makers who won't read the full document).50514. **Write section content** — For each section, plan: opening paragraph (what this section covers), body content (details, analysis, data), and closing statement or transition. Use numbered paragraphs for regulatory or legal documents; use flowing prose for reports and proposals.52535. **Design tables** — For each table: provide a title/caption, define column headers and their alignment (left, center, right), specify data types per column, and indicate if the header row should have background shading. Mark any cells that should be merged.54556. **Plan visual elements** — For figures, charts, or images: write the caption text, specify where in the text the figure is referenced, and describe the content. In a description for programmatic generation, also specify the image file path or chart data source.56577. **Add lists and callouts** — Bullet lists for unordered items (features, considerations), numbered lists for ordered items (steps, rankings), and callout boxes or shaded text boxes for important notes, warnings, or key findings.58598. **Define headers and footers** — Specify: left/center/right content in the header (company logo, document title, section name), left/center/right content in the footer (confidentiality notice, page number, date), and whether the first page has a different header/footer.60619. **Specify styles and formatting** — Define the style guide: body font (Calibri 11pt or Times New Roman 12pt), heading fonts and sizes, line spacing, paragraph spacing before/after, color scheme for headings. Consistent styles make the document look professional and are critical if others will extend the template.626310. **Add back matter** — Include as needed: appendices (labeled A, B, C), references/bibliography, glossary of terms, and revision history table.6465## Examples6667### Example 1: Project Proposal Document68**Input:** A consulting firm needs a project proposal for a client presenting a 6-month data platform modernization engagement.6970**Output:**7172**Document structure:**73```74Cover Page75 Title: "Data Platform Modernization: Project Proposal"76 Client: Acme Corp77 Prepared by: TechConsult LLC78 Date: [Month Year]79 Version: 1.0 | Confidential8081Table of Contents (auto-generated)82831. Executive Summary (H2)84 One-page summary of the problem, proposed solution, timeline, and investment.85862. Background and Context (H2)87 2.1 Current State Assessment (H3)88 Description of existing data infrastructure, pain points.89 2.2 Business Drivers (H3)90 Why this project is necessary; business KPIs affected.91923. Proposed Solution (H2)93 3.1 Solution Architecture (H3)94 High-level architecture diagram (Figure 1). Description of components.95 3.2 Technology Stack (H3)96 Table: Component | Selected Technology | Rationale97 3.3 Data Migration Approach (H3)98994. Project Plan (H2)100 4.1 Phases and Milestones (H3)101 Table: Phase | Duration | Deliverables | Key Milestones102 4.2 Assumptions and Dependencies (H3)103 4.3 Risk Register (H3)104 Table: Risk | Likelihood | Impact | Mitigation1051065. Team and Governance (H2)107 Table: Role | Name | Responsibility | Allocation (%)1081096. Investment (H2)110 6.1 Fee Summary (H3)111 Table: Phase | Professional Fees | Expenses | Total112 6.2 Payment Terms (H3)1131147. Terms and Conditions (H2)115116Appendix A: Team Biographies117Appendix B: Client References118Appendix C: Revision History119 Table: Version | Date | Author | Changes120```121122**Formatting conventions:**123```124Body text: Calibri 11pt, 1.15 line spacing, 6pt spacing after paragraph125H2 headings: Calibri 16pt Bold, Dark Blue (#1F3864), 12pt space before126H3 headings: Calibri 13pt Bold, Medium Blue (#2E75B6), 6pt space before127Table header rows: Bold, light blue background (#D6E4F0), centered128Page margins: 1 inch all sides129Header: Left = company logo | Right = "Confidential"130Footer: Left = document title | Center = page number | Right = date131```132133### Example 2: Business Report with Executive Summary — python-docx Generation134**Input:** Generate a monthly operations report programmatically using python-docx.135136**Output:**137138**python-docx implementation:**139```python140from docx import Document141from docx.shared import Inches, Pt, RGBColor142from docx.enum.text import WD_ALIGN_PARAGRAPH143from docx.oxml.ns import qn144import datetime145146def create_operations_report(month: str, data: dict) -> Document:147 doc = Document()148149 # Set page margins150 section = doc.sections[0]151 section.top_margin = Inches(1)152 section.bottom_margin = Inches(1)153 section.left_margin = Inches(1.25)154 section.right_margin = Inches(1.25)155156 # Title157 title = doc.add_heading(f'Operations Report — {month}', level=0)158 title.alignment = WD_ALIGN_PARAGRAPH.CENTER159160 # Metadata161 doc.add_paragraph(f'Prepared: {datetime.date.today().strftime("%B %d, %Y")}')162 doc.add_paragraph(f'Department: Operations | Status: FINAL')163 doc.add_page_break()164165 # Executive Summary166 doc.add_heading('Executive Summary', level=1)167 doc.add_paragraph(data['executive_summary'])168169 # KPI Summary Table170 doc.add_heading('Key Performance Indicators', level=2)171 table = doc.add_table(rows=1, cols=4)172 table.style = 'Table Grid'173 headers = ['Metric', 'Target', 'Actual', 'Status']174 hdr_cells = table.rows[0].cells175 for i, header in enumerate(headers):176 hdr_cells[i].text = header177 hdr_cells[i].paragraphs[0].runs[0].bold = True178179 for kpi in data['kpis']:180 row_cells = table.add_row().cells181 row_cells[0].text = kpi['metric']182 row_cells[1].text = str(kpi['target'])183 row_cells[2].text = str(kpi['actual'])184 row_cells[3].text = '✓' if kpi['met'] else '✗'185186 # Operational Highlights187 doc.add_heading('Operational Highlights', level=1)188 for highlight in data['highlights']:189 doc.add_paragraph(highlight, style='List Bullet')190191 # Issues and Risks192 doc.add_heading('Issues and Risks', level=1)193 for issue in data['issues']:194 p = doc.add_paragraph(style='List Number')195 p.add_run(issue['title']).bold = True196 p.add_run(f' — {issue["description"]}')197198 return doc199200# Usage201report = create_operations_report('January 2025', report_data)202report.save('operations_report_jan2025.docx')203```204205## Best Practices206- Always define heading styles before writing content — consistent styles enable auto-TOC and navigation207- Use built-in Word/python-docx styles rather than manual formatting — they are portable and maintainable208- Keep tables simple — avoid merged cells when possible; they are hard to read and maintain209- Place the executive summary at the front — decision-makers often read only this section210- Use numbered sections for formal documents (government, legal, technical specs); prose headings for business reports211- Include a revision history table in all documents that will go through multiple review cycles212- Set `Track Changes` expectation up front if the document will be edited collaboratively213214## Common Mistakes215- Inconsistent heading levels — skipping from H2 to H4 breaks table of contents and navigation216- Using manual bold/font changes instead of styles — breaks when the template is updated217- Overly wide tables that don't fit the page margins — always verify column widths sum to page width minus margins218- Forgetting page breaks between major sections — makes the document look unprofessional219- Using spaces for indentation instead of paragraph indent settings — breaks on different printers and screen sizes220- Creating a table of contents manually instead of using Word's auto-generate feature221222## Tips & Tricks223- Use `docxtpl` for template-based generation — fill a Word template with Jinja2 syntax, much easier than building from scratch224- For complex tables, design in Excel first, then describe the structure for DOCX225- The `python-mammoth` library converts DOCX to clean HTML for web publishing226- Word's "Navigation Pane" is the best test: if headings show correctly there, the structure is right227- Use `styles.xml` in the DOCX to define a corporate style guide once and reuse across documents228- For very long documents, split into multiple DOCX files and use Word's Master Document feature229- PDF export from Word preserves all styles and is the safest format for sharing with external parties230231## Related Skills232- [pdf](../pdf/SKILL.md)233- [pptx](../pptx/SKILL.md)234- [xlsx](../xlsx/SKILL.md)