AI logoAI BEGINNER

Claude Code

Complete reference for Claude Code CLI commands, configuration, and features

10 min read
aicliautomationproductivity

Installation & Setup

Getting started with Claude Code

Installation Methods

Multiple ways to install Claude Code

📄 Codebash
💡 NPM installation is recommended for most users
📌 Native installers available for all platforms
⚡ Requires Node.js 18 or newer
installation

Basic Usage

Starting and using Claude Code

📄 Codebash
📄 Examplebash
📌 Interactive mode is the default
📌 Use quotes for one-time tasks
🔍 Can resume previous conversations
basics

Essential Commands

Core slash commands in Claude Code

Session Management

Control your Claude Code session

📄 Codebash
📄 Examplebash
📌 Use /clear to start fresh
📌 /compact helps with long sessions
📌 Multiple ways to exit
commandssession

Configuration Commands

Customize Claude Code behavior

📄 Codebash
📌 /config opens interactive menu
📌 Permissions control tool approval
📌 Create custom output styles
commandsconfig

Custom Commands

Create your own slash commands

📄 Codemarkdown
📄 Examplemarkdown
📌 Commands are markdown files
🔍 Support arguments with $ARGUMENTS
📌 Project commands override user commands
customcommands

Configuration Files

Understanding Claude Code configuration

Settings Files

Configuration file hierarchy

📄 Codebash
📌 Project settings override user settings
📌 Use settings.local.json for personal config
📌 CLAUDE.md for project-specific instructions
configfiles

Permissions Configuration

Control tool approval requirements

📄 Codejson
📌 Plan mode is safest for new users
📌 Auto mode for trusted operations
🔍 Can set per-tool permissions
permissionsconfig

CLAUDE.md File

Project-specific instructions

📄 Codemarkdown
📌 Claude reads this for project context
📌 Include coding standards and patterns
📌 Document important constraints
documentation

Output Styles

Customize Claude Code responses

Built-in Styles

Available output styles

📄 Codebash
📌 Switch styles anytime
📌 Explanatory for learning
📌 Learning for tutorials
styles

Custom Output Styles

Create your own response styles

📄 Codemarkdown
📄 Examplemarkdown
📌 Markdown files with frontmatter
📌 User styles in ~/.claude/output-styles/
📌 Project styles in .claude/output-styles/
customstyles

Hooks System

Automate and customize behavior

Hook Events

Available hook trigger points

📄 Codebash
📌 Hooks run at specific events
🔍 Can run commands or scripts
📌 Useful for logging and automation
hooks

Hook Configuration

Setting up hooks in settings.json

📄 Codejson
📄 Examplejson
📌 Matcher filters by tool name
🔍 Can run commands or scripts
📌 Access tool data via placeholders
hooksconfig

Hook Scripts

Creating custom hook scripts

📄 Codepython
📌 Scripts receive JSON via stdin
📌 Return 0 to allow, non-zero to block
🔍 Can modify or validate actions
hooksscripts

Advanced Features

Power user capabilities

Subagents

Specialized agents for complex tasks

📄 Codemarkdown
📄 Examplemarkdown
📌 Subagents handle specific tasks
🔍 Can work in parallel
📌 Define custom agents in .claude/agents/
agentsadvanced

MCP Integration

Model Context Protocol for external data

📄 Codejson
📌 Connect external data sources
📌 Extends Claude capabilities
⚡ Requires MCP server setup
mcpintegration

CI/CD Integration

Use Claude Code in automation

📄 Codeyaml
📌 Integrate with any CI/CD system
📌 Use --print for non-interactive mode
📌 Automate code reviews and checks
cicdautomation

Troubleshooting

Common issues and solutions

Diagnostic Commands

Debug and fix issues

📄 Codebash
📌 /doctor checks configuration
📌 /bug sends reports to Anthropic
📌 Check PATH for command issues
troubleshooting

Context Management

Handle context size limits

📄 Codebash
📌 /compact preserves key context
📌 Break large tasks into steps
📌 Be specific to reduce context usage
contexttips