Home/Building Workflows with Claude Code/Episode 1
IntermediateEpisode 1 of 415 min

Build Multi-Step Workflows Using Claude

Chain tasks together: clean, transform, summarize, output.

Multi-Step Workflows

So far you've run single tasks: clean this CSV, extract data from this PDF, summarize this file. That's useful, but real work usually involves multiple steps. You get data from one place, transform it, combine it with something else, then produce an output.

This is where Claude Code starts saving you serious time.

The pattern: chaining tasks

A multi-step workflow is just several tasks connected together. The output of step 1 becomes the input for step 2.

Here's a real example — a weekly sales pipeline review:

1. Read this week's CRM export (pipeline.csv)
2. Clean it: remove test accounts, standardize company names
3. Read last week's snapshot (pipeline_last_week.csv)
4. Compare: flag deals that moved stages, stalled, or dropped off
5. Calculate: win rate, average deal velocity, pipeline coverage
6. Generate a markdown report with findings
7. Generate a Slack-formatted summary (shorter, bullet points only)

Seven steps. Manually, you'd open multiple files, flip between spreadsheets, write notes, format everything. With Claude Code, you describe the whole chain and let it execute.

Writing multi-step instructions

You can write this as one instruction block. Number your steps to make the order clear:

Read pipeline.csv and pipeline_last_week.csv.

1. Clean the current pipeline:
   - Remove any row where company_name contains "test" or "demo"
   - Standardize company names (trim whitespace, proper case)
   
2. Compare current vs. last week:
   - Flag deals that moved forward (stage increased)
   - Flag deals that stalled (same stage, no activity date change)
   - Flag deals that disappeared (in last week, not in current)
   
3. Calculate metrics:
   - Win rate: closed-won ÷ (closed-won + closed-lost)
   - Average days in pipeline for closed deals
   - Pipeline coverage: total pipeline value ÷ quarterly target ($500K)
   
4. Generate two outputs:
   - pipeline_review.md: Full report with tables and analysis
   - pipeline_slack.md: 5-bullet summary for posting to Slack

Claude reads both files, works through each step in order, and produces both outputs.

When to split vs. chain

Chain everything together when the steps are tightly connected and you want one coherent run. Like the example above — each step depends on the previous one.

Split into separate runs when:

  • You want to verify intermediate results before continuing
  • Steps are independent (you don't need output A to produce output B)
  • You're debugging and want to isolate where things go wrong

For example, if the comparison step is complex and you're not sure it's working right, run just steps 1-2 first, check the cleaned data, then run steps 3-4 separately.

Using intermediate files

For complex workflows, it helps to save intermediate results:

1. Read raw_data.csv
2. Clean it and save as step1_cleaned.csv
3. Read step1_cleaned.csv and enrich it with data from reference.csv
4. Save enriched data as step2_enriched.csv
5. Generate final report from step2_enriched.csv

This gives you checkpoints. If step 5 produces weird results, you can inspect step2_enriched.csv to see if the problem started earlier.

Real workflow: Monthly expense reconciliation

Here's a workflow that combines multiple file types:

Read these files:
- bank_statement.csv (this month's transactions)
- credit_card.csv (card transactions)  
- receipts/ folder (PDF receipts)

Workflow:
1. Combine bank and credit card transactions into one list
2. For each PDF in receipts/, extract vendor, date, and amount
3. Match receipts to transactions (by date and amount, ±$1 tolerance)
4. Flag transactions without matching receipts
5. Flag receipts that don't match any transaction
6. Calculate totals by category (use the categories from my CLAUDE.md)

Output:
- reconciled_expenses.csv (all transactions with receipt match status)
- missing_receipts.md (transactions that need receipts)
- expense_summary.md (totals by category, flagged items)

Three input sources, three output files, six logical steps. This would take an hour manually. Claude does it in under a minute.

Conditional steps

Sometimes you want different behavior based on what Claude finds:

Read the support_tickets.csv.

1. Categorize each ticket by type: billing, technical, feature-request, other
2. Count tickets per category

3. If any category has more than 50% of total tickets:
   - Create an alert file (urgent_trend.md) highlighting this
   - Include the top 5 example tickets from that category
   
4. If technical tickets mention "login" or "password" more than 10 times:
   - Flag this as a potential outage pattern
   - List the affected customers

5. Generate the standard weekly summary regardless of alerts

The conditional logic ("if X, then do Y") lets you build in alerts without running separate queries.

The CLAUDE.md connection

In Getting Started, you learned about CLAUDE.md files. They shine in multi-step workflows because they hold the context that applies to every step:

  • Your category definitions
  • Your team members' names
  • Your formatting preferences
  • Your file naming conventions

Instead of repeating "format currency as $X,XXX" in every workflow, put it in CLAUDE.md once. Then your workflow instructions stay focused on the logic.

Building your first multi-step workflow

Pick a task you do regularly that involves:

  1. Getting data from somewhere
  2. Doing something to it
  3. Producing an output

Write out the steps in plain English. Number them. Be specific about what each step produces. Run it.

The first time might need adjustment — you'll see where Claude interpreted something differently than you meant. Refine the instructions, run again. After 2-3 iterations, you'll have a workflow you can run reliably every time.

Next up

Multi-step workflows generate multiple files. That's fine for one project, but what happens when you have five different automations, each with their own inputs and outputs? In the next lesson, you'll learn how to organize your projects so things don't become a mess.

Next: Organize Your Claude Code Projects