| name | fill-docx-template |
| description | Fill a DOCX template interactively โ extracts <placeholder> names via CLI, asks the user for each value with vscode_askQuestions, then produces a filled copy. The original template is never modified. |
| version | 2.0.0 |
- Use this skill when asked to fill a DOCX template with data.
- Input: a
.docx template path + desired output path.
- Placeholders are discovered automatically from the template โ no properties file needed.
- Agent asks the user for every placeholder value using the
vscode_askQuestions tool.
- Output: a new
.docx file โ a filled copy. Original template is never touched.
Step-by-step agent workflow
Step 1 โ get template and output paths
- If the user has not provided both, ask them (one
vscode_askQuestions call with two questions):
template โ path to the .docx template file.
output โ desired path for the filled output file.
Step 2 โ extract placeholders via CLI
Step 3 โ ask the user for values
- Build one
vscode_askQuestions call with one question per placeholder:
header โ the placeholder key (e.g. data1).
question โ "Enter value for <data1>:" (show the angle-bracket form so the user sees what it replaces).
- Send all questions in a single call โ do not loop one-by-one.
- Example call structure:
{
"questions": [
{ "header": "data1", "question": "Enter value for <data1>:" },
{ "header": "data2", "question": "Enter value for <data2>:" },
{ "header": "data3", "question": "Enter value for <data3>:" }
]
}
Step 4 โ fill the template
Step 5 โ confirm
- Report the output file path to the user.
- Optionally show a summary table of key โ value used.
Scripts reference
extract_placeholders.py โ prints placeholder names (one per line) from a DOCX.
fill_docx_template.py โ copies template and replaces <key> tokens.
Placeholder format
- Templates use angle-bracket syntax:
<key> (e.g. <data1>, <fullName>, <date>).
- Placeholders may appear in body paragraphs and table cells.
- Placeholders split across XML runs are handled automatically.
Prerequisites
- Python 3.8+
pip install python-docx
Alternative: properties-file mode (non-interactive)
- Still supported for batch / CI scenarios:
python instructions/fill-docx-template/scripts/fill_docx_template.py \
--template path/to/Template.docx \
--properties path/to/data.properties \
--output path/to/Output.docx
- Properties file format โ one
key=value per line, # lines are comments:
data1=Alice Johnson
data2=Senior Engineer