Skip to content

Commands & Shortcuts

Quick reference for Claude Code commands and keyboard shortcuts.

Built-in Slash Commands

CommandDescription
/helpShow help information
/clearClear conversation history
/compactCompact conversation to save context
/configOpen configuration
/costShow token usage and cost
/doctorCheck Claude Code installation health
/initInitialize CLAUDE.md in current project
/loginSwitch accounts or re-authenticate
/logoutSign out of current account
/memoryEdit CLAUDE.md memory file
/modelSwitch AI model
/permissionsManage tool permissions
/reviewReview conversation/code
/statusShow current status
/terminal-setupConfigure terminal integration
/vimToggle vim mode

Keyboard Shortcuts

ShortcutAction
Ctrl+CCancel current operation
Ctrl+DExit Claude Code
Ctrl+LClear screen
Up/DownNavigate command history
TabAutocomplete
EscapeCancel current input

Useful Command Patterns

Git Workflows

Terminal window
# Quick commit with AI-generated message
"commit these changes"
# Create a PR with description
"create a pr for this branch"
# Review changes before committing
"show me what changed and suggest a commit message"

Code Navigation

Terminal window
# Find where something is defined
"where is the User class defined?"
# Understand code flow
"how does the authentication flow work?"
# Find usages
"where is this function called from?"

Refactoring

Terminal window
# Rename with updates
"rename this function to X and update all usages"
# Extract code
"extract this logic into a separate function"
# Improve code
"refactor this for readability"

Testing

Terminal window
# Generate tests
"write tests for this function"
# Run specific tests
"run tests for the auth module"
# Fix failing tests
"why is this test failing?"

Debugging

Terminal window
# Investigate errors
"why am I getting this error: [paste error]"
# Trace issues
"find where this value becomes null"
# Explain behavior
"why does this return undefined?"

Team-Specific Commands

Add your team’s common command patterns here:

Deployment

Terminal window
# Deploy to staging
/deploy-staging
# Check deployment status
"what's the status of the staging deployment?"

Database

Terminal window
# Run migrations
/db-migrate
# Generate migration
"create a migration to add email_verified column to users"

Tips

  1. Be specific - “fix the bug” is less effective than “fix the null pointer in UserService.getUser”

  2. Provide context - Reference file names and line numbers when possible

  3. Use plan mode - For complex tasks, let Claude plan before executing

  4. Check permissions - Use /permissions to see what tools are allowed

  5. Save context - Use /compact when running low on context window