Introduction
Every power user knows that efficiency comes from mastering the tools you use daily. Claude Code is no different. While natural language interaction is its foundation, knowing the right commands and shortcuts transforms you from a casual user into someone who can navigate Claude Code at the speed of thought.
This reference guide covers everything you need to work faster with Claude Code. From slash commands that control session behavior to keyboard shortcuts that save precious seconds, to communication patterns that get better results from Claude. Keep this page bookmarked; you'll refer to it often as you build your muscle memory.
Whether you're managing context limits during long sessions, navigating command history, or crafting prompts that get exactly what you want, this guide has you covered. Let's dive into the commands and shortcuts that will level up your Claude Code workflow.
Slash Commands
Slash commands are built-in instructions that control Claude Code's behavior. They start with a forward slash and are processed immediately rather than being interpreted as natural language prompts.
/help - Show Available Commands
The most important command to remember. When you're unsure what's available, /help displays all available commands with brief descriptions:
> /help
Available commands:
/clear - Clear conversation history
/compact - Compress context to save tokens
/config - View and modify settings
/cost - Show token usage and costs
/exit - Exit Claude Code
...
Run this periodically to discover new commands as Claude Code is updated with new features.
/clear - Clear Conversation
Wipes your conversation history and starts fresh. Your file system context remains (Claude Code still knows what directory it's in), but all previous messages are forgotten:
> /clear
Conversation cleared. Starting fresh.
Use /clear when switching to a completely different task, when the conversation has accumulated irrelevant context, or when you want Claude Code to approach a problem without bias from previous attempts.
/compact - Compress Context
When you're deep into a long session and approaching context limits, /compact summarizes the conversation while preserving essential information:
> /compact
Compacting conversation...
Preserved: Key decisions, file changes, current task context
Removed: Redundant explanations, superseded code versions
Unlike /clear, compact preserves important context. Use it when you want to continue working but need to free up token space. It's particularly useful during refactoring sessions that involve many iterations.
/config - Configuration Options
View and modify Claude Code settings, including your API key and other preferences:
> /config
Current configuration:
API Key: sk-ant-...****
Model: claude-sonnet-4-20250514
...
Use this to update your API key if you've rotated it, or to check which model you're currently using.
/cost - Show Token Usage
Displays detailed token usage and estimated costs for your current session:
> /cost
Session token usage:
Input tokens: 12,450
Output tokens: 8,230
Estimated cost: $0.42
Monitor your usage throughout long sessions to avoid surprise bills. Running /cost periodically helps you understand which operations consume the most tokens.
/exit - Exit Claude Code
Gracefully exits your Claude Code session and returns you to your regular terminal prompt. Alternatively, you can use Ctrl+C or Ctrl+D.
Keyboard Shortcuts
Keyboard shortcuts let you control Claude Code without typing commands. They're especially useful for quick actions during active development.
Ctrl+C - Cancel Current Operation
The universal interrupt signal. In Claude Code, it has context-dependent behavior:
- During generation: Stops Claude Code mid-response
- At the prompt: Clears your current input line
- Pressed twice: Exits Claude Code entirely
Use this when Claude Code is generating a lengthy response you don't need, or when you realize you want to rephrase your request.
Ctrl+L - Clear Screen
Clears your terminal display without affecting conversation history. The conversation continues exactly where it was; only the visual display is refreshed:
# Before: Screen full of previous output
# Press Ctrl+L
# After: Clean screen, cursor at top, conversation intact
Helpful when your terminal is cluttered with long responses and you want visual clarity without losing context.
Up/Down Arrows - History Navigation
Navigate through your previous prompts just like in a regular terminal shell:
- Up Arrow: Recall previous prompt
- Down Arrow: Move forward through history
This is invaluable when you want to retry a prompt with slight modifications or when you've been iterating on similar requests.
Ctrl+D - End Input / Exit
Sends an end-of-file signal. At an empty prompt, this exits Claude Code. It's the same as typing /exit.
Useful Patterns
Beyond commands and shortcuts, how you phrase your requests dramatically affects results. These patterns help Claude Code understand exactly what you want.
"Read file X first, then..." - Explicit File Reads
When you need Claude Code to have specific context before making changes:
> Read src/utils/validation.js first, then add email validation
that follows the same patterns used there.
This ensures Claude Code loads the file into context before attempting changes, leading to more consistent code that matches your existing patterns.
"Don't change file Y" - Scope Limiting
Prevent unintended modifications by explicitly stating what's off-limits:
> Refactor the authentication logic but don't change the API
routes or the database schema files.
This is especially important for large changes where Claude Code might otherwise "improve" related files you want left alone.
"Show me the diff before applying" - Review Mode
When you want to see proposed changes without automatic application:
> Show me what changes you would make to implement caching,
but don't apply them yet. I want to review first.
Claude Code will present the changes in a diff format, letting you review and decide whether to proceed.
"Only modify these specific files" - Allowlist Approach
The inverse of scope limiting - explicitly list what CAN be changed:
> Add error handling to the API client. Only modify
src/api/client.js and src/api/errors.js.
Git Integration
Claude Code works seamlessly with Git, and understanding these workflows will save you significant time.
Commit Workflows
Claude Code can create commits with well-written messages based on the changes it made:
> Create a commit for these changes with a descriptive message
Claude Code:
Creating commit with message:
"Add input validation for user registration form
- Add email format validation with regex
- Add password strength requirements
- Add error message display component"
Claude Code analyzes the staged changes and writes a conventional commit message that describes what changed and why.
PR Creation
Create pull requests directly from Claude Code with proper descriptions:
> Create a pull request for this branch with a summary
of all the changes we made
Claude Code will use gh pr create (GitHub CLI) to open a PR with a comprehensive description based on your session's work.
Status Checks
Ask Claude Code to check your repository status and explain what needs attention:
> What's the current git status? Any uncommitted changes
or files I should be aware of?
git stash if you have work-in-progress you want to preserve.
Working with Tools
Claude Code has access to a suite of tools for reading, writing, and navigating your codebase. Understanding these helps you give better instructions.
Read, Edit, Write Tools
Claude Code uses specialized tools for file operations:
- Read: Loads file contents into context
- Edit: Makes surgical changes to specific sections
- Write: Creates new files or overwrites existing ones
You can explicitly request which operation you want:
> Just read the config file, don't change anything
> Edit just the validateEmail function, leave everything else
> Write a new test file for the validation module
Bash Commands
Claude Code can run shell commands when needed:
> Run the test suite and tell me if anything fails
> Install the lodash package
> Check if the dev server is running on port 3000
Claude Code will ask for permission before running commands that could modify your system.
Grep and Glob for Search
Finding code across your project is where these tools shine:
> Find all files that import the auth service
> Search for TODO comments across the codebase
> Find all React components that use the useEffect hook
Claude Code uses optimized search tools rather than slow shell commands, making large codebase searches fast and efficient.
Pro Tips
Advanced techniques that separate casual users from power users.
Combine Commands in Single Prompts
You can request multiple operations in a single prompt:
> Read the auth module, add rate limiting, write tests for it,
and create a commit when done
Claude Code processes these sequentially, maintaining context throughout.
Create Shell Aliases
Set up aliases in your shell configuration for common Claude Code workflows:
# Quick Claude Code access
alias cc='claude'
# Start Claude Code with a specific prompt
alias ccr='claude -p "Review this code for potential issues"'
alias cct='claude -p "Write tests for the recent changes"'
# Project-specific shortcuts
alias cc-api='cd ~/projects/api && claude'
alias cc-web='cd ~/projects/webapp && claude'
Session Management
For long-running work, manage your sessions strategically:
- Start sessions from project root: Claude Code gets the full project context
- Use /compact periodically: Prevent context overflow before it happens
- Clear between unrelated tasks: Don't let old context confuse new work
- Check /cost regularly: Stay aware of token usage
Use tmux or screen for Persistence
Run Claude Code in a terminal multiplexer so you can disconnect and reconnect without losing your session:
# Create a named tmux session for Claude Code
tmux new -s claude-work
# Detach: Ctrl+B then D
# Reattach later:
tmux attach -t claude-work
Conclusion: Commands Are Just the Beginning
Mastering these commands and shortcuts makes you dramatically more efficient with Claude Code. The slash commands give you control over your session. The keyboard shortcuts keep your hands on the keyboard. The prompt patterns get you better results with fewer iterations. And the Git integration streamlines your entire development workflow.
But here's the thing: no matter how well you know these commands, Claude Code still operates on a session-by-session basis. It doesn't inherently remember your architecture decisions from yesterday. It doesn't enforce your naming conventions without being reminded. Each new session starts fresh, and maintaining consistency across sessions requires constant vigilance.
This is where the power user's challenge becomes clear. You can be incredibly efficient within a single session, but what about across days, weeks, and months of development? How do you ensure that Claude Code follows the same patterns whether you're working on authentication today or payment processing tomorrow?
Claude Architect solves this problem. It provides the persistent structure that makes Claude Code follow your rules session after session. Your architecture decisions, documented once, are enforced automatically. Your naming conventions, defined clearly, are applied consistently. Instead of remembering to tell Claude Code your preferences, you define them once and they're always active.
Ready for Consistent AI Development?
Master the commands in this guide, then take it further with Claude Architect. Persistent rules, enforced architecture, and consistency that lasts beyond a single session.
Join the Waitlist