Skip to content

Chapter 2: Claude Code Basics

The Problem

You've heard about AI helping with code. Maybe you've tried ChatGPT or other AI assistants. You describe what you want, they give you code, and then... you're stuck. Where does this code go? How do you make it work? You copy, paste, hope for the best—and often end up in the same place you started.

This is the gap between AI suggestions and actual results. AI can write code, but you still need to put it somewhere and make it run.

The Key Idea

Core concept

Claude Code is an agentic AI—it doesn't just suggest code, it writes files, runs commands, and takes action directly in your project.

When you tell Claude Code to create a segment, it doesn't show you code to copy. It creates the file. When you ask it to run a query, it executes it. When you're ready to deploy, it pushes your changes to the server.

This is what "agentic" means: Claude Code acts on your behalf, not just advises.

What Makes Claude Code Different

It Takes Action

Traditional AI assistants show you code and say "here's what you could do." Claude Code does things:

  • Writes files directly to your project
  • Runs commands to test and validate
  • Creates commits with your changes
  • Connects to external tools like databases and marketing platforms

When you say "create a segment for high-value customers who haven't purchased in 90 days," Claude Code creates high-value-win-back.yml in your project folder—ready to review and deploy.

It Understands Context

Claude Code reads your entire project. It knows:

  • What files exist and how they connect
  • Your project's patterns and conventions
  • What you've discussed in the current conversation
  • What commands are available and how to use them

When you ask "add an activation to yesterday's segment," Claude Code knows which segment you mean and where to add the activation.

It Works Where You Work

Claude Code lives in your terminal—the same place where code lives. Not another browser tab. Not a separate application. It meets you where the work happens.

This matters because marketing-as-code means your work exists as files on your computer. Claude Code works with those files directly, alongside the same tools you'll use to deploy them.

How You Work With Claude Code

Describe Intent, Not Instructions

You don't need to know the technical details. Describe what you want in marketing terms:

> "Create a segment of customers who spent over $1000 and purchased in the last 30 days"

Claude Code translates your intent into the right format:

yaml
name: High-Value Recent Buyers
rule:
  type: And
  conditions:
    - type: Value
      attribute: lifetime_value
      operator:
        type: Greater
        value: 1000
    - type: Value
      attribute: last_purchase_date
      operator:
        type: TimeWithinPast
        value: 30
        unit: day

You didn't need to know YAML syntax. You described what you wanted; Claude Code wrote the code.

Review and Refine

Claude Code always shows you what it's about to do. You review, and if something's not right:

> "Actually, make it $500 instead of $1000"

Claude Code updates the file. This back-and-forth refinement is normal and expected. You're not failing when you need to adjust—you're collaborating.

Trust But Verify

Claude Code is powerful but not infallible. Before deploying, you'll:

  • Preview what Claude Code created
  • Validate that the syntax is correct
  • Dry-run to see what would happen without actually doing it
  • Deploy when you're confident

These safety steps are built into the workflow. Chapter 15 covers them in detail.

Claude Code for Marketing

Here's a preview of what you'll do in this book:

Writing SQL Without Knowing SQL

You'll ask questions in plain English:

> "What was our total revenue last month, broken down by customer segment?"

Claude Code writes and runs the SQL query, then shows you the results. Chapter 7 covers this in depth.

Building Segments Through Conversation

Instead of clicking through UI menus, you'll describe your audience:

> "I need customers from the US or Canada who haven't purchased in 90 days but opened an email in the last week"

Claude Code creates the targeting rules. Chapters 8-10 walk through this.

Automating Workflows

Daily tasks become automated:

> "Set up a workflow that refreshes this segment every morning at 6am and syncs to Salesforce"

Claude Code writes the automation. Chapter 13 covers workflows.

Mental Model: Your AI Colleague

Think of Claude Code as a skilled colleague who:

  • Works fast—can write code much faster than you could manually
  • Needs direction—knows how to code but needs you to say what to build
  • Shows their work—always lets you review before anything ships
  • Learns from feedback—improves as you correct and refine

You bring the marketing expertise: who to target, what message to send, when campaigns should run. Claude Code brings the technical execution: writing the YAML, running the queries, deploying to production.

Neither of you could do this alone. Together, you can manage complex customer journeys without waiting for engineering tickets.

What You've Learned

  • Claude Code is agentic—it takes action, not just gives suggestions
  • It writes files, runs commands, and deploys changes directly
  • You describe intent in plain English; Claude Code handles the code
  • Review is essential—you're the expert on what's correct for your business
  • Think of it as a colleague: fast at coding, but needs your direction

Next Step

Now that you understand what Claude Code can do, let's get it set up. Chapter 3 walks through installation and your first conversation.


You've met your AI partner. Next, you'll get it running on your computer.