By Anthropic

Claude Code

AI coding assistant

/

Setup

Install Claude Code

Install Claude Code globally via npm

npm install -g @anthropic-ai/claude-code

Run without installing

Run Claude Code directly with npx

npx @anthropic-ai/claude-code

Authenticate

Sign in to your Anthropic account

claude auth

Basics

Start session

Launch interactive Claude Code session

claude

Show help

Display available commands and options

claude --help

Check version

Show installed Claude Code version

claude --version

Inline prompt

Run a single prompt without interactive mode

claude "your prompt here"

Code Operations

Review code

Get feedback on staged git changes

claude "review my staged changes"

Explain code

Get detailed explanation of code

claude "explain this function"

Write tests

Generate test cases for your code

claude "write tests for this module"

Refactor code

Improve code structure and readability

claude "refactor this to be more readable"

Fix bugs

Identify and fix issues in code

claude "fix the bug in this file"

Git Integration

Generate commit

Create commit with AI-generated message

claude "commit these changes"

Create PR

Generate pull request with description

claude "create a PR for these changes"

Explain diff

Understand changes between commits

claude "explain what changed in this diff"

MCP & Tools

List MCP servers

Show configured MCP servers

claude mcp list

Add MCP server

Configure a new MCP server

claude mcp add <name> <command>

Advanced

Custom slash commands

Run custom slash commands from .claude/commands/

/project:command

Pipe input

Pipe file contents to Claude

cat file.txt | claude "summarize this"

Output to file

Save Claude output to file

claude "generate readme" > README.md

MCP Servers

Extend Claude with tools

View all

Filesystem

Official

GitHub

Official

PostgreSQL

Official

Slack

Official

Puppeteer

Official

Memory

Official