
You're staring at a complex analysis request from your manager: "I need a comprehensive market analysis of our top three competitors, including their pricing strategies, recent product launches, and social media sentiment. Can you have this by Friday?" Your first instinct might be to craft one massive prompt for an AI assistant, cramming all these requirements into a single request. But there's a better way.
Just like how you wouldn't try to build a house by doing all the work simultaneously—foundation, framing, plumbing, and painting—complex AI tasks work best when broken into logical, sequential steps. This approach is called prompt chaining, and it's one of the most powerful techniques for getting reliable, high-quality results from AI systems.
By the end of this lesson, you'll understand how to decompose complex requests into manageable steps, create prompts that build on each other's outputs, and orchestrate multi-step workflows that produce far better results than any single prompt could achieve.
What you'll learn:
You should be comfortable with basic prompt engineering concepts like providing clear instructions, setting context, and specifying output formats. If you're new to prompting, we recommend completing our "Prompt Engineering Fundamentals" lesson first.
Prompt chaining is the practice of breaking a complex task into a sequence of simpler prompts, where each prompt builds on the output of the previous one. Think of it like an assembly line for knowledge work—each station (prompt) has a specific job, and the product gets more refined as it moves through the process.
Let's start with a concrete example. Imagine you need to analyze customer feedback data to identify improvement opportunities for your product. A single, complex prompt might look like this:
Analyze this customer feedback data, identify the main themes,
categorize them by urgency and impact, suggest specific product
improvements, estimate implementation costs, and create a
prioritized action plan with timelines.
This prompt asks the AI to perform multiple cognitive tasks simultaneously: analysis, categorization, creative problem-solving, cost estimation, and project planning. Each requires different types of reasoning, and trying to do them all at once often leads to shallow or inconsistent results.
Here's how the same task looks when broken into a chain:
Step 1: Theme Extraction
Analyze the following customer feedback and identify the top 10 most
frequently mentioned themes or issues. For each theme, provide:
- A clear, descriptive name
- 2-3 representative quotes from the feedback
- The approximate frequency of mentions
[feedback data]
Step 2: Impact Assessment
Review these customer feedback themes: [output from Step 1]
Rate each theme on two dimensions:
- Customer Impact (High/Medium/Low): How much does this issue affect
the customer experience?
- Business Impact (High/Medium/Low): How much could resolving this
issue impact our business metrics?
Provide a brief justification for each rating.
Step 3: Solution Generation
For each high-impact theme identified: [relevant themes from Step 2]
Generate 2-3 specific, actionable improvement ideas. Each idea should:
- Address the root cause, not just symptoms
- Be technically feasible
- Have clear success metrics
This chained approach allows each prompt to focus on what it does best, leading to more thorough and reliable results.
Successful prompt chains share several key characteristics that distinguish them from random sequences of prompts.
Each prompt in your chain should have a well-defined "contract"—exactly what it expects as input and what it will produce as output. This predictability allows subsequent prompts to work with the data reliably.
Consider this poorly designed prompt pair:
# Weak example
Prompt 1: "Analyze this sales data and find insights"
Prompt 2: "Based on the analysis, make recommendations"
The problem here is that "insights" is vague. What format will they be in? How many? What aspects of the data? The second prompt has no reliable foundation to build on.
Here's a stronger version:
# Better example
Prompt 1: "Analyze this sales data and identify exactly 5 key trends.
For each trend, provide: trend name, supporting data points, and
potential business implications. Format as a numbered list."
Prompt 2: "Based on these 5 sales trends: [output from Prompt 1]
For each trend, provide 2 specific, actionable recommendations.
Include expected impact and implementation difficulty (High/Medium/Low)."
Well-designed chains move from simple, foundational tasks to more complex, synthetic ones. This mirrors how humans naturally approach complex problems—we gather facts first, then analyze, then synthesize and create.
A typical progression might look like:
One challenge with prompt chaining is maintaining important context across steps. Each prompt in the chain should include enough background information for the AI to understand its role in the larger process.
# Good context preservation
You are analyzing customer service data to improve response times.
In the previous step, we identified that 73% of slow responses are
related to technical issues, 18% to billing questions, and 9% to
account access problems.
Now, for each of these three categories, analyze the typical
resolution steps and identify the specific bottlenecks that cause delays...
Certain types of business tasks lend themselves to predictable chaining patterns. Understanding these patterns helps you quickly structure effective chains for new challenges.
This pattern works well for market analysis, competitive research, or any task requiring information gathering followed by synthesis.
Step 1: Information Gathering
"Research [topic] and compile key facts about X, Y, and Z aspects.
Structure as: Aspect | Key Facts | Sources"
Step 2: Gap Analysis
"Based on this research: [Step 1 output]
Identify 3-5 areas where information is missing or contradictory.
Prioritize by importance to our analysis goals."
Step 3: Synthesis
"Using the research findings: [Step 1 output]
Create a comprehensive summary that addresses our key questions: [list questions]
Highlight areas of uncertainty identified in Step 2."
Ideal for customer service analysis, process improvement, or troubleshooting workflows.
Step 1: Problem Identification
"Analyze this data/feedback and identify the top 5 most critical problems.
For each: problem description, frequency, impact level, affected stakeholders."
Step 2: Root Cause Analysis
"For each problem identified: [Step 1 output]
Dig deeper to identify potential root causes. Consider: process issues,
resource constraints, training gaps, system limitations."
Step 3: Solution Design
"For each root cause: [Step 2 output]
Design 2-3 potential solutions. Include: description, pros/cons,
implementation effort, expected impact."
Step 4: Prioritization & Planning
"Review all solutions: [Step 3 output]
Create an implementation roadmap considering: impact vs. effort,
dependencies, resource requirements, timeline."
Useful when you need to check work, ensure accuracy, or get multiple perspectives on a complex issue.
Step 1: Initial Analysis
"Perform [analysis type] on this data: [data]
Provide findings in format: Finding | Supporting Evidence | Confidence Level"
Step 2: Challenge Analysis
"Act as a skeptical reviewer. Examine these findings: [Step 1 output]
Identify potential flaws in reasoning, alternative interpretations,
or gaps in evidence. Be thorough but fair."
Step 3: Synthesis & Confidence Rating
"Consider both the original analysis and the critical review:
[Step 1 & 2 outputs]
Provide final conclusions with adjusted confidence levels and
recommendations for additional validation if needed."
Creating prompt chains that work reliably in practice requires attention to several design principles that go beyond just breaking tasks into steps.
Real-world data is messy, and AI outputs can vary in length, format, and content. Your chain design should account for this variability.
# Robust prompt design
Based on the analysis results: [previous output]
Note: The previous analysis may have identified anywhere from 3-10 key themes.
Regardless of the number identified, for each theme:
- Assign a priority score (1-10)
- Identify 1-2 quick wins (if any)
- Suggest 1 major improvement initiative
If fewer than 5 themes were identified, also suggest areas for additional research.
If more than 8 themes were identified, group related themes and focus on the top 5 clusters.
Add explicit validation steps to catch errors before they propagate through your chain.
Step 2.5: Quality Check
Review the analysis from Step 2: [Step 2 output]
Verify that:
- All requested data points are present
- Numbers and percentages add up correctly
- Conclusions are supported by the provided evidence
- Format matches the specified requirements
If any issues are found, revise the analysis. If the analysis passes all checks, proceed to Step 3.
Sometimes you'll need to loop back or refine earlier steps based on later insights. Design your chains to accommodate this.
Step 4: Feasibility Review
Examine the proposed solutions: [Step 3 output]
If any solutions appear technically unfeasible or prohibitively expensive:
1. Note the specific concerns
2. Revise Step 3 to generate alternative approaches for those specific problems
3. Continue with revised solutions
Otherwise, proceed to Step 5: Implementation Planning.
Let's put prompt chaining into practice with a realistic scenario. You're a data analyst at an e-commerce company, and your marketing director has asked for a comprehensive analysis of your abandoned cart problem.
The Challenge: "We're losing too many customers at checkout. I need to understand why people abandon their carts, which customer segments are most affected, and what we can do about it. Can you analyze our data and give me an action plan?"
Step 1: Design Your Chain
Before writing any prompts, sketch out your approach. What are the logical steps needed to address this request comprehensively?
Try to break this into 4-6 steps on your own before looking at the solution below.
Here's how you might structure this chain:
Step 2: Write the First Three Prompts
Now craft the actual prompts for steps 1-3. Focus on creating clear input-output contracts and building complexity progressively.
Here's the first one to get you started:
Step 1: Cart Abandonment Data Exploration
Analyze this cart abandonment data: [your data would go here]
Provide a structured overview:
- Total carts created vs. completed purchases (with percentages)
- Average time between cart creation and abandonment
- Most common cart values at abandonment
- Abandonment rates by day of week and hour of day
- Top 5 most frequently abandoned product categories
Format each finding with the metric name, the value, and a one-sentence interpretation.
Try writing prompts for steps 2 and 3 yourself. Consider:
Step 3: Test and Refine
If you have access to an AI assistant, try running your first prompt with sample data (you can create fictional data for this exercise). Look at the output and ask:
Refine your prompt based on what you learn.
Even well-intentioned prompt chains can go off the rails. Here are the most frequent problems and how to address them.
Symptom: Later prompts in your chain seem to "forget" important context or make decisions that contradict earlier analysis.
Cause: Each prompt only sees its immediate input, not the full context of the analysis.
Solution: Carry forward essential context explicitly.
# Instead of this:
"Based on the previous analysis, make recommendations."
# Do this:
"Context: We're analyzing cart abandonment to improve checkout conversion rates.
Previous analysis found that 68% of abandonment happens at the shipping cost step,
particularly among first-time customers (45% higher abandonment rate).
Based on these findings: [full previous output]
Generate specific recommendations..."
Symptom: Output formats change between steps, making it hard for subsequent prompts to parse the information reliably.
Cause: Vague formatting instructions or AI creativity in interpretation.
Solution: Use extremely specific format requirements and examples.
# Vague format instruction:
"List the findings clearly"
# Specific format instruction:
"Format findings exactly as follows:
FINDING 1: [one-sentence description]
Evidence: [2-3 supporting data points]
Impact: [High/Medium/Low]
FINDING 2: [one-sentence description]
Evidence: [2-3 supporting data points]
Impact: [High/Medium/Low]"
Symptom: Later prompts in the chain start addressing issues outside your original scope or making assumptions about business priorities.
Cause: Insufficient constraint setting and goal reinforcement.
Solution: Regularly restate the scope and constraints.
"Remember: Our goal is specifically to reduce cart abandonment, not to redesign the entire checkout process. Focus recommendations on changes that directly address the abandonment patterns we identified, considering our constraint of a $50K budget and 3-month timeline."
Symptom: Small uncertainties in early steps become stated as facts in later steps, leading to overconfident final recommendations.
Cause: Not tracking uncertainty levels across the chain.
Solution: Explicitly track and propagate confidence levels.
"Rate your confidence in each finding (High/Medium/Low) and note any assumptions made. These confidence ratings should inform how strongly you state subsequent recommendations."
Once you're comfortable with basic chains, several advanced techniques can make your workflows even more powerful.
Some tasks can benefit from running multiple prompts on the same input, then synthesizing the results.
# Branch the chain
Step 2A: Technical Analysis
"Analyze the checkout process from a technical perspective..."
Step 2B: User Experience Analysis
"Analyze the checkout process from a UX perspective..."
Step 3: Synthesis
"Combine insights from both analyses: [2A output] and [2B output]
Identify areas where technical and UX concerns align..."
Build logic into your prompts that adapts the chain based on intermediate results.
Step 3: Analysis and Next Steps
"Based on the data analysis: [Step 2 output]
If the primary issue appears to be technical (slow load times, errors):
- Skip to Step 4A: Technical Solutions
If the primary issue appears to be pricing/cost-related:
- Skip to Step 4B: Pricing Strategy Analysis
If issues are mixed or unclear:
- Proceed to Step 4C: Comprehensive Investigation"
Build prompts that can identify and correct their own errors.
Step N: Self-Review
"Review your analysis from the previous step: [previous output]
Check for:
- Internal consistency (do the conclusions match the evidence?)
- Logical gaps (are there unsupported leaps in reasoning?)
- Missing perspectives (what stakeholders or factors weren't considered?)
If significant issues are found, provide a revised analysis.
If the analysis is sound, confirm it's ready for the next step."
Prompt chaining transforms how you approach complex analytical tasks by breaking them into focused, manageable steps. The key principles we've covered—clear input-output contracts, progressive complexity, and robust error handling—will serve you well across all types of business analysis.
The most important insight from this lesson is that AI works best when each prompt has a clear, specific job to do. Instead of asking for everything at once, design workflows where each step builds logically on the previous one, maintaining context while allowing the AI to focus its capabilities where they're most effective.
As you begin applying prompt chaining in your work, start with simple 3-4 step chains before attempting more complex workflows. Pay attention to where your chains break down—these failure points will teach you the most about designing robust workflows.
Immediate next steps:
To continue learning:
Remember: the goal isn't to create the most complex chain possible, but to create the most reliable path from your question to a useful answer. Sometimes a simple 2-step chain will outperform an elaborate 8-step process. Focus on clarity, reliability, and results.
Learning Path: Intro to AI & Prompt Engineering