// Claude Code
Standalone terminal AI coding assistant powered by your Claude subscription. No API keys, no endpoint configuration — just install and start coding.
01# Overview
Claude Code is Anthropic's official CLI tool for AI-assisted coding. It runs directly in your terminal and has deep understanding of your codebase. Unlike other tools that need API endpoints, Claude Code uses your Claude subscription directly.
Direct terminal integration
Works in any shell — bash, zsh, fish
Full codebase awareness
Understands project structure & dependencies
File editing
Creates, edits, and refactors files directly
Shell commands
Runs tests, builds, and other CLI tools for you
02# Prerequisites
Claude Subscription
Max or Team plan
Required — no free tier available for Claude Code
Node.js
v18+ required
For npm global install
03# Installation
Install Claude Code globally using npm:
npm install -g @anthropic-ai/claude-codeVerify the installation:
claude --versionsudo npm install -g @anthropic-ai/claude-code or configure npm to use a different global directory.04# Getting Started
Navigate to your project directory and launch Claude Code:
cd /path/to/your-project
claudeOn first run, you'll be prompted to authenticate with your Anthropic account. A browser window will open for OAuth — sign in with the account linked to your Claude subscription.
Once authenticated, you can start giving Claude instructions in natural language:
claude "Explain the architecture of this project"
claude "Add error handling to the API routes"
claude "Write tests for the auth module"claude without arguments opens an interactive session. Adding a message in quotes runs a one-shot command and exits.05# Key Commands
Inside an interactive Claude Code session, use these slash commands:
/helpShow all available commands/statusCheck connection, model info, and configuration/clearClear conversation history and context/compactCompress conversation to save context window/costShow token usage and cost for current session/doctorDiagnose common issues with your setup/initCreate a CLAUDE.md project memory file/reviewReview pending file changes before applying/undoRevert the last file changeCtrl+CCancel current generationCtrl+DExit Claude Code06# Configuration
Project Memory — CLAUDE.md
Create a CLAUDE.md file in your project root to give Claude persistent context about your project. This file is read automatically every session.
# Project: My App
## Stack
- Next.js 14 with TypeScript
- Prisma ORM with PostgreSQL
- NextAuth for authentication
## Conventions
- Use server components by default
- API routes in app/api/
- All components in /components
## Important
- Never modify the database schema without asking first
- Always run tests after changesSettings
Global settings are stored in $HOME/.claude/settings.json. Project-level settings go in .claude/settings.json within your repo.
{
"permissions": {
"allow": [
"Read",
"Write",
"Bash(git *)",
"Bash(npm test)",
"Bash(npm run build)"
],
"deny": [
"Bash(rm -rf *)"
]
}
}07# Best Practices
Use CLAUDE.md for project context
Give Claude a project memory file with your stack, conventions, and rules. This dramatically improves output quality.
Start with /compact for long sessions
If your session gets long, use /compact to summarize the conversation and free up context window space.
Be specific in your prompts
Instead of "fix the bug", say "fix the null pointer error in handleSubmit when the form fields are empty".
Review changes with /review
Always review pending changes before they are applied to catch any unwanted modifications.
Use one-shot for quick tasks
For simple tasks like generating a component or fixing a typo, use claude "task" for faster turnaround.
Commit frequently
Make git commits before and after Claude Code sessions. This gives you easy rollback points.