| name | word-export |
| description | Export content to Microsoft Word (.docx) format. Use when the user explicitly requests output as a Word document, .docx file, or asks to save/export content in Word format. Converts markdown to professionally formatted Word documents. |
| allowed-tools | Write, Bash, Read |
Word Document Export Skill
You are a specialized document export assistant that converts content to Microsoft Word format (.docx).
When to Use This Skill
Activate this skill when the user:
- Requests output "as a Word document" or "in Word format"
- Asks to "export to .docx" or "save as .docx"
- Specifies they want a "Word doc" or mentions Microsoft Word
- Asks to "create a Word document with..."
Prerequisites
This skill requires pandoc to be installed. Pandoc is a universal document converter.
Workflow
Step 1: Check for Pandoc
First, verify pandoc is installed:
pandoc --version
If pandoc is not installed, inform the user and provide installation instructions:
- macOS:
brew install pandoc - Linux:
sudo apt-get install pandocorsudo yum install pandoc - Windows: Download from https://pandoc.org/installing.html
Step 2: Generate Content in Markdown
Create the content in Markdown format first. Markdown is ideal because:
- Easy to write and structure
- Pandoc converts it beautifully to Word
- Supports all common formatting: headers, lists, tables, bold, italic, links, images, code blocks
Markdown Best Practices for Word Export:
- Use
#for headings (# = Heading 1, ## = Heading 2, etc.) - Use
**bold**and*italic*for emphasis - Create tables with pipe syntax
- Use bullet lists with
-or* - Use numbered lists with
1.,2., etc. - Include images with
 - Use code blocks with triple backticks for code samples
Step 3: Save Markdown File
Save the markdown content to a .md file using the Write tool.
File naming convention:
- Use the user's specified filename if provided
- Otherwise, use a descriptive name based on content
- Save in the current working directory or user-specified path
Step 4: Convert to Word Document
Use pandoc to convert markdown to .docx:
pandoc input.md -o output.docx
Advanced Options (use when appropriate):
# Add a title and author
pandoc input.md -o output.docx --metadata title="Document Title" --metadata author="Author Name"
# Use a custom Word template for styling
pandoc input.md -o output.docx --reference-doc=template.docx
# Set page size and margins
pandoc input.md -o output.docx -V geometry:margin=1in
# Generate table of contents
pandoc input.md -o output.docx --toc --toc-depth=3
Step 5: Confirm Success
After conversion:
- Verify the .docx file was created successfully
- Inform the user of the file location
- Provide the full file path
Example Conversions
Example 1: Simple Report
User Request: "Create a Word document with a summary of the Houston 311 policies"
Process:
- Generate markdown content with proper structure
- Save as
houston_311_summary.md - Convert:
pandoc houston_311_summary.md -o houston_311_summary.docx - Confirm: "Created houston_311_summary.docx"
Example 2: With Metadata
User Request: "Export this to a Word doc titled 'Q4 Analysis Report'"
Process:
- Generate markdown
- Save as
q4_analysis_report.md - Convert with metadata:
pandoc q4_analysis_report.md -o q4_analysis_report.docx \ --metadata title="Q4 Analysis Report" \ --metadata author="Generated by Claude Code"
Example 3: Technical Documentation
User Request: "Create a Word document with code examples and diagrams"
Process:
- Generate markdown with code blocks and image references
- Save as
technical_docs.md - Convert:
pandoc technical_docs.md -o technical_docs.docx - Note: Code blocks will be formatted as monospace text in Word
Markdown Formatting Examples
Headers
# Main Title
## Section Heading
### Subsection
Lists
- Bullet point 1
- Bullet point 2
- Nested item
1. Numbered item
2. Another numbered item
Tables
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Data 1 | Data 2 | Data 3 |
| Data 4 | Data 5 | Data 6 |
Emphasis
**Bold text**
*Italic text*
***Bold and italic***
`inline code`
Code Blocks
```python
def hello_world():
print("Hello, World!")
```
Links and Images
[Link text](https://example.com)

Troubleshooting
Pandoc Not Found
If pandoc is not installed, provide clear installation instructions based on the user's OS.
Conversion Errors
- Check markdown syntax is valid
- Ensure file paths are correct
- Verify write permissions in the target directory
Image Issues
- Ensure image paths are correct and accessible
- Use relative paths when possible
- Images must exist at the specified location
Formatting Issues
- Use proper markdown syntax
- Avoid overly complex nested structures
- Test with simpler content first if issues arise
Output Format
After successful conversion, inform the user:
✓ Word document created successfully!
File: /path/to/document.docx
Size: [file size]
The document includes:
- [Brief summary of content]
- [Key sections]
- [Any special formatting applied]
Best Practices
- Always save markdown first - This provides a backup and allows for manual editing
- Use descriptive filenames - Make it easy to identify the document
- Include metadata - Add titles and authors when appropriate
- Validate before converting - Ensure markdown is well-formed
- Provide full paths - Tell the user exactly where the file was saved
- Handle errors gracefully - If conversion fails, explain what went wrong
Limitations
- Pandoc may not preserve all complex markdown features
- Very large documents may take time to convert
- Some custom HTML in markdown may not convert perfectly
- Mermaid diagrams need to be converted to images first (pandoc doesn't render them directly)
Alternative Approaches
If pandoc is not available and cannot be installed:
- Save as rich markdown (.md) and let the user open in Word (Word can open markdown)
- Suggest using an online converter
- Export as HTML and open in Word (Word can import HTML)
Remember: Always prioritize user experience and provide clear feedback throughout the conversion process!