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
—
The Claude Code CLI provides an interactive terminal-based interface for AI-assisted coding through natural language commands.
The primary entry point for Claude Code that starts an interactive session.
# Start Claude Code interactive session
claude
# Usage patterns:
# 1. Run from project root directory for full codebase context
# 2. Interact through natural language commands
# 3. Claude understands your codebase and can perform various tasksUsage Examples:
# Navigate to your project
cd /path/to/your/project
# Start Claude Code
claude
# Example interactions:
# User: "Help me understand this authentication flow"
# User: "Create a new React component for user profiles"
# User: "Fix the failing tests in the user service"
# User: "Explain what the calculateTotalPrice function does"
# User: "Create a git commit with all staged changes"Claude Code provides several interactive capabilities:
Common interaction patterns with Claude Code:
# Code analysis requests
"Explain this function"
"What does this component do"
"How does the authentication work"
# Code modification requests
"Fix this bug"
"Add error handling to this function"
"Refactor this component to use hooks"
# File operations
"Create a new component"
"Add a test file for this module"
"Update the README with installation instructions"
# Git operations
"Create a commit with these changes"
"Create a new branch for this feature"
"Show me the git status"
# Testing and debugging
"Run the tests"
"Fix the failing tests"
"Add unit tests for this function"Direct commands for specific actions:
# File and project management
/add-dir path/to/directory # Add directories to context
/memory # Edit memory files
/context # Debug context issues
/export # Export conversations
/resume # Switch conversations
/clear # Clear conversation
# Development workflow
/bug "Issue description" # Report bugs
/cost # View usage and costs
/todos # List current todos
/pr-comments # Handle PR comments
/install-github-app # Install GitHub integration
# Configuration and tools
/doctor # Validate configuration
/permissions # Manage tool permissions
/model # Model selection
/statusline # Customize status line
/vim # Enable vim bindings
/config # Configuration management
/mcp # MCP server management
/agents # Create custom subagents
/status # View system status
/release-notes # View release notes
/upgrade # Upgrade subscriptionEach Claude Code session maintains:
# Real-time interaction
Ctrl+b # Run command in background
Shift+Tab # Toggle auto-accept mode
Ctrl+R # Access transcript mode
Ctrl+C # Interrupt current operation
Tab # File/directory completion
# File operations
@filename.js # Mention file in conversation
@directory/ # Mention directory
Drag & drop # Add images/files to context
Clipboard paste # Paste images directly
# Session commands
"exit" or Ctrl+C # End session
/clear # Clear current conversation
/resume conversation-id # Switch to different conversation# Global installation via npm
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
claude --help
# Start using in any project directory
cd /your/project
claude
# Alternative startup options
claude --print "single command" # Non-interactive mode
claude --settings custom.json # Custom settings
claude --add-dir additional/path # Include additional directories
claude --mcp-config servers.json # With MCP serversClaude Code behavior can be customized through:
.claude/ directory~/.claude/settings.json~/.claude/settings.json # Global user settings
.claude/settings.json # Project-specific settings
CLAUDE.md # Project context and instructions
.mcp.json # MCP server configuration
~/.claude/commands/ # Custom slash commandsClaude Code handles various error scenarios:
# Diagnostic commands
/doctor # Run comprehensive diagnostics
/doctor --verbose # Detailed diagnostic output
/doctor --fix-permissions # Attempt to fix permission issues
# Recovery actions
/config --reset # Reset to default configuration
claude --reset-auth # Reset authentication
claude --clear-cache # Clear cached data
/mcp --restart server-name # Restart failed MCP server# Exit Claude Code session
# Use Ctrl+C or type "exit" to end the session
# Claude Code will clean up any temporary resources
# Graceful shutdown
"exit" # Normal session termination
"quit" # Alternative exit command
Ctrl+C # Interrupt and exit
Ctrl+D # EOF signal (Unix/Linux)
# Session cleanup
# - Closes active MCP server connections
# - Saves conversation history
# - Releases file system resources
# - Clears temporary files and caches
# - Executes SessionEnd hooks if configured# Single command execution
claude --print "Fix the bug in auth.js"
# JSON output for programmatic use
claude --print "Analyze code" --output-format=json
# Batch processing
for file in *.js; do
claude --print "Review $file" > "review-$file.txt"
done# Git hooks integration
#!/bin/bash
# pre-commit hook
claude --print "Review staged changes" --output-format=text
# CI/CD pipeline integration
claude --print "Generate PR description" --system-prompt-file ci-prompt.txt
# IDE integration
# VS Code extension provides seamless integration
# Real-time diff display and diagnosticsInstall with Tessl CLI
npx tessl i tessl/npm-anthropic-ai--claude-code