Claude Training Program · Week 1–2 · Build Track

Claude Code Setup &
Your First SEO Script

📖 Tutorial 3 of 8 ⏱ 90 minutes 👥 Build Track — all levels 🎯 No prior coding experience required

Claude Code is a command-line tool that lets Claude write, run, edit, and debug code autonomously on your own machine. It's fundamentally different from asking Claude for code snippets in the chat interface — it can read your files, execute scripts, install libraries, and iterate until the job is done. This tutorial gets you set up from scratch and walks you through building a real, useful SEO tool: a URL status code checker.

Learning Objectives
  • Understand what Claude Code is and how it differs from Claude chat
  • Install and authenticate Claude Code on your machine
  • Understand how to start and navigate a Claude Code session
  • Build a working HTTP status code checker from a CSV of URLs
  • Learn how to guide, correct, and iterate with Claude Code
  • Know where your scripts live and how to re-run them later

1Claude Code vs Claude Chat — What's the Difference?

Before installing anything, it's worth understanding what makes Claude Code distinct. Both use the same underlying AI, but they operate in very different ways.

Claude Chat (claude.ai)
  • Runs in your browser
  • Generates code as text you copy
  • Cannot access your files or computer
  • You run the code yourself
  • Best for: writing prompts, analysis, content
Claude Code (terminal)
  • Runs in your terminal / command line
  • Writes AND executes code directly
  • Can read, write, and create files
  • Installs libraries, runs scripts, fixes errors
  • Best for: building tools, automating tasks

New to the command line? The terminal is a text-based way of controlling your computer. On Mac it's called "Terminal" (find it in Applications → Utilities). On Windows, use "Command Prompt" or "PowerShell". Don't worry — Claude Code does most of the heavy lifting; you mainly just type commands Claude tells you to.

2Installation

Claude Code requires Node.js to be installed on your machine. Follow the steps for your operating system below.

