Docx conditionals
Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-claude-opus-4-6/offer-letter-generator/docx-conditionals
Handle conditional sections in Word templates with IF/END_IF markers, removing or keeping content based on data values.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill docx-conditionalsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
0.8 KB, 149 tokens by cl100k_base, as published. Nobody here has run it
Conditional Sections in Word Templates
Pattern
Templates use {{IF_TAG}}content{{END_IF_TAG}} to mark conditional content.
Logic
- Check the data field (e.g.,
RELOCATION_PACKAGE) for "Yes"/"No" - If "Yes": strip the
{{IF_RELOCATION}}and{{END_IF_RELOCATION}}markers, keep inner content - If "No": remove the entire block including markers and content
- Handle the case where conditional markers and content may span a single paragraph or multiple paragraphs
Implementation Note
Process conditionals BEFORE placeholder replacement, since the conditional content may itself contain placeholders that should only be replaced if the section is kept.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.