variables

Variables let you create reusable prompt templates with dynamic placeholders. Write a prompt once, then swap in different values without rewriting.

syntax

Use the $variable_name syntax to define placeholders in your prompts.

Example prompt:

Translate the following text from $source_language to $target_language:

$text_to_translate

Variable names can contain letters, numbers, and underscores. They are case-sensitive.

how_it_works

1

Write your template

Add variables using $variable_name syntax anywhere in your system or user prompt.

2

Variables are auto-detected

x47 scans your prompt and automatically shows input fields for each variable in the Variables panel below the editor.

3

Fill in values

Enter the values you want to substitute for each variable. You can see the compiled prompt in real-time.

4

Run the prompt

When you execute, x47 substitutes all variables with their values and sends the compiled prompt to the selected models.

examples

Translation template

Template:

Translate from $source to $target: "$text"

Variables:

$source
English
$target
Spanish
$text
Hello world

Compiled:

Translate from English to Spanish: "Hello world"

Code review template

System prompt:

You are a senior $language developer reviewing code for $focus_area.

User prompt:

Review this code and provide feedback:
\`\`\`$language
$code
\`\`\`

This template lets you quickly review code in any language, focusing on different aspects like security, performance, or readability.

A/B testing template

Template:

Write a product description for $product using a $tone tone. Target audience: $audience.

Perfect for testing different tones (professional, casual, humorous) or audiences (developers, marketers, executives) with the same base prompt.

tips

Naming conventions

Use descriptive names like $user_input or $target_language rather than generic names like $x or $var1.

Multiline values

Variables can contain multiline text. This is useful for code snippets, long paragraphs, or structured data.

Preview before running

Always check the compiled prompt preview to ensure your variables are substituted correctly before running. This catches typos in variable names.

Escaping dollar signs

If you need a literal $ in your prompt that shouldn't be treated as a variable, use a variable with the dollar sign as its value, or rephrase to avoid the symbol.

tab_persistence

Variable values are saved per tab. This means you can have different tabs with the same template but different variable values - perfect for comparing how the same prompt performs with different inputs.