Step 1 — Install Node.js (if you don't have it)

Open your terminal and check if Node.js is already installed:

Terminal
$ node --version v20.11.0 # Any version 18+ is fine. If you see this, skip to Step 2. # If you get "command not found", install Node.js: # Mac (using Homebrew): $ brew install node # Windows: download the installer from nodejs.org # Choose the "LTS" (Long Term Support) version

Step 2 — Install Claude Code

Terminal
$ npm install -g @anthropic-ai/claude-code # Wait for installation to complete, then verify: $ claude --version ✓ Claude Code v1.x.x

Step 3 — Authenticate with your Anthropic account

Terminal
$ claude # Claude Code will open and prompt you to log in. # It will open a browser window — log in with your Anthropic/Claude account. # Once authenticated, you'll see the Claude Code prompt: ✓ Logged in as your@email.com Claude Code ready. Type your request or /help for commands. >

Claude for Teams users: Log in with the same account credentials you use for claude.ai. Your Teams subscription covers Claude Code usage. If you're asked about an API key, you can generate one from your Anthropic account dashboard at console.anthropic.com.

3How Claude Code Works — The Basics

When you open Claude Code, you're in a conversation — just like claude.ai — but Claude also has access to your file system within the folder you opened it from. This is important: always navigate to your project folder before starting Claude Code.

Starting a session in the right folder

Terminal
# Navigate to your project folder first $ cd ~/Documents/seo-tools # Then start Claude Code $ claude # Claude Code can now see and create files in ~/Documents/seo-tools

Key Claude Code commands

CommandWhat it does
/helpShow available commands
/clearClear conversation history and start fresh
/exitExit Claude Code back to your regular terminal
/modelCheck or change the model being used
Ctrl + CStop a running task mid-way

Permissions: Claude Code will ask your permission before running commands or writing files — you'll see a confirmation prompt. Always read what it's about to do before pressing Enter to approve. You can always say "no, do it differently" if you're not comfortable.

What an agentic session looks like

Unlike Claude chat where you get one response, Claude Code works in loops. You give it a goal, it plans steps, executes them one at a time, checks the output, and keeps going until done — or until it hits a problem and asks you for input. Here's a simplified view of what happens under the hood:

You describe the goal

"Build a script that checks HTTP status codes for a list of URLs in a CSV file."

Claude plans the approach

It outlines what it will build, what libraries it'll use, and asks any clarifying questions.

Claude writes the code

It creates the file(s) on your machine, writing each function or section.

Claude runs the code

It executes the script against your data and reviews the output.

Claude fixes errors automatically

If something breaks, it reads the error, adjusts the code, and tries again — often without you needing to do anything.

You review the result

Claude shows you the output and explains what it built. You can ask for changes or additions.

4Project Setup — Organising Your SEO Tools

Before building anything, let's set up a clean folder structure. This keeps your scripts organised and makes it easy to find and re-run them later.

Terminal
# Create your SEO tools directory $ mkdir ~/seo-tools $ cd ~/seo-tools $ mkdir scripts data output # Your structure should look like:
seo-tools/
├── scripts/ # Your Python scripts live here
├── data/ # Input files (CSVs, sitemaps, exports)
└── output/ # Generated reports go here

Now prepare your input data. For this tutorial's script, create a file called urls.csv in the data/ folder with a list of URLs to check — one per row, with a header. You can export this from Screaming Frog, Google Search Console, or create it manually.

data/urls.csvCSV
url https://example.com/ https://example.com/about https://example.com/services https://example.com/old-page https://example.com/contact

5Building the Script — Step by Step

Now for the main event. Navigate to your seo-tools folder and open Claude Code. We'll build the HTTP status checker together, showing you exactly what to say and what to expect.

Terminal
$ cd ~/seo-tools $ claude ✓ Claude Code ready. >

Your opening prompt

The quality of your first message shapes everything that follows. Give Claude Code a clear brief — just like you learned in Tutorial 1, but focused on what you want built:

Build a Python script called check_status.py in the scripts/ folder. The script should: - Read a CSV file from data/urls.csv (column header: "url") - Make an HTTP GET request to each URL - Record the HTTP status code and final URL (after any redirects) - Handle timeouts gracefully (timeout after 10 seconds, record as "TIMEOUT") - Handle connection errors gracefully (record as "ERROR") - Output a CSV file to output/status_report.csv with columns: url, status_code, final_url, redirect_count Use Python's built-in requests library. Add a polite delay of 0.5 seconds between requests so we don't hammer servers. After building it, run it against data/urls.csv and show me the output.

What Claude Code will do

Claude Code will now work through this autonomously. Here's roughly what you'll see in your terminal:

Claude Code Session
I'll build a URL status checker. Let me start by checking the data file exists... ● Read(data/urls.csv) ✓ Found 5 URLs Now I'll create the script: ● Write(scripts/check_status.py) ✓ Created scripts/check_status.py Let me check if the requests library is available... ● Bash(python -c "import requests") ✓ requests is available Running the script against your URLs... ● Bash(python scripts/check_status.py) Checking https://example.com/ ............. 200 Checking https://example.com/about ........ 200 Checking https://example.com/services ..... 301 → 200 Checking https://example.com/old-page ..... 404 Checking https://example.com/contact ...... 200 ✓ Report saved to output/status_report.csv Done! Here's a summary of what the script found: 200 OK: 3 URLs 301 Redirect: 1 URL 404 Not Found: 1 URL

The script Claude Code builds

For reference, here's the kind of script Claude Code will produce. You don't need to type this — Claude writes it for you. But reading it helps you understand what was built:

scripts/check_status.pyPython
import csv import time import requests from pathlib import Path # Configuration INPUT_FILE = "data/urls.csv" OUTPUT_FILE = "output/status_report.csv" TIMEOUT = 10 DELAY = 0.5 def check_url(url): """Check a single URL and return status info.""" try: response = requests.get( url, timeout=TIMEOUT, allow_redirects=True, headers={"User-Agent": "SEOAuditBot/1.0"} ) return { "url": url, "status_code": response.status_code, "final_url": response.url, "redirect_count": len(response.history), } except requests.exceptions.Timeout: return {"url": url, "status_code": "TIMEOUT", "final_url": "", "redirect_count": 0} except requests.exceptions.RequestException as e: return {"url": url, "status_code": "ERROR", "final_url": "", "redirect_count": 0} def main(): urls = [] results = [] # Read input CSV with open(INPUT_FILE, newline="") as f: reader = csv.DictReader(f) urls = [row["url"] for row in reader] # Check each URL for url in urls: print(f"Checking {url} ...", end=" ", flush=True) result = check_url(url) results.append(result) print(result["status_code"]) time.sleep(DELAY) # Write output CSV Path("output").mkdir(exist_ok=True) with open(OUTPUT_FILE, "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=[ "url", "status_code", "final_url", "redirect_count" ]) writer.writeheader() writer.writerows(results) print(f"\n✓ Report saved to {OUTPUT_FILE}") if __name__ == "__main__": main()

6Iterating — Improving the Script in the Same Session

Once the script is working, you can ask Claude Code to improve it without starting over. The conversation context means it already knows everything about what was just built. Here are useful follow-up requests:

The script works well. Can you add a summary section at the end that prints: total URLs checked, count of each status code category (2xx, 3xx, 4xx, 5xx, errors), and the 5 slowest URLs with their response times?
Some of my URL lists have thousands of URLs. Add a progress bar using the tqdm library so I can see how far through it is.
Can you also add an optional command-line argument so I can specify a different input file? Like: python scripts/check_status.py --input data/other_urls.csv

Good iterating habit: Ask for one improvement at a time. Claude Code can handle multiple requests at once, but smaller, focused changes are easier to review and less likely to accidentally break something that was already working.

7When Things Go Wrong

Claude Code will sometimes produce code with errors, or the script might behave unexpectedly. This is normal — here's how to handle it.

SituationWhat to say to Claude Code
Script crashes with an error message"I got this error when running the script: [paste error]. Please fix it."
Output is wrong or unexpected"The script ran but the output doesn't look right. I expected [X] but got [Y]. Can you investigate?"
Script is too slow"This is running too slowly on 500 URLs. Can you add concurrent requests to speed it up?"
Missing library error"I got a ModuleNotFoundError for [library]. Please install it and update the script."
You want to start againType /clear to reset the conversation, then re-brief Claude Code from scratch.

Always check the output: Claude Code is very capable but not infallible. After any script runs, open the output CSV in a spreadsheet and scan a sample of results to make sure they look correct before relying on them for client work.

8Re-running Your Script Later

Once Claude Code has built a script, you don't need Claude to run it again. You can run it directly from your terminal at any time:

Terminal
# Navigate to your project folder $ cd ~/seo-tools # Replace the input file with a new one and run $ python scripts/check_status.py # Or with a custom input file (if you added the argument) $ python scripts/check_status.py --input data/client_abc_urls.csv

This is the real payoff of building tools with Claude Code: you build once, use forever. The next time you need to check URLs for a client, it takes 30 seconds — not 30 minutes.

9Practice Exercises

✏️ Exercise 1 — Install and authenticate Claude Code

Get set up before the next step:

  1. Install Node.js if needed (run node --version to check)
  2. Run npm install -g @anthropic-ai/claude-code
  3. Run claude and complete the login flow
  4. Type /help and read the available commands
  5. Type /exit to close Claude Code
✏️ Exercise 2 — Build the URL status checker

Build the script from this tutorial with your own data:

  1. Create the ~/seo-tools/data/ folder structure
  2. Create a urls.csv with 10–20 real URLs from a client site
  3. Open Claude Code from the seo-tools folder
  4. Use the opening prompt from Section 5 (adapting as needed)
  5. Let Claude Code build and run the script
  6. Open output/status_report.csv in Excel/Sheets and review the results
✏️ Exercise 3 — Add one improvement

Practice iterating within the same session:

  1. After the script is working, ask Claude Code to add response time (in milliseconds) as a new column in the output
  2. Then ask it to add a second output file: a summary CSV that shows just the count of each status code group
  3. Re-run the script and confirm both output files are correct

10Summary

Agentic Coding
Claude Code writes, runs, and fixes code autonomously — you just guide it
🔧
Build Once, Run Forever
Scripts you build live on your machine and can be reused for every client
🔁
Iterate, Don't Restart
Improve scripts in the same session — Claude knows what it built

Key takeaway: You don't need to understand Python deeply to build useful SEO tools with Claude Code. Your job is to describe clearly what you want, review what Claude builds, and test the output. Claude handles the syntax — you bring the SEO knowledge.