{"data":{"slug":"github-claude-office-skills-skills-template-engine-e5ba91ea6a61","title":"Template Engine for Document Automation","summary":"Automatically fill document templates with data for mail merge, report generation, and form filling. Supports Word, Excel, and more. Output is generated as a document file.","url":"https:\/\/skillshunter.net\/skills\/github-claude-office-skills-skills-template-engine-e5ba91ea6a61","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-claude-office-skills-skills-template-engine-e5ba91ea6a61","markdown_url":"https:\/\/skillshunter.net\/skills\/github-claude-office-skills-skills-template-engine-e5ba91ea6a61.md","download_url":"https:\/\/skillshunter.net\/skills\/github-claude-office-skills-skills-template-engine-e5ba91ea6a61\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Install required dependencies first: python-docx, openpyxl, python-pptx, reportlab, and jinja2. Provide a template file with placeholders and a data source (e.g., a CSV file) to generate output documents.","instructions":"---\n# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n# CLAUDE OFFICE SKILL - Enhanced Metadata v2.0\n# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n# Basic Information\nname: template-engine\ndescription: \"Auto-fill document templates with data - mail merge for any format\"\nversion: \"1.0\"\nauthor: claude-office-skills\nlicense: MIT\n\n# Categorization\ncategory: template\ntags:\n  - template\n  - engine\n  - autofill\n  - docxtpl\ndepartment: All\n\n# AI Model Compatibility\nmodels:\n  recommended:\n    - claude-sonnet-4\n    - claude-opus-4\n  compatible:\n    - claude-3-5-sonnet\n    - gpt-4\n    - gpt-4o\n\n# MCP Tools Integration\nmcp:\n  server: office-mcp\n  tools:\n    - fill_docx_template\n\n# Skill Capabilities\ncapabilities:\n  - template_filling\n  - document_automation\n\n# Language Support\nlanguages:\n  - en\n  - zh\n---\n\n# Template Engine Skill\n\n## Overview\n\nThis skill enables template-based document generation - define templates with placeholders, then automatically fill them with data. Works with Word, Excel, PowerPoint, and more.\n\n## How to Use\n\n1. Describe what you want to accomplish\n2. Provide any required input data or files\n3. I'll execute the appropriate operations\n\n**Example prompts:**\n- \"Mail merge for bulk letters\/contracts\"\n- \"Generate personalized reports from data\"\n- \"Create certificates from templates\"\n- \"Auto-fill forms with user data\"\n\n## Domain Knowledge\n\n\n### Template Syntax (Jinja2-based)\n\n```\n{{ variable }}           - Simple substitution\n{% for item in list %}   - Loop\n{% if condition %}       - Conditional\n{{ date | format_date }} - Filter\n```\n\n### Word Template Example\n\n```python\nfrom docxtpl import DocxTemplate\n\n# Create template with placeholders:\n# Dear {{ name }},\n# Thank you for your order #{{ order_id }}...\n\ndef fill_template(template_path: str, data: dict, output_path: str):\n    doc = DocxTemplate(template_path)\n    doc.render(data)\n    doc.save(output_path)\n    return output_path\n\n# Usage\nfill_template(\n    \"templates\/order_confirmation.docx\",\n    {\n        \"name\": \"John Smith\",\n        \"order_id\": \"ORD-12345\",\n        \"items\": [\n            {\"name\": \"Product A\", \"qty\": 2, \"price\": 29.99},\n            {\"name\": \"Product B\", \"qty\": 1, \"price\": 49.99}\n        ],\n        \"total\": 109.97\n    },\n    \"output\/confirmation_john.docx\"\n)\n```\n\n### Excel Template\n\n```python\nfrom openpyxl import load_workbook\nimport re\n\ndef fill_excel_template(template_path: str, data: dict, output_path: str):\n    wb = load_workbook(template_path)\n    ws = wb.active\n    \n    # Find and replace placeholders like {{name}}\n    for row in ws.iter_rows():\n        for cell in row:\n            if cell.value and isinstance(cell.value, str):\n                for key, value in data.items():\n                    placeholder = \"{{\" + key + \"}}\"\n                    if placeholder in cell.value:\n                        cell.value = cell.value.replace(placeholder, str(value))\n    \n    wb.save(output_path)\n    return output_path\n```\n\n### Bulk Generation (Mail Merge)\n\n```python\nimport csv\nfrom pathlib import Path\n\ndef mail_merge(template_path: str, data_csv: str, output_dir: str):\n    \"\"\"Generate documents for each row in CSV.\"\"\"\n    \n    Path(output_dir).mkdir(exist_ok=True)\n    \n    with open(data_csv) as f:\n        reader = csv.DictReader(f)\n        \n        for i, row in enumerate(reader):\n            output_path = f\"{output_dir}\/document_{i+1}.docx\"\n            fill_template(template_path, row, output_path)\n            print(f\"Generated: {output_path}\")\n\n# Usage with contacts.csv:\n# name,email,company\n# John,john@example.com,Acme\n# Jane,jane@example.com,Corp\n\nmail_merge(\n    \"templates\/welcome_letter.docx\",\n    \"data\/contacts.csv\",\n    \"output\/letters\"\n)\n```\n\n### Advanced: Conditional Content\n\n```python\nfrom docxtpl import DocxTemplate\n\n# Template with conditionals:\n# {% if vip %}\n# Thank you for being a VIP member!\n# {% else %}\n# Thank you for your purchase.\n# {% endif %}\n\ndoc = DocxTemplate(\"template.docx\")\ndoc.render({\n    \"name\": \"John\",\n    \"vip\": True,\n    \"discount\": 20\n})\ndoc.save(\"output.docx\")\n```\n\n\n## Best Practices\n\n1. **Use clear placeholder naming ({{client_name}})**\n2. **Validate data before rendering**\n3. **Handle missing data gracefully**\n4. **Keep templates version-controlled**\n\n## Installation\n\n```bash\n# Install required dependencies\npip install python-docx openpyxl python-pptx reportlab jinja2\n```\n\n## Resources\n\n- [docxtpl \/ yumdocs Repository](https:\/\/github.com\/elapouya\/python-docxtpl)\n- [Claude Office Skills Hub](https:\/\/github.com\/claude-office-skills\/skills)\n","use_cases":["Generate personalized letters from contact lists","Create bulk reports from structured data","Automate form filling with user data","Generate certificates from templates"],"limitations":[],"compatibility":[],"setup_tip":"```bash\n# Install required dependencies\npip install python-docx openpyxl python-pptx reportlab jinja2\n```","sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/claude-office-skills\/skills\/blob\/9c4c7d5cd2813a8936bf2c9fdb174ea883b85a11\/template-engine\/SKILL.md","source_commit":"9c4c7d5cd2813a8936bf2c9fdb174ea883b85a11","license":"MIT","version":null,"listing_approved_at":"2026-11-22","created_at":"2026-11-21T15:22:54.000000Z","updated_at":"2026-11-22T11:18:24.000000Z","seo_title":"Template Engine for Document Automation","seo_description":"Automate document generation by filling templates with data. Supports Word, Excel, and more.","seo_keywords":["document automation","template filling","mail merge","document generation","auto-fill templates"]}}