Skip to content

Variables

Make your prompts dynamic and reusable with StickyPrompts’ powerful variable system. Variables allow you to create flexible prompt templates that can be customized for different contexts, users, and use cases.

Variables in StickyPrompts are placeholders that you can replace with different values each time you use a prompt. They make your prompts flexible and reusable.

Variables in StickyPrompts use a simple syntax:

{{VARIABLE_NAME}}

Variables are particularly useful in these scenarios:

Hello {{USER_NAME}}, welcome to {{COMPANY_NAME}}!
Please analyze the following {{CONTENT_TYPE}}: {{CONTENT}}
Generate a {{STYLE}} email for {{AUDIENCE}} about {{TOPIC}}.

StickyPrompts supports various variable types to handle different kinds of data.

For simple text replacement:

**Variable:** {{PRODUCT_NAME}}
**Example Value:** "StickyPrompts Pro"
**Usage:** Write a review for {{PRODUCT_NAME}}

For numbers and quantities:

**Variable:** {{WORD_COUNT}}
**Example Value:** 500
**Usage:** Write a {{WORD_COUNT}}-word article about {{TOPIC}}

For conditional logic:

**Variable:** {{INCLUDE_EXAMPLES}}
**Example Value:** true
**Usage:** Explain {{CONCEPT}}. {{INCLUDE_EXAMPLES ? "Include practical examples." : "Keep it theoretical."}}

For collections of items:

**Variable:** {{FEATURES}}
**Example Value:** "Speed, Accuracy, Ease of use"
**Usage:** Highlight these key features: {{FEATURES}}

For complex, structured data:

**Variable:** {{USER_PROFILE}}
**Example Value:**
{
"name": "Sarah Johnson",
"role": "Marketing Manager",
"experience": "5 years",
"industry": "SaaS"
}
**Usage:** Create a personalized message for {{USER_PROFILE.name}}, a {{USER_PROFILE.role}}

In the StickyPrompts Interface:

  1. Prompt Editor

    • Add variables directly in your prompt text
    • Use the variable panel to define types and defaults
    • Set validation rules and constraints
  2. Variable Library

    • Create reusable variable definitions
    • Set global defaults and descriptions
    • Organize by categories and use cases
  3. Template Configuration

    • Define required vs. optional variables
    • Set variable dependencies and relationships
    • Configure validation and error handling

Set default values to make prompts work out-of-the-box:

{
"variables": {
"TONE": {
"default": "professional",
"type": "text",
"description": "The tone of voice for the response"
},
"WORD_COUNT": {
"default": 300,
"type": "number",
"min": 50,
"max": 2000
},
"INCLUDE_CONCLUSION": {
"default": true,
"type": "boolean",
"description": "Whether to include a conclusion section"
}
}
}

Ensure data quality with validation rules:

{
"variables": {
"EMAIL": {
"type": "text",
"validation": {
"pattern": "^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$",
"error": "Please enter a valid email address"
}
},
"PRIORITY": {
"type": "text",
"validation": {
"enum": ["low", "medium", "high", "urgent"],
"error": "Priority must be: low, medium, high, or urgent"
}
},
"BUDGET": {
"type": "number",
"validation": {
"min": 1000,
"max": 1000000,
"error": "Budget must be between $1,000 and $1,000,000"
}
}
}
}
Create a {{CONTENT_TYPE}} about {{TOPIC}} for {{TARGET_AUDIENCE}}.
## Requirements:
- Length: approximately {{WORD_COUNT}} words
- Tone: {{TONE}}
- Style: {{WRITING_STYLE}}
- Include SEO keywords: {{SEO_KEYWORDS}}
## Structure:
1. Engaging introduction
2. {{MAIN_POINTS}} main sections
3. {{INCLUDE_EXAMPLES ? "Practical examples throughout" : "Theoretical focus"}}
4. {{INCLUDE_CTA ? "Call-to-action at the end" : "Informational conclusion"}}
## Additional Context:
{{ADDITIONAL_CONTEXT}}
Please ensure the content is {{QUALITY_LEVEL}} and suitable for {{PLATFORM}}.

Variable Configuration:

