Back to Blog

Supercharge Your Workflows with Variable Chaining

Master Promptsy's variable chaining system to create powerful multi-step workflows where each prompt builds on the previous one's output.

Posted by

What Is Variable Chaining?

Variable chaining is the secret sauce that makes Promptsy bundles incredibly powerful. Instead of running isolated prompts, you can create workflows where each step automatically uses outputs from previous steps as inputs.

Imagine a research workflow: Step 1 searches for information, Step 2 summarizes the findings, Step 3 analyzes the summary, and Step 4 generates recommendations - all automatically, with each step building on the previous one.

The Basics: Using {{prev.output}}

Simple Chaining Syntax

The most basic variable is {{prev.output}}, which inserts the complete output from the immediately previous step.

Step 1: "List 5 competitor companies in the AI space"

Step 2: "For each company in this list:
{{prev.output}}

Provide their main product and pricing model"

When Step 2 runs, {{prev.output}} is automatically replaced with the output from Step 1.

Referencing Specific Steps

You can also reference any previous step using {{step[N].output}} where N is the step number:

Step 1: Generate blog topics
Step 2: Choose the best topic
Step 3: Create an outline for: {{step2.output}}
Step 4: Write introduction using:
Topic: {{step2.output}}
Outline: {{step3.output}}
Step 5: Write body paragraphs based on: {{step3.output}}
Step 6: Write conclusion summarizing:
{{step4.output}}
{{step5.output}}

The Queue Runner

Manual vs Auto-Play Mode

When you run a bundle, the Queue Runner modal appears with two execution modes:

  • Manual Mode: Review each step's output before proceeding. Click "Next" to continue to the next step.
  • Auto-Play Mode: Steps execute automatically with configured delays between them. Perfect for long workflows.

Clipboard vs API Mode

Choose how to execute your prompts:

  • Clipboard Mode: Each processed prompt is copied to your clipboard. Paste it into ChatGPT, Claude, or any AI tool. When you get the response, paste it back into Promptsy to continue.
  • API Mode: Provide your OpenAI or Anthropic API key, and prompts execute automatically. Outputs are captured and chained automatically. Perfect for automation.

Real-Time Progress

The Queue Runner shows live status for each step:

  • ⏳ Waiting - Step hasn't started yet
  • ▶️ Running - Step is currently executing
  • ✅ Done - Step completed successfully
  • ❌ Error - Step failed (with error details)

Real-World Examples

Example 1: Content Marketing Workflow

Step 1: Keyword Research
"Generate 10 long-tail keywords related to: [Your Topic]"

Step 2: Topic Selection
"From this list: {{prev.output}}
Choose the 3 keywords with highest search intent"

Step 3: Content Outline
"Create a blog post outline optimized for: {{prev.output}}
Include H2 and H3 headings"

Step 4: Introduction
"Write an engaging introduction for:
{{step3.output}}
Target keywords: {{step2.output}}"

Step 5: Main Content
"Write detailed content for each section in:
{{step3.output}}
Use this introduction as context: {{step4.output}}"

Step 6: SEO Optimization
"Review and optimize for SEO:
{{step5.output}}
Target keywords: {{step2.output}}"

Step 7: Meta Description
"Write a compelling meta description for:
Title: {{step3.output}}
Keywords: {{step2.output}}"

Example 2: Code Review Workflow

Step 1: Code Analysis
"Review this code for bugs and issues: [PASTE CODE]"

Step 2: Security Check
"Analyze this code for security vulnerabilities:
{{step1.output}}"

Step 3: Performance Review
"Identify performance optimization opportunities in:
[PASTE CODE]
Context: {{step1.output}}"

Step 4: Best Practices
"Suggest improvements for code quality and maintainability:
Issues found: {{step1.output}}
Security concerns: {{step2.output}}
Performance notes: {{step3.output}}"

Step 5: Refactoring Plan
"Create a prioritized refactoring plan based on:
{{step4.output}}"

Step 6: Documentation
"Generate comprehensive documentation for the improved code:
Original issues: {{step1.output}}
Improvements made: {{step4.output}}"

Example 3: Research Analysis

Step 1: Data Collection
"Research recent developments in: [TOPIC]
Find 5-7 credible sources"

Step 2: Source Summary
"Summarize key findings from each source:
{{prev.output}}"

Step 3: Pattern Recognition
"Identify trends, patterns, and contradictions in:
{{prev.output}}"

Step 4: Critical Analysis
"Critically analyze the quality and reliability of:
{{step2.output}}
Considering these patterns: {{step3.output}}"

Step 5: Synthesis
"Synthesize insights into a coherent narrative:
Summaries: {{step2.output}}
Patterns: {{step3.output}}
Analysis: {{step4.output}}"

Step 6: Recommendations
"Based on this research:
{{step5.output}}
Provide actionable recommendations"

Advanced Techniques

Conditional Logic

While Promptsy doesn't have built-in conditionals, you can use prompts themselves to create branching logic:

Step 3: Decision Point
"Based on this analysis: {{prev.output}}
Should we proceed with Option A or Option B?
Respond with just 'A' or 'B'"

Step 4: Action (reads step 3)
"If {{step3.output}} equals 'A', do this: [Action A]
If {{step3.output}} equals 'B', do this: [Action B]"

Partial Output Extraction

Sometimes you only need part of a previous output:

Step 2: Extract Key Information
"From this text: {{prev.output}}
Extract only the email addresses and return them as a comma-separated list"

Step 3: Use Extracted Data
"Send personalized messages to: {{step2.output}}"

Accumulation Patterns

Build up information across multiple steps:

Step 4: Comprehensive Report
"Create a final report combining:

Research findings: {{step1.output}}
Analysis: {{step2.output}}
Recommendations: {{step3.output}}"

Best Practices

  • Clear context: Always provide context when referencing previous outputs
  • Test incrementally: Run your bundle step-by-step the first time to verify chaining works
  • Handle errors: Include fallback instructions if a previous step fails
  • Structured outputs: Ask for JSON or markdown when you need to parse outputs programmatically
  • Length awareness: Remember AI context limits - don't chain too many long outputs

Debugging Variable Chains

If your chain isn't working as expected:

  • Use manual mode to inspect each step's output
  • Check the RunLog in your Analytics dashboard for detailed execution data
  • Verify variable syntax - it's case-sensitive
  • Make sure referenced steps exist and completed successfully