This guide covers every discoverable Claude Code command as of Juli 2025,
including many features that are not widely known or documented in basic tutorials.
This represents the most complete Claude Code command reference available.
For updates and contributions, visit the official Claude Code documentation
Visit: https://zebbern.github.io/ for more detailed info!
| Section | Status |
|---|---|
| Guides on how to install on Windows, Linux, MacOS | β |
| Tips and Tricks | β |
| MCP Overview with what to use | β |
| Community Guides | β |
| Troubleshooting | β |
| How to use Claude code the most optimal way | β |
# Quick Installment
## Method 1 β NPM (global) βοΈ Official
npm install -g @anthropic-ai/claude-code
# Requires Node 18+ on macOS / Linux / WSL
## Method 2 β Homebrew Tap (macOS & Linux) *οΈβ£
brew install anthropic/tap/claude-code
# Formula contributed by the community
## Method 3 β Arch Linux AUR *οΈβ£
yay -S claude-code # or paru -S claude-code
# Keeps pace with npm releases
## Method 4 β Docker (containerised) *οΈβ£
docker pull ghcr.io/rchgrav/claudebox:latest
docker run -it -v "$PWD":"$PWD" -w "$PWD" \
ghcr.io/rchgrav/claudebox:latest
# Nice when you canβt touch the host system
## Method 5 β Windows via WSL (Anthropic-recommended path)
# 1) Enable WSL 2 and install Ubuntu
# 2) Inside Ubuntu:
sudo apt update && sudo apt install -y nodejs npm
npm install -g @anthropic-ai/claude-code
# Step-by-step guide
## Method 6 β Build from source (any OS) *οΈβ£
git clone https://github.com/anthropics/claude-code.git
cd claude-code && pnpm install && pnpm build
pnpm --filter cli run cli:install
# Handy for cutting-edge commits or local patches
# Interactive Mode
claude # Start interactive REPL
claude "your question" # Start with initial prompt
# One-Shot Mode
claude -p "analyze this" # Quick query and exit
cat file | claude -p "fix" # Process piped content
# Management
claude config # Configure settings
claude update # Update to latest
claude mcp # Setup MCP serversSystem Requirements:
- Node.js 16+ or standalone binary
- API key from Anthropic
- 4GB RAM minimum (8GB+ recommended for large projects)
- Internet connection for API calls
Supported Platforms:
- macOS (Intel/Apple Silicon)
- Linux (Ubuntu 18+, Debian 10+, CentOS 7+)
- Windows 10/11 (WSL recommended)[Win 10 Not Tested]
# Install globally
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version# Required: Get your API key from https://console.anthropic.com
export ANTHROPIC_API_KEY="sk-your-key-here"
# Make permanent (choose your shell)
# Bash
echo 'export ANTHROPIC_API_KEY="sk-your-key-here"' >> ~/.bashrc
source ~/.bashrc
# Zsh
echo 'export ANTHROPIC_API_KEY="sk-your-key-here"' >> ~/.zshrc
source ~/.zshrc
# Fish
echo 'set -gx ANTHROPIC_API_KEY "sk-your-key-here"' >> ~/.config/fish/config.fish# Interactive setup
claude config
# Set basic defaults
claude config set -g model claude-sonnet-4
claude config set -g verbose true
claude config set -g outputFormat text
# Test installation
claude "Hello, Claude!"
claude /doctor export DISABLE_TELEMETRY=1
export DISABLE_ERROR_REPORTING=1
export DISABLE_NON_ESSENTIAL_MODEL_CALLS=1
# Security defaults
claude config set allowedTools "Edit,View"
claude config set hasTrustDialogAccepted
claude config set hasCompletedProjectOnboarding
claude config set ignorePatterns
claude config set --global# Basic functionality test
claude "Explain what you can do"
# Print mode test
claude -p "What is 2+2?"
# Tool permission test
claude "Create a file called test.txt with 'Hello World'"
# Should prompt for Edit permission
# Session continuity test
claude -c # Should continue from previous sessionclaude /doctor
Expected output might include:
# β
API Key: Valid
# β
Network: Connected
# β
Model Access: Available
# Also check if everything is correct at
~/claude/local/package-lock.json
What is MCP? MCP extends Claude's capabilities by connecting to external services, databases, APIs, and tools.
MCP Architecture:
Claude Code ββ MCP Protocol ββ MCP Servers ββ External Services
claude mcp # Interactive MCP configuration
claude mcp list # List configured servers
claude mcp add <name> <cmd> # Add new server
claude mcp remove <name> # Remove serverLocation:~/.claude.json
User/Global Scope:
Global MCP servers
Project Scope:
Project-scoped servers are stored in a .mcp.json file at your project's root directory
{
"mcpServers": {
"git": {
"command": "git-mcp-server",
"args": [],
"env": {}
},
"postgres": {
"command": "postgres-mcp-server",
"args": ["--host", "localhost", "--port", "5432"],
"env": {
"POSTGRES_USER": "developer",
"POSTGRES_PASSWORD": "dev_password",
"POSTGRES_DB": "myapp_development"
}
}
}
}Note: The exact package names and installation commands below may not be accurate. Consult official MCP documentation for current server packages.
# npm install -g git-mcp-server
# claude mcp add git "git-mcp-server"
# claude mcp add github "github-mcp-server --token $GITHUB_TOKEN"npm install -g postgres-mcp-server
npm install -g mysql-mcp-server
npm install -g sqlite-mcp-server
# Setup examples
# export POSTGRES_URL="postgresql://user:password@localhost:5432/mydb"
# claude mcp add postgres "postgres-mcp-server --url $POSTGRES_URL"# Allow specific MCP tools
claude --allowedTools "mcp__git__commit,mcp__git__push"
# Allow all tools from specific server
claude --allowedTools "mcp__postgres__*"
# Combined with built-in tools
claude --allowedTools "Edit,View,mcp__git__*"| Command | Description | Example | Status |
|---|---|---|---|
claude |
Start interactive REPL | claude |
|
claude "query" |
REPL with initial prompt | claude "help debug this" |
|
claude -p "query" |
One-shot query (print mode) | claude -p "explain function" |
| Command | Description | Example | Status |
|---|---|---|---|
claude -c |
Continue last session | claude -c |
|
claude -r <id> |
Resume specific session | claude -r abc123 |
|
claude --resume <name> |
Resume named session | claude --resume project-review |
| Command | Description | Example | Status |
|---|---|---|---|
claude config |
Interactive configuration | claude config |
|
claude config list |
List all settings | claude config list |
|
claude config get <key> |
Get specific value | claude config get model |
|
claude config set <key> <value> |
Set value | claude config set model sonnet |
| Flag | Short | Description | Example |
|---|---|---|---|
--print |
-p |
Print response without interactive mode | claude -p "help" |
--continue |
-c |
Load most recent conversation | claude -c |
--help |
-h |
Show help information | claude --help |
--version |
-v |
Show version | claude --version |
| Flag | Options | Description | Example |
|---|---|---|---|
--output-format |
text, json, stream-json |
Control response format | claude -p "help" --output-format json |
--json |
- | Shorthand for JSON output | claude -p "analyze" --json |
| Flag | Risk Level | Description | Example |
|---|---|---|---|
--allowedTools <tools> |
LOW | Whitelist specific tools | claude --allowedTools "Edit,View" |
--disallowedTools <tools> |
LOW | Blacklist specific tools | claude --disallowedTools "Bash" |
--dangerously-skip-permissions |
CRITICAL | Skip ALL permission prompts | claude --dangerously-skip-permissions |
| Flag | Purpose | Example | Notes |
|---|---|---|---|
--add-dir <path> |
Add working directories | claude --add-dir ../lib ../src |
|
--model <model> |
Set specific model | claude --model sonnet |
|
--verbose |
Enable detailed logging | claude --verbose |
| Command | Purpose | Status |
|---|---|---|
/help |
Show all slash commands | |
/clear |
Clear current conversation | |
/exit |
Exit Claude safely | |
/bug |
Report issues |
/doctor # Complete health check
/status # System information
/cost # Token usage stats
/config # Configuration menu
/permissions # Manage tool access
/memory # Edit memory files
/sessions # List all sessionsClaude Code uses a hierarchical configuration system:
- Command-line flags (highest priority)
- Environment variables
- Project configuration (location may vary)
- Global configuration (likely
~/.claude.json) - Built-in defaults (lowest priority)
Location: ~/.claude.json
{
"model": "claude-sonnet-4",
"verbose": true,
"outputFormat": "text",
"allowedTools": ["Edit", "View"],
"disallowedTools": [],
}Location: settings.json OR similar
{
"model": "claude-sonnet-4",
"systemPrompt": "You are a senior developer working on this project",
"allowedTools": [
"Edit",
"View",
"Bash(git:*)",
"Bash(npm:*)"
],
}| Variable | Required | Purpose | Example |
|---|---|---|---|
ANTHROPIC_API_KEY |
YES | API Authentication | sk-ant-api03-xxx |
ANTHROPIC_MODEL |
No | Default model | claude-sonnet-4 |
ANTHROPIC_BASE_URL |
No | API endpoint override | https://api.anthropic.com |
export DISABLE_NON_ESSENTIAL_MODEL_CALLS=1
export MAX_THINKING_TOKENS=50000
export DISABLE_TELEMETRY=1
# Cloud provider variables
export CLAUDE_CODE_USE_BEDROCK=1
export CLAUDE_CODE_USE_VERTEX=1# Standard proxy variables
export HTTP_PROXY="http://proxy.company.com:8080"
export HTTPS_PROXY="https://proxy.company.com:8443"
export NO_PROXY="localhost,127.0.0.1,*.company.com"How it works:
- Claude asks for permission before using tools
- Permissions are remembered per session
- Dangerous operations require confirmation
| Level | Description | Risk | Use Case |
|---|---|---|---|
| Interactive | Prompt for each operation | Low | Development work |
| Allowlist | Pre-approved tools only | Medium | Automation scripts |
| Dangerous | Skip all permissions | CRITICAL | Containers only |
# Allow specific tools
claude --allowedTools "Edit,View"
# Allow tool categories
claude --allowedTools "Edit,View,Bash"
# Scoped permissions (Git operations only)
claude --allowedTools "Bash(git:*)"
# Multiple scopes
claude --allowedTools "Bash(git:*),Bash(npm:*)"# DANGEROUS - Can cause data loss
claude --dangerously-skip-permissions
# Only use in isolated environments:
# β
Safe: Isolated Docker container
# β NEVER: Production systems, shared machines, systems with important data# Good: Specific permissions
claude --allowedTools "Edit,View,Bash(git:status)"
# Bad: Broad permissions
claude --allowedTools "Bash"# Good: Environment variables
export DATABASE_URL="postgresql://user:pass@host/db"
# Bad: Hardcoded credentials in commands
# claude "connect to postgresql://user:password123@host/db"# Check current permissions
claude config get allowedTools
claude config get disallowedTools
# Review configuration
claude config listA practical guide for editing your
~/.claude.jsonconfiguration file safely
This guide shows you what you can safely edit in your ~/.claude.json configuration file based on real, working configurations. Always backup your file before making changes.
| Operating System | File Path |
|---|---|
| Linux/macOS | ~/.claude.json |
| Windows | %USERPROFILE%\.claude.json |
{
"theme": "dark-daltonized"
}Known working themes (based on actual configurations):
"dark-daltonized"- Dark theme optimized for colorblind users"dark"- Standard dark theme"light"- Light theme
{
"editorMode": "vim"
}Options:
"vim"- Vim keybindings"emacs"- Default mode
{
"autoUpdates": true
}Options:
true- Enable automatic updatesfalse- Disable automatic updates
This is the most commonly edited section. Add new MCP servers to extend Claude's capabilities:
{
"mcpServers": {
"sequential-thinking": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"],
"env": {}
},
"puppeteer": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"],
"env": {}
},
"fetch": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@kazuph/mcp-fetch"],
"env": {}
}
}
}| Field | Description | Example |
|---|---|---|
type |
Connection type | "stdio" (most common) |
command |
Executable command | "npx" for npm packages |
args |
Command arguments | ["-y", "package-name"] |
env |
Environment variables | {"API_KEY": "value"} |
{
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "your-github-token-here"
}
},
"brave-search": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {
"BRAVE_API_KEY": "your-brave-api-key-here"
}
}
}
}{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"],
"env": {}
},
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"],
"env": {}
}
}
}Based on actual configurations, these can be safely modified:
{
"bypassPermissionsModeAccepted": true,
"hasAcknowledgedCostThreshold": true,
"isQualifiedForDataSharing": false
}| Flag | Description |
|---|---|
bypassPermissionsModeAccepted |
Whether you've accepted bypass permissions mode |
hasAcknowledgedCostThreshold |
Cost warning acknowledgment |
isQualifiedForDataSharing |
Data sharing preferences |
If you want to see tips again or restart onboarding:
{
"tipsHistory": {
"new-user-warmup": 0,
"ide-hotkey": 0,
"shift-enter": 0
},
"hasCompletedOnboarding": false
}π‘ Tip: Set tip counters to 0 to see them again, or set hasCompletedOnboarding to false to restart onboarding.
β οΈ Warning: Don't manually edit these sections unless you know exactly what you're doing:
Authentication Data (Click to expand)
{
"oauthAccount": { ... },
"primaryApiKey": "sk-ant-api03-...",
"customApiKeyResponses": { ... }
}Application State (Click to expand)
{
"numStartups": 45,
"userID": "...",
"firstStartTime": "...",
"autoUpdaterStatus": "...",
"cachedChangelog": "..."
}Project-Specific Data (Click to expand)
{
"projects": {
"/path/to/project": {
"lastCost": 0.11092260000000002,
"lastTotalInputTokens": 40329,
"lastSessionId": "..."
}
}
}cp ~/.claude.json ~/.claude.json.backup# Check if your JSON is valid
python -m json.tool ~/.claude.json
# or if you have jq installed
jq . ~/.claude.jsonAfter making changes, restart Claude Code for them to take effect:
# If Claude is running, exit it first
# Then restart
claude- Backup your config
- Add your server to the
mcpServersobject - Validate JSON syntax
- Restart Claude Code
- Check with
/mcpcommand that it loaded
- Backup your config
- Change the
"theme"value - Restart Claude Code
- Backup your config
- Set
"editorMode": "vim" - Restart Claude Code
# Restore your backup
cp ~/.claude.json.backup ~/.claude.json- Check JSON syntax with validator
- Look for missing commas, quotes, or brackets
- Check the
/mcpcommand in Claude Code - Verify the package name and spelling
- Check that environment variables are set correctly
- Try running the server manually:
npx -y package-name
If you want to start fresh:
# Backup first
cp ~/.claude.json ~/.claude.json.backup
# Remove config (will be recreated)
rm ~/.claude.json
# Restart Claude Code
claudeHere's the basic structure you should maintain:
{
"theme": "dark-daltonized",
"editorMode": "vim",
"autoUpdates": true,
"mcpServers": {
"server-name": {
"type": "stdio",
"command": "npx",
"args": ["-y", "package-name"],
"env": {}
}
},
"bypassPermissionsModeAccepted": true,
"hasCompletedOnboarding": true,
"projects": { },
"oauthAccount": { },
"primaryApiKey": "..."
}π Important Security Guidelines:
- Never share your
~/.claude.jsonfile - it contains your API keys and personal data - Use environment variables for sensitive data instead of putting API keys directly in the file
- Set proper file permissions:
chmod 600 ~/.claude.jsonon Unix systems
- Only include configuration options that have been verified to work
- Always include examples from real configurations
- Add safety warnings for potentially dangerous changes
Disclaimer: This is an unofficial community guide based on real Claude Code configurations (version 1.0.38+). Only edit what you understand and always backup first.
name: Claude Code Review
on:
pull_request:
branches: [main, develop]
jobs:
claude-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Claude Code
run: npm install -g @anthropic-ai/claude-code
- name: Run Review
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
claude -p "Review changes for security issues and bugs" \
--allowedTools "View" \
--output-format json > review-results.json#!/bin/bash
# .git/hooks/pre-commit
# Get staged files
staged_files=$(git diff --cached --name-only --diff-filter=ACM)
if [ -z "$staged_files" ]; then
exit 0
fi
# Analyze with Claude
analysis=$(echo "$staged_files" | xargs cat | \
claude -p "Review these changes for issues before commit" \
--allowedTools "View" \
--output-format json)
# Check for critical issues
if echo "$analysis" | jq -e '.critical_issues[]' > /dev/null 2>&1; then
echo "β Critical issues found - commit blocked"
exit 1
fi
echo "β
Code analysis passed"# Basic health checks
claude --version
claude --help
claude config list
claude /doctor # Check API key
echo $ANTHROPIC_API_KEY
# Test connection
claude -p "test" --verbose
# Reset authentication # Reinstall
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code
# Check Node.js version
node --version # Should be 16+# Check current permissions
claude config get allowedTools
# Reset permissions
claude config set allowedTools "[]"
claude config set allowedTools '["Edit", "View"]'# Debug MCP
claude --mcp-debug
claude mcp status
claude mcp restart --all# Enable verbose logging
claude --verbose
# Check logs (verify log location)Purpose: Store persistent project information that Claude remembers
Location: Project root directory
# Project: My Application
## Overview
This is a React/Node.js application with PostgreSQL database.
## Architecture
- Frontend: React 18 with TypeScript
- Backend: Node.js with Express
- Database: PostgreSQL 14
## Current Goals
- [ ] Implement authentication
- [ ] Add API documentation
- [ ] Set up CI/CD pipeline
## Development Guidelines
- Use TypeScript for all new code
- Follow ESLint configuration
- Write tests for new featuresclaude /memory # Edit project memory
claude /memory view # View current memory# These "thinking" phrases may work:
claude "think hard about the security implications of this code"
claude "analyze this thoroughly and provide detailed recommendations"
# Add multiple directories
claude --add-dir ../frontend ../backend ../shared
# Project-wide analysis
claude "analyze the entire application architecture"# Good: Specific and detailed
claude "Review UserAuth.js for security vulnerabilities, focusing on JWT handling"
# Bad: Vague
claude "check my code"- Start with minimal permissions:
claude --allowedTools "View" - Use environment variables:
export API_KEY="secret" - Regular audits:
claude config get allowedTools - Avoid dangerous mode: Only use
--dangerously-skip-permissionsin containers
- Use appropriate output formats:
--output-format jsonfor automation - Be specific in prompts: Better results, faster execution
- Clean up regularly: Remove old sessions and cache
- Official Documentation: https://docs.anthropic.com/en/docs/claude-code/overview
- Report Issues: Use
/bugcommand (if it works) or file GitHub issues - Test First: Always test commands in safe environments before relying on them
Last Updated: Based on package version 1.0.38 and available documentation. Many features require verification in your specific installation.
1. Health Check Automation
# Regular health checks
*/15 * * * * /usr/local/bin/claude /doctor > /dev/null || echo "Claude health check failed" | mail -s "Alert" [email protected]2. Log Analysis
# Daily log analysis
0 6 * * * tail -1000 /var/log/app.log | claude -p "analyze for issues" --output-format json > /tmp/daily-analysis.json1. Shared Configuration Templates
# Create team templates
mkdir -p ~/.claude/templates/
cat > ~/.claude/templates/team-frontend.json << EOF
{
"allowedTools": ["Edit", "View", "Bash(npm:*)", "mcp__git__*"],
"model": "claude-sonnet-4",
"systemPrompt": "You are working on our React frontend. Follow our coding standards and use TypeScript."
}
EOF
# Use templates
claude config import ~/.claude/templates/team-frontend.json2. Documentation Automation
# Automated documentation updates
claude "update README.md with recent changes to the API endpoints"
claude "generate TypeScript definitions from the new database schema"3. Code Review Standards
# Standardized review process
claude --allowedTools "View,mcp__git__*" \
"review PR #123 using our team standards:
- Security best practices
- Performance considerations
- Code style compliance
- Test coverage adequacy"1. Create Project Runbooks
# Generate runbooks
claude "create a deployment runbook for this application including all steps and troubleshooting"
claude "document the onboarding process for new developers"2. Architecture Documentation
# Maintain architecture docs
claude "update architecture documentation to reflect recent microservices changes"
claude "create sequence diagrams for the new authentication flow"β Don't:
- Use
--dangerously-skip-permissionson production systems - Hardcode secrets in commands or configuration
- Grant overly broad permissions
- Run with elevated privileges unnecessarily
β Do:
- Use environment variables for secrets
- Start with minimal permissions
- Regular security audits
- Isolate sensitive operations
β Don't:
- Load entire large codebases unnecessarily
- Use maximum thinking budget for simple tasks
- Run multiple concurrent Claude instances
- Ignore memory and cache cleanup
β Do:
- Use focused context with
--add-dir - Match thinking budget to task complexity
- Monitor resource usage
- Clean up regularly
β Don't:
- Skip project context setup (CLAUDE.md)
- Use vague, ambiguous prompts
- Ignore error messages and logs
- Automate without testing first
β Do:
- Maintain comprehensive project context
- Be specific and detailed in requests
- Monitor and analyze logs
- Test automation in safe environments