Last updated: May 2026·Claude Code v2.x  ·  Sonnet 4.6 / Opus 4.6 / Haiku 4.5
To update: ask Claude at claude.ai — "regenerate the Claude Code cheat sheet"
v2.x Latest CLI · Web · IDE · Desktop · Mobile Sonnet 4.6 Default MCP · Hooks · Skills · Subagents · Checkpoints
🤖Current Models — May 2026
Claude Sonnet 4.6 Default
claude-sonnet-4-6
Best speed/quality balance. Default across claude.ai and Claude Code. Improved agentic search.
Context Window
1M ctx (GA)64K–128K out$3/$15 per MTokAug 2025 cutoff
Claude Opus 4.6 Most Capable
claude-opus-4-6
SOTA. Best for complex multi-step planning, architecture, and hard reasoning. Use sparingly.
Context Window
1M ctx (GA)Max/Team/EnterpriseStandard per-MTok
Claude Haiku 4.5 Fast
claude-haiku-4-5
Fastest, cheapest. Near-frontier performance. Use for subagent exploration, simple tasks.
Context Window
200K ctxUltra-fastLowest cost
💡Switch model: /model in session · claude config set model claude-opus-4-6 globally
🧠1M context now GA for Sonnet 4.6 & Opus 4.6 — standard pricing, no beta header required
💰Route Haiku for subagent exploration → Sonnet for implementation → Opus for complex planning only
📦Installation & Setup
Install
$npm install -g @anthropic-ai/claude-code
$claudeStart interactive session
$claude --version
$claude --help
Auth & Config
$claude loginAuthenticate via browser
$claude config list
$claude config set model claude-opus-4-6
$claude -p "task"One-shot, non-interactive
$claude --autoFully autonomous mode
$claude --teleportPull remote session to local
$claude -n "session name"Name session at start 🆕
Session
$claude --resumeResume last session
$claude --continueContinue + add message
$claude project purge [path]Delete all project state
🖥️Core Commands
Codebase Tasks
explain this codebaseArchitecture overview
find all TODO comments
fix all lint errors and format
add error handling to auth.php
write tests for UserService
remove all dead code and stubs
review this code for security issues
Shell & Run
run the tests and fix failures
start the dev server
!git status! runs shell directly
2026 Features 🆕
use subagents to explore in parallel
schedule a daily dependency audit
use the reviewer subagent on this
🌿Git & Branch Operations
Commits
commit my changes with a good message
commit only src/auth/ with: refactor auth
amend the last commit message
Branches
create branch release/v7.4.5 from main
switch to feature/login
create branch, clean code, push PR
Pull Requests
push and open PR with summary
review this PR for security issues
Checkpoints 🆕
💾Auto-saved before each change. /rewind or Esc Esc to restore.
🛡️Protected branches: PRs only — never force-pushes to main.
📝All commits tagged Co-Authored-By: Claude
🖥️Available Surfaces
Terminal CLI
Full featured. Direct file access.
Stable
🌐
Web (claude.ai/code)
Full agentic. GitHub connected. Persists.
Stable
💙
VS Code
Extension. Inline diffs. Sidebar panel.
Stable
🟠
JetBrains
IntelliJ, PHPStorm, PyCharm plugin.
Stable
🖥️
Desktop App
Visual diff, multi-session, scheduling.
Stable
📱
iOS / Mobile
Dispatch tasks. Remote Control.
New
⚙️
GitHub Actions
anthropics/claude-code-action
Stable
💬
Slack
Tag @claude in channels.
Beta
Slash Commands
/helpShow all commands
/modelSwitch Opus/Sonnet/Haiku
/clearClear conversation context
/resetReset session state
/memoryView auto memory
/configOpen settings
/permissionsView tool access
/doctorDiagnose setup issues
/scheduleSchedule a routine 🆕
/loopRepeat prompt in session
/rewindRestore to checkpoint 🆕
/focusToggle focus view 🆕
/effortSet model effort level 🆕
/colorSet prompt bar colour 🆕
/renameName this session 🆕
/pluginManage plugins
/mcpMCP server management
/costToken usage breakdown
/initCreate CLAUDE.md
/voiceToggle voice mode
Custom Commands
🔧Project: .claude/commands/name.md/name  ·  Global: ~/.claude/commands/
⌨️Keyboard Shortcuts
Terminal / CLI
CtrlC
Cancel / interrupt
CtrlD
Exit session
CtrlR
Search prompt history
CtrlG
Open external editor
CtrlO
Toggle verbose transcript
EscEsc
Rewind checkpoint 🆕
Tab
Autocomplete
Browse history
Web Interface
Enter
Send message
ShiftEnter
New line
Esc
Cancel streaming
K
Command palette
VS Code Extension
⌘⇧P
Command palette → Claude
I
Inline edit / ask
Tab
Accept suggestion
Esc
Reject suggestion
📋CLAUDE.md · Hooks · Skills · Subagents
CLAUDE.md (auto-read every session)
# Project Instructions ## Stack: PHP 8.2 / MySQL / cPanel ## Standards: PSR-12, camelCase ## Test: ./vendor/bin/phpunit ## Never: commit to main directly ## Never: leave stubs in release builds
Hooks (shell commands on events)
# settings.json "hooks": { "PostToolUse": [{ "matcher": "Write(*.py)", "hooks": [{"type":"command", "command":"python -m black $file"}] }], "PostCompact": [...] // 🆕 }
🆕claude plugin prune removes orphaned plugin dependencies
Skills (model-invoked automatically)
📁Place in .claude/skills/ — Claude loads based on context. Encode domain expertise once, applied everywhere.
🔧Built-in Anthropic skills: PowerPoint, Excel, Word, PDF. Custom via Skills API.
Subagents (delegate to specialised instances)
# .claude/agents/reviewer.md --- name: reviewer model: sonnet # or haiku description: For thorough code reviews --- You are an expert code reviewer. Focus on security and performance.
Subagents get clean contexts — prevents main-context bloat. Use Haiku for read-only exploration.
🔌MCP Integrations
🔗Model Context Protocol — connects Claude to external services and data sources
GitHub MCP
Issues, PRs, repos, branches
Google Drive
Read docs, specs, design files
Gmail / Calendar
Emails, scheduling, context
Jira / Asana
Tickets, tasks, project data
Slack
Pull thread context, post updates
Postgres / MySQL
Query database directly
Sentry / Datadog
Errors, metrics, incidents
Custom MCP
Build with FastMCP / SDK
Setup
$claude mcp add <server-name>
🆕alwaysLoad: true in MCP config — tools always available, skip deferral
🐙GitHub Actions Integration
What Claude Code Can Do
Create branches from any base branch
Clean, refactor, and rewrite code
Commit + push + open PR with summary
Review PRs, comment on issues @claude
Wait for CI, fix failures, re-push
Cannot push to protected branches
Setup
/install-github-appRun in CLI
Workflow File
# .github/workflows/claude.yml name: Claude Review on: pull_request: issue_comment: types: [created] jobs: claude: runs-on: ubuntu-latest steps: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} github_token: ${{ secrets.GITHUB_TOKEN }}
Trigger via Comments
💬@claude review this PR for security issues
💬@claude fix the bug described in this issue
🔒Permissions
Defaults
Read files in working dir
Edit files in working dir
Run shell commands
✓*
Create git branches
Push to protected branch
Delete files permanently
Files outside project
settings.json
"permissions": { "allowedTools": ["Read","Write","Bash(git *)"], "deny": ["Read(./.env)","Write(./prod.*)"] }
🔐--auto fully autonomous · --dangerously-skip-permissions bypasses most prompts
🚀Release Branch Workflow + Routines
Single Compound Prompt
Create release branch release/v7.4.5 from main. Audit entire codebase — remove all dead code, stubs, unused variables, redundant comments, incomplete implementations. Zero stubs remain. Run all tests. Fix any failures. Commit: "release: v7.4.5 clean-code audit" Push and open PR into main with full summary.
Step-by-Step
1›create branch release/v7.4.5 from main
2›audit all files for stubs, TODOs, dead code
3›remove all stubs, clean formatting everywhere
4›run tests and fix any failures
5›commit: release: v7.4.5 clean-code prep
6›push and open PR into main
CLI Single-Line Release
claude "create release branch release/v7.4.5 from main, clean up the code, remove dead code and unused variables, run tests, then commit and push"
Routines & Scheduling 🆕
☁️Cloud Routines — run on Anthropic infra even when your computer is off. Trigger: schedule, API, or GitHub event.
🖥️Desktop Routines — run locally with direct file access.
/schedule "every Monday audit deps"
$claude --teleportPull remote to local
🚨Troubleshooting
🔑Auth failed — Run claude login or check ANTHROPIC_API_KEY
🚫Push denied — Check GitHub App has repo write access in settings
⏱️Stream timeout — Use Routines or web session (more resilient) for long tasks
🔌Private repo not found — Grant access in GitHub App → Repository access
🩺General issues — Run /doctor for automated diagnosis and fixes
🔄Context limit — Conversation auto-compacts. Use /clear to start fresh.
💾Accidental change — Use /rewind or Esc Esc to restore from checkpoint
Debug
$claude --debugVerbose logging
/costToken usage breakdown
/doctorAutomated diagnosis
💡Pro Tips
📁Start in project root. Always cd into your repo — context is the whole directory.
🎯Be specific. "Fix login bug in src/Auth.php line 47" beats "fix bug".
🤖Use subagents. Haiku for read-only exploration, Sonnet for writing, Opus for planning.
💾Trust checkpoints. Attempt ambitious refactors — /rewind can always restore.
📝CLAUDE.md discipline. Test command, linter, "never do X" rules = zero drift per session.
🧠Auto memory. Claude learns build commands across sessions — no re-explaining.
🔄Chain tasks. "Now do the same for src/models/" — Claude remembers the pattern.