Run1 docx template manipulation
[COLM'26] SkillLearnBench is the first benchmark for evaluating continual learning methods that automatically generate agent skills.
npx -y skills add cxcscmu/SkillLearnBench --skill run1_docx-template-manipulationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
Strategies for programmatically modifying .docx files, handling placeholders, and performing conditional text removal.
SKILL.md
1.2 KB, as published. Nobody here has run it
Handling Template Placeholders
Since the source is a .docx file, standard text replacement is not possible because Word files are zipped XML structures.
- Library Selection: Use the
python-docxordocxtpllibrary to interact with the file structure.docxtplis recommended as it natively supports Jinja2-style syntax ({{VAR}}). - Standard Replacement: Iterate through the document's paragraphs and tables to swap placeholders like
{{CANDIDATE_FULL_NAME}}with the corresponding value from the JSON data.
Conditional Content Logic
To handle the {{IF_RELOCATION}} blocks:
- Evaluation: Check the
RELOCATION_PACKAGEboolean or string from the JSON data. - Processing:
- If "Yes": Remove the
{{IF_RELOCATION}}and{{END_IF_RELOCATION}}markers while keeping the text contained between them. - If "No" (or empty): Remove the entire block, including the markers and the text contained within them.
- If "Yes": Remove the
- Save: Once modifications are complete, save the object as
/root/offer_letter_filled.docx.