Claude Code
AI-powered coding agent in the terminal, built by Anthropic. Runs directly in your shell with full access to your codebase.
Install
Launch & authenticate
On first launch, Claude Code opens a browser to authenticate via your claude.ai account (Pro or Max plan required).
Alternatively, set ANTHROPIC_API_KEY to use your own API key directly:
Keyboard shortcuts
| Shortcut | Action |
|---|---|
| Ctrl+C | Interrupt current operation |
| Ctrl+L | Clear terminal |
| Ctrl+R | Search command history |
| Up Down | Navigate conversation history |
@ | Reference files and include contents in context |
# | Add a memory to CLAUDE.md |
Slash commands
| Command | Description |
|---|---|
/help | Show available commands |
/clear | Clear conversation history |
/compact | Summarize history to reduce context usage |
/model | Select AI model |
/review | Run a code review on recent changes |
/init | Generate CLAUDE.md for the current project |
/memory | Open CLAUDE.md in your editor |
/add-dir | Add a directory to the allowed list |
/vim | Toggle vim keybindings in the input |
/quit | Exit Claude Code |
Non-interactive mode
Run a single prompt from the command line (useful for scripts and CI):
File references
Use @ to include file contents directly in your prompt:
Supports glob patterns:
Custom instructions
Claude Code reads instructions from CLAUDE.md in the project root (and any parent directories up to ~). Generate it with /init, or let Claude add entries on the fly with #.
Global instructions live at ~/.claude/CLAUDE.md.
Permissions
Claude Code asks before writing files or running commands. You can adjust this per session:
| Option | Description |
|---|---|
--allowedTools | Comma-separated list of tools to allow without prompting |
--disallowedTools | Tools that are always denied |
/add-dir <path> | Allow reads/writes in an extra directory |
Dangerous permissions
--dangerously-skip-permissions disables all permission checks. Only use this in isolated environments (containers, CI).
Hooks
Hooks are shell commands that run automatically at key points in the Claude Code lifecycle. Define them in ~/.claude/settings.json (global) or .claude/settings.json (project).
Hook events
| Event | Triggers when… |
|---|---|
PreToolUse | Before any tool call |
PostToolUse | After any tool call completes |
Notification | Claude sends a system notification |
Stop | Claude finishes a response turn |
Hook matchers
The matcher field is a regex matched against the tool name:
| Matcher | Matches |
|---|---|
Bash | Shell commands |
Write | File writes (new files) |
Edit | File edits (existing files) |
Read | File reads |
.* | All tools |
MCP servers
Claude Code supports Model Context Protocol servers for extending available tools.
Configure in ~/.claude/settings.json or .claude/settings.json:
Configuration
Settings are stored in ~/.claude/settings.json (global) or .claude/settings.json (project-level):
Key settings
| Key | Description |
|---|---|
model | Default model |
theme | dark, light, dark-daltonism, light-daltonism |
verbose | Show full tool outputs |
cleanupPeriodDays | Days before conversation logs are purged (default: 30) |
env | Environment variables passed to all sessions |
Workflow: explore → plan → implement
Multi-agent with git worktrees
Run multiple independent Claude Code sessions in parallel using git worktrees:
Isolate long-running tasks
Each worktree has its own working directory and git state, so agents can't interfere with each other.