Loading tutorials…
Loading tutorials…
Claude Code is the terminal-based agent that writes + runs code on your behalf. For marketers comfortable with light technical work, it is the closest thing to a junior developer on-call.
Who this is forMarketers comfortable with basic terminal use (cd, ls, git) who need to automate data tasks: pulling reports from APIs, transforming CSVs, sending bulk personalized emails, building one-off scripts.
What you'll need
Step 1
Install via npm or the official installer. Authenticate with your Claude account.
Open terminal (Mac/Linux: Terminal app; Windows: PowerShell or WSL).
Install Claude Code: `npm install -g @anthropic-ai/claude-code` (requires Node.js installed).
Or use the official installer from claude.ai/code.
Authenticate: run `claude auth` and follow the browser-based login.
Verify install: run `claude --version`. Should show the current version.
Step 2
Create a new directory for your project. Run `claude` to start an interactive session.
Create a working directory for the automation: `mkdir my-marketing-script && cd my-marketing-script`.
Run `claude`. An interactive session starts.
Claude Code prompts you: "What do you want to build?" Type your goal in plain English.
Example: "Pull the last 30 days of leads from HubSpot via their API, transform the data to include lead score + lifecycle stage, and write a CSV report."
Claude proposes a plan + code. Review before approving.
Step 3
Claude proposes architecture. Iterate before letting it write code.
Claude proposes: "I will create a Python script that authenticates with HubSpot via API key, paginates through the last 30 days of contacts, extracts the fields you need, and writes to leads.csv."
Audit the plan: does it match your intent? Are there missing requirements?
Iterate: "Also include the lead's associated company name. And filter out contacts with lifecycle stage = customer."
Claude updates the plan. Once correct, approve.
Plan review is the most important step. Wrong plan = wasted iterations on wrong code.
Step 4
Claude writes the code in your project directory. You can run it directly or review first.
Claude writes files (.py, .js, .ts, .sh depending on language).
For each file, Claude shows you the code before saving. Approve or request changes.
Once approved, Claude saves the file.
Run the script: `python script.py` or `node script.js`.
For first-time scripts: ALWAYS review the code before running. AI-generated code can have bugs or unintended behaviors (e.g., overwriting files).
Step 5
Errors happen. Paste the error back to Claude; it fixes them.
If the script errors: copy the error message. Paste back into Claude Code.
Claude diagnoses the error and proposes a fix.
Approve the fix. Re-run.
Iterate until the script works.
Common errors: missing API keys (Claude will prompt you to add a `.env` file), wrong field names (verify against API docs), permission errors (verify file paths).
Step 6
Before running on production data, test on a small sample. Avoids accidents.
Ask Claude: "Run this on the first 10 records only, not the full 1,000."
Claude modifies the script to limit records.
Run. Verify output is correct (10 records in CSV, with expected fields).
Once verified, expand: "Now run on all records, but save to a different output file (production-leads.csv) so I do not overwrite the test."
Iteration on small samples saves hours of debugging mistakes on full data.
Step 7
Once a script works, save it to a Git repo or shared location. Reuse + version control.
After the automation works, initialize Git: `git init && git add . && git commit -m "Initial working version"`.
Push to a private GitHub repo for version control.
Document in the repo README: what the script does, how to run, what API keys it needs.
For team sharing: invite team members to the GitHub repo. They can clone + run.
Build a library of reusable scripts over time. Each automation compounds your productivity.
Common mistakes
Running scripts without reviewing the code
What goes wrong: AI-generated code can have bugs. You run it, it overwrites a file or sends 100 wrong emails. Hard to undo.
How to avoid: ALWAYS review code before running, especially first-time scripts. For destructive operations (delete, send email, charge card), test on safe sample data first.
Hardcoding API keys in scripts
What goes wrong: If you commit the script to GitHub with API keys inline, the keys leak. Bad actors find these and abuse them.
How to avoid: Use environment variables. Create a `.env` file (Claude will help). Add `.env` to `.gitignore` so it never commits. Reference keys via `os.getenv()` in Python or `process.env` in Node.
No version control
What goes wrong: You iterate the script over weeks. A new change breaks it. You cannot recover the working version. Hours lost to recreating.
How to avoid: Initialize Git from the first working version. Commit every meaningful change. `git log` lets you find working versions.
Building scripts for one-time use
What goes wrong: You spend 2 hours building a script for a one-off task. The script gets thrown away after one run. Total time = same as doing it manually.
How to avoid: Only build automations for tasks that recur. Monthly reports, weekly imports, daily syncs. One-time tasks: do manually.
No error handling
What goes wrong: Script runs fine on Day 1. On Day 30, an API returns slightly different data. Script crashes. You discover this when a stakeholder asks where the report is.
How to avoid: Ask Claude to add error handling: try/catch blocks, retry logic, notification on failure. Production scripts need this; one-offs do not.
Recap
Done — what's next
How to use Claude Projects for marketing workflows
Read the next tutorial
Hand it off
Claude Code is powerful for marketers willing to cross the technical learning curve. A specialist who has built 20+ Claude Code automations has the patterns: which tasks to automate, error handling, security. From $14-16/hr — most Claude Code automation engagements land at $500-1,500 for a starter library.
See specialist rates
No, but you need comfort with terminal navigation (cd, ls, basic commands). Claude writes the code; you review and run. The skill is reading code well enough to spot obvious problems, not writing it.
ChatGPT Code Interpreter runs Python in a sandbox (inside the chat). Claude Code runs on YOUR machine, writing real files. Claude Code is for production scripts you save and reuse; Code Interpreter is for one-off analysis.
Yes — it writes scripts that hit any API (HubSpot, Stripe, OpenAI, internal APIs). For destructive operations (sending emails, charging cards), always test on sample data first.
Claude Code requires a Claude Pro, Team, or Enterprise subscription. The CLI tool itself is free; the API calls it makes count against your Claude usage.
Pull data from a CSV, transform it (filter, aggregate, format), write to a new CSV. No API calls, no destructive operations. Validates the workflow. Graduate to API + write operations once confident.
Claude for Marketing
Claude Projects are how you stop re-explaining your brand voice every conversation. Set up once, every chat in the project starts with full context. The leverage move for serious Claude users.
Claude for Marketing
Claude can analyze CSVs, run statistical reasoning, and write the explanation in plain English. For marketers without a data analyst, this is the closest thing to having one on-call.
Claude for Marketing
Claude Artifacts let you generate functional marketing assets — landing pages, email HTML, calculators, charts — in a side panel you can edit and export. The non-developer's superpower.
ChatGPT for Marketing
ChatGPT Actions let your Custom GPTs call external APIs — pull data from your CRM, post to social, query analytics. The leverage move for marketers who automate AI.