██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ███████╗
██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝
██║ ██║ ███████║██║ ██║██║ ██║█████╗ ██║ ██║ ██║██║ ██║█████╗
██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝ ██║ ██║ ██║██║ ██║██╔══╝
╚██████╗███████╗██║ ██║╚██████╔╝██████╔╝███████╗ ╚██████╗╚██████╔╝██████╔╝███████╗
╚═════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
Claude Code Cheat Sheet
Quick reference for Anthropic's CLI coding assistant
Last updated: January 2026
Quick Links:
Installation |
Slash Commands |
Config Files |
Context |
GitHub |
CLI |
Hooks |
MCP |
Shortcuts |
Best Practices |
Resources
Installation
| Platform | Command |
|---|---|
| macOS/Linux | curl -fsSL https://claude.ai/install.sh | bash |
| Homebrew | brew install --cask claude-code |
| Windows | irm https://claude.ai/install.ps1 | iex |
| WinGet | winget install Anthropic.ClaudeCode |
Slash Commands
| Command | Description |
|---|---|
/agents | Create and manage subagents |
/allowed-tools | Manage tool permissions |
/bug | Report issues |
/config | Interactive settings configuration |
/context | View context usage breakdown |
/help | Display all available commands |
/hooks | Set up automation triggers |
/install-github-app | Set up GitHub Actions integration |
/mcp | Configure MCP servers |
/terminal-setup | Install keyboard shortcuts |
/vim | Enable vim-style editing |
Read more: Comprehensive slash commands guide
Tip: Use /context regularly to monitor token usage and avoid context exhaustion.
Configuration Files
| File | Scope | Location |
|---|---|---|
| User settings | All projects | ~/.claude/settings.json |
| Project settings | Team (git tracked) | .claude/settings.json |
| Local settings | Personal (git ignored) | .claude/settings.local.json |
| Memory file | Project context | CLAUDE.md (hierarchical) |
| Custom agents | Subagent definitions | .claude/agents/ |
| Custom commands | Slash commands | .claude/commands/ |
Context Categories
| Category | Description |
|---|---|
| System prompt | Claude's base instructions |
| System tools | Built-in tools (Read, Write, Bash, etc.) |
| Custom agents | Your .claude/agents/ definitions |
| Memory files | Your CLAUDE.md files |
| MCP tools | Model Context Protocol servers |
| Reserved | Buffer (~40-45k) for auto-compact |
| Messages | Conversation history |
| Free space | Available for new content |
GitHub Integration
Quick Setup:
/install-github-app
@claude Mentions:
@claude review this PR
@claude fix the TypeError in dashboard
@claude implement user authentication
@claude /review
Local Git Operations:
commit these changes
create a pr for this branch
what changes made it into v1.2.3?
CLI Arguments
| Argument | Description |
|---|---|
-p "prompt" | Print mode (single query, then exit) |
--model <model> | Specify Claude model |
--max-turns <n> | Limit conversation turns |
--allowed-tools <list> | Restrict available tools |
--mcp-config <path> | MCP configuration file |
--debug | Enable debug output |
Piping:
tail -f app.log | claude -p "analyze these logs"
cat error.txt | claude -p "explain this error"
Hooks
| Hook | Trigger |
|---|---|
PreToolUse | Before a tool is executed |
PostToolUse | After a tool completes |
UserPromptSubmit | When user sends a message |
SessionStart | When a new session begins |
Example use cases:
- Auto-format code after edits
- Run linters before commits
- Send notifications on completion
MCP (Model Context Protocol)
Connect external tools and data sources:
- Google Drive (design docs)
- Figma (designs)
- Slack (team communication)
- Jira (issue tracking)
- Custom tooling
Setup:
/mcp
Warning: MCP tools can consume significant context (40%+). Disable unused servers.
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+C | Cancel current operation |
Ctrl+D | Exit Claude Code |
Tab | Autocomplete |
Up/Down | Navigate history |
Ctrl+T | Toggle syntax highlighting (in /theme) |
Install terminal shortcuts:
/terminal-setup
Best Practices
- Use CLAUDE.md - Encode project conventions, build commands, standards (guide)
- Start focused sessions - New conversations for distinct tasks
- Be specific - Target file reads, specific grep patterns
- Use Task tool - Let Claude spawn subagents for exploration
- Monitor /context - Avoid context exhaustion
- Review changes - Always review before accepting
Resources
[ More articles coming soon - check back for updates ]