AddThisFeature

Prompt Variables

Feed app data into prompts through declared, typed variables rather than string assembly.

moderate Developer Experience

What it adds

A typed variable layer for prompt templates, with declarations, validation, escaping, and a preview of the rendered prompt.

What your agent is told to do

5
  1. 1

    Give every template an explicit declaration of the values it takes, each with a name, a type, and whether it is required, optional, secret, or a list. A template that silently accepts anything cannot be validated or previewed.

  2. 2

    Validate every value against its declaration before rendering: type, length ceiling, and list size. Reject rather than truncate, since a value cut in half changes the meaning of the instruction that contains it.

  3. 3

    Wrap substituted values in clear delimiters and neutralise anything that looks like an instruction, so text drawn from a record cannot redirect the model. Treat every value sourced from user input, uploaded files, or third-party records as hostile.

  4. 4

    Give authors a preview of the rendered prompt with the task content and substituted values visible and the system portion withheld. Storage, scoping, and ownership of the templates themselves belong to Prompt Template Library; this feature owns declaration, substitution, and validation only.

  5. 5

    Do not let a missing optional value collapse into an empty string inside a sentence. Define what the template says when a value is absent, or the model reads a truncated instruction as a complete one.

Edge cases it handles

8
  • Values coming from records, uploads, or third-party data must be delimited and escaped before substitution. Text that reads as a new instruction will be followed, and this is the most common way an app's own data attacks its prompts.
  • The declaration must distinguish required, optional, secret, and list variables, because each needs different handling at validation, preview, and logging time.
  • Type and length must be checked before rendering, so an oversized value fails loudly instead of consuming the context window and pushing the real instructions out of scope.
  • The preview must show what will actually be substituted while withholding hidden system instructions, so an author can debug a template without being handed the safety rules to edit around.
  • A missing value must never render as an empty gap in a sentence. Either block the run or substitute an explicit statement that the value is unavailable.
  • Secret values must be excluded from previews, logs, error messages, and stored request records, and must never be placed in client-visible code or a template body a user can read back.
  • A list variable of unbounded length must be capped, with the truncation stated in the prompt itself rather than performed silently.
  • Values containing the delimiter characters must be handled so they cannot close the wrapper early and escape into the instruction body.

Definition of done

8
  • Every template declares its variables with a name, a type, and required, optional, secret, or list status.
  • Values are validated for type, length, and list size before any request is made, and invalid input is rejected rather than truncated.
  • Substituted values are delimited and neutralised so embedded instructions are not followed.
  • Authors can preview the rendered prompt without seeing or editing system instructions.
  • Missing values block the run or render an explicit unavailable statement, never a silent gap.
  • Secret values never appear in previews, logs, error output, or stored requests.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.