{
"CONTENT_TYPE": "blog post",
"TOPIC": "sustainable energy",
"TARGET_AUDIENCE": "homeowners",
"WORD_COUNT": 800,
"TONE": "informative yet approachable",
"WRITING_STYLE": "conversational",
"SEO_KEYWORDS": ["solar panels", "energy efficiency", "green technology"],
"MAIN_POINTS": 3,
"INCLUDE_EXAMPLES": true,
"INCLUDE_CTA": true,
"QUALITY_LEVEL": "high-quality",
"PLATFORM": "company blog",
"ADDITIONAL_CONTEXT": "Focus on cost savings and environmental benefits"
}
You are a customer service representative for {{COMPANY_NAME}}.
## Customer Context:
- Name: {{CUSTOMER_NAME}}
- Account Type: {{ACCOUNT_TYPE}}
- Issue: {{ISSUE_DESCRIPTION}}
- Priority: {{PRIORITY_LEVEL}}
- Previous Interactions: {{PREVIOUS_INTERACTIONS}}
## Response Guidelines:
- Tone: {{RESPONSE_TONE}}
- Max Response Length: {{MAX_WORDS}} words
- {{ESCALATION_REQUIRED ? "Prepare for escalation to supervisor" : "Resolve at first contact level"}}
- {{OFFER_COMPENSATION ? "Consider appropriate compensation if needed" : "Focus on solution without compensation"}}
## Company Policies:
{{RELEVANT_POLICIES}}
## Available Actions:
{{AVAILABLE_ACTIONS}}
Please provide a helpful, professional response that addresses {{CUSTOMER_NAME}}'s concern about {{ISSUE_DESCRIPTION}}.
Create an email for {{CAMPAIGN_TYPE}} targeting {{AUDIENCE_SEGMENT}}.
## Email Details:
- Subject Line: Should mention {{KEY_BENEFIT}}
- Preheader: {{PREHEADER_TEXT}}
- Sender: {{SENDER_NAME}} from {{COMPANY_NAME}}
## Content Structure:
1. **Opening:** Personalized greeting for {{RECIPIENT_NAME}}
2. **Hook:** Compelling opening about {{MAIN_OFFER}}
3. **Value Proposition:** Highlight {{VALUE_POINTS}}
4. **Social Proof:** Include {{TESTIMONIAL_TYPE}}
5. **Call-to-Action:** {{CTA_TEXT}} button
6. **Urgency:** {{URGENCY_MESSAGE}}
## Personalization:
- Industry: {{RECIPIENT_INDUSTRY}}
- Company Size: {{COMPANY_SIZE}}
- Previous Purchases: {{PURCHASE_HISTORY}}
- Engagement Level: {{ENGAGEMENT_SCORE}}
## Constraints:
- Length: {{EMAIL_LENGTH}}
- Tone: {{BRAND_TONE}}
- Compliance: {{COMPLIANCE_REQUIREMENTS}}
Create an engaging email that drives {{DESIRED_ACTION}} while maintaining {{BRAND_VOICE}}.

Use logic to show/hide content based on variable values:

Welcome to {{COMPANY_NAME}}!
{{if USER_TYPE === "premium"}}
As a premium member, you have access to:
- Priority support
- Advanced features
- Exclusive content
{{endif}}
{{if USER_TYPE === "basic"}}
Upgrade to premium to unlock:
- Priority support
- Advanced features
- Exclusive content
{{endif}}
{{if FIRST_TIME_USER}}
Here's a quick tutorial to get you started:
{{TUTORIAL_CONTENT}}
{{endif}}

Apply formatting and transformations:

**Uppercase:** {{PRODUCT_NAME | uppercase}}
**Lowercase:** {{EMAIL | lowercase}}
**Title Case:** {{ARTICLE_TITLE | titlecase}}
**Currency:** {{PRICE | currency}}
**Date:** {{EVENT_DATE | date("MMMM DD, YYYY")}}
**Truncate:** {{DESCRIPTION | truncate(100)}}
**Join List:** {{FEATURES | join(", ")}}

Variables can inherit from parent templates:

{
"parent_template": "base_email_template",
"inherited_variables": [
"COMPANY_NAME",
"BRAND_COLOR",
"CONTACT_INFO"
],
"local_variables": {
"CAMPAIGN_NAME": "Summer Sale 2024",
"DISCOUNT_PERCENT": 25
}
}

Generate variables programmatically:

{
"dynamic_variables": {
"CURRENT_DATE": "{{ new Date().toLocaleDateString() }}",
"DAYS_UNTIL_EVENT": "{{ Math.ceil((eventDate - new Date()) / (1000 * 60 * 60 * 24)) }}",
"PERSONALIZED_GREETING": "{{ getGreetingByTimeZone(userTimezone) }}",
"RECOMMENDED_PRODUCTS": "{{ getRecommendations(userHistory, 3) }}"
}
}

Best Practices:

✅ GOOD NAMES:
- USER_NAME
- PRODUCT_CATEGORY
- EMAIL_SUBJECT
- RESPONSE_TONE
- INCLUDE_EXAMPLES
❌ AVOID:
- x
- temp
- data1
- thing
- variable

Naming Rules:

  • Use UPPERCASE with underscores
  • Be descriptive and specific
  • Avoid abbreviations unless common
  • Use consistent terminology
  • Group related variables with prefixes

User Information:

USER_NAME
USER_EMAIL
USER_ROLE
USER_DEPARTMENT
USER_EXPERIENCE_LEVEL

Content Parameters:

CONTENT_TYPE
CONTENT_LENGTH
CONTENT_STYLE
CONTENT_TONE
CONTENT_FORMAT

Business Context:

