Getting Started
Install via curl (macOS/Linux)
Recommended installation method
curl -fsSL https://claude.ai/install.sh | bashInstall via Homebrew
Install using Homebrew on macOS
brew install --cask claude-codeInstall via PowerShell (Windows)
Install on Windows using PowerShell
irm https://claude.ai/install.ps1 | iexInstall via npm
Install globally using npm (requires Node.js 18+)
npm install -g @anthropic-ai/claude-codeStart Claude Code
Launch Claude Code in your project
cd your-project && claudeUpdate to Latest
Keep Claude Code up to date
claude updateKeyboard Shortcuts
Configuration
📁 Settings File Locations (Priority Order)
/etc/claude-code/managed-settings.json (highest priority).claude/settings.local.json (personal, git-ignored).claude/settings.json (team settings)~/.claude/settings.json (personal defaults)View all settings
List current configuration
claude config listGet setting value
Check specific setting
claude config get <key>Set configuration
Change a setting value
claude config set <key> <value>Add to list setting
Push to arrays like permissions
claude config add <key> <value>Remove from list
Remove from array settings
claude config remove <key> <value>Checkpointing - Undo & Rewind
⏮️ Automatic Safety Net
Claude Code automatically tracks all file edits, letting you quickly rewind to previous states if changes go wrong.
⌨️ Rewind Commands
Esc+EscOpen rewind menu to restore previous states/rewindOpen rewind menu via slash command✨ Rewind Options
Automatic Tracking
Every user prompt creates a new checkpoint
Conversation Rewind
Restore to previous user message while keeping code
Code Rewind
Revert file changes while keeping conversation
Full Rewind
Restore both code and conversation to prior state
⚠️ Limitations
Slash Commands - Interactive Session Control
⚡ Interactive Session Commands
Control Claude's behavior during interactive sessions. Type commands directly in the Claude Code chat interface.
📋 Built-in Commands
/add-dirAdd additional working directories/agentsManage custom AI subagents for specialized tasks/bugReport bugs (sends conversation to Anthropic)/clearClear conversation history/compact [instructions]Compact conversation with optional focus instructions/configView/modify configuration/costShow token usage statistics/doctorCheck Claude Code installation health/helpGet usage help/initInitialize project with CLAUDE.md guide/loginSwitch Anthropic accounts/logoutSign out from your Anthropic account/mcpManage MCP server connections and OAuth authentication/memoryEdit CLAUDE.md memory files/modelSelect or change the AI model/permissionsView or update permissions/pr_commentsView pull request comments/reviewRequest code review/rewindRewind the conversation and/or code (Esc+Esc)/sandboxEnable sandboxed bash tool with filesystem and network isolation/statusView account and system statuses/terminal-setupInstall Shift+Enter key binding (iTerm2/VSCode)/usageShow plan usage limits and rate limit status (subscription plans only)/vimEnter vim mode for alternating insert/command modes🎯 Custom Slash Command Templates
Basic Project Command
Create a simple project-specific command
Analyze this code for performance issues and suggest optimizations:Personal Command
Create a user-wide command available in all projects
Review this code for security vulnerabilities:Command with All Arguments
Use $ARGUMENTS placeholder for all arguments
Fix issue #$ARGUMENTS following our coding standardsCommand with Positional Arguments
Use $1, $2, $3 for individual arguments
---
argument-hint: [pr-number] [priority] [assignee]
description: Review pull request with priority and assignee
---
Review PR #$1 with priority $2 and assign to $3.
Focus on security, performance, and code style.Git Commit Command
Advanced command with bash execution and file references
---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
argument-hint: [message]
description: Create a git commit
---
## Context
- Current git status: !`git status`
- Current git diff: !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -10`
## Your task
Based on the above changes, create a single git commit.Command with Model Override
Specify model and disable automatic invocation
---
description: Perform deep code analysis
model: claude-opus-4-1-20250805
disable-model-invocation: true
---
Perform a comprehensive analysis of this codebase focusing on:
- Architecture patterns
- Potential scalability issues
- Security vulnerabilities
- Performance bottlenecks💡 Usage Tips
.claude/commands/ (shared with team)~/.claude/commands/ (available across all projects)$ARGUMENTS placeholder for dynamic values!`command` to run commands before processing@filename to include file contents/mcp__server__prompt_nameHeadless Mode - Programmatic Usage
🤖 Run Claude Code Non-Interactively
Use --print (or -p) for automation, scripts, and CI/CD pipelines. Perfect for SRE bots, automated code reviews, and agent integrations.
📋 Key Headless Commands
claude -p "query"Non-interactive mode, print result and exitclaude -p --output-format json "query"Output in JSON format with metadataclaude -p --output-format stream-json "query"Stream JSON messages as they arriveclaude -c -p "query"Continue most recent conversation non-interactivelyclaude --resume <id> -p "query"Resume specific session non-interactivelyecho "query" | claude -pProcess piped inputclaude --verbose -p "query"Enable verbose logging for debuggingclaude --max-turns 3 -p "query"Limit agentic turns in non-interactive mode💼 Real-World Examples
SRE Incident Response
Automated incident investigation
claude -p "Analyze these errors" \
--append-system-prompt "You are an SRE expert" \
--output-format json \
--allowedTools "Bash,Read,mcp__datadog"Security Audit
Automated PR security review
gh pr diff 123 | claude -p \
--append-system-prompt "You are a security engineer" \
--output-format json \
--allowedTools "Read,Grep" > audit.jsonMulti-turn Session
Maintain context across multiple commands
session_id=$(claude -p "Start review" --output-format json | jq -r '.session_id')
claude --resume "$session_id" -p "Check compliance"
claude --resume "$session_id" -p "Generate summary"📊 Output Formats
Agent Skills - Modular Capabilities
🧠 What are Agent Skills?
Skills are modular capabilities that extend Claude's functionality. Unlike slash commands (user-invoked), Skills are model-invoked—Claude autonomously uses them based on context.
.claude/skills/ (project) or ~/.claude/skills/ (personal)📋 Skill Setup Commands
mkdir -p .claude/skills/skill-nameCreate project Skill directorymkdir -p ~/.claude/skills/skill-nameCreate personal Skill directorycat > .claude/skills/my-skill/SKILL.mdCreate Skill definition file🎯 Skill Templates
Simple Skill
Basic Skill with single file
---
name: generating-commit-messages
description: Generates clear commit messages from git diffs. Use when writing commit messages or reviewing staged changes.
---
# Generating Commit Messages
## Instructions
1. Run `git diff --staged` to see changes
2. I'll suggest a commit message with:
- Summary under 50 characters
- Detailed description
- Affected components
## Best practices
- Use present tense
- Explain what and why, not howSkill with Tool Permissions
Skill that limits tool access
---
name: code-reviewer
description: Review code for best practices and potential issues. Use when reviewing code, checking PRs, or analyzing code quality.
allowed-tools: Read, Grep, Glob
---
# Code Reviewer
## Review checklist
1. Code organization and structure
2. Error handling
3. Performance considerations
4. Security concerns
5. Test coverage🔄 Skills vs Slash Commands
/command), simple prompts, single filePlugins - Extend Claude Code
🧩 What are Plugins?
Plugins extend Claude Code with custom commands, agents, hooks, Skills, and MCP servers. Install from marketplaces or create your own.
📋 Plugin Management Commands
/pluginOpen plugin management interface/plugin marketplace add <url-or-path>Add a plugin marketplace/plugin install <name>@<marketplace>Install a plugin from marketplace/plugin enable <name>@<marketplace>Enable a disabled plugin/plugin disable <name>@<marketplace>Disable a plugin without uninstalling/plugin uninstall <name>@<marketplace>Completely remove a plugin💡 Quick Start Examples
Add GitHub Marketplace
Add a plugin marketplace from GitHub
claude mcp add marketplace your-org/claude-pluginsInstall Plugin
Install a specific plugin from marketplace
/plugin install formatter@your-orgLocal Development Marketplace
Add local marketplace for plugin development
/plugin marketplace add ./dev-marketplace✨ What Plugins Can Provide
MCP Servers & Extensions
🔌 Model Context Protocol (MCP)
Extend Claude Code with external tools and integrations. MCP servers provide additional capabilities like browser automation, database access, and API integrations.
📋 MCP Management Commands
claude mcp add <name> <command> [args...]Add MCP server with commandclaude mcp add --transport sse <name> <url>Add SSE transport MCP serverclaude mcp add --transport http <name> <url>Add HTTP transport MCP serverclaude mcp listList installed MCP serversclaude mcp remove <name>Remove MCP server⚡ Popular MCP Integrations
Airtable
Read/write records, manage bases and tables
claude mcp add --transport stdio airtable --env AIRTABLE_API_KEY=YOUR_KEY -- npx -y airtable-mcp-serverAsana
Interact with your Asana workspace
claude mcp add --transport sse asana https://mcp.asana.com/sseAtlassian
Manage Jira tickets and Confluence docs
claude mcp add --transport sse atlassian https://mcp.atlassian.com/v1/sseBox
Access enterprise content and automate workflows
claude mcp add --transport http box https://mcp.box.com/Canva
Browse, summarize, autofill and generate Canva designs
claude mcp add --transport http canva https://mcp.canva.com/mcpClickUp
Task management, project tracking
claude mcp add --transport stdio clickup --env CLICKUP_API_KEY=YOUR_KEY --env CLICKUP_TEAM_ID=YOUR_TEAM -- npx -y @hauptsache.net/clickup-mcpCloudflare
Build apps, analyze traffic, manage security
claude mcp add --transport http cloudflare https://mcp.cloudflare.com/mcpCloudinary
Upload, manage, transform media assets
claude mcp add --transport http cloudinary https://mcp.cloudinary.com/mcpDaloopa
High quality fundamental financial data
claude mcp add --transport http daloopa https://mcp.daloopa.com/server/mcpFigma
Generate better code with full Figma context
claude mcp add --transport http figma https://mcp.figma.com/mcpFireflies
Extract insights from meeting transcripts
claude mcp add --transport http fireflies https://api.fireflies.ai/mcpGitHub
Manage repositories, PRs, and issues
claude mcp add --transport http github https://api.githubcopilot.com/mcp/HubSpot
Access and manage HubSpot CRM data
claude mcp add --transport http hubspot https://mcp.hubspot.com/anthropicHugging Face
Access Hugging Face Hub and Gradio apps
claude mcp add --transport http huggingface https://huggingface.co/mcpIntercom
Access customer conversations and tickets
claude mcp add --transport http intercom https://mcp.intercom.com/mcpinvideo
Build video creation capabilities
claude mcp add --transport sse invideo https://mcp.invideo.io/sseJam
Debug with AI agents accessing Jam recordings
claude mcp add --transport http jam https://mcp.jam.dev/mcpLinear
Issue tracking and project management
claude mcp add --transport http linear https://mcp.linear.app/mcpMonday
Manage monday.com boards and items
claude mcp add --transport http monday https://mcp.monday.com/mcpNetlify
Create, deploy, and manage websites
claude mcp add --transport http netlify https://netlify-mcp.netlify.app/mcpNotion
Read docs, update pages, manage tasks
claude mcp add --transport http notion https://mcp.notion.com/mcpPayPal
Payment processing and transaction management
claude mcp add --transport http paypal https://mcp.paypal.com/mcpPlaid
Banking data and financial account linking
claude mcp add --transport sse plaid https://api.dashboard.plaid.com/mcp/ssePlaywright
Advanced browser automation
claude mcp add --transport stdio playwright -- npx @playwright/mcp@latestPuppeteer
Browser automation
claude mcp add --transport stdio puppeteer -- npx -y @modelcontextprotocol/server-puppeteerSentry
Monitor errors, debug production issues
claude mcp add --transport http sentry https://mcp.sentry.dev/mcpSocket
Security analysis for dependencies
claude mcp add --transport http socket https://mcp.socket.dev/Square
Payments, inventory, orders, and more
claude mcp add --transport sse square https://mcp.squareup.com/sseStripe
Payment processing and subscriptions
claude mcp add --transport http stripe https://mcp.stripe.comStytch
Configure and manage authentication services
claude mcp add --transport http stytch http://mcp.stytch.dev/mcpSupabase
Database operations
claude mcp add --transport stdio supabase --env SUPABASE_ACCESS_TOKEN=YOUR_TOKEN -- npx -y @supabase/mcp-server-supabase@latestVercel
Manage projects, deployments, and logs
claude mcp add --transport http vercel https://mcp.vercel.com/Workato
Access applications, workflows, and data
claude mcp add --transport http workato https://mcp.workato.com/mcpZapier
Connect to 8,000+ apps
claude mcp add --transport http zapier https://mcp.zapier.com/mcpGit Worktrees - Parallel Development
🚀 Why Use Git Worktrees with Claude Code?
- No Context Loss: Each Claude session keeps full project understanding
- Parallel Work: Handle hotfixes while continuing feature development
- Safe Experiments: Test risky changes in complete isolation
- Model Comparison: Run different AI models on identical tasks
- Zero Switching Cost: No more git stash, checkout, restart cycle
📋 Essential Worktree Commands
git worktree add <path> <branch>Create worktree with existing branchgit worktree add <path> -b <branch> <start-point>Create worktree with new branchgit worktree listList all worktrees and their branchesgit worktree remove <path>Remove a worktree directorygit worktree pruneClean up worktree referencesgit worktree move <worktree> <new-path>Move worktree to new location💡 Powerful Workflow Examples
Parallel Feature Development
Work on multiple features simultaneously
git worktree add ../myapp-auth -b feature/auth main
git worktree add ../myapp-api -b feature/api main
cd ../myapp-auth && claude
cd ../myapp-api && claudeHotfix While Developing
Handle urgent fixes without losing context
git worktree add ../myapp-hotfix -b hotfix/critical main
cd ../myapp-hotfix
claude "fix the critical bug"
# Original work continues in main directorySafe Experiment Testing
Test risky changes in isolation
git worktree add ../myapp-experiment -b experiment/refactor main
cd ../myapp-experiment
claude "refactor the entire auth system"
# If it fails, just delete the directoryModel Comparison
Compare different AI implementations
git worktree add ../ml-sonnet -b experiment/sonnet main
git worktree add ../ml-opus -b experiment/opus main
cd ../ml-sonnet && claude --model sonnet
cd ../ml-opus && claude --model opusCode Review Preparation
Polish code without affecting main work
git worktree add ../myapp-review -b review/cleanup feature-branch
cd ../myapp-review
claude "add docs, tests, and clean up code style"
git merge review/cleanupSubagents - Specialized AI Assistants
🤖 Why Use Subagents?
- Context Preservation: Each subagent has separate context from main conversation
- Specialized Expertise: Fine-tuned prompts for specific domains and tasks
- Reusable Workflows: Share subagents across projects and with your team
- Tool Control: Grant specific tool access per subagent for security
- Automatic Delegation: Claude proactively uses appropriate subagents
📁 Subagent Locations
.claude/agents/ (highest priority, team shared)~/.claude/agents/ (personal, all projects)📋 Essential Subagent Commands
/agentsOpen subagents management interfaceclaude "Use the [name] subagent to..."Explicitly invoke a specific subagentmkdir -p .claude/agentsCreate project subagents directorymkdir -p ~/.claude/agentsCreate user subagents directory🎯 Ready-to-Use Subagent Templates
Code Reviewer
Expert code review after writing/modifying code
---
name: code-reviewer
description: Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.
tools: Read, Grep, Glob, Bash
model: inherit
---
You are a senior code reviewer ensuring high standards of code quality and security.
When invoked:
1. Run git diff to see recent changes
2. Focus on modified files
3. Begin review immediately
Review checklist:
- Code is simple and readable
- Functions and variables are well-named
- No duplicated code
- Proper error handling
- No exposed secrets or API keys
- Input validation implemented
- Good test coverage
- Performance considerations addressed
Provide feedback organized by priority:
- Critical issues (must fix)
- Warnings (should fix)
- Suggestions (consider improving)
Include specific examples of how to fix issues.Debugger
Debugging specialist for errors and test failures
---
name: debugger
description: Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.
tools: Read, Edit, Bash, Grep, Glob
model: sonnet
---
You are an expert debugger specializing in root cause analysis.
When invoked:
1. Capture error message and stack trace
2. Identify reproduction steps
3. Isolate the failure location
4. Implement minimal fix
5. Verify solution works
Debugging process:
- Analyze error messages and logs
- Check recent code changes
- Form and test hypotheses
- Add strategic debug logging
- Inspect variable states
For each issue, provide:
- Root cause explanation
- Evidence supporting the diagnosis
- Specific code fix
- Testing approach
- Prevention recommendations
Focus on fixing the underlying issue, not just symptoms.Data Scientist
Data analysis expert for SQL and BigQuery
---
name: data-scientist
description: Data analysis expert for SQL queries, BigQuery operations, and data insights. Use proactively for data analysis tasks.
tools: Bash, Read, Write
model: opus
---
You are a data scientist specializing in SQL and BigQuery analysis.
When invoked:
1. Understand the data analysis requirement
2. Write efficient SQL queries
3. Use BigQuery command line tools (bq) when appropriate
4. Analyze and summarize results
5. Present findings clearly
Key practices:
- Write optimized SQL queries with proper filters
- Use appropriate aggregations and joins
- Include comments explaining complex logic
- Format results for readability
- Provide data-driven recommendations
Always ensure queries are efficient and cost-effective.💡 Usage Tips
"Use the code-reviewer subagent to check my code""Use debugger then optimizer subagents"📝 Subagent File Format
---
name: your-subagent-name
description: When this subagent should be invoked
tools: Read, Edit, Bash # Optional - inherits all if omitted
---
Your subagent's system prompt goes here.
Include specific instructions, examples, and constraints.
Define the subagent's role, capabilities, and approach
to solving problems within its domain.Permissions & Security
🔒 Ready-to-Use Permission Templates
Copy complete settings.json configurations for different security levels. Save to .claude/settings.json in your project.
⚠️ MCP Tool Permissions
mcp__github__* will NOT work"allow": ["mcp__github"]"allow": ["mcp__github__get_issue"]🏢 Enterprise Configuration
/etc/claude-code/managed-settings.json/etc/claude-code/managed-mcp.jsonallowedMcpServers and deniedMcpServersBasic Security
Block sensitive files, allow common dev commands
{
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git status)",
"Bash(git diff)",
"Bash(git add *)",
"Bash(git commit *)"
],
"ask": [
"Bash(git push:*)",
"Bash(npm install *)"
],
"deny": [
"Read(./.env*)",
"Read(./secrets/**)",
"Read(./**/credentials*)",
"Bash(rm -rf:*)",
"Bash(curl:*)"
]
}
}Strict Security
Maximum security for sensitive projects
{
"permissions": {
"ask": [
"Bash(*)",
"Write(*)",
"Edit(*)"
],
"deny": [
"Read(./.env*)",
"Read(./secrets/**)",
"Read(./config/**)",
"Read(./**/credentials*)",
"Read(./**/*.key)",
"Read(./**/*.pem)",
"WebFetch",
"Bash(curl:*)",
"Bash(wget:*)",
"Bash(ssh:*)"
]
}
}Slash Command Permissions
Control which slash commands Claude can invoke
{
"permissions": {
"allow": [
"SlashCommand:/commit",
"SlashCommand:/review-pr:*"
],
"deny": [
"SlashCommand"
]
}
}Enterprise MCP Restrictions
Example enterprise MCP server allowlist/denylist
{
"allowedMcpServers": [
{
"serverName": "github"
},
{
"serverName": "sentry"
},
{
"serverName": "company-internal"
}
],
"deniedMcpServers": [
{
"serverName": "filesystem"
}
]
}Hooks - Automation & Control
⚠️ Security Warning
Hooks execute shell commands automatically with your credentials. Always review hook code before adding. Malicious hooks can damage your system or exfiltrate data.
Use hooks to automate formatting, logging, notifications, and custom permissions instead of relying on Claude to remember these tasks.
📋 Hook Events
PreToolUseRuns before tool calls (can block them)PostToolUseRuns after tool calls completeUserPromptSubmitRuns when user submits a prompt, before Claude processes itNotificationRuns when Claude Code sends notificationsStopRuns when Claude Code finishes respondingSubagentStopRuns when subagent tasks completePreCompactRuns before compact operationSessionStartRuns when Claude Code starts/resumes sessionSessionEndRuns when Claude Code session ends🛠️ Hook Management Commands
/hooksOpen hooks configuration interfaceclaude --debugRun with debug output to see hook executionmkdir -p .claude/hooksCreate project hooks directorychmod +x .claude/hooks/script.shMake hook script executable🎯 Ready-to-Use Hook Examples
Auto Format Code
Run prettier on edited files
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "npx prettier --write $FILE_PATH"
}
]
}
]
}
}Log Activity
Keep a log of all Claude sessions
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "echo \"$(date): $CONVERSATION_SUMMARY\" >> ~/.claude/activity.log"
}
]
}
]
}
}🏗️ Hook Structure & Tips
~/.claude/settings.json (user) or .claude/settings.json (project)Bash, Edit|Write, *)$CLAUDE_PROJECT_DIR for relative paths0=success, 2=block & show to Claude, other=errorjq to parse)claude --debug to see hook execution detailsPDF & PNG Downloads

Printable Version
Special version for printing or keeping as a desktop reference. Contains all essential keyboard shortcuts, commands, configurations, and file locations in a compact format.