← Back to Home Lesson 4

Claude Code (Local CLI)

What is Claude Code?

Claude Code (claude) is Anthropic's command-line AI coding assistant. It's NOT the same as the Claude API — it's a local CLI that helps with terminal tasks, coding, and more.

Key Differences

FeatureClaude APIClaude Code
UsageHTTP calls, pay per tokenLocal CLI, subscription
ContextAPI callsFile-aware, git-aware
Best forWorkflow automationInteractive coding sessions

Installing Claude Code

# macOS
brew install anthropic-cli

# Or download from anthropic.com/claude-code

# Then authenticate:
claude auth login

Using Claude Code in Workflows

Since Claude Code is interactive, you can:

1. Run Claude in a Subprocess

echo "Explain this git diff" | claude -p

2. Use n8n's Execute Command Node

[Node: Execute Command]
Command: echo "Review my latest commit" | claude -p

3. Generate Code with Claude Code

claude -p --print "Write a Python function to parse CSV files"

Use Cases with n8n

Automated Code Review

# Get git diff
DIFF=$(git diff HEAD~1)
echo "$DIFF" | claude -p "Review this code for bugs"

Generate Boilerplate

claude -p "Create a React component for a login form with email/password"

Debug Help

claude -p "Fix this error: $ERROR_MESSAGE"

Claude Code + Codex Together

Claude Code pairs well with GitHub Copilot (Codex):

Subscription & Limits

Claude Code has evolved:

Next: Lesson 5: Codex & Copilot →