Prompt Variables Guide
Variables are a powerful feature in Musebox that allow you to create dynamic, reusable prompts. Instead of hardcoding specific details into your prompt, you can use placeholders that you (or others) fill in when running the prompt.
What are Prompt Variables?
Prompt variables are placeholders in your prompt text that get replaced with actual values when the prompt is used. For example, instead of writing "Write a blog post about gardening", you can write "Write a blog post about {{topic}}".
When you run this prompt, Musebox will ask you to enter a value for "topic".
Why Use Variables?
Text Variables
Text variables are simple placeholders for text input.
Syntax
Use double curly braces to define a text variable:
{{variable_name}}How to Add Text Variables
You can add text variables in two ways:
Method 1: Using the UI Button
- In the prompt editor, locate the Add Text Variable button (usually found below the prompt content textarea)
- Click the button to open the variable configuration modal
- Fill in the variable details:
- Variable Name (required): Use lowercase with underscores (e.g.,
topic,target_audience,writing_tone) - Display Label (optional): A friendly name shown to users (e.g., "Topic", "Target Audience")
- Description (optional): Help text explaining what the user should enter
- Placeholder (optional): Example text shown in the input field (e.g., "e.g., sustainable living")
- Required (checkbox): Check if the variable must have a value
- Variable Name (required): Use lowercase with underscores (e.g.,
- Click Insert Variable to add it to your prompt at the cursor position
- The variable will appear as
{{variable_name}}in your prompt
Position Your Cursor
Method 2: Typing Manually
Simply type {{variable_name}} directly into the prompt content area. Musebox will automatically detect it. After typing the variable manually, you can use the Manage Variables button to configure its settings.
Customization Options
- Variable Name: The internal name used in the prompt (e.g.,
target_audience) - Display Label: A human-readable label shown to the user (e.g., "Target Audience")
- Description: Help text explaining what the user should enter
- Placeholder: Example text shown inside the input field
- Required: Whether the user must provide a value
Example: Text Variable
Write a comprehensive article about {{topic}}
for {{audience}} using a {{tone}} tone.
The article should be {{word_count}} words long
and include practical examples.Dropdown Variables
Dropdown variables allow you to provide a predefined list of options for the user to choose from.
Syntax
Use triple curly braces with options separated by commas:
{{{variable_name: option1, option2, option3}}}How to Add Dropdown Variables
Method 1: Using the UI Button
- In the prompt editor, locate and click the Add Dropdown Variable button
- In the modal that appears, fill in the variable details:
- Variable Name (required): Use lowercase with underscores (e.g.,
tone,content_type,skill_level) - Display Label (optional): A friendly name for the dropdown (e.g., "Writing Tone", "Content Type")
- Description (optional): Help text explaining the dropdown options
- Options (required): Add at least two options
- Click Add Option to create each choice
- Enter the option text (e.g., "professional", "casual", "friendly")
- You can reorder options by dragging them
- Remove options using the delete button
- Required (checkbox): Check if the user must select an option
- Variable Name (required): Use lowercase with underscores (e.g.,
- Click Insert Variable to add it to your prompt
- The variable will appear as
{{{variable_name: option1, option2, option3}}}in your prompt
Method 2: Typing Manually
You can also type dropdown variables manually using the syntax {{{variable_name: option1, option2, option3}}}, but using the button is recommended to ensure correct formatting and avoid syntax errors.
Dropdown Best Practices
Example: Dropdown Variable
Write a {{{content_type: blog post, email, social media post}}}
about {{topic}} using a {{{tone: professional, casual, friendly}}} tone.
Target audience: {{{audience: beginners, intermediate, experts}}}Managing Variables
If you have added variables manually or want to update their settings later, use the Manage Variables feature.
Accessing the Variable Manager
- Look for the Manage Variables button in the prompt editor (this button appears automatically when variables are detected in your prompt)
- Click the button to open the variable management interface
- You will see a list of all variables found in your prompt content
What You Can Edit
For each variable in the list, you can modify:
- Display Label: Change the human-readable name shown to users
- Variable Type: Switch between Text and Dropdown
- Converting Text to Dropdown will prompt you to add options
- Converting Dropdown to Text will remove the options
- Description: Add or update help text
- Placeholder: Set or change the example text (for text variables)
- Required Status: Toggle whether the variable is mandatory
- Options: Add, remove, or reorder dropdown options (for dropdown variables)
Saving Your Changes
- After making your edits, click Save Changes or Update Variables
- The variable configurations will be saved with your prompt
- The actual variable syntax in your prompt text remains unchanged
Variable Management
Using Prompts with Variables
When you or another user opens a prompt that contains variables:
- A form will appear showing all the variables you defined
- Text variables will show as text input boxes
- Dropdown variables will show as selection menus
- Fill in the values
- The prompt preview will update in real-time to show the final text with your values inserted
- Copy the prompt or use it directly with your AI tools
Best Practices for Variables
1. Use Descriptive Names
Choose variable names that clearly indicate what they represent:
- Good:
{{target_audience}},{{writing_style}},{{main_topic}} - Avoid:
{{var1}},{{x}},{{temp}}
2. Add Helpful Descriptions
When configuring variables, add descriptions that help users understand what to enter. This is especially important for prompts you plan to share publicly.
3. Provide Examples in Placeholders
Use the placeholder field to show users what kind of input you expect:
- For
{{company_name}}: "e.g., Acme Corporation" - For
{{word_count}}: "e.g., 500" - For
{{industry}}: "e.g., technology, healthcare, finance"
4. Use Dropdowns for Limited Options
If a variable should only accept specific values, use a dropdown instead of text:
- Tone: professional, casual, friendly, formal
- Length: short, medium, long
- Format: blog post, email, social media, documentation
5. Mark Essential Variables as Required
Set the "Required" flag for variables that are critical to the prompt functioning correctly. This prevents users from accidentally skipping important fields.
Too Many Variables?
Advanced Variable Techniques
Combining Multiple Variables
You can use multiple variables in close proximity to create flexible templates:
Act as a {{role}} with expertise in {{expertise}}.
Create a {{deliverable}} for {{target_audience}} that:
1. Focuses on {{main_topic}}
2. Uses a {{tone}} tone
3. Is approximately {{length}} words
4. Includes {{num_examples}} examplesConditional Logic in Variables
While Musebox doesn't support conditional variables directly, you can create the effect by using dropdown variables with complete sentence fragments:
Write a blog post about {{topic}}.
{{{additional_requirement: Include 3 case studies, Focus on actionable tips, Compare with competitors, none}}}