Agent skill
docx-templates-template-variables-not-rendering
Sub-skill of docx-templates: Template Variables Not Rendering (+2).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/data/office/docx-templates/template-variables-not-rendering
SKILL.md
Template Variables Not Rendering (+2)
Template Variables Not Rendering
# Problem: Variables appear as {{ variable }} in output
# Solution: Check variable syntax and context keys
def diagnose_template(template_path: str, context: dict):
"""Diagnose template rendering issues."""
template = DocxTemplate(template_path)
# Get expected variables
expected = template.get_undeclared_template_variables()
print(f"Template expects: {expected}")
# Check context
provided = set(context.keys())
print(f"Context provides: {provided}")
# Find mismatches
missing = expected - provided
if missing:
print(f"MISSING: {missing}")
Loop Not Iterating
# Problem: Loop content not appearing
# Solution: Verify loop syntax and data structure
# CORRECT loop syntax in template:
# {%tr for item in items %}
# {{ item.name }}
# {%tr endfor %}
# Ensure data is a list
context = {
"items": [
{"name": "Item 1"}, # Must be dict or object
{"name": "Item 2"}
]
}
Image Not Appearing
# Problem: Image placeholder shows error
# Solution: Verify image path and format
from pathlib import Path
def validate_image(image_path: str) -> bool:
"""Validate image file."""
path = Path(image_path)
if not path.exists():
print(f"Image not found: {image_path}")
return False
valid_extensions = {'.png', '.jpg', '.jpeg', '.gif', '.bmp'}
if path.suffix.lower() not in valid_extensions:
print(f"Invalid format: {path.suffix}")
return False
return True
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?