7  Core Workflow

Now that you understand the basics, let’s see how a real working session flows.

7.1 The Iterative Cycle

Working with Claude Code follows a natural cycle:

    ┌─────────────┐
    │   Describe  │  ← You explain what you want
    │    Goal     │
    └──────┬──────┘
           │
           ▼
    ┌─────────────┐
    │   Claude    │  ← Claude proposes a solution
    │  Proposes   │
    └──────┬──────┘
           │
           ▼
    ┌─────────────┐
    │   Review    │  ← You check if it's right
    │  & Refine   │
    └──────┬──────┘
           │
           ▼
    ┌─────────────┐
    │   Execute   │  ← Run and test
    │   & Test    │
    └──────┬──────┘
           │
           ▼
    ┌─────────────┐
    │   Iterate   │  ← Refine until done
    │  or Done    │
    └─────────────┘

7.2 A Real Example: Data Processing Script

Let’s walk through a realistic task: creating a script to process some data.

7.2.1 Phase 1: Understanding

You have a CSV file and want to analyze it. Start by orienting:

> I have a CSV file called survey_results.csv. Can you take a look at it and tell me what data is in there?

Claude reads the file and summarizes: - Column names - Data types - Number of rows - Any obvious issues (missing values, etc.)

7.2.2 Phase 2: Planning

> I want to find out which responses correlate with high satisfaction scores. The satisfaction is in the 'satisfaction' column. What approach would you suggest?

Claude proposes an approach: - Load with pandas - Calculate correlations - Visualize significant ones - Export results

You might refine:

> Let's also filter out responses where satisfaction is missing

7.2.3 Phase 3: Implementation

> Go ahead and create the analysis script

Claude creates analyze_satisfaction.py with the code. Review it:

  • Does the logic look correct?
  • Are there any hardcoded values that should be parameters?
  • Does it handle edge cases?
> This looks good, but can you make the threshold for "significant correlation" a parameter I can adjust?

Claude modifies the script.

7.2.4 Phase 4: Execution

> Run the script and show me the results

Claude executes it. You might see: - The correlation matrix printed - A plot file generated - Some warnings about the data

7.2.5 Phase 5: Iteration

> The plot is hard to read because the labels overlap. Can you rotate the x-axis labels 45 degrees?
> Also, I noticed there are some outliers in column X. Can we handle those?

Continue until you’re satisfied.

7.2.6 Phase 6: Cleanup

> Add a docstring explaining what this script does and how to use it
> Create a requirements.txt with the packages this needs
> Commit this with a message describing what we built

7.3 Workflow Tips

7.3.1 1. Start Small, Then Expand

Don’t ask for the whole thing at once:

Instead of:

> Build me a complete data pipeline that ingests, cleans, transforms, analyzes, and visualizes my data with a web dashboard

Try:

> Let's start by loading the data and checking for quality issues

Then build up incrementally.

7.3.2 2. Use Claude as a Sounding Board

> I'm thinking of using pandas for this, but the file is 5GB. Is that going to be a problem? What alternatives are there?

Claude can help you think through approaches before committing.

7.3.3 3. Ask Why

> Why did you use a dictionary here instead of a list?
> What's the advantage of this approach over X?

You’ll learn as you work.

7.3.4 4. Checkpoint Often

After each significant chunk of work:

> Let's commit what we have so far

This gives you restore points if something goes wrong.

7.3.5 5. Test Incrementally

Don’t wait until the end:

> Let's test this function before we move on

Finding bugs early is easier than debugging a complete system.

7.4 Working with Existing Code

Often you’re not starting from scratch. Claude excels at understanding existing code:

7.4.1 Understanding

> Explain the overall architecture of this project
> What does the process_batch function in utils.py do?
> Where is the database connection configured?

7.4.2 Modifying

> I need to add logging throughout this module. Can you add appropriate log statements?
> The function calculate_metrics is slow. Can you optimize it?

7.4.3 Debugging

> I'm getting a KeyError on line 47 of main.py. Here's the error message: [paste error]. Can you figure out what's wrong?

7.5 Multi-File Changes

Claude can work across multiple files:

> I want to rename the function getData to fetchData everywhere it's used in the project

Claude will: 1. Find all occurrences 2. Show you each change 3. Apply them with your approval

7.6 Handling Complexity

For complex tasks, break them down:

> This is a big task. Let's plan it out first. What are the main steps we need to take?

Claude can create a to-do list, and you work through it together:

> Let's start with step 1: setting up the database schema

7.7 Common Patterns

7.7.1 The Explain-Then-Do

> Explain how you would add authentication to this Flask app

(Claude explains)

> That makes sense. Go ahead and implement it

7.7.2 The Show-Me-Options

> What are the different ways we could structure this data?

(Claude presents options with trade-offs)

> Let's go with option 2

7.7.3 The Rubber Duck

> I'm stuck on how to handle the case where the user submits an empty form. Walk me through the possibilities

Sometimes just explaining helps you think.

7.7.4 The Second Opinion

> Look at my implementation of the sorting function. Any issues or improvements you'd suggest?

7.8 When Things Go Wrong

7.8.1 Claude Makes a Mistake

> That's not quite right. The function should return a list, not a dictionary

Be specific about what’s wrong.

7.8.2 You Made a Mistake

> Actually, I changed my mind about the previous change. Can you revert that?

Or use git:

> Run git diff to see what changed, then git checkout the file to revert

7.8.3 Something Breaks

> The tests are failing now. Can you figure out why?

Claude can debug its own changes.

7.9 Practice Exercise

Let’s practice the full workflow. Create a new project:

mkdir ~/Projects/workflow-practice
cd ~/Projects/workflow-practice
claude
  1. Ask Claude to create a simple “todo list” script:

    > Create a Python script that manages a simple todo list stored in a JSON file. It should support add, list, and complete commands.
  2. Test it:

    > Run it and add a few todos
  3. Request a feature:

    > Add a "delete" command
  4. Request a change:

    > Actually, let's add due dates to todos as well
  5. Clean up:

    > Add error handling for invalid commands and missing files
  6. Document:

    > Add usage instructions as a comment at the top of the file
  7. Save your work:

    > Initialize git and commit everything

7.10 Next Steps

You’ve got the workflow down. Let’s see how to start a project from scratch.

Continue to Project Initialization.