Prompt variable scope checker
Templated prompts are powerful and fragile. Misspell a placeholder name or
forget to supply a value, and the variable renders as raw text or an empty
string — the model gets a broken prompt and you get mysterious bad outputs. This
checker treats a prompt template like code: it cross-references every
{{variable}} against the values you supply and flags anything that does not
line up.
Why template bugs are hard to spot
The insidious quality of a variable bug in a prompt template is that it usually does not cause an error. The API call succeeds. The model responds. But the response is based on a broken prompt that contained the literal text {{customer_name}} instead of the actual customer name, or that was missing a key piece of context because a variable was never substituted.
These failures produce output that is subtly wrong rather than obviously broken. A missing {{tone}} variable might mean the model fell back to a generic tone instead of the formal register you specified. A misspelled {{product_name}} means the model never received the product context and had to invent or infer it. Neither failure throws an exception — both silently degrade the output.
The problem compounds in production systems where the template is authored by one person, the variable injection is handled by another, and both sides can drift independently. A renamed variable in the injection layer breaks the template silently until someone notices the output quality has dropped.
How it works
You paste a template using double-brace placeholders and a list of the variables
you actually provide, written as key = value lines. The tool extracts every
placeholder from the template and every key from your definitions, then
computes two sets: variables used in the template but never defined (errors,
because they will render empty) and variables defined but never used (warnings,
usually a typo or leftover). It also warns about stray braces that do not form
a valid placeholder.
Common mistakes the checker catches
| Error type | Example | What happens at runtime |
|---|---|---|
| Undefined variable | {{customer_name}} in template, key never provided | Literal {{customer_name}} appears in the prompt |
| Typo in key | Template uses {{audience}}, key defined as audiance | Same as undefined — the misspelled key never matches |
| Unused variable | Key tone provided but template never uses {{tone}} | Variable supplied but silently ignored |
| Stray brace | Single {variable} instead of double {{variable}} | Not matched as a placeholder, substitution never happens |
Tips and notes
- Run it before every prompt change. The most common production bug is a renamed variable that one side forgot to update.
- Unused warnings catch typos. If
{{audience}}is flagged unused but you expected it, check whether the template says{{audiance}}. - Empty is silent. An undefined variable rarely throws — it just degrades output quality, which is why catching it statically matters.
- Everything is local. No upload, so it is safe to paste proprietary templates.