Claude Code Quick Reference
This comprehensive quick reference provides all the essential Claude Code commands, tools, and best practices in one convenient resource. Bookmark this page for easy access during your development sessions.
Quick Navigation
CLI Commands
Command | Description | Example |
---|---|---|
claude |
Start interactive REPL | claude |
claude "query" |
Start REPL with initial prompt | claude "explain this project" |
claude -p "query" |
Run one-off query, then exit | claude -p "explain this function" |
cat file | claude -p "query" |
Process piped content | cat logs.txt | claude -p "explain" |
claude config |
Configure settings | claude config set --global theme dark |
claude update |
Update to latest version | claude update |
CLI Flags
Flag | Description | Example |
---|---|---|
-p, --prompt |
Run a single query and exit | claude -p "explain this function" |
-v, --version |
Show Claude Code version | claude -v |
--help |
Show help documentation | claude --help |
--config |
Set configuration options | claude --config theme=dark |
--disable-tool |
Disable specific tools | claude --disable-tool Bash,Edit |
--disable-all-tools |
Disable all tools | claude --disable-all-tools |
--thinking |
Toggle model thinking visibility | claude --thinking |
--model |
Specify the Claude model to use | claude --model claude-3-7-sonnet |
--bedrock |
Run on AWS Bedrock | claude --bedrock |
--vertex |
Run on Google Vertex AI | claude --vertex |
Slash Commands
Command | Purpose | Example |
---|---|---|
/bug |
Report bugs (sends conversation to Anthropic) | /bug The search isn't working correctly |
/clear |
Clear conversation history | /clear |
/compact [instructions] |
Compact conversation with optional focus | /compact Focus on testing issues |
/config |
View/modify configuration | /config theme dark |
/cost |
Show token usage statistics | /cost |
/doctor |
Check Claude Code installation health | /doctor |
/help |
Get usage help | /help |
/init |
Initialize project with CLAUDE.md guide | /init |
/login |
Switch Anthropic accounts | /login |
/logout |
Sign out from your Anthropic account | /logout |
/memory |
Edit CLAUDE.md memory files | /memory |
Tools Reference
Tool | Description | Permissions |
---|---|---|
dispatch_agent |
Launches a new agent with access to a subset of tools for specialized tasks | No permission required |
Bash |
Executes bash commands in your terminal environment | Permission required |
GlobTool |
Finds files matching specified patterns | No permission required |
GrepTool |
Searches file contents for specific patterns | No permission required |
LS |
Lists files and directories | No permission required |
View |
Reads and displays file contents | No permission required |
Edit |
Makes targeted changes to specific sections of files | Permission required |
Replace |
Creates new files or completely replaces existing ones | Permission required |
ReadNotebook |
Reads and displays Jupyter notebooks with their outputs | No permission required |
NotebookEditCell |
Edits specific cells in Jupyter notebooks | Permission required |
BatchTool |
Runs multiple tool operations in parallel for efficiency | Depends on tools used |
WebFetchTool |
Retrieves and processes content from web URLs | No permission required |
Pro Tip
Always use BatchTool when making multiple tool calls of the same type (e.g., viewing multiple files, making several edits to the same file). This significantly improves performance and reduces context usage.
Memory Management
Memory Types
Project Memory (CLAUDE.md)
- Shared with team members
- Stored at project root
- Version controlled
- Focused on project state
Local Memory
- Personal preferences
- Project-specific notes
- Not shared
- Not version controlled
User Memory
- Global preferences
- Cross-project settings
- Stored centrally
- Persistent in all sessions
Memory Management Commands
# Initialize memory
/init
# View and edit memory
/memory
# Compact context to optimize memory
/compact [focus instructions]
# Check memory usage
/cost
Permission Management
Permission Levels
Level | Description | Configuration |
---|---|---|
allow | Always allow tool use without prompting | claude config set toolPermissions.Bash allow |
prompt | Ask for permission each time (default) | claude config set toolPermissions.Bash prompt |
deny | Never allow tool use | claude config set toolPermissions.Bash deny |
Tool Restriction Options
# Disable specific tools for a session
claude --disable-tool Bash,Edit
# Disable all tools for a session
claude --disable-all-tools
# Set global permission settings
claude config set toolPermissions.Edit prompt
Effective Prompting
Trigger Phrases for Enhanced Thinking
Basic Prompts
- "Add a function to..."
- "Find bugs in this code"
- "Create tests for..."
- "Improve performance"
Enhanced Prompts
- "Think carefully about how to add a function..."
- "Analyze deeply to find bugs..."
- "Think step by step to create tests..."
- "Consider all aspects to improve performance..."
Template Structures
# Code Review Template
Please review this code with the following focus:
1. Security vulnerabilities (high priority)
2. Performance optimizations
3. Adherence to coding standards
4. Test coverage
5. Documentation completeness
# Implementation Template
Help me implement [feature] with these requirements:
1. Core functionality: [describe]
2. API constraints: [list any API requirements]
3. Performance expectations: [describe]
4. Security considerations: [describe]
Essential Best Practices
- Use Specific Instructions: Give clear, specific directions rather than general requests
- Leverage BatchTool: Bundle multiple related operations for efficiency
- Keep CLAUDE.md Updated: Regularly refresh your project context file
- Specify Context in Prompts: Include relevant information about your project or preferences
- Use Proper Tool Selection: Choose the right tool for each task (e.g., GrepTool for searching, not Bash with grep)
- Implement Security Boundaries: Limit tool permissions appropriately for sensitive projects
- Monitor Context Usage: Regularly check token usage with
/cost
- Start Broad, Then Narrow: Begin with open exploration, then focus on specific details
- Create Reproducible Workflows: Document your Claude Code processes for future reference
- Verify Before Modifying: Always check file contents before editing
Configuration Options
Option | Description | Values |
---|---|---|
theme |
UI theme for terminal | light , dark , auto |
model |
Claude model to use | claude-3-7-sonnet-20250219 , claude-3-5-sonnet |
thinking |
Show model thinking | true , false |
maxHistorySize |
Max conversation history | Number (in entries) |
maxTokens |
Max tokens per completion | Number |
temperature |
Generation temperature | 0-1 (lower = more deterministic) |
toolPermissions |
Default permission settings | allow , prompt , deny |
# Set global configuration
claude config set --global model claude-3-7-sonnet-20250219
claude config set --global theme dark
claude config set --global thinking true
# Set project-specific configuration
claude config set model claude-3-5-sonnet
claude config set toolPermissions.Bash prompt
claude config set toolPermissions.Edit prompt
Additional Resources
Official Documentation
VibeCoding Guides
Community Resources