Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add cxcscmu/SkillLearnBench --skill docx-conditional-sectionsgit clone --depth 1 https://github.com/cxcscmu/SkillLearnBenchWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cxcscmu/skilllearnbench/docx-conditional-sections)<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/docx-conditional-sections"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/docx-conditional-sections.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00040 | $0.00879 |
| Opus 5 | $0.00020 | $0.00439 |
| Sonnet 5 | $0.00008 | $0.00176 |
| Haiku 4.5 | $0.00004 | $0.00088 |
Grade A, and why
docx-conditional-sections scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Conditional Sections in Word Templates
Pattern
Templates use markers like:
{{IF_RELOCATION}}You are eligible for a relocation package...{{END_IF_RELOCATION}}
Rules:
- Condition is true: Keep the content between markers, remove the markers themselves.
- Condition is false: Remove the entire block including markers.
Cases to Handle
Conditional blocks may span:
- Single paragraph — start and end markers are in the same paragraph
- Multiple paragraphs — start marker in one paragraph, end marker in another
Single-Paragraph Conditional
import re
def handle_single_para_conditional(para, condition_key, should_include, data):
"""Handle {{IF_KEY}}...{{END_IF_KEY}} within a single paragraph."""
start = '{{IF_' + condition_key + '}}'
end = '{{END_IF_' + condition_key + '}}'
text = para.text
if start not in text or end not in text:
return False # Not applicable
if should_include:
# Strip markers, keep content, then replace placeholders
inner = re.search(re.escape(start) + r'(.*?)' + re.escape(end), text, re.DOTALL)
new_text = inner.group(1) if inner else text.replace(start, '').replace(end, '')
# Replace any remaining placeholders in the content
new_text = re.sub(r'\{\{([A-Z0-9_]+)\}\}', lambda m: str(data.get(m.group(1), m.group(0))), new_text)
else:
new_text = ''
if para.runs:
para.runs[0].text = new_text
for run in para.runs[1:]:
run.text = ''
return True
Multi-Paragraph Conditional
When markers span multiple paragraphs, collect and process paragraph-by-paragraph:
from docx.oxml.ns import qn
def remove_paragraph(para):
"""Remove a paragraph element from the document."""
p = para._element
p.getparent().remove(p)
def handle_multi_para_conditional(doc, condition_key, should_include, data):
"""Handle conditional block that may span multiple paragraphs."""
start_marker = '{{IF_' + condition_key + '}}'
end_marker = '{{END_IF_' + condition_key + '}}'
paragraphs = list(doc.paragraphs)
inside = False
to_remove = []
for para in paragraphs:
text = para.text
starts = start_marker in text
ends = end_marker in text
if starts and ends:
# Entire block in one paragraph
handle_single_para_conditional(para, condition_key, should_include, data)
elif starts:
inside = True
if not should_include:
to_remove.append(para)
else:
# Strip start marker
new_text = text.replace(start_marker, '')
if para.runs:
para.runs[0].text = new_text
for run in para.runs[1:]: run.text = ''
elif ends:
inside = False
if not should_include:
to_remove.append(para)
else:
new_text = text.replace(end_marker, '')
if para.runs:
para.runs[0].text = new_text
for run in para.runs[1:]: run.text = ''
elif inside:
if not should_include:
to_remove.append(para)
for para in to_remove:
remove_paragraph(para)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 124 lines · 40 tokens per session scan A 62737b279ea4
docx-conditional-sections is a skill published in the GitHub repository cxcscmu/SkillLearnBench (83 stars, last pushed 1mo ago), licensed MIT. It adds 40 tokens to every session and 879 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
image-ocr
Extract text content from images using Tesseract OCR via Python.
PDF manipulation toolkit. Extract text/tables, create PDFs, merge/split, fill forms, for programmatic document processing and analysis.
pdf-editing
Complete guide for reading and editing PDF documents with PyMuPDF.
exoplanet-workflows
General workflows and best practices for exoplanet detection and characterization from light curve data. Use when planning an exoplanet analysis pipeline, understanding when to use different methods, or troubleshooting detection issues.
docx
Word document manipulation with python-docx - handling split placeholders, headers/footers, nested tables.
xlsx-parsing
Read Microsoft Excel (.xlsx) files robustly with openpyxl (or pandas). Covers multi-sheet workbooks, header rows, empty cells, merged cells, comma-separated list cells, and converting a sheet to a list-of-dicts the rest of your code can consume. Use when a task input or reference document is an .xlsx file rather than…