
Docx Contracts
- 38 installs
- 177 repo stars
- Updated May 10, 2026
- artwist-polyakov/polyakov-claude-skills
docx-contracts is a Claude skill that fills Word (.docx) contract and form templates containing {{variables}} with structured data using the docxtpl library.
About
This skill fills Word document templates such as contracts and forms with structured data using the docxtpl library. A developer uses it when a user uploads a .docx template with {{variables}} and provides data to populate it. It extracts the template's variable schema, gathers matching values, asks the user for any missing fields, then fills the template and delivers the output document.
- Fills Word (.docx) contract and form templates from structured data using docxtpl
- Extracts the template's variable schema, then fills a JSON of values
- Asks for missing required fields rather than guessing values
Docx Contracts by the numbers
- 38 all-time installs (skills.sh)
- Ranked #396 of 688 Office & Documents skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
docx-contracts capabilities & compatibility
- Use cases
- documentation
- Pricing
- Free
What docx-contracts says it does
Automated contract and form filling using docxtpl library.
Ask user for missing data - never invent values
npx skills add https://github.com/artwist-polyakov/polyakov-claude-skills --skill docx-contractsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 38 |
|---|---|
| repo stars | ★ 177 |
| Last updated | May 10, 2026 |
| Repository | artwist-polyakov/polyakov-claude-skills ↗ |
What it does
Fill Word contract and form templates that use {{variables}} with structured data using docxtpl and deliver the output.
Who is it for?
Users who need to generate contracts or forms from a .docx template and structured data
When should I use this skill?
The user uploads a .docx template with {{variables}} and provides data, or requests contract/form generation from a template
What you get
A completed .docx document with all required template fields filled from the provided data.
- filled .docx document
- template variable schema
By the numbers
- 5-step workflow (extract schema, gather, handle missing, fill, deliver)
Files
docx-contracts
Automated contract and form filling using docxtpl library.
Workflow
Be shure, that you recieve docx file. Don't try to read it.
1. Extract schema: Run scripts/extract_schema.py <template.docx> to get variables list and JSON schema. Don't read file. Just launch script. 2. Gather data: Extract values from user message context, matching schema fields. Use Claude completion for extraction if needed 3. Handle missing data: If any required field is missing or uncertain, ask user directly. Do not guess 4. Fill template: Create JSON file with data, then run scripts/fill_template.py <template.docx> <data.json> <output.docx> 5. Deliver: Move result to /mnt/user-data/outputs/ and provide download link. Please don't read output file.
Key Points
- Template must use Jinja2 syntax:
{{VARIABLE_NAME}} - All required fields from schema must be filled
- Ask user for missing data - never invent values
- Install docxtpl if needed:
pip install docxtpl --break-system-packages
#!/usr/bin/env python3
"""Extract template variables from a docx template and generate JSON schema."""
import sys
import json
from docxtpl import DocxTemplate
def extract_schema(template_path):
"""Extract variables and return JSON schema."""
doc = DocxTemplate(template_path)
variables = doc.get_undeclared_template_variables()
schema = {
"type": "object",
"properties": {var: {"type": "string"} for var in variables},
"required": list(variables)
}
return {
"variables": list(variables),
"schema": schema
}
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python extract_schema.py <template.docx>")
sys.exit(1)
result = extract_schema(sys.argv[1])
print(json.dumps(result, indent=2, ensure_ascii=False))
#!/usr/bin/env python3
"""Fill docx template with provided data."""
import sys
import json
from docxtpl import DocxTemplate
def fill_template(template_path, data_json, output_path):
"""Fill template with data and save result."""
doc = DocxTemplate(template_path)
data = json.loads(data_json) if isinstance(data_json, str) else data_json
doc.render(data)
doc.save(output_path)
return output_path
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: python fill_template.py <template.docx> <data.json> <output.docx>")
sys.exit(1)
with open(sys.argv[2], 'r', encoding='utf-8') as f:
data = json.load(f)
result = fill_template(sys.argv[1], data, sys.argv[3])
print(f"✓ Created: {result}")
Related skills
FAQ
What syntax must the template use?
Jinja2 syntax with {{VARIABLE_NAME}} placeholders, which docxtpl fills from the provided JSON data.
What happens if a required field is missing?
The skill asks the user directly for the missing data and never invents values.