Claude Code is Anthropic's command-line AI coding tool. It is not a VS Code plugin or an IDE. It runs in your terminal, reads your files, and makes changes across your codebase using Claude's language models. The short version: install with one npm command, add your API key, drop a CLAUDE.md file in your project, and you have an AI that genuinely understands your codebase rather than just autocompleting lines.
Here is the complete setup guide, including the things the official docs gloss over.
What Claude Code Actually Is
This distinction is worth being explicit about before anything else: Claude Code is a CLI tool, not an IDE enhancement. It does not add autocomplete to your editor. It does not integrate into VS Code's sidebar. It runs in a terminal session where you give it natural-language instructions and it modifies your files.
The mental model is closer to "AI contractor who has read your whole codebase" than "smarter autocomplete." You use it for tasks like:
- "Refactor the authentication module to use JWTs instead of sessions"
- "Write tests for every function in lib/billing/"
- "Explain how the real-time synchronization works in this codebase"
- "Add input validation to all POST endpoints that are currently missing it"
For quick one-line completions, use Cursor or Copilot. For work that requires reasoning across many files, use Claude Code.
Installation
Prerequisites: Node.js 18+ and an Anthropic API key (or a Claude Max subscription).
npm install -g @anthropic-ai/claude-code
That is the entire installation. No binary download, no Docker container, no complex setup.
Set your API key:
export ANTHROPIC_API_KEY="sk-ant-..."
Add this to your .zshrc or .bashrc so it persists. If you have a Claude Max subscription ($100/month or $200/month), authentication works through your Anthropic account and token billing is included.
Verify installation:
claude --version
Core Commands
Start the REPL in any project:
cd your-project
claude
This starts an interactive session. Claude reads your project structure and CLAUDE.md file (if present) and is ready for instructions.
One-shot command (non-interactive):
claude "write unit tests for lib/auth/utils.ts"
Useful for scripting or quick one-off tasks.
Get help:
claude --help
/help # inside the REPL
Key REPL commands:
/help— list all available slash commands/context— show what files and context Claude currently has loaded/clear— clear conversation history (useful when a session gets confused)/quitor Ctrl+C — exit the session
The CLAUDE.md File: The Most Important Setup Step
The CLAUDE.md file is how you give Claude Code persistent context about your project. Without it, Claude Code has to re-learn your project conventions every session. With it, it knows your architecture, your conventions, and the things that matter before you type the first command.
Create a CLAUDE.md in your project root:
# Project: Zlyqor Web
## Architecture
Next.js 16 with App Router. MongoDB 7 for data storage. Socket.IO 4.8 for real-time features.
Custom JWT authentication (NOT NextAuth). bcryptjs for passwords.
## Database Rules
- Every query MUST filter by organization_id (snake_case in MongoDB documents)
- Use getDatabase() from @/lib/mongodb/client.ts — never instantiate MongoClient directly
- ObjectIds must be created with new ObjectId() from 'mongodb'
## Auth Rules
- Use getCurrentUser() from @/lib/auth/utils for all protected API routes
- Never use getServerSession or next-auth directly
- Passwords use hashPassword/verifyPassword from @/lib/auth/utils
## Code Style
- TypeScript strict mode — no any without a justification comment
- No inline styles — Tailwind only
- No em dashes in any content
## File Structure
- API routes: app/api/**
- Components: components/**
- Types: lib/mongodb/models.ts
The more specific your CLAUDE.md, the better Claude Code performs. Include actual examples of correct patterns, not just descriptions. "Use getDatabase() from @/lib/mongodb/client.ts" is better than "use our database utility."
How File Context Works
When you start a Claude Code session, it reads your directory structure. When you ask it to modify files, it reads those files before making changes. It does not load your entire codebase into context at startup (that would be expensive and slow). It reads what it needs as it works.
You can explicitly tell Claude Code which files to focus on:
claude "refactor the auth module" --include "lib/auth/**"
Or reference specific files in your instructions:
claude "the function in lib/billing/invoices.ts that calculates totals has a bug with discount stacking — find and fix it"
Best Use Cases (With Realistic Time Estimates)
Multi-file refactoring: A field rename across 15+ files that would take 40 minutes manually (find every reference, check each context, update tests) takes 8 minutes with Claude Code. It finds all references, applies changes consistently, and flags anything ambiguous for your review.
Understanding an unfamiliar codebase: When I joined a client's project mid-stream, the question "explain how the billing module works and what calls it" would have taken me 2-3 hours of code reading. Claude Code answered it in 4 minutes and was accurate.
Writing comprehensive tests: Claude Code reads a module and generates test cases including edge cases it identifies from the code. For a 300-line auth module, it generated 28 tests in 6 minutes. Writing those manually would have taken 45-60 minutes.
Generating boilerplate: API endpoint with authentication, validation, error handling, and TypeScript types. Claude Code produces this in 90 seconds. The output follows your existing patterns if your CLAUDE.md is set up correctly.
Sub-Agents: How Parallel Work Works
For tasks that can be parallelized, Claude Code spawns sub-agents. If you ask it to "write tests for every module in lib/," it can spawn multiple sub-agents that work on different modules simultaneously, then merge the results.
This is powerful for large code generation tasks but it has implications for cost. Each sub-agent is an independent API call reading files and generating output. A task that spawns 5 sub-agents costs roughly 5x what the same task costs without parallelization.
For agentic tasks, you can configure the maximum number of sub-agents Claude Code is allowed to spawn:
claude --max-agents 3 "write tests for all modules in lib/"
Cost Management
Claude Code charges by token consumption via the Anthropic API (unless you are on Claude Max). Understanding what costs what prevents surprise bills.
Cheap tasks (cents per task):
- Explaining a specific function
- Making a small change to a known file
- Short question answering about the codebase
Medium cost tasks ($0.10-0.50 per task):
- Writing tests for a module
- Refactoring a specific file
- Understanding how a feature works
Expensive tasks ($1-10+ per task):
- Full codebase analysis
- Large refactors spanning 20+ files
- Agentic tasks with multiple sub-agents
- Tasks that require reading many large files
The main cost drivers are (a) how many files Claude needs to read and (b) how long the output is. Keeping your instructions specific reduces both.
Claude Max ($100/month) is worth it if you are spending more than $50/month on API tokens. It also removes the per-token anxiety that can make you avoid using the tool for larger tasks.
Claude Code vs Claude in the Browser
A common question: why use Claude Code instead of just pasting code into claude.ai?
The browser interface is good for one-off questions. Claude Code is better for actual codebase work because:
- It reads your files directly. No copy-pasting code. No truncating long files to fit in the message box.
- It writes changes directly to your files. No copy-pasting output back into your editor.
- It maintains session context. Within a Claude Code session, it remembers what it has seen and done in this project.
- CLAUDE.md. The persistent project context that makes every session start with full project knowledge.
For one-off "how do I do X in Python" questions, the browser is fine. For actual development work, Claude Code is a different tool category entirely.
Common Pitfalls
Not setting up CLAUDE.md first. Without it, you will spend the first few minutes of every session re-explaining your project. Set it up once and you never re-explain it.
Using it for autocomplete-scale tasks. Claude Code is overkill for "add a semicolon" or "rename this variable." Use Cursor or Copilot for that. Use Claude Code for tasks that require real reasoning.
Letting sessions run too long. After a very long session with many file reads and changes, Claude Code can lose coherence. Start a fresh session for unrelated tasks rather than continuing an exhausted one.
Not reviewing changes before accepting. Claude Code shows you what it plans to do before applying changes. Always read the plan. It is right most of the time, but "most of the time" is not the standard you want for production code.
Keep Reading
- Claude Code vs Cursor vs GitHub Copilot: An Honest Comparison — How Claude Code fits alongside other AI coding tools
- Cursor IDE Honest Review 2026 — The IDE that pairs well with Claude Code for daily editing
- Cutting LLM API Costs by 50%+ — How to manage API costs when using Claude Code heavily
Pristren builds AI-powered software for teams. Zlyqor is our all-in-one workspace — chat, projects, time tracking, AI meeting summaries, and invoicing — in one tool. Try it free.