COMPANY_NAME
INDUSTRY
TARGET_MARKET
BRAND_VOICE
COMPETITIVE_ADVANTAGE

Technical Settings:

OUTPUT_FORMAT
QUALITY_LEVEL
PROCESSING_MODE
ERROR_HANDLING
VALIDATION_LEVEL

Global Variables:

  • Company information
  • Brand guidelines
  • Contact details
  • Standard formatting

Department Variables:

  • Role-specific terminology
  • Department-specific processes
  • Team preferences
  • Local compliance requirements

Project Variables:

  • Project-specific context
  • Timeline information
  • Stakeholder details
  • Success metrics

ChatGPT Integration:

{
"chatgpt_variables": {
"system_prompt_variables": [
"ROLE_DEFINITION",
"EXPERTISE_LEVEL",
"RESPONSE_STYLE"
],
"user_prompt_variables": [
"TASK_DESCRIPTION",
"CONTEXT_INFO",
"OUTPUT_REQUIREMENTS"
]
}
}

Claude Integration:

{
"claude_variables": {
"thinking_variables": [
"ANALYSIS_DEPTH",
"REASONING_STYLE",
"CONSIDERATION_FACTORS"
],
"response_variables": [
"STRUCTURE_TYPE",
"DETAIL_LEVEL",
"VERIFICATION_NEEDS"
]
}
}

Gemini Integration:

{
"gemini_variables": {
"multimodal_variables": [
"IMAGE_CONTEXT",
"VISUAL_FOCUS",
"CREATIVE_DIRECTION"
],
"content_variables": [
"CREATIVITY_LEVEL",
"EXPLORATION_DEPTH",
"PERSPECTIVE_COUNT"
]
}
}

Optimization Tips:

  • Cache frequently used variable values
  • Use default values to reduce lookup time
  • Batch variable resolution when possible
  • Minimize complex transformations
  • Pre-validate variable formats

Variable Sanitization:

{
"security_rules": {
"input_sanitization": {
"remove_html": true,
"escape_special_chars": true,
"validate_length": true,
"check_encoding": true
},
"output_validation": {
"scan_for_injection": true,
"validate_format": true,
"check_content_policy": true
}
}
}

Access Control:

{
"variable_permissions": {
"USER_PERSONAL_DATA": ["admin", "hr"],
"FINANCIAL_DATA": ["admin", "finance"],
"COMPANY_SECRETS": ["admin"],
"PUBLIC_INFO": ["all"]
}
}

Issue: Variable Not Replacing

  • Check variable name spelling
  • Verify variable is defined
  • Ensure proper syntax: {{VARIABLE_NAME}}
  • Check for extra spaces or characters

Issue: Invalid Variable Value

  • Validate against defined constraints
  • Check data type compatibility
  • Verify required variables are provided
  • Review validation rules

Issue: Performance Problems

  • Reduce complex variable transformations
  • Cache frequently used values
  • Optimize variable resolution order
  • Consider lazy loading for large datasets

Variable Inspector:

{
"debug_mode": {
"show_variable_values": true,
"highlight_replacements": true,
"log_resolution_steps": true,
"validate_all_variables": true
}
}

Testing Framework:

{
"variable_tests": [
{
"name": "Required variables present",
"variables": ["USER_NAME", "TASK_TYPE"],
"expected": "all_present"
},
{
"name": "Email format validation",
"variable": "USER_EMAIL",
"test": "email_format"
}
]
}

Keep It Simple:

  • Use clear, descriptive names
  • Avoid overly complex structures
  • Set sensible defaults
  • Provide helpful descriptions

Maintain Consistency:

  • Use consistent naming patterns
  • Apply uniform validation rules
  • Follow company style guides
  • Document variable purposes

Plan for Scale:

  • Organize variables into logical groups
  • Use inheritance where appropriate
  • Create reusable variable libraries
  • Consider future extensibility

Documentation:

  • Document all variables clearly
  • Provide usage examples
  • Explain validation rules
  • Include troubleshooting guides

Governance:

  • Establish naming conventions
  • Define approval processes
  • Set access controls
  • Regular variable audits

Training:

  • Train team on variable usage
  • Share best practices
  • Provide templates and examples
  • Encourage consistent adoption
{
"migration_rules": {
"old_name": "NEW_NAME",
"user": "USER_NAME",
"content": "CONTENT_TYPE",
"length": "WORD_COUNT"
}
}
{
"variable_versioning": {
"version": "2.1",
"changes": [
"Added USER_PREFERENCES variable",
"Deprecated OLD_FORMAT variable",
"Updated validation for EMAIL variable"
],
"migration_guide": "See documentation for migration steps"
}
}

Ready to master variables in StickyPrompts?

  • Start with simple text variables in your first prompts
  • Practice with the provided examples and templates
  • Explore advanced features like conditionals and transformations
  • Build your own variable library for common use cases
  • Share best practices with your team

Variables are the foundation of powerful, scalable prompt management. Master them to unlock the full potential of StickyPrompts!