Learning objectives
- > Install Claude Code and run your first interactive session
- > Understand the differences between web interfaces and terminal-based AI
- > Run the same prompt in both environments and compare results
- > Explain what project context files are and how they differ across tools (CLAUDE.md, GEMINI.md, AGENTS.md)
- > Write a context file with beat-specific instructions, style preferences, and source standards
- > Use the deletion test to decide what belongs in a context file and what doesn't
- > Process journalism documents with and without context, and compare the results
- > Initialize a Git repo and commit your context file as versioned project infrastructure
Before you start
You've used AI through a browser — typed a prompt, read the response, copied it somewhere. That works, but it puts the clipboard between you and the tool. Every file you want to analyze has to be copied in by hand. Every response has to be copied back out. CLI tools let AI read files directly from your computer, write results back to disk, and be chained into automated workflows. The model is the same. The interface changes what you can do with it.
The second half of this module solves a different problem: every time you open a new chat, the AI starts blank. It doesn't know your beat, your publication's style, or what you were working on last session. A context file — CLAUDE.md for Claude Code — is where you put that background once, so you never have to retype it.
Key concepts
Why leave the browser?
Web-based AI tools like ChatGPT and Claude.ai are convenient, but they force you to copy and paste content back and forth. CLI tools let AI read and write files directly, chain multiple operations together, and integrate with version control. For journalists handling large documents or repetitive tasks, this saves hours.
What is a CLI?
A command-line interface (CLI) is a text-based way to interact with your computer. Instead of clicking buttons, you type commands. This might feel unfamiliar at first, but it gives you precise control and the ability to automate repetitive work. Think of it as learning keyboard shortcuts for your entire computer.
Node.js and npm
Node.js is a runtime that lets you run JavaScript outside a web browser. npm (Node Package Manager) comes with it and lets you install tools others have built. Many AI CLI tools, including Claude Code, are distributed through npm.
The terminal vs. web interface trade-off
Web interface advantages: No setup required, visual formatting, easy to share conversations.
CLI advantages: Direct file access, automation, piping between tools, no copy-paste friction, works offline (for local models).
Working inside a session
Once you type claude and press Enter, you're inside an interactive session. The terminal becomes a conversation interface — paste prompts the same way you would in a browser. A few commands you'll use often:
/help— list available commands and installed skills/plan— ask Claude to think through an approach before acting/compact— compress conversation history when a long session starts to slow down/clear— start fresh without leaving the sessionCtrl+C— interrupt whatever Claude is doing; press twice to exit
To continue a previous session after a break, run claude --resume from the same directory.
What goes in a context file
A context file contains the things that make your project different from every other project — not things that are true of all journalism. Good content: your beat entities, beat-specific terminology, style preferences that differ from defaults, source attribution standards you want enforced, phrases to avoid. Bad content: "be helpful," "write clearly," "verify facts" — generic instructions the tool already tries to follow.
Think of it as a briefing document for a new reporter joining your beat. Not the journalism 101 stuff — the specific things about your coverage area and your newsroom's conventions.
The deletion test
Before saving a line to your context file, ask: if I delete this, would the AI's output change for someone who already knows my beat?
An experienced city hall reporter doesn't need to be told "verify facts before publishing." But they might need to know "the city uses 'resolution' for binding votes and 'ordinance' for legislation — don't confuse these." The first is generic. The second is beat-specific context that changes the output.
If deleting a line changes nothing for a knowledgeable reporter, cut the line.
Context files should be versioned
Your CLAUDE.md is infrastructure. Not a note to yourself — infrastructure. It gets committed to Git, versioned alongside your project files, and shared with colleagues when you share the project. When you push a project to GitHub, your context file goes with it. When a colleague clones the repo, your accumulated beat knowledge is already there.
This module introduces Git basics — what a repository is, what a commit does, what cloning means — because context files, skills, and workflow scripts are all shared through GitHub repos. You don't need to memorize Git commands; your CLI tool can run them for you. But you need to know what you're asking for and why.
EXERCISE
PART 1 — CLI SETUP AND COMPARISON
GOAL: Run the same task in a browser interface and in Claude Code, then compare what each one required of you.
01 Install Node.js
Download and install Node.js from nodejs.org. Choose the LTS (Long Term Support) version. The installer will also install npm.
After installation, open your terminal and verify:
node --version
npm --version
You should see version numbers for both. If you get "command not found," restart your terminal or computer.
02 Install Claude Code
Claude Code is Anthropic's official CLI for Claude. Install it with:
curl -fsSL https://claude.ai/install.sh | sh
Then type claude to launch it. The first time, you'll go through a one-time setup — granting permissions and logging in with your Anthropic account. After that, typing claude opens a session immediately.
claude
Follow the prompts to log in. You'll need an Anthropic account with API access.
03 Try the task in a browser
Go to claude.ai and paste this prompt:
Summarize this news brief in one sentence:
The city council voted 5-2 yesterday to approve a $2.3 million budget for road repairs. Council member Jane Smith opposed the measure, citing concerns about contractor selection. The repairs will begin in March and affect Main Street, Oak Avenue, and Park Road.
Note what it took: open a browser, navigate to the site, paste the text manually, read the response. That works fine for one article.
04 Do the same task in Claude Code
Open your terminal and type claude to start a session. Then paste this prompt:
Create a file called test-article.txt with this content: "The city council voted 5-2 yesterday to approve a $2.3 million budget for road repairs. Council member Jane Smith opposed the measure, citing concerns about contractor selection. The repairs will begin in March and affect Main Street, Oak Avenue, and Park Road."
Then read the file and summarize it in one sentence. Save the summary to summary.txt.
Claude creates the files, reads them, and saves the output — without you touching the clipboard. Try following up: "Now do the same for every .txt file in this folder."
05 Compare the experience
Consider these questions:
- > Which workflow required more steps from you?
- > Which would scale better if there were 50 articles in a folder?
- > What happened to the output in each case — where did it go?
PART 2 — PROJECT CONTEXT
GOAL: Set up a beat project directory, initialize a Git repo, process journalism documents with and without a context file, and compare the results.
06 Set up your project folder
Open your terminal and launch Claude Code from your home directory:
claude
Ask Claude to create the project folder with sample documents:
Create a project folder called city-hall-beat in my home directory. Add four sample journalism documents with realistic fictional content: a press release about a park closure, city council meeting minutes (a 1-2 page excerpt), notes from an interview with a local official named Martinez, and a reader tip email about a potential story. Use descriptive filenames and tell me what you created.
Once Claude confirms, exit the session (press Ctrl+C twice). Then step into the folder:
cd ~/city-hall-beat
claude
This step matters: Claude Code reads context files from wherever you launch it. Later, when you add a CLAUDE.md to this folder, Claude picks it up automatically — but only if you're inside the folder when you start.
07 Initialize a Git repository
Open your CLI tool and ask it to initialize a Git repo and commit your files:
Initialize this directory as a Git repository and commit all files with the message "Add sample journalism documents for city hall beat"
Watch what the tool does: it runs git init, git add, and git commit. You don't need to memorize the commands — but note what each one does.
08 Process documents without context
You're already inside a session from Step 6. Paste these four prompts one at a time. There is no CLAUDE.md yet — Claude has no knowledge of your beat or preferences.
Read the press release file and write a 3-sentence summary suitable for a news brief
Read the council meeting minutes. List every factual claim made by a council member, and note which are attributed to a named source vs. unattributed
Read the interview notes. What follow-up questions should I ask? Flag any claims that need independent verification
Read the tip email. Is this tip actionable? What would you need to verify before pursuing it?
Note the responses — you'll compare them to the with-context versions in Step 10.
09 Write your CLAUDE.md
In your city-hall-beat directory, create a file called CLAUDE.md. Use Resources/examples/beat-project/sample-claude-md.md as a reference, but write your own.
Required sections:
- — Beat description — what you cover, key entities (city name, current officials, agencies)
- — Style rules — AP style, Oxford comma, how to refer to the city on second reference
- — Source standards — how to handle attribution, what to flag as unverified
- — Terminology — beat-specific terms the AI might confuse
- — Things to avoid — phrases or patterns you don't want in the output
- — Hard-won lessons — leave this section empty for now. Add entries as you correct the AI over time.
Apply the deletion test before saving: read each line and ask whether it would change the AI's output for a knowledgeable reporter. If not, cut it.
Then commit it — your context file is infrastructure, not a draft:
Commit my CLAUDE.md to the project repository with the message "Add beat context file"
10 Process the same documents with context
Exit the current session (Ctrl+C twice) and relaunch from the same directory. This starts a fresh session that picks up your new CLAUDE.md:
claude
Run the exact same four prompts from Step 8. Don't change anything — the only difference is that CLAUDE.md now exists and Claude read it before you typed a word.
Compare the responses side by side. Look for specific differences: terminology, attribution handling, style choices, what Claude flagged as needing verification.
Checkpoint
Self-check: Make sure you can answer these before moving on.
- ? What command shows your installed Node.js version?
- ? Why might a journalist prefer CLI tools over web interfaces for batch processing?
- ? What is the deletion test, and how do you apply it to a line in your CLAUDE.md?
- ? What filename does Gemini CLI use for its context file? What about Codex?
- ? What does a Git commit do? Why should your CLAUDE.md be committed?
- ? What changed in the AI's output once CLAUDE.md was present? Give one specific example.
Resources
- [DOCS] Claude Code documentation - Official setup guide, command reference, and CLAUDE.md documentation
- [DOCS] Claude Code memory and CLAUDE.md — official documentation
- [DOCS] Gemini CLI configuration and GEMINI.md — official documentation
- [GUIDE] Introduction to Node.js - Background on the runtime
- [READ] What is Git? — Pro Git book, chapter 1
- [COURSE] The Missing Semester: The Shell - MIT's free course on command-line fundamentals
Troubleshooting
"command not found: node"
Node.js isn't in your system PATH. Try restarting your terminal. On macOS, you may need to restart your computer. On Windows, make sure you checked "Add to PATH" during installation.
"permission denied" when installing globally
The native installer handles permissions automatically. If the curl install fails, see code.claude.com/docs for platform-specific instructions.
Claude Code says "unauthorized"
Your authentication may have expired or your API key may be invalid. Run claude again to re-authenticate, or check your Anthropic account for API access issues.
CLAUDE.md doesn't seem to be working
Make sure the file is named exactly CLAUDE.md (all caps) and is in the same directory where you're running the CLI tool. Run ls to confirm.
The AI is ignoring a rule in my context file
Check whether the rule is specific enough to affect output. Vague instructions ("write clearly") rarely change behavior. Specific ones ("refer to the agency as 'the Department' on second reference") do. If the rule is specific and still ignored, try moving it higher in the file.
Git says "not a git repository"
You need to run git init (or ask the CLI tool to do it) in your project directory before using Git commands. Check that you're in the right folder with pwd.
The AI can't find my document file
File names are case-sensitive on macOS and Linux. Make sure the name in your prompt matches the actual filename exactly. Use ls to list files in the current directory.