Skip to content
Skills Library
Documents & office · Automation

docx-format-replicator

/docx-format-replicator

Extract formatting from existing Word documents and generate new documents with the same format but different content. Use this skill when users need to create multiple documents with consistent formatting, replicate document templates, or maintain corporate document standards across different content.

Licence
MIT
Last repository change
07.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
7
Scripts
2
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 07.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 2 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/extract_format.py, scripts/generate_document.py

What it does and when to use it

Extract formatting from existing Word documents and generate new documents with the same format but different content. Use this skill when users need to create multiple documents with consistent formatting, replicate document templates, or maintain corporate document standards across different content.

Original author description

Extract formatting from existing Word documents and generate new documents with the same format but different content. Use this skill when users need to create multiple documents with consistent formatting, replicate document templates, or maintain corporate document standards across different content.

How it works

  1. Overview
  2. When to Use This Skill
  3. Workflow
  4. Complete Example Workflow
  5. Common Use Cases
  6. Advanced Usage
  7. Dependencies
  8. Resources
  9. Troubleshooting
  10. Tips
Original SKILL.md headings · 253 lines, 951 words
SKILL.md preview
---
name: docx-format-replicator
description: Extract formatting from existing Word documents and generate new documents with the same format but different content. Use this skill when users need to create multiple documents with consistent formatting, replicate document templates, or maintain corporate document standards across different content.
---

# DOCX Format Replicator

## Overview

Extract formatting information from existing Word documents (.docx) and use it to generate new documents with identical formatting but different content. This skill enables creating document templates, maintaining consistent formatting across multiple documents, and replicating complex Word document structures.

## When to Use This Skill

Use this skill when the user:
- Wants to extract formatting from an existing Word document
- Needs to create multiple documents with the same format
- Has a template document and wants to generate similar documents with new content
- Asks to "replicate", "copy format", "use the same style", or "create a document like"
- Mentions document templates, corporate standards, or format consistency

## Workflow

### Step 1: Extract Format from Template

Extract formatting information from an existing Word document to create a reusable format configuration.

```bash
python scripts/extract_format.py <template.docx> <output.json>
```

**Example**:
```bash
python scripts/extract_format.py "HY研制任务书.docx" format_template.json
```

**What Gets Extracted**:
- Style definitions (fonts, sizes, colors, alignment)
- Paragraph and character styles
- Numbering schemes (1, 1.1, 1.1.1, etc.)
- Table structures and styles
- Header and footer configurations

**Output**: JSON file containing all format information (see `references/format_config_schema.md` for details)

### Step 2: Prepare Content Data

Create a JSON file with the actual content for the new document. The content must follow the structure defined in `references/content_data_schema.md`.

**Content Structure**:
```json
{
  "metadata": {
    "title": "Document Title",
    "author": "Author Name",
    "version": "1.0",
    "date": "2025-01-15"
  },
  "sections": [
    {
      "type": "heading",
      "content": "Section Title",
      "level": 1,
      "number": "1"
    },
    {
      "type": "paragraph",
      "content": "Paragraph text content."
    },
    {
      "type": "table",
      "rows": 3,
      "cells": [
        ["Header 1", "Header 2"],
        ["Data 1", "Data 2"]
      ]
    }
  ]
}
```

**Supported Section Types**:
- `heading` - Headings with optional numbering
- `paragraph` - Text paragraphs
- `table` - Tables with configurable rows and columns
- `page_break` - Page breaks

See `assets/example_content.json` for a complete example.

### Step 3: Generate New Document

Generate a new Word document using the extracted format and prepared content.

```bash
python scripts/generate_document.py <format.json> <content.json> <output.docx>
```

**Example**:
```bash
python scripts/generate_document.py format_template.json new_content.json output_document.docx
```

**Result**: A new .docx file with the format from the template applied to the new content.

## Complete Example Workflow

User asks: "I have a research task document. I need to create 5 more documents with the same format but different content."

1. **Extract the format**:
```bash
python scripts/extract_format.py research_task_template.docx template_format.json
```

2. **Create content files** for each new document (content1.json, content2.json, etc.)

3. **Generate documents**:
```bash
python scripts/generate_document.py template_format.json content1.json document1.docx
python scripts/generate_document.py template_format.json content2.json document2.docx
# ... repeat for all documents
```

## Common Use Cases

### Corporate Document Templates

Extract format from a company template and generate reports, proposals, or specifications with consistent branding.

```bash
# One-time: Extract company template
python scripts/extract_format.py "Company Template.docx" company_format.json

# For each new document:
python scripts/generate_document.py company_format.json new_report.json "Monthly Report.docx"
```

### Technical Documentation Series

Create multiple technical documents (specifications, test plans, manuals) with identical formatting.

```bash
# Extract from specification template
python scripts/extract_format.py spec_template.docx spec_format.json

# Generate multiple specs
python scripts/generate_document.py spec_format.json product_a_spec.json "Product A Spec.docx"
python scripts/generate_document.py spec_format.json product_b_spec.json "Product B Spec.docx"
```

### Research Task Documents

The included example template (`assets/hy_template_format.json`) demonstrates a complete research task document format with:
- Approval/review table in header
- Multi-level numbering (1, 1.1, 1.1.1)
- Technical specification tables
- Structured sections

Use this as a starting point for similar technical documents.

## Advanced Usage

### Customizing Extraction

Modify `scripts/extract_format.py` to extract additional properties not covered by default:
- Custom XML elements
- Advanced table features (merged cells, borders)
- Embedded objects
- Custom properties

### Extending Content Types

Add new section types in `scripts/generate_document.py`:
- Images with captions
- Bulleted or numbered lists
- Footnotes and endnotes
- Custom content blocks

See `references/content_data_schema.md` for extension guidelines.

### Batch Processing

Create a wrapper script to generate multiple documents:

```python
import json
import subprocess

format_file = "template_format.json"
content_files = ["content1.json", "content2.json", "content3.json"]

for i, content_file in enumerate(content_files, 1):
    output = f"document_{i}.docx"
    subprocess.run([
        "python", "scripts/generate_document.py",
        format_file, content_file, output
    ])
```

## Dependencies

The scripts require:
- Python 3.7+
- `python-docx` library: `pip install python-docx`

No additional dependencies are needed for the core functionality.

## Resources

### scripts/

- **extract_format.py** - Extract formatting from Word documents
- **generate_document.py** - Generate new documents from format + content

Both scripts include built-in help:
```bash
python scripts/extract_format.py --help
python scripts/generate_document.py --help
```

### references/

- **format_config_schema.md** - Complete schema for format configuration files
- **content_data_schema.md** - Complete schema for content data files

Read these for detailed information on file structures and available options.

### assets/

- **hy_template_format.json** - Example extracted format from a technical research task document
- **example_content.json** - Example content data showing all section types

Use these as references when creating your own format and content files.

## Troubleshooting

**Missing styles in output**: Ensure style IDs in content data match those in format config. Check `format.json` for available style IDs.

**Table formatting issues**: Verify table dimensions (rows/columns) match between content data and format config. See `format_config_schema.md` for table structure.

**Font not displaying correctly**: Some fonts may not be available on all systems. Check that referenced fonts are installed.

**Dependencies missing**: Install required Python packages:
```bash
pip install python-docx
```

## Tips

1. **Test with examples first**: Use the included `hy_template_format.json` and `example_content.json` to understand the workflow before extracting your own formats.

2. **Start simple**: Begin with basic headings and paragraphs, then add tables and complex formatting.

3. **Validate JSON**: Use a JSON validator to check content data files before generating documents.

4. **Keep format configs**: Store extracted format configurations for reuse across multiple projects.

5. **Version control**: Track both format configs and content data in version control for reproducible document generation.
Files in this package (7)
  • SKILL.md 8 KB
  • assets/example_content.json 3 KB
  • assets/hy_template_format.json 114 KB
  • references/content_data_schema.md 6 KB
  • references/format_config_schema.md 5 KB
  • scripts/extract_format.py 8 KB
  • scripts/generate_document.py 5 KB

Versions

The database has no other skills named docx-format-replicator.

Database snapshot: 13.11.2026 · package version e3116853b624 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100docx
    Use this skill whenever the user wants to create or edit .docx (Microsoft Word) files. This includes creating new Word documents from scratch, editing existing Word documents, extracting content from Word files, converting between formats, adding images or other content to Word…
  • 100word-read-write
    Create and read Microsoft Word (.docx) documents. Use this skill when you need to generate reports/letters/templates as .docx or extract readable text from existing .docx files.
  • 95Docx
    Create, edit, and analyze Word documents — tracked changes, tables, images, complex formatting, and format conversion. USE WHEN docx, Word document, create document, tracked changes, redlining.
  • 95Docx
    Create, edit, and analyze Word documents — tracked changes, tables, images, complex formatting, and format conversion. USE WHEN docx, Word document, create document, tracked changes, redlining.
  • 95docx
    Create, read and edit native Word (.docx) documents with styles, page layouts, tables and images while preserving existing features. TRIGGER WHEN: creating, reading, editing or formatting Word (.docx) documents or templates. DO NOT TRIGGER WHEN: spreadsheets (use office:xlsx) or…
  • 100docx
    Create and edit Word documents (.docx): headings, styled paragraphs, tables, images, headers/footers, and page formatting. Use whenever the user asks to write, format, or modify a Word/.docx document.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.