agentsclimarketplace

Run1 docx template manipulation

Skill cxcscmu/SkillLearnBench/skills/b3-teacher-feedback-gemini-3.1-flash-lite-preview/offer-letter-generator/run1_docx-template-manipulation

Strategies for programmatically modifying .docx files, handling placeholders, and performing conditional text removal.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run1_docx-template-manipulation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.2 KB, 248 tokens by cl100k_base, 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.

  1. Library Selection: Use the python-docx or docxtpl library to interact with the file structure. docxtpl is recommended as it natively supports Jinja2-style syntax ({{VAR}}).
  2. 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:

  1. Evaluation: Check the RELOCATION_PACKAGE boolean or string from the JSON data.
  2. 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.
  3. Save: Once modifications are complete, save the object as /root/offer_letter_filled.docx.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.