docx-draft
Skill2 starsChanged 43 days agoMITView on GitHub
Convert Word documents to structured markdown for LLM-assisted editing, then convert back to Word with preserved formatting. Make sure to use this whenever the user wants to work on, revise, draft, fill in, or collaboratively edit a .docx and then produce a final .docx again. Prefer this over markitdown or docx-to-markdown whenever round-trip editing fidelity matters.
In this repository41 other files it gives its agents.
- skills/web-asset-generator/CLAUDE.mdCLAUDE.md
- academic-writingSkill
- agent-os-childSkill
- agy-pSkill
- amazon-uk-scraperSkill
- artifact-variationsSkill
- audio-transcription-workflowSkill
- capture-dashboardSkill
- claude-channelsSkill
- claude-pSkill
- code-documenterSkill
- context7-docsSkill
- context7-searchSkill
- deep-researchSkill
- grill-meSkill
- handoffSkill
- long-horizon-waiting-strategiesSkill
- openapi-schemaSkill
- opencode-pluginSkill
- pi-extensionSkill
- pi-web-ui-internal-api-orchestrationSkill
- pptx-draftSkill
- saas-idea-finderSkill
- scraping-redditSkill
- scraping-twitterSkill
- secret-scanningSkill
- socialmedia-optimizationSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- text-to-speechSkill
- thematic-analysisSkill
- transcribe-audioSkill
- video-deep-understandingSkill
- video-useSkill
- web-asset-generatorSkill
- web-crawlingSkill
- web-create-assetsSkill
- web-data-acquisitionSkill
- webfetch-skillSkill
- youtube-captionSkill
- youtube-searchSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 18 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈18
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when:
- Distinctive: line 43
Run the converter script:
- Distinctive: line 74
Check that the original .docx exists (from metadata)
- Distinctive: line 75
Verify it hasn't been modified
- Distinctive: line 76
Use it as a template
- Very specific: line 78
Create a new _FINAL.docx file
- Very specific: line 113
Keep the markers intact: [PARA:N] and [/PARA:N]
- Distinctive: line 115
Don't change the numbers
- Very specific: line 149
Keep all markers intact: [TABLE:N], [ROW:N], [CELL:r,c], closing tags
- Distinctive: line 152
Don't change the numbers in markers
- Distinctive: line 156
When editing a structured markdown file:
- Distinctive: line 158
Never modify structure markers: - Only edit content between markers
- Distinctive: line 159
Preserve metadata: - Don't touch the YAML header at the top
- Distinctive: line 160
Maintain table structure: - Keep the same number of rows/columns
- Very specific: line 161
Respect element order: - Don't reorder [PARA] or [TABLE] blocks
- Very specific: line 162
Keep markers paired: - Every [PARA:N] needs its [/PARA:N]
- Distinctive: line 168
If the original .docx is not found during back-conversion:
- Distinctive: line 175
Ask user: "Where is the original .docx file?"
- Very specific: line 176
If they can provide it, update the ORIGINAL_PATH in metadata
- Distinctive: line 177
If not available, inform them formatting may be lost
- Distinctive: line 181
If the hash doesn't match:
- Distinctive: line 243
Does not preserve: images, complex formatting, embedded objects
- Distinctive: line 251
Validate structure: after editing if user made manual changes
- Distinctive: line 252
Be explicit: when content is complete and ready for conversion
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Word Document Drafting Skill
Convert Microsoft Word documents (.docx) to structured markdown for easy editing with LLM assistance, then convert back to Word format with all formatting preserved.
When to Use This Skill
Use this skill when:
- User asks to work on, edit, or draft a Word document
- User wants to convert a .docx file to a more editable format
- User wants to prepare a final .docx from a draft markdown
- User mentions: "work on this docx", "edit this Word file", "draft this document"
How It Works
Phase 1: Convert to Structured Markdown
Converts a .docx file into a structured markdown file with special markers that preserve the exact structure of the original document.
Phase 2: Edit the Draft
You (Claude Code) can now edit the structured markdown file. The structure markers ensure the content maps back perfectly to the Word template.
Phase 3: Convert Back to Word
Converts the edited structured markdown back to a .docx file, using the original as a template to preserve all formatting.
Usage
Converting TO Structured Markdown
When user says:
- "Convert [file.docx] to draft format"
- "Use docx-draft on [file.docx]"
- "I want to work on this Word document"
- "Convert PDR_Form.docx to markdown"
Steps:
- Locate the .docx file
- Run the converter script:
python3 ./scripts/docx_draft_converter.py --to-structured <input.docx> [output.md] - Inform user:
- Where the draft file was created
- CRITICAL: Remind them to keep the original .docx file in its current location
- Explain they can now edit the draft
Example:
python3 ./scripts/docx_draft_converter.py --to-structured ~/pdr/PDR_Form_Jan2026.docxOutput: ~/pdr/PDR_Form_Jan2026_DRAFT.md
Converting BACK to Word
When user says:
- "Convert the draft back to Word"
- "I'm done editing, create the final Word document"
- "Convert [file_DRAFT.md] to docx"
- "Finalize this document"
Steps:
- Locate the structured markdown file (usually ends with
_DRAFT.md) - Run the converter script:
python3 ./scripts/docx_draft_converter.py --to-docx <draft.md> [output.docx] - The script will:
- Check that the original .docx exists (from metadata)
- Verify it hasn't been modified
- Use it as a template
- Fill in the edited content
- Create a new
_FINAL.docxfile
- Inform user of success and location of final file
Example:
python3 ./scripts/docx_draft_converter.py --to-docx ~/pdr/PDR_Form_Jan2026_DRAFT.mdOutput: ~/pdr/PDR_Form_Jan2026_FINAL.docx
Structure Markers
The structured markdown uses special markers that you MUST preserve:
Metadata Block (at top of file)
---
DOCX_DRAFT_FORMAT: v1.0
ORIGINAL_DOCX: filename.docx
ORIGINAL_PATH: /full/path/to/filename.docx
ORIGINAL_HASH: abc123...
CONVERSION_DATE: 2026-01-19T12:00:00
---DO NOT MODIFY the metadata block. The conversion process depends on it.
Paragraph Markers
[PARA:0]
This is the content of a paragraph.
[/PARA:0]Editing rules:
- Keep the markers intact:
[PARA:N]and[/PARA:N] - Edit the content between the markers
- Don't change the numbers
Table Markers
[TABLE:5:rows=4:cols=3]
[ROW:0]
[CELL:0,0]
Header 1
[/CELL:0,0]
[CELL:0,1]
Header 2
[/CELL:0,1]
[CELL:0,2]
Header 3
[/CELL:0,2]
[/ROW:0]
[ROW:1]
[CELL:1,0]
Data in row 1, column 1
[/CELL:1,0]
[CELL:1,1]
Data in row 1, column 2
[/CELL:1,1]
[CELL:1,2]
Data in row 1, column 3
[/CELL:1,2]
[/ROW:1]
[/TABLE:5]Editing rules:
- Keep all markers intact:
[TABLE:N],[ROW:N],[CELL:r,c], closing tags - Edit content between
[CELL:r,c]and[/CELL:r,c] - Maintain table structure (same number of rows and columns)
- Don't change the numbers in markers
Critical Rules for Editing
When editing a structured markdown file:
- Never modify structure markers - Only edit content between markers
- Preserve metadata - Don't touch the YAML header at the top
- Maintain table structure - Keep the same number of rows/columns
- Respect element order - Don't reorder
[PARA]or[TABLE]blocks - Keep markers paired - Every
[PARA:N]needs its[/PARA:N]
Error Handling
If Original File is Missing
If the original .docx is not found during back-conversion:
Error: Original file not found at /path/to/original.docxResponse:
- Ask user: "Where is the original .docx file?"
- If they can provide it, update the
ORIGINAL_PATHin metadata - If not available, inform them formatting may be lost
If Original File Was Modified
If the hash doesn't match:
Error: Original file has been modified (hash mismatch)Response: Warn the user that the original template was changed. Ask if they want to:
- Proceed anyway (formatting might differ)
- Locate the original unmodified file
Example Workflow
Initial request:
User: "I need to work on Quarterly_Review_Form_Jan2026.docx"
Your response:
I'll convert Quarterly_Review_Form_Jan2026.docx to a structured draft format so we can work on it together.
[Run conversion command]
✓ Created Quarterly_Review_Form_Jan2026_DRAFT.md
⚠️ Important: Keep the original Quarterly_Review_Form_Jan2026.docx file in its current location.
You'll need it to convert back to Word format when you're done.
You can now tell me what sections you'd like to work on, and I'll help you draft the content.During editing:
User: "Fill in the Part 1 section with my achievements"
Your response:
I'll edit the Part 1 section in the structured draft. I'll make sure to keep all the structure
markers intact while updating the content.
[Edit content between appropriate markers]
Done! The Part 1 section now includes your achievements. Would you like to work on another section?Finalization:
User: "I'm happy with the draft. Convert it back to Word."
Your response:
I'll convert your draft back to Word format now.
[Run back-conversion command]
✓ Created Quarterly_Review_Form_Jan2026_FINAL.docx
Your final Word document is ready! All formatting from the original template has been preserved.Technical Notes
- Script location:
./scripts/docx_draft_converter.py - Requires
python-docxlibrary - Preserves: paragraph styles, table structures, document sections
- Does not preserve: images, complex formatting, embedded objects
- Best for: forms, templates, text-heavy documents
Tips
- Always inform users about keeping the original file in place
- Use Read tool to examine structure markers before editing
- Edit systematically - work section by section
- Validate structure after editing if user made manual changes
- Be explicit when content is complete and ready for conversion
Common Patterns
Working on a section
1. Read the draft file to locate the section
2. Find the relevant [PARA] or [TABLE] markers
3. Edit content within markers
4. Confirm changes with userMulti-turn editing
1. User provides content for section A → Edit [PARA:X]
2. User provides content for section B → Edit [PARA:Y]
3. User reviews → Make adjustments
4. User approves → Convert back to WordTable filling
1. Identify table by [TABLE:N] marker
2. Locate specific cells by [CELL:row,col]
3. Fill in cell content
4. Maintain all cell markersThis skill enables efficient collaborative document drafting while maintaining perfect fidelity to the original Word document format.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

