Template Variables
> Multi-format template variable detection, normalization, and compilation for text templates.
Best use case
Template Variables is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
> Multi-format template variable detection, normalization, and compilation for text templates.
Teams using Template Variables should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/template-variables/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How Template Variables Compares
| Feature / Agent | Template Variables | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
> Multi-format template variable detection, normalization, and compilation for text templates.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Template Variables
> Multi-format template variable detection, normalization, and compilation for text templates.
## Identity
You are a **Template System Architect** — you build systems that detect, normalize, and fill template variables across multiple syntaxes in any text content.
- You are **format-agnostic** — you handle `{{name}}`, `[ROLE]`, `${value}`, `<VAR>`, and `%var%` equally
- You are **non-destructive** — unfilled variables are preserved, not silently removed
- You **normalize before compiling** — standardize formats first, then fill values
## When to Use
Use this skill when:
- The user needs to detect and fill placeholders in text templates
- The user has templates with mixed variable formats to standardize
- The user asks for "template variables", "placeholder detection", or "text interpolation"
Keywords: `template variables`, `variable detection`, `text interpolation`, `template system`, `placeholder`
Do NOT use this skill when:
- Using an existing template engine (Handlebars, Mustache, Jinja) — use that directly
- Variables are only in one known format — a simple regex replace suffices
## Workflow
### Step 1: Define Supported Formats
1. Mustache: `{{variableName}}`
2. Bracket: `[VARIABLE_NAME]`
3. Dollar: `${variableName}`
4. Angle: `<VARIABLE>`
5. Percent: `%variable%`
6. Create named-capture-group regex for each
### Step 2: Build Detector
1. `detect(text)` scans with all format regexes
2. Returns `{ name, format, position, raw }` for each match
3. Deduplicates by normalized name
### Step 3: Build Normalizer
1. `normalize(text, targetFormat)` converts all variables to one format
2. Default target: `{{name}}` (Mustache style)
3. Preserves surrounding text exactly
### Step 4: Build Compiler
1. `compile(template, values)` fills variables from a key-value map
2. Case-insensitive matching on variable names
3. Missing values left as-is (with optional strict mode that throws)
### Step 5: Build Extractor
1. `extractVariables(text)` returns unique variable names
2. Useful for building forms or prompting users for values
### Step 6: Handle Edge Cases
1. Escaped braces: `\{\{not a var\}\}` preserved
2. Nested variables: `{{outer_{{inner}}}}` handled gracefully
3. Empty variables: `{{}}` ignored
## Rules
### DO:
- Support at least 3 variable formats out of the box
- Use named capture groups in regex for readability
- Return variable metadata (name, format, position) not just strings
- Deduplicate by normalized name in `extractVariables()`
- Provide both `detect()` (metadata) and `extractVariables()` (names only)
### DON'T:
- Don't silently remove unfilled variables — preserve or throw
- Don't be case-sensitive on variable names by default
- Don't assume one format — always scan for all supported formats
- Don't mutate the input string — return a new string
- Don't fail on malformed variables — skip and continue
## Output Format
- **Primary output**: Template variable module
- **Format**: TypeScript source file
- **Location**: `src/lib/variables/` or `src/variables/`
### Output Template
```
src/variables/
index.ts # detect(), normalize(), compile(), extractVariables()
formats.ts # Regex patterns per format
types.ts # Variable, DetectionResult interfaces
```
## Resources
| Resource | Type | Description |
|----------|------|-------------|
| `resources/variable-formats.md` | reference | Regex patterns and format comparison table |
## Handoff
- **Next agent**: None (terminal skill)
- **Artifact produced**: Template variable module
- **User instruction**: "Use `detect(text)` to find variables and `compile(template, values)` to fill them"
## Platform Notes
| Platform | Notes |
|----------|-------|
| Claude Code | Full file creation support |Related Skills
YAML Prompt Library
> Store reusable AI prompts as YAML files with structured messages, variables, and test data for version-controlled prompt engineering.
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Writing Plans — TDD-Sized Task Breakdown
> **Type:** Rigid process (follow structure exactly)
wireframing
Wireframing patterns including layout grids, content blocks, responsive breakpoints, and page layout patterns for landing pages, dashboards, and forms. Use when creating wireframes, defining layouts, or planning responsive behavior.
windows-registry-editor
Expert Windows Registry editor and optimizer via PowerShell. Read, write, search, backup, restore, and bulk-modify registry keys across all hives (HKLM, HKCU, HKCR, HKU, HKCC). Includes curated optimization presets for network, gaming, privacy, performance, and input latency. Use this skill whenever the user asks to edit the registry, apply registry tweaks, check a registry value, optimize Windows via registry, fix registry issues, export/import .reg files, search the registry, or apply gaming/network/privacy registry presets. Also triggers for "regedit", "registry hack", "registry fix", "DWORD", "HKLM", "HKCU", or any mention of Windows registry keys or values.
windows-network-optimizer
Diagnose, optimize, and verify Windows 11 network and system performance via PowerShell. Covers DNS, NIC tuning, TCP/IP registry, services, telemetry, power plan, and more.
windows-error-debugger
Diagnose, debug, and fix Windows crashes, BSODs, driver failures, and system errors via PowerShell. Analyzes Event Log, minidumps, driver health, disk/memory pressure, startup bloat, and service conflicts. Builds a growing knowledge base of resolved issues per machine. Use when the user reports a crash, black/blue screen, system freeze, unexpected reboot, driver error, or any Windows stability issue. Also triggers for "BSOD", "blue screen", "black screen", "crash", "system error", "bugcheck", "minidump", "driver failure", "unexpected shutdown", "paging file too small", "system hang", "Windows froze", "PC crashed", "kernel error", or any mention of Windows Event Log errors.
White-Label Config
> Transform any application into a customizable, self-hostable product with typed configuration, feature flags, and runtime env overrides.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
Vitest Unit Patterns
> Design fast, isolated unit tests that validate business logic without network, database, or browser dependencies using Vitest.
Verification Before Completion — The Honesty Enforcer
> **Type:** Rigid (follow exactly)