Open source · Prompt & Agent Workflows

Prompt Variable Auditor

Find undeclared prompt variables, unsafe defaults and unused template fields.

v0.1.0 · Node.js 22+ · MIT

Browse the public repository · View releases

A prompt template and the code that fills it drift apart quietly. Somebody renames a field and the placeholder renders as empty text; somebody adds a placeholder and nothing declares what may go in it; somebody moves an interpolation inside a fenced code block and the escaping that was right in prose is now wrong. None of that raises an error at run time — it produces a prompt that is subtly not the prompt anybody wrote, and the model does something reasonable with it.

This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+.

Run the checked-in example

# A template whose variables all line up and whose values are all safe. Exits 0.
node bin/prompt-variable-auditor.mjs \
  --template examples/clean/template.md \
  --schema   examples/clean/variables.json \
  --values   examples/clean/values.json

# A required variable with no value, an undeclared placeholder, an unused
# declaration, and three values that break out of their context. Exits 1.
node bin/prompt-variable-auditor.mjs \
  --template examples/unsafe/template.md \
  --schema   examples/unsafe/variables.json \
  --values   examples/unsafe/values.json --json

Read the result

Exit 2 has two shapes on purpose. A usage error means the run never had a subject, so there is nothing to report about. An unreadable input means the run had a subject and failed to obtain evidence about it — which is what incomplete exists to say, and a consumer needs that report to know which input was not read. A consumer piping stdout must handle an empty stdout on exit 2.

Scope

Every limit is enforced and overridable. Exceeding one is an incomplete result naming the limit, never a silent truncation and never a pass.