🔓 unclaimed — this page was auto-generated from GitHub. Are you the creator?
Claim this page →
claude-code-guide
The Complete Claude Code CLI Guide - Live & Auto-Updated Every 2 Days
git clone https://github.com/Cranot/claude-code-guide
The Complete Claude Code CLI Guide
Quick Links: Get Started · Commands · MCP Setup · Settings · SDK · Changelog
🔄 Live Guide: Auto-updated every 2 days from official docs, GitHub releases, and Anthropic changelog. See update-log.md.
🤖 For AI Agents: Optimized for both humans and AI.
[OFFICIAL]= from code.claude.com.[COMMUNITY]= observed patterns.[EXPERIMENTAL]= unverified.
What is Claude Code?
Claude Code is an agentic AI coding assistant that lives in your terminal. It understands your codebase, edits files directly, runs commands, and helps you code faster through natural language conversation.
Key Capabilities:
- 💬 Natural language interface in your terminal
- 📝 Direct file editing and command execution
- 🔍 Full project context awareness
- 🔗 External integrations via MCP (Model Context Protocol)
- 🤖 Extensible via Skills, Hooks, and Plugins
- 🛡️ Sandboxed execution for security
Installation:
# Quick Install (macOS, Linux, WSL)
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
# Windows CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
# Alternative: Homebrew (macOS/Linux)
brew install --cask claude-code
# Alternative: WinGet (Windows)
winget install Anthropic.ClaudeCode
# Alternative: NPM (⚠️ Deprecated - use native install instead)
npm install -g @anthropic-ai/claude-code
claude --version # Verify installation
Official Documentation: https://code.claude.com/docs/en/overview
Contents
Quick Reference
Essential Commands [OFFICIAL]
# Starting Claude Code
claude # Start interactive session
claude -p "task" # Print mode (non-interactive)
claude --continue # Continue last session
claude --resume <id> # Resume specific session
# Session Management
/help # Show available commands
/exit # End session
/compact # Reduce context size
/compact [instructions] # Compact conversation with optional focus instructions
# Background Tasks
/bashes # List background processes
/kill <id> # Stop background process
# Discovery
/commands # List skills and commands
/hooks # Show configured hooks
/skills # List available Skills (NEW)
/plugin # Manage plugins
Source: CLI Reference
CLI Flags Reference [OFFICIAL]
# Output Control
claude -p, --print "task" # Print mode: non-interactive, prints result and exits
claude --output-format json # Output format: text, json, or stream-json
claude --input-format text # Input format: text or stream-json
claude --verbose # Enable verbose logging (full turn-by-turn output)
# Session Management
claude --continue # Continue from last session
claude --resume <session-id> # Resume specific session by ID or name
claude --from-pr <pr> # Resume session linked to GitHub PR number or URL [NEW]
claude --fork-session # Create new session ID instead of reusing original
claude --session-id <uuid> # Use specific session ID (must be valid UUID)
# Remote Sessions (claude.ai subscribers)
claude --remote "task" # Create web session on claude.ai
claude --teleport # Resume web session in local terminal
# Debugging & Logging
claude --debug # Enable debug mode (with optional category filtering)
claude --debug "api,mcp" # Debug specific categories
claude --debug "!statsig,!file" # Exclude categories with !
# Model & Agent Configuration
claude --model <name> # Specify model (sonnet, opus, haiku, or full name)
claude --fallback-model <name> # Fallback model when default overloaded (print mode)
claude --agent <name> # Specify custom agent (overrides settings)
claude --agents '<json>' # Define custom subagents dynamically via JSON
# System Prompt Customization
claude --system-prompt "prompt" # Replace entire default system prompt
claude --system-prompt-file <path> # Replace with file contents (print mode only)
claude --append-system-prompt "..." # Append to default system prompt
claude --append-system-prompt-file <path> # Append file contents (print mode only)
# Tool & Permission Management
claude --tools "Bash,Read,Edit" # Restrict built-in tools (use "" to disable all)
claude --allowedTools "Bash(git:*)" # Tools that execute without prompting
claude --disallowedTools "Edit" # Tools removed from context
claude --permission-mode plan # Begin in specified permission mode
claude --dangerously-skip-permissions # Skip all permission prompts ⚠️
claude --allow-dangerously-skip-permissions # Enable bypass option without activating [NEW]
claude --permission-prompt-tool <mcp-tool> # MCP tool for permission prompts (non-interactive) [NEW]
# Budget & Execution Limits (print mode)
claude --max-budget-usd 5.00 # Maximum dollar amount for API calls
claude --max-turns 3 # Limit number of agentic turns
claude --json-schema '<schema>' # Get validated JSON output matching schema (print mode) [NEW]
# Directory & Configuration
claude --add-dir ../apps ../lib # Add additional working directories
claude --plugin-dir ./my-plugins # Load plugins from directories
claude --settings ./settings.json # Path to settings JSON file
claude --setting-sources user,project # Comma-separated list of setting sources [NEW]
claude --mcp-config ./mcp.json # Load MCP servers from JSON file
claude --strict-mcp-config # Only use MCP servers from --mcp-config
# IDE & Browser Integration
claude --ide # Auto-connect to IDE on startup
claude --chrome # Enable Chrome browser integration
claude --no-chrome # Disable Chrome browser integration
# Agent Teams [NEW]
claude --teammate-mode in-process # Teammates display in main terminal
claude --teammate-mode tmux # Each teammate in own pane (requires tmux/iTerm2)
claude --teammate-mode auto # Auto-detect (default)
# Setup & Maintenance
claude --init # Run Setup hooks and start interactive mode
claude --init-only # Run Setup hooks and exit (no interactive session)
claude --maintenance # Run Setup hooks with maintenance trigger and exit
# Other Options
claude --disable-slash-commands # Disable all skills and slash commands
claude --no-session-persistence # Disable session persistence (print mode)
claude --betas interleaved-thinking # Beta headers for API requests
claude --include-partial-messages # Include partial streaming events (with stream-json) [NEW]
Common Flag Combinations:
# One-off task with JSON output
claude --print "analyze this code" --output-format json
# Debug MCP and API issues
claude --debug "api,mcp"
# Resume session with specific model
claude --resume auth-refactor --model opus
# Non-interactive with budget limit (CI/CD)
claude -p --max-budget-usd 5.00 --output-format json "run tests"
# Custom subagents for specialized work
claude --agents '{"reviewer":{"description":"Code reviewer","prompt":"Review for bugs"}}'
# Remote session for claude.ai subscribers
claude --remote "fix the login bug"
Source: CLI Reference
Core Tools [OFFICIAL]
| Tool | Purpose | Permission Required |
|---|---|---|
| Read | Read files, images, PDFs | No |
| Write | Create new files | Yes |
| Edit | Modify existing files | Yes |
| Bash | Execute shell commands | Yes |
| Grep | Search content with regex | No |
| Glob | Find files by pattern | No |
| TodoWrite | Task management | No |
| Task | Launch sub-agents | No |
| WebFetch | Fetch web content | Yes |
| WebSearch | Search the web | Yes |
| NotebookEdit | Edit Jupyter notebooks | Yes |
| NotebookRead | Read Jupyter notebooks | No |
Source: Settings Reference
Core Concepts
1. How Claude Code Works [OFFICIAL]
Claude Code operates through a conversational interface in your terminal:
# You describe what you want
$ claude
> "Add user authentication to the API"
# Claude Code:
1. Analyzes your codebase structure
2. Plans the implementation
3. Requests permission for file edits (first time)
4. Writes code directly to your files
5. Can run tests and verify changes
6. Creates git commits if requested
Key Principles:
- Natural Language: Just describe what you need - no special syntax
- Direct Action: Edits files and runs commands with your permission
- Context Aware: Understands your entire project structure
- Incremental Trust: Asks permission as needed for new operations
- Scriptable: Can be automated via SDK
Source: Overview
2. Permission Model [OFFICIAL]
Claude Code uses an incremental permission system for safety:
# Permission Modes
"ask" # Prompt for each use (default for new operations)
"allow" # Permit without asking
"deny" # Block completely
# Permission Priority [NEW v2.1.27]
# Content-level rules override tool-level rules
# Example: allow: ["Bash"], ask: ["Bash(rm *)"]
# -> Bash is generally allowed, but "rm *" commands require confirmation
# Tools Requiring Permission
- Bash (command execution)
- Write/Edit/NotebookEdit (file modifications)
- WebFetch/WebSearch (network access)
- Skill (skills and custom commands)
# Tools Not Requiring Permission (Safe Operations)
- Read/NotebookRead (reading files)
- Grep/Glob (searching)
- TodoWrite (task tracking)
- Task (sub-agents)
Configuring Permissions:
Create .claude/settings.json in your project or ~/.claude/settings.json globally:
{
"permissions": {
"defaultMode": "ask",
"allow": {
"Bash": ["git status", "git diff", "git log", "npm test", "npm run*"],
"Read": {},
"Edit": {}
},
"deny": {
"Write": ["*.env", ".env.*", ".git/*"],
"Edit": ["*.env", ".env.*"]
},
"additionalDirectories": [
"/path/to/other/project"
]
}
}
Source: Settings
3. Project Context - CLAUDE.md [COMMUNITY]
A CLAUDE.md file in your project root provides persistent context across sessions:
Example CLAUDE.md file (click to expand)
# Project: My Application
## Critical Context (Read First)
- Language: TypeScript + Node.js
- Framework: Express + React
- Database: PostgreSQL with Prisma ORM
- Testing: Jest + React Testing Library
## Commands That Work
npm run dev # Start dev server (port 3000)
npm test # Run all tests
npm run lint # ESLint check
npm run typecheck # TypeScript validation
npm run db:migrate # Run Prisma migrations
## Important Patterns
- All API routes in /src/routes - RESTful structure
- Database queries use Prisma Client
- Auth uses JWT tokens (implementation in /src/auth)
- Frontend components in /src/components
- API responses: {success: boolean, data: any, error?: string}
## Gotchas & What NOT to Do
- DON'T modify /generated folder (auto-generated by Prisma)
- DON'T commit .env files (use .env.example instead)
- ALWAYS run npm run db:migrate after pulling schema changes
- DON'T use `any` type in TypeScript - use proper typing
## File Structure
/src
/routes # Express API routes
/services # Business logic
/models # Type definitions
/middleware # Express middleware
/utils # Shared utilities
/auth # Authentication logic
## Recent Learnings
- [2026-01-15] Payment webhook needs raw body parser for Stripe
- [2026-01-10] Redis pool: {maxRetriesPerRequest: 3}
Why CLAUDE.md Helps:
- ✅ Provides context immediately at session start
- ✅ Reduces need to re-explain project structure
- ✅ Stores project-specific patterns and conventions
- ✅ Documents what works (and what doesn't)
- ✅ Shared with team via git
- ✅ AI-optimized format for Claude to understand quickly
Note: While CLAUDE.md is not an official feature, it's a widely-adopted community pattern. Claude Code will automatically read it if present at project root.
4. Tools Reference [OFFICIAL]
Read Tool
Purpose: Read and analyze files
# Examples
Read file_path="/src/app.ts"
Read file_path="/docs/screenshot.png" # Can read images!
Read file_path="/docs/guide.pdf" # Can read PDFs!
Read file_path="/docs/guide.pdf" pages="1-5" # Read specific PDF pages [NEW v2.1.30]
Capabilities:
- Reads any text file (code, configs, logs, etc.)
- Handles images (screenshots, diagrams, charts)
- Processes PDFs - extracts text and visual content
- Parses Jupyter notebooks (.ipynb files)
- Returns content with line numbers (
cat -nformat) - Can read large files with offset/limit parameters
PDF Parameters [NEW v2.1.30]:
pages: Optional page range (e.g.,"1-5","1,3,5") to read specific pages- Large PDFs (>10 pages) return a lightweight reference when @mentioned
- PDF limits: Maximum 100 pages, 20MB file size
Special Features:
- Images: Claude can read screenshots of errors, UI designs, architecture diagrams
- PDFs: Extract and analyze PDF content, useful for documentation and requirements
- Notebooks: Full access to code cells, markdown, and outputs
Write Tool
Purpose: Create new files
Write file_path="/src/newFile.ts"
content="export const config = {...}"
Behavior:
- Creates new file with specified content
- Will OVERWRITE if file already exists (use Edit for existing files)
- Requires permission on first use per session
- Creates parent directories if needed
Best Practice: Use Edit tool for modifying existing files, Write tool only for new files.
Edit Tool
Purpose: Modify existing files with precise string replacement
Edit file_path="/src/app.ts"
old_string="const port = 3000"
new_string="const port = process.env.PORT || 3000"
Important:
- Requires exact string match including whitespace and indentation
- Fails if
old_stringis not unique in file (use larger context orreplace_all) - Use
replace_all=trueto replace all occurrences (useful for renaming) - Must read file first before editing
Common Pattern:
# 1. Read file to see exact content
Read file_path="/src/app.ts"
# 2. Edit with exact string match
Edit file_path="/src/app.ts"
old_string="function login() {
return 'TODO';
}"
new_string="function login() {
return authenticateUser();
}"
Bash Tool
Purpose: Execute shell commands
Bash command="npm test"
Bash command="git status"
Bash command="find . -name '*.test.ts'"
Features:
- Can run any shell command
- Supports background execution (
run_in_background=true) - Configurable timeout (default 2 minutes, max 10 minutes)
- Git operations are common (status, diff, log, commit, push)
Security:
- Requires permission
- Can be restricted by pattern in settings
- Sandboxing available on macOS/Linux
Common Git Patterns:
# Check status
Bash command="git status"
# View changes
Bash command="git diff"
# Create commit
Bash command='git add . && git commit -m "feat: add authentication"'
# View history
Bash command="git log --oneline -10"
Grep Tool
Purpose: Search file contents with regex patterns
# Find functions
Grep pattern="function.*auth" path="src/" output_mode="content"
# Find TODOs with context
Grep pattern="TODO" output_mode="content" -C=3
# Count occurrences
Grep pattern="import.*from" output_mode="count"
# Case insensitive
Grep pattern="error" -i=true output_mode="files_with_matches"
Parameters:
pattern: Regex pattern (ripgrep syntax)path: Directory or file to search (default: current directory)output_mode:"files_with_matches"(default) - Just file paths"content"- Show matching lines"count"- Show match counts per file
-A,-B,-C: Context lines (after, before, both)-i: Case insensitive-n: Show line numberstype: Filter by file type (e.g., "js", "py", "rust")glob: Filter by glob pattern (e.g., "*.test.ts")
Fast and Powerful: Uses ripgrep under the hood, much faster than bash grep on large codebases.
Glob Tool
Purpose: Find files by pattern
# Find test files
Glob pattern="**/*.test.ts"
# Find specific extensions
Glob pattern="src/**/*.{ts,tsx}"
# Find config files
Glob pattern="**/config.{json,yaml,yml}"
Features:
- Fast pattern matching (works with any codebase size)
- Returns files sorted by modification time (recent first)
- Supports complex glob patterns (
**for recursive,{}for alternatives)
TodoWrite Tool
Purpose: Manage task lists during work
TodoWrite todos=[
{
"content": "Add authentication endpoint",
"status": "in_progress",
"activeForm": "Adding authentication endpoint"
},
{
"content": "Write integration tests",
"status": "pending",
"activeForm": "Writing integration tests"
},
{
"content": "Update API documentation",
"status": "pending",
"activeForm": "Updating API documentation"
}
]
Task States:
"pending"- Not started yet"in_progress"- Currently working on (should be only ONE at a time)"completed"- Finished successfully
Dependency Tracking [NEW]: v2.1.16 introduced task dependency tracking, allowing tasks to define prerequisites that must complete before they start. This enables complex multi-step workflows with proper sequencing.
Best Practices:
- Use for multi-step tasks (3+ steps)
- Keep ONE task
in_progressat a time - Mark completed IMMEDIATELY after finishing
- Use descriptive
content(what to do) andactiveForm(what you're doing)
When to Use:
- ✅ Complex multi-step features
- ✅ User provides multiple tasks
- ✅ Non-trivial work requiring planning
- ❌ Single straightforward tasks
- ❌ Trivial operations
Task Tool (Sub-Agents)
Purpose: Launch specialized AI agents for specific tasks
# Explore codebase
Task subagent_type="Explore"
prompt="Find all API endpoints and their authentication requirements"
# General purpose agent for complex tasks
Task subagent_type="general-purpose"
prompt="Research best practices for rate limiting APIs and implement a solution"
Available Sub-Agent Types:
"general-purpose"- Complex multi-step tasks, research, implementation"Explore"- Fast codebase exploration (Glob, Grep, Read, Bash)
When to Use:
- Research tasks requiring web search + analysis
- Codebase exploration (finding patterns, understanding architecture)
- Complex multi-step operations that can run independently
- Background work while you continue other tasks
WebFetch Tool
Purpose: Fetch and analyze web page content
WebFetch url="https://docs.example.com/api"
prompt="Extract all endpoint documentation"
Features:
- Converts HTML to markdown for analysis
- Can extract specific information with prompt
- Useful for researching docs, articles, references
WebSearch Tool
Purpose: Search the web for current information
WebSearch query="React 19 new features 2024"
Use Cases:
- Research current best practices
- Find up-to-date library documentation
- Check for known issues or solutions
- Verify latest framework features
Source: CLI Reference, Settings
LSP Tool (Language Server Protocol) [OFFICIAL]
Purpose: Get code intelligence features like go-to-definition, find references, and hover documentation.
LSP operation="goToDefinition"
filePath="src/utils/auth.ts"
line=42
character=15
Available Operations:
| Operation | Description |
|---|---|
goToDefinition | Find where a symbol is defined |
findReferences | Find all references to a symbol |
hover | Get documentation and type info for a symbol |
documentSymbol | Get all symbols in a document (functions, classes, variables) |
workspaceSymbol | Search for symbols across the entire workspace |
goToImplementation | Find implementations of an interface or abstract method |
prepareCallHierarchy | Get call hierarchy item at a position |
incomingCalls | Find all functions/methods that call the function at a position |
outgoingCalls | Find all functions/methods called by the function at a position |
Parameters:
operation(required): The LSP operation to performfilePath(required): Absolute or relative path to the fileline(required): Line number (1-based, as shown in editors)character(required): Character offset (1-based, as shown in editors)
Use Cases:
# Find where a function is defined
> "Go to the definition of getUserById"
# Find all usages of a function
> "Find all references to the authenticate function"
# Get documentation for a symbol
> "What does the validateToken function do?"
# Explore code structure
> "List all symbols in the auth.ts file"
Note: LSP servers must be configured for the file type. If no server is available for a language, an error will be returned.
Source: CLI Reference
5. Context Management [OFFICIAL]
Claude Code maintains conversation context with smart management:
Context Commands
/compact # Reduce context by removing old information
/compact "keep auth work" # Compact with focus instructions (keeps specified context)
When to Use
Use /compact when:
- Long sessions with many file reads
- "Context too large" errors
- You've completed a major task and want to start fresh
Use /compact with instructions when:
- Context is getting large but you want to preserve recent work
- Switching between related tasks
- You want intelligent cleanup without losing important context
- Example:
/compact "keep the authentication implementation context"
What Gets Preserved vs Cleared
Preserved:
- CLAUDE.md content (your project context)
- Recent interactions and decisions
- Current task information and todos
- Recent file reads still relevant
Cleared:
- Old file reads no longer needed
- Completed operations
- Stale search results
- Old context no longer relevant
Automatic Context Management
Claude Code may automatically compact when:
- Token limit is approaching
- Many old file reads are present
- Session has been very long
Source: Settings
6. Workspace Management [OFFICIAL]
Adding Directories with /add-dir
Claude Code can work with multiple directories simultaneously:
# Add another directory to current session
/add-dir /path/to/other/project
# Work across multiple projects
> "Update the User type in backend and propagate to frontend"
# Claude can now access both directories
Use Cases:
- Monorepo development (frontend + backend + shared libs)
- Cross-project refactoring
- Dependency updates across multiple projects
- Coordinating changes between related repositories
Configuration:
You can also pre-configure additional directories in .claude/settings.json:
{
"permissions": {
"additionalDirectories": [
"/path/to/frontend",
"/path/to/backend",
"/path/to/shared-libs"
]
}
}
Status Line Configuration with /statusline
Customize what information appears in your status line:
# Configure status line
/statusline
# Options typically include:
# - Current model
# - Token usage
# - Session duration
# - Active tools
# - Background processes
Benefits:
- Monitor token usage in real-time
- Track session duration
- See active background processes
- Understand which tools are being used
Source: CLI Reference
Quick Start Guide
Your First Session
# 1. Navigate to your project
cd /path/to/your/project
# 2. Start Claude Code
claude
# 3. Ask Claude to understand your project
> "Read the codebase and explain the project structure"
# Claude will:
- Look for README, package.json, or similar entry points
- Read relevant files (asks permission first time)
- Analyze the code structure
- Provide a summary
# 4. Request an analysis
> "Review the authentication system for security issues"
# Claude will:
- Find authentication-related files
- Analyze the implementation
- Identify potential vulnerabilities
- Suggest improvements
# 5. Make changes
> "Add rate limiting to the login endpoint"
# Claude will:
- Plan the implementation
- Show you what changes will be made
- Request permission to edit files
- Implement the changes
- Can run tests to verify
# 6. Create a commit
> "Create a git commit for these changes"
# Claude will:
- Run git status to see changes
- Review git diff
- Create a descriptive commit message
- Commit the changes
Setting Up Your Project for Claude Code
1. Create CLAUDE.md [COMMUNITY]
This provides context that persists across all sessions:
# Ask Claude to help create it
> "Create a CLAUDE.md file documenting this project's structure, commands, and conventions"
# Or create manually with:
- Languages and frameworks used
- Important commands (dev, test, build, lint)
- Project structure overview
- Coding conventions
- Known gotchas or issues
2. Configure Permissions (Optional) [OFFICIAL]
Create .claude/settings.json in your project:
{
"permissions": {
"defaultMode": "ask",
"allow": {
"Bash": [
"npm test",
"npm run*",
"git status",
"git diff",
"git log*"
],
"Read": {},
"Grep": {},
"Glob": {}
},
"deny": {
"Write": ["*.env", ".env.*"],
"Edit": ["*.env", ".env.*", ".git/*"]
}
}
}
This configuration:
- Allows common safe commands without asking
- Blocks editing sensitive files
- Still asks permission for file modifications
3. Test the Setup
> "Run the tests"
# Should execute without permission prompt (if configured)
> "What commands are available?"
# Claude will read package.json and list scripts
> "What's in CLAUDE.md?"
# Claude will read and summarize your project context
Source: Quickstart, Settings
Advanced Features
Thinking Mode [OFFICIAL]
Claude Code supports extended thinking for complex reasoning tasks. Opus 4.5 has thinking mode enabled by default.
Activation Methods:
# Toggle with keyboard shortcut
Alt+T (or Option+T on macOS) # Toggle thinking on/off
# Or use natural language
> "think about this problem"
> "think harder about the architecture"
> "ultrathink about this security issue"
# Tab key (sticky toggle)
Press Tab to toggle thinking mode on/off for subsequent prompts
Thinking Levels:
| Trigger | Thinking Budget | Use Case |
|---|---|---|
think | Standard | General reasoning, code analysis |
think harder | Extended | Complex problems, multiple approaches |
ultrathink | Maximum | Critical decisions, deep architecture analysis |
Best Practices:
- Use
think harderfor debugging complex issues - Use
ultrathinkfor architectural decisions or security reviews - Thinking content is visible in
Ctrl+Otranscript mode - Thinking mode is sticky - stays on until toggled off
Source: Thinking Mode
Fast Mode [NEW] [OFFICIAL]
Fast mode is a high-speed configuration for Claude Opus 4.6, making responses 2.5x faster at a higher cost per token. Available since v2.1.36.
Toggle Fast Mode:
# Toggle with built-in command
/fast # Toggle on/off
# Or set in settings
"fastMode": true # In user settings file
Visual Indicators:
↯icon appears next to prompt when fast mode is active- Icon turns gray during rate limit cooldown
Pricing (per MTok):
| Mode | Input (<200K) | Output | Input (>200K) | Output |
|---|---|---|---|---|
| Standard Opus 4.6 | $15 | $75 | $15 | $75 |
| Fast Mode | $30 | $150 | $60 | $225 |
Note: Fast mode is available at 50% discount until February 16, 2026.
Requirements:
- Claude subscription plan (Pro/Max/Team/Enterprise) or Claude Console API
- Extra usage enabled (
/extra-usage) - Not available on third-party providers (Bedrock, Vertex, Azure Foundry)
- For Teams/Enterprise: Admin must enable in organization settings
When to Use:
- ✅ Rapid iteration on code changes
- ✅ Live debugging sessions
- ✅ Time-sensitive work
- ❌ Long autonomous tasks (cost matters more)
- ❌ Batch processing or CI/CD pipelines
Fast Mode vs Effort Level:
| Setting | Effect |
|---|---|
| Fast mode | Same quality, lower latency, higher cost |
| Lower effort level | Faster responses, potentially lower quality |
You can combine both for maximum speed on straightforward tasks.
Rate Limits:
- Separate rate limits from standard Opus 4.6
- Automatically falls back to standard mode during cooldown
- Re-enables when cooldown expires
Source: Fast Mode
Plan Mode [OFFICIAL]
Plan Mode provides structured planning with model selection for complex tasks.
# Enter plan mode
/plan
# Or Claude may suggest plan mode for complex tasks
> "Implement a complete authentication system"
# Claude: "This is a complex task. Would you like me to create a plan first?"
Plan Mode Features:
- Opus planning, Sonnet execution - Uses stronger model for planning, faster model for implementation
- SonnetPlan Mode - Sonnet planning, Haiku execution (cost-effective)
- Shift+Tab - Auto-accept edits in plan mode
- Plan persistence - Plans persist across
/clear
Plan Mode Workflow:
- Claude analyzes the task and creates a structured plan
- You review and approve or modify the plan
- Claude executes the plan step by step
- Progress is tracked with TodoWrite
Source: Plan Mode
Background Tasks & Agents [OFFICIAL]
Run commands and agents in the background while continuing to work.
Keyboard Shortcut:
Ctrl+B # Background current command or agent (unified shortcut)
Background Commands:
# Start command in background
> "Run the dev server in background"
> "Start tests in watch mode in background"
# Or prefix with &
> "& npm run dev"
# View background tasks
/tasks
/bashes
# Kill a background task
/kill <task-id>
Background Agents:
# Launch agent in background
> "Have an Explore agent analyze the codebase architecture in background"
# Agents run asynchronously and notify you when complete
# You receive wake-up messages when background agents finish
Features:
- Real-time output streaming to status line
- Wake-up notifications when tasks complete
- Multiple concurrent background processes
- Output persisted to files for large outputs
Source: Background Tasks
Auto-Memory [NEW]
Claude Code now automatically records and recalls memories as it works (v2.1.32+).
How It Works:
- Claude automatically remembers important context, decisions, and patterns
- Memories persist across sessions and inform future work
- No manual intervention required
Memory Scopes for Agents:
---
name: my-agent
memory: project # Options: user, project, local
---
| Scope | Storage | Shared |
|---|---|---|
user | ~/.claude/ | All your projects |
project | .claude/ | Team via git |
local | .claude/*.local.* | No (gitignored) |
Disable Auto-Memory:
export CLAUDE_CODE_DISABLE_AUTO_MEMORY=1
Keyboard Shortcuts [OFFICIAL]
Navigation & Editing:
| Shortcut | Action |
|---|---|
Ctrl+R | Search command history |
Ctrl+O | View transcript (shows thinking blocks) |
Ctrl+G | Edit prompt in system text editor |
Ctrl+Y | Readline-style paste (yank) |
Alt+Y | Yank-pop (cycle through kill ring) |
Ctrl+B | Background current command/agent |
Ctrl+Z | Suspend/Undo |
Model & Mode Switching:
| Shortcut | Action |
|---|---|
Alt+P (Win/Linux) / Option+P (macOS) | Switch models while typing |
Alt+T (Win/Linux) / Option+T (macOS) | Toggle thinking mode |
Tab | Toggle thinking (sticky) / Accept suggestions |
Shift+Tab | Auto-accept edits (plan mode) / Switch modes (Windows) |
Input & Submission:
| Shortcut | Action |
|---|---|
Enter | Submit prompt / Accept suggestion immediately |
Shift+Enter | New line (works in iTerm2, WezTerm, Ghostty, Kitty) |
Tab | Edit/accept prompt suggestion |
Ctrl+T | Toggle syntax highlighting in /theme |
Image & File Handling:
| Shortcut | Action |
|---|---|
Cmd+V (macOS) / Alt+V (Windows) | Paste image from clipboard |
Cmd+N / Ctrl+N | New conversation (VSCode) |
Vim Bindings (if enabled):
| Shortcut | Action |
|---|---|
; and , | Repeat last motion |
y | Yank operator |
p / P | Paste |
Alt+B / Alt+F | Word navigation |
Login & Authentication:
| Shortcut | Action |
|---|---|
c | Copy OAuth URL during login |
Bash Mode Autocomplete [NEW v2.1.14]:
| Shortcut | Action |
|---|---|
! + Tab | History-based autocomplete - complete partial commands from history |
Prompt Suggestions [OFFICIAL]
Claude Code suggests prompts based on context (enabled by default).
# Claude suggests contextual prompts
> _ # Cursor blinking
# Suggestion appears: "Review the changes we made"
# Tab to edit the suggestion
Tab → Edit the suggestion text
# Enter to submit immediately
Enter → Submit the suggestion as-is
Configuration:
# Toggle in /config
/config
# Search for "prompt suggestions"
# Toggle enable/disable
Environment Variables [OFFICIAL]
Core Configuration:
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Your API key |
CLAUDE_CODE_SHELL | Override shell detection |
CLAUDE_CODE_TMPDIR | Custom temp directory |
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS | Disable background task system |
CLAUDE_CODE_ENABLE_TASKS | Set to false to use legacy task system [NEW v2.1.19] |
Display & UI:
| Variable | Description |
|---|---|
CLAUDE_CODE_HIDE_ACCOUNT_INFO | Hide account info in UI |
Bash & Commands:
| Variable | Description |
|---|---|
BASH_DEFAULT_TIMEOUT_MS | Default bash command timeout |
BASH_MAX_TIMEOUT_MS | Maximum allowed timeout |
CLAUDE_BASH_NO_LOGIN | Don't use login shell |
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR | Keep working directory |
CLAUDE_CODE_SHELL_PREFIX | Prefix for shell commands |
Model Configuration:
| Variable | Description |
|---|---|
ANTHROPIC_DEFAULT_SONNET_MODEL | Override default Sonnet model |
ANTHROPIC_DEFAULT_OPUS_MODEL | Override default Opus model |
ANTHROPIC_DEFAULT_HAIKU_MODEL | Override default Haiku model |
ANTHROPIC_LOG | Enable debug logging |
MCP Configuration:
| Variable | Description |
|---|---|
MCP_TIMEOUT | MCP connection timeout |
MCP_TOOL_TIMEOUT | Individual tool timeout |
File & Context:
| Variable | Description |
|---|---|
CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS | Max tokens for file reads |
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD | Set to 1 to load CLAUDE.md from --add-dir directories [NEW] |
CLAUDE_PROJECT_DIR | Override project directory |
CLAUDE_PLUGIN_ROOT | Plugin root substitution |
CLAUDE_CONFIG_DIR | Custom config directory |
XDG_CONFIG_HOME | XDG config base path |
Network & Proxy:
| Variable | Description |
|---|---|
NODE_EXTRA_CA_CERTS | Custom CA certificates |
NO_PROXY | Proxy bypass list |
CLAUDE_CODE_PROXY_RESOLVES_HOSTS | Proxy DNS resolution |
Auto-Update & Plugins:
| Variable | Description |
|---|---|
DISABLE_AUTOUPDATER | Disable auto-updates |
FORCE_AUTOUPDATE_PLUGINS | Force plugin updates |
CLAUDE_CODE_EXIT_AFTER_STOP_DELAY | Exit delay after stop |
Monitoring & Telemetry:
| Variable | Description |
|---|---|
CLAUDE_CODE_ENABLE_TELEMETRY | Enable OpenTelemetry collection (1) |
OTEL_METRICS_EXPORTER | OTel metrics exporter (e.g., otlp) |
DISABLE_TELEMETRY | Opt out of Statsig telemetry (1) |
DISABLE_ERROR_REPORTING | Opt out of Sentry error reporting (1) |
DISABLE_COST_WARNINGS | Disable cost warning messages (1) |
Advanced:
| Variable | Description |
|---|---|
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS | Disable anthropic-beta headers (workaround for gateway users) |
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS | Enable agent teams feature (1) [NEW] |
CLAUDE_CODE_DISABLE_AUTO_MEMORY | Disable automatic memory recording (1) [NEW] |
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS | Disable background task system (1) |
DISABLE_INTERLEAVED_THINKING | Disable interleaved thinking |
USE_BUILTIN_RIPGREP | Use built-in ripgrep |
CLOUD_ML_REGION | Cloud ML region for Vertex |
AWS_BEARER_TOKEN_BEDROCK | AWS bearer token |
MAX_THINKING_TOKENS | Extended thinking budget (default: 31,999) |
MAX_MCP_OUTPUT_TOKENS | Max MCP tool response tokens (default: 25,000) |
CLAUDE_CODE_MAX_OUTPUT_TOKENS | Max output tokens (default: 32,000, max: 64,000) |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC | Disable autoupdate, bug reporting, telemetry |
New Settings [OFFICIAL]
Recent settings additions (configure in /config or settings.json):
{
// Response language
"language": "en", // Claude's response language
// Git integration
"attribution": true, // Add model name to commit bylines
"respectGitignore": true, // Respect .gitignore in searches
// UI preferences
"showTurnDuration": true, // Show turn duration messages
"fileSuggestion": "custom-cmd", // Custom @ file search command
"spinnerVerbs": ["analyzing", "thinking", "processing"], // Custom spinner verbs
"prefersReducedMotion": false, // Reduce UI animations for accessibility [NEW v2.1.30]
// Session behavior
"companyAnnouncements": true, // Show startup announcements
// Plan mode
"plansDirectory": ".claude/plans" // Custom directory for plan files
}
Skills Variable Substitution: [NEW]
# In skill files, use ${CLAUDE_SESSION_ID} for session-specific operations
Session ID: ${CLAUDE_SESSION_ID}
Project Rules:
# New: .claude/rules/ directory for project-specific rules
.claude/rules/
├── coding-style.md # Coding conventions
├── testing.md # Testing requirements
└── security.md # Security guidelines
Wildcard Permissions:
{
"permissions": {
"allow": {
"Bash": ["npm *", "git *"], // Wildcard patterns
"mcp__myserver__*": {} // MCP tool wildcards
}
}
}
Skills System
Skills are unified capabilities that extend Claude Code — both auto-activated by Claude and manually invoked via /skill-name.
Note: Custom slash commands (
.claude/commands/files) have been merged into skills as of v2.1.3. Your existing command files keep working unchanged. Skills are recommended for new work because they support additional features like supporting files, invocation control, and subagent execution. See Migration: Commands to Skills.
Claude Code skills follow the Agent Skills open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection.
What Are Skills? [OFFICIAL]
Skills are instructions packaged as SKILL.md files that extend what Claude Code can do. Claude loads them when relevant to your request, or you invoke them directly:
# Claude auto-activates a skill based on your request
You: "Review this code for security issues"
Claude: [Loads security-reviewer skill automatically]
# Or you invoke a skill directly
You: /security-reviewer src/auth.ts
Claude: [Loads and executes the security-reviewer skill]
Two types of skill content:
- Reference content — Knowledge Claude applies to your current work (conventions, patterns, style guides). Runs inline alongside your conversation context.
- Task content — Step-by-step instructions for a specific action (deploy, commit, code generation). Often invoked manually with
/skill-name.
Where Skills Live [OFFICIAL]
Where you store a skill determines who can use it:
| Location | Path | Applies To |
|---|---|---|
| Enterprise | Managed settings | All users in organization |
| Personal | ~/.claude/skills/<skill-name>/SKILL.md | All your projects |
| Project | .claude/skills/<skill-name>/SKILL.md | This project only |
| Plugin | <plugin>/skills/<skill-name>/SKILL.md | Where plugin is enabled |
When skills share the same name, higher-priority locations win: Enterprise > Personal > Project. Plugin skills use a plugin-name:skill-name namespace, so they cannot conflict.
Legacy compatibility: Files in .claude/commands/ still work and support the same frontmatter. If a skill and a command share the same name, the skill takes precedence.
Automatic nested directory discovery: When you work with files in subdirectories, Claude Code discovers skills from nested .claude/skills/ directories. For example, editing a file in packages/frontend/ also loads skills from packages/frontend/.claude/skills/. This supports monorepo setups where packages have their own skills.
Live change detection: Skills from directories added via --add-dir are loaded automatically and picked up by live change detection — edit them during a session without restarting.
Skill Directory Structure [OFFICIAL]
Each skill is a directory with SKILL.md as the entrypoint:
my-skill/
├── SKILL.md # Main instructions (required)
├── template.md # Template for Claude to fill in (optional)
├── examples/
│ └── sample.md # Example output (optional)
└── scripts/
└── validate.sh # Script Claude can execute (optional)
Reference supporting files from your SKILL.md so Claude knows what each file contains:
## Additional resources
- For complete API details, see [reference.md](https://github.com/Cranot/claude-code-guide/blob/HEAD/reference.md)
- For usage examples, see [examples.md](https://github.com/Cranot/claude-code-guide/blob/HEAD/examples.md)
Tip: Keep
SKILL.mdunder 500 lines. Move detailed reference material to separate files.
Creating a Skill [OFFICIAL]
Step 1: Create the skill directory:
# Personal skill (available in all projects)
mkdir -p ~/.claude/skills/explain-code
# Project skill (shared with team via git)
mkdir -p .claude/skills/explain-code
Step 2: Write SKILL.md with frontmatter and instructions:
---
name: explain-code
description: Explains code with visual diagrams and analogies. Use when explaining how code works, teaching about a codebase, or when the user asks "how does this work?"
---
When explaining code, always include:
1. **Start with an analogy**: Compare the code to something from everyday life
2. **Draw a diagram**: Use ASCII art to show the flow, structure, or relationships
3. **Walk through the code**: Explain step-by-step what happens
4. **Highlight a gotcha**: What's a common mistake or misconception?
Keep explanations conversational. For complex concepts, use multiple analogies.
Step 3: Test the skill:
# Let Claude invoke it automatically
> "How does this code work?"
# Or invoke it directly
> /explain-code src/auth/login.ts
Frontmatter Reference [OFFICIAL]
Configure skill behavior with YAML frontmatter between --- markers at the top of SKILL.md. All fields are optional; only description is recommended.
| Field | Required | Description |
|---|---|---|
name | No | Display name. If omitted, uses directory name. Lowercase letters, numbers, hyphens (max 64 chars). |
description | Recommended | What the skill does and when to use it. Claude uses this to decide when to load it. |
argument-hint | No | Hint shown during autocomplete (e.g., [issue-number] or [filename] [format]). |
disable-model-invocation | No | true → only user can invoke via /name. Default: false. |
user-invocable | No | false → hidden from / menu, only Claude can invoke. Default: true. |
allowed-tools | No | Tools Claude can use without asking permission when skill is active. |
model | No | Model to use when skill is active. |
context | No | Set to fork to run in a forked subagent context. |
agent | No | Which subagent type to use when context: fork is set. |
hooks | No | Hooks scoped to this skill's lifecycle. See Hooks. |
Controlling Invocation [OFFICIAL]
By default, both you and Claude can invoke any skill. Two frontmatter fields restrict this:
disable-model-invocation: true— Only you can invoke. Use for workflows with side effects (e.g.,/deploy,/commit).user-invocable: false— Only Claude can invoke. Use for background knowledge that isn't actionable as a command.
# User-only skill (Claude won't auto-trigger)
---
name: deploy
description: Deploy the application to production
disable-model-invocation: true
---
# Model-only skill (hidden from / menu)
---
name: legacy-system-context
description: Background knowledge about the legacy system
user-invocable: false
---
Invocation and context-loading behavior:
| Frontmatter | You Can Invoke | Claude Can Invoke | When Loaded into Context |
|---|---|---|---|
| (default) | Yes | Yes | Description always in context; full skill loads when invoked |
disable-model-invocation: true | Yes | No | Description not in context; full skill loads when you invoke |
user-invocable: false | No | Yes | Description always in context; full skill loads when invoked |
Restricting Claude's access via /permissions:
# Allow only specific skills
Skill(commit)
Skill(review-pr *)
# Deny specific skills
Skill(deploy *)
# Disable all skills
Skill # Add to deny rules
Permission syntax: Skill(name) for exact match, Skill(name *) for prefix match with any arguments.
Passing Arguments [OFFICIAL]
Skills accept arguments via placeholder substitutions:
| Variable | Description |
|---|---|
$ARGUMENTS | All arguments passed when invoking the skill |
$ARGUMENTS[N] | Specific argument by 0-based index (e.g., $ARGUMENTS[0]) |
$N | Shorthand for $ARGUMENTS[N] (e.g., $0, $1) |
${CLAUDE_SESSION_ID} | Current session ID (useful for logging) |
Example:
---
name: fix-issue
description: Fix a GitHub issue
disable-model-invocation: true
---
Fix GitHub issue $ARGUMENTS following our coding standards.
1. Read the issue description
2. Implement the fix
3. Write tests
4. Create a commit
/fix-issue 123
# Claude receives: "Fix GitHub issue 123 following our coding standards..."
Indexed arguments:
---
name: compare-files
description: Compare two files
_…[view the full README on GitHub](https://github.com/Cranot/claude-code-guide)._
// compatibility
| Platforms | cli, api, desktop, web, mobile |
|---|---|
| Operating systems | — |
| AI compatibility | claude |
| License | — |
| Pricing | open-source |
| Language | Shell |
// faq
What is claude-code-guide?
The Complete Claude Code CLI Guide - Live & Auto-Updated Every 2 Days. It is open-source on GitHub.
Is claude-code-guide free to use?
claude-code-guide is open-source, so it is free to use.
What category does claude-code-guide belong to?
claude-code-guide is listed under devops in the Claudeers registry of Claude-compatible tools.
// embed badge
[](https://claudeers.com/claude-code-guide-2)
// retro hit counter
[](https://claudeers.com/claude-code-guide-2)
// reviews
// guestbook
// related in Productivity
Agent skills for Obsidian. Teach your agent to use Obsidian CLI and open formats including Markdown, Bases, JSON Canvas.
Garry's Opinionated OpenClaw/Hermes Agent Brain
Open source repository of plugins primarily intended for knowledge workers to use in Claude Cowork
An open-source alternative to Claude Cowork (powered by opencode)
// built by
1 of its contributors also build on official projects — claude-code, claude-cookbooks, claude-plugins-official
→ see how claude-code-guide connects across the ecosystem