What is Claude Code?
Claude Code is a command-line tool made by Anthropic that puts Claude — the AI model — directly into your terminal as an autonomous coding agent. It is not autocomplete. It is not a chatbot you paste code into. It is an agent that takes real, sequential actions inside your project.
When you give it a task, it:
- Reads the relevant files in your codebase to understand context
- Writes or edits code across as many files as needed
- Runs shell commands to check output, run tests, or install dependencies
- Inspects the results and loops — fixing failures, adjusting code — until the task is done
The key distinction from tools like Cursor or GitHub Copilot is agency. Claude Code does not suggest a line and wait for you to accept it. It makes a plan and executes it, step by step, until the goal is met or you stop it.
Who is it for?
| Right for you if… | Not yet — try Lovable or Cursor first if… |
|---|---|
| You are comfortable in the terminal | You have never used a terminal |
| You use git regularly | You do not have version control set up |
| You want autonomous multi-step help | You want AI autocomplete inside a GUI editor |
| You work in an existing codebase | You are building something from scratch with no code experience |
| You are already paying for Anthropic API access | You want a free tool to experiment with |
The magic moment
Here is what it looks like in practice. Navigate to your project, run claude, and type this:
"Find where we handle user authentication, add rate limiting so no account can attempt more than 5 logins per minute, and write a test for it."
Claude Code will:
- Search the codebase for authentication-related files
- Read the relevant middleware or handler code
- Write the rate limiting implementation in the right place
- Create a test file covering the new logic
- Run the test suite
- Read the failures, adjust the code, and re-run
- Stop when the tests pass
That is the moment it clicks. You described an outcome in plain English and got working, tested code without touching a file.
Prerequisites
| Requirement | Details |
|---|---|
| Node.js | v18 or higher (node --version to check) |
| Anthropic API key | From console.anthropic.com — requires a payment method |
| Estimated monthly cost | $5–$50 for typical developer use |
| Git | Required — Claude Code edits real files; you need a way to undo mistakes |
Before every session: commit your work. This gives you a clean checkpoint to revert to if something goes wrong.
Step-by-step installation
1. Install Node.js
Check if you have it: node --version. If not, download it from nodejs.org.
2. Install Claude Code globally
npm install -g @anthropic-ai/claude-code
3. Get an Anthropic API key
Go to console.anthropic.com, create an account, add a payment method, and generate an API key.
4. Set the environment variable
Add this line to your ~/.zshrc (or ~/.bashrc):
export ANTHROPIC_API_KEY=sk-ant-your-key-here
Then reload: source ~/.zshrc
5. Start a session
cd your-project
claude
Essential commands
| Command | What it does |
|---|---|
claude | Start an interactive session in the current directory |
claude "task description" | Run a single task non-interactively and exit |
/help | Show available slash commands |
/clear | Clear the conversation history and start fresh |
/compact | Summarise the current context to save tokens |
/cost | Show token usage and estimated cost for the session |
Escape | Interrupt the current task without exiting |
Ctrl+C | Exit Claude Code |
CLAUDE.md — your project instruction file
CLAUDE.md is a Markdown file you create in your project root. Claude Code reads it automatically at the start of every session. Think of it as a briefing document for a new team member — you write it once and every session benefits.
What to put in it:
- A one-paragraph overview of what the project does
- The tech stack (framework, language, key libraries)
- Coding conventions (naming, file structure, preferred patterns)
- Things Claude should NOT do
- How to run the project and tests
Example CLAUDE.md:
# My Project
A Next.js 14 app with a PostgreSQL database via Prisma. Auth via NextAuth.
## Stack
- Next.js 14 (App Router), TypeScript (strict)
- Prisma + PostgreSQL
- Tailwind CSS, NextAuth
## Conventions
- Components in `src/components/` using PascalCase
- Use `zod` for all input validation
- No `any` types — use proper TypeScript
- All new features need a test in `__tests__/`
## Do not
- Never modify `prisma/schema.prisma` directly — ask me first
- Do not install packages without explaining why
## Running locally
- `npm run dev` — start dev server
- `npm run test` — run tests
Skills — custom slash commands
Skills are custom slash commands you define for Claude Code. Each skill is a plain markdown file containing a prompt. When you type /skill-name in a session, Claude reads that file and executes the instructions inside it — every time, consistently, without you having to re-type the prompt.
Think of skills as saved workflows. Instead of typing the same detailed instructions for your code review process on every task, you write it once in a skill file, and /review runs it forever. They are one of the most underused features in Claude Code, and the one that delivers the most leverage once you invest 30 minutes setting them up.
Built-in skills
Claude Code ships with built-in skills that work immediately — no setup required:
| Skill | What it does |
|---|---|
/help | Show all available commands and skills |
/commit | Generate a conventional commit message for staged changes and commit |
/review-pr | Full code review of the current branch compared to main |
/clear | Clear the conversation history and start fresh |
/compact | Summarise the current context to reduce token usage |
/cost | Show token usage and estimated cost for the current session |
/commit alone is worth knowing — it reads your staged diff and writes the right conventional commit message automatically.
How skills work
Skills live in .md files inside a .claude/commands/ directory. Claude Code scans this at startup and registers each file as a slash command.
# Shared with your team (commit to git)
your-project/
.claude/
commands/
commit.md → /commit
review.md → /review
deploy-check.md → /deploy-check
# Personal only (all your projects, not shared)
~/.claude/
commands/
standup.md → /standup
Namespacing: Skills in subdirectories become /namespace:skill-name:
.claude/commands/
db/
migrate.md → /db:migrate
seed.md → /db:seed
Creating your first skill
mkdir -p .claude/commands
touch .claude/commands/standup.md
Write the prompt inside standup.md:
Look at the git log for the last 24 hours.
List all commits since yesterday, grouped by author if there are multiple.
Format as a standup update:
**Yesterday:**
- [commit summary in plain English]
**Today's focus:** [ask me what I'm working on today]
Keep each summary to one short sentence. No technical jargon.
Then run /standup in any session. Claude reads the file, checks git, and writes your standup.
Skill examples
/deploy-check — Run before pushing to production:
Before we deploy, check the following:
1. Run the test suite with `npm run test`. Stop and report any failures.
2. Check for TypeScript errors with `npx tsc --noEmit`.
3. List any database migrations included in this branch.
4. Check for new environment variables that need to be set in production.
5. Summarise what this deployment changes in 3 bullet points.
If everything passes, say "✅ Ready to deploy" at the end.
/explain — Explain a file to a new developer:
Read the current file. Explain what it does as if you're talking to a junior
developer joining the team for the first time. Cover: what this file's job is,
what each major function does, any non-obvious patterns, anything a new developer
is likely to get confused by. Use simple language.
$ARGUMENTS — passing parameters to skills
Use the $ARGUMENTS placeholder to accept input when invoking a skill:
# .claude/commands/ticket.md
Look up context for ticket $ARGUMENTS.
Search the codebase for code, comments, or TODOs mentioning this ticket number.
Summarise: what's already been done, which files are likely affected, any conflicts.
Run it as /ticket PROJ-247 and Claude replaces $ARGUMENTS with PROJ-247.
Skills as team knowledge
Committing .claude/commands/ to git means every new developer who clones the repo immediately has your team's entire workflow library. Practical team skills:
/pr-checklist— your team's pre-PR review checklist/changelog— generates a changelog entry from recent commits/onboard— walks a new developer through setup steps/test-coverage— finds untested code paths in the current branch
Over time your .claude/commands/ folder becomes a living library of your team's best practices — every workflow that used to live in someone's head, documented and executable.
Skills vs Hooks
| Skills | Hooks | |
|---|---|---|
| Triggered by | You, manually (/skill-name) | Events (file edited, tool called) |
| Best for | On-demand workflows — review, deploy check | Automated enforcement — lint on save |
| Example | /review before merging | Auto-run ESLint after every file edit |
Use hooks to enforce rules automatically. Use skills to run workflows on demand.
MCP — connecting Claude Code to external tools
MCP (Model Context Protocol) lets Claude Code talk to databases, GitHub, Slack, and more. Each MCP server adds new tools Claude can use during a session.
Adding the filesystem server (~/.claude/mcp_servers.json):
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/Documents"]
}
}
}
Other popular servers: GitHub (read issues, open PRs), PostgreSQL (query your database in plain English), Puppeteer (control a browser). See the MCP guide for the full list.
Hooks
Hooks are shell commands that run automatically before or after Claude takes actions — useful for auto-linting, formatting, or type-checking on every file edit.
Example (.claude/settings.json):
{
"hooks": {
"postToolCall": [
{
"matcher": "Edit",
"command": "npx eslint --fix ${file}"
}
]
}
}
Best practices
- Always commit before you start. Claude Code edits real files — git gives you a safety net.
- Use CLAUDE.md to set context upfront. A good briefing file means fewer wasted tokens on codebase exploration.
- Break large tasks into steps. Smaller, well-scoped tasks produce better results with fewer compounding mistakes.
- Review changes with
git diffbefore moving on. Claude Code moves fast — read what actually changed after each task. - Use
/compacton long sessions. When context fills up,/compactsummarises the conversation and frees up space without losing the thread.
Real cost guide
| Task size | Example | Estimated cost |
|---|---|---|
| Small | Fix a specific bug in one file | ~$0.05 |
| Medium | Add a new feature across 3–5 files | $0.20–$0.50 |
| Large | Build a new module from scratch | $1.00–$3.00 |
| Heavy session | Full feature with tests, refactor, iteration | $5.00+ |
Use Claude Sonnet for most work — fast and affordable. A typical active developer spends $15–$40/month.
Compare with similar tools
| Tool | Autonomous? | Best for |
|---|---|---|
| Claude Code | Yes — plans and executes multi-step tasks | Experienced devs who want hands-off automation |
| Cursor | Partially — strong context, you accept suggestions | Devs who want AI inside a familiar GUI editor |
| Windsurf | Partially — some agentic capability | Devs who want a GUI with burst autonomy |
| GitHub Copilot | No — line-by-line autocomplete | Devs who want AI suggestions without workflow changes |
| Lovable | Yes — builds full apps from prompts | Non-developers and rapid prototyping |
