Fill bounded DOCX templates while preserving content placement
73%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./benchmarks/collective-learning/published/executable-learning-20261114/recipient/package/SKILL.mdFill a bounded DOCX offer-letter template from a JSON data object by replacing
{{FIELD_NAME}} placeholders and resolving a single-paragraph conditional
block, then write a new DOCX. Inputs are never modified.
Use this skill when you need to:
{{CANDIDATE_FULL_NAME}}.{{IF_RELOCATION}}...{{END_IF_RELOCATION}} inside a single paragraph.A placeholder may be split across several Word text runs within one paragraph; the helper reassembles the paragraph text, substitutes, then writes the result back while preserving the paragraph/run so the first run's formatting is kept.
{{IF_RELOCATION}}...{{END_IF_RELOCATION}} occurs within
one paragraph (possibly across runs). The enclosed content is kept only when
RELOCATION_PACKAGE is exactly Yes; every other string (and no value)
removes it, and the control markers are always removed. The IF_<X> marker is
governed exclusively by data field <X>_PACKAGE, which is required
whenever the conditional appears. A bare <X> key (e.g. RELOCATION) is
unused: it never acts as an alias or fallback for <X>_PACKAGE and never
affects keep/drop. If the governing <X>_PACKAGE field is absent, the
helper exits nonzero and reports the missing requirement rather than
inventing a default (so an unused bare RELOCATION key cannot stand in for a
missing RELOCATION_PACKAGE).python3 helpers/fill_docx.py \
--template INPUT.docx \
--data INPUT.json \
--output OUTPUT.docxAll three arguments are required. On success the script writes OUTPUT.docx and
exits 0. On failure it writes a diagnostic to stderr (prefixed fill_docx:)
and exits nonzero:
| Exit | Meaning |
|---|---|
| 0 | Output written successfully |
| 2 | Unreadable/invalid data JSON, bad value types/delimiters, unopenable template, or write failure |
| 3 | Unbalanced or mismatched conditional markers in a paragraph |
| 4 | Required value absent: a template field missing from data, or a conditional's required governing field (<X>_PACKAGE) absent |
| 5 | Unresolved template markers remain after substitution |
Contract output filename is offer_letter_filled.docx; pass it via --output.
python3 helpers/fill_docx.py \
--template development/case-02/offer_letter_template.docx \
--data development/case-02/employee_data.json \
--output /tmp/offer_letter_filled.docxPython 3.11 standard library plus python-docx and lxml from the pinned
runtime. No installation or network access required.
Also appears in
since Nov 17, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.