Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows
—
Claude Code provides comprehensive command-line options for different usage modes, from interactive sessions to programmatic automation.
The default mode providing a conversational interface with Claude.
# Start interactive session
claude
# Interactive session with additional directories
claude --add-dir frontend --add-dir backend
# Interactive session with custom settings
claude --settings custom-settings.jsonInteractive Features:
Non-interactive mode for single commands and automation.
# Basic print mode
claude --print "Fix the bug in auth.js"
claude -p "Generate unit tests for user service"
# Print mode with output formatting
claude --print "Analyze code quality" --output-format=stream-json
claude --print "List all functions" --output-format=jsonPrint Mode Features:
Control how Claude Code presents information.
# JSON output (default for print mode)
claude --print "command" --output-format=json
# Streaming JSON for real-time processing
claude --print "command" --output-format=stream-json
# Plain text output
claude --print "command" --output-format=textFormat Options:
json: Structured JSON responsestream-json: Streaming JSON for large responsestext: Plain text outputmarkdown: Formatted markdown outputSpecify configuration files and settings.
Load custom settings from JSON file.
# Load custom settings
claude --settings my-settings.json
claude --settings ~/.claude/project-settings.json
# Settings file structure
{
"model": "claude-3-sonnet-20240229",
"permissions": {
"allowedTools": ["Bash(git *)", "Read(*)", "Write(*.js)"]
},
"hooks": {
"PreToolUse": [...]
}
}Configure Model Context Protocol servers.
# Single MCP config file
claude --mcp-config servers.json
# Multiple MCP config files
claude --mcp-config server1.json server2.json
# MCP with debugging
claude --mcp-config servers.json --mcp-debugMCP Configuration Example:
{
"servers": {
"filesystem": {
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/allowed/path"]
},
"git": {
"command": "mcp-server-git",
"args": ["--repository", "."]
}
}
}Include additional directories in the working context.
# Single additional directory
claude --add-dir shared-components
# Multiple additional directories
claude --add-dir frontend --add-dir backend --add-dir shared
# Directories with spaces (use quotes)
claude --add-dir "My Projects/Frontend"Override or extend the default system prompt.
# Use custom system prompt file
claude --system-prompt-file custom-prompt.txt
# Append to default system prompt
claude --append-system-prompt "Focus on TypeScript best practices"
# Custom prompt with print mode
claude --print "command" --system-prompt-file expert-mode.txtSystem Prompt Files:
Resume and manage conversations.
# Resume previous conversation
claude --continue
claude --resume
# Resume specific conversation by ID
claude --resume conversation-id-123
# Start fresh session (ignore previous context)
claude --new-sessionConversation Features:
Replay user messages from previous sessions.
# Replay messages from conversation
claude --replay-user-messages conversation-id
# Replay with modifications
claude --replay-user-messages conversation-id --append-system-prompt "Use Python instead"Replay Features:
Control security behavior and tool permissions.
# Skip permission checks (dangerous!)
claude --dangerously-skip-permissions
# Strict permission mode
claude --strict-permissions
# Custom permission file
claude --permissions-file custom-perms.jsonSecurity Options:
--dangerously-skip-permissions: Bypasses all permission checks--strict-permissions: Enforces stricter permission validation--permissions-file: Loads custom permission rulesOptions for debugging and development purposes.
# Enable debug mode
claude --debug
# MCP server debugging
claude --mcp-debug
# Verbose logging
claude --verbose
# Log to file
claude --log-file claude-debug.logDebug Information:
Configure Claude Code behavior through environment variables.
# Configuration directory override
CLAUDE_CONFIG_DIR=/custom/path claude
# Model selection
ANTHROPIC_DEFAULT_SONNET_MODEL=claude-3-sonnet-latest claude
# IDE integration
CLAUDE_CODE_AUTO_CONNECT_IDE=false claude
# Shell command wrapping
CLAUDE_CODE_SHELL_PREFIX="time" claude
# Working directory control
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=true claudeKey Environment Variables:
CLAUDE_CONFIG_DIR: Override config directory (respects XDG_CONFIG_HOME)ANTHROPIC_DEFAULT_SONNET_MODEL: Control Sonnet model aliasANTHROPIC_DEFAULT_OPUS_MODEL: Control Opus model aliasCLAUDE_CODE_AUTO_CONNECT_IDE: Enable/disable IDE auto-connectionCLAUDE_CODE_SHELL_PREFIX: Wrap shell commandsCLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR: Freeze working directoryUSE_BUILTIN_RIPGREP: Control built-in ripgrep usageNO_PROXY: Proxy bypass configurationAWS_BEARER_TOKEN_BEDROCK: Bedrock API authenticationDISABLE_INTERLEAVED_THINKING: Disable thinking modeANTHROPIC_LOG: Debug logging levelBASH_DEFAULT_TIMEOUT_MS / BASH_MAX_TIMEOUT_MS: Bash timeoutsMCP_TIMEOUT / MCP_TOOL_TIMEOUT: MCP timeouts# Batch processing with print mode
for file in *.js; do
claude --print "Review code quality in $file" --output-format=json > "review-$file.json"
done
# Automated code generation
claude --print "Generate API client for $(cat api-spec.json)" --settings api-gen-settings.json# Code review in CI pipeline
claude --print "Review changes in this PR" --system-prompt-file ci-review-prompt.txt
# Automated documentation generation
claude --print "Update README based on recent code changes" --output-format=text > NEW_README.md# Project-specific startup
claude --settings .claude/project-settings.json --add-dir src --add-dir tests
# Expert mode for specific domains
claude --system-prompt-file prompts/react-expert.txt --add-dir components# Show all available options
claude --help
claude -h
# Show version information
claude --version
claude -v
# Show configuration information
claude --infoClaude Code uses standard exit codes:
# Success
0 # Command completed successfully
# Error codes
1 # General error
2 # Misuse of shell command
64 # Usage error (invalid arguments)
65 # Data format error
66 # Cannot open input
67 # Addressee unknown
68 # Host name unknown
69 # Service unavailable
70 # Internal errorThese exit codes enable proper error handling in scripts and automation workflows.
Install with Tessl CLI
npx tessl i tessl/npm-anthropic-ai--claude-code