The terminal interface is Claude Code’s primary interaction method, and mastering it transforms your development speed. These 10 tips cover essential commands, keyboard shortcuts, and productivity techniques that power users rely on daily.
Understanding Claude Code’s command structure enables fluid interaction:
# Start interactive session
claude " implement user authentication with JWT "
# Quick query with immediate exit
claude -p " explain this regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ "
# Continue most recent conversation
# Resume specific previous conversation
# Skip permissions for faster workflow
claude --dangerously-skip-permissions
# Add multiple directories
claude --add-dir ../backend --add-dir ../frontend
claude --model sonnet # or claude --model claude-sonnet-4-20250514
# Debug mode for troubleshooting
# JSON output for automation
claude -p " analyze security vulnerabilities " --output-format stream-json
# Pipe output to other tools
claude -p " generate test cases " | jq ' .content '
result = $( claude -p " format this JSON " < data.json )
Quick Reference
-p, --print
: Run single prompt and exit (non-interactive)
-c, --continue
: Continue last conversation
-r, --resume
: Resume from history
-m, --model
: Specify model to use
-v, --verbose
: Show debug information
--add-dir
: Include additional directories
Slash commands provide quick access to Claude Code’s features:
Essential Slash Commands:
/help - Show all available commands and usage
/init - Initialize project with CLAUDE.md
/review - Request comprehensive code review
/clear - Clear conversation history
/config - View or modify configuration
/status - View account and system status
/memory - Edit CLAUDE.md memory files
/permissions - Manage tool permissions
/cost - Check token usage and costs
/compact - Compress conversation history
/add-dir - Add directory to workspace
/hooks - Configure automation hooks
/terminal-setup - Configure terminal settings
/ide - Connect to IDE for diagnostics
/install-github-app - Enable GitHub integration
Custom command examples:
# Create custom test command
echo ' Generate comprehensive tests for: $ARGUMENTS ' > .claude/commands/test.md
# Create deployment command
echo ' Deploy to staging following our process: $ARGUMENTS ' > .claude/commands/deploy-staging.md
/deploy-staging --version 2.1.0
One of the most impactful habits for Claude Code efficiency:
# Clear at the start of each new task
# 1. Saves tokens (no history to process)
# 2. Prevents context confusion
# 3. Avoids compaction overhead
# 4. Faster response times
# 5. Cleaner mental model
When to Clear
Starting a new feature
Switching between different parts of codebase
After completing a task
When context becomes confused
Before complex architectural discussions
Best practices for context management:
# Work on authentication feature
# Complete authentication
# Work on payment integration
# Complete payment integration
# Work on payment without clearing
# Work on UI without clearing
# Context becomes muddled
Claude Code maintains comprehensive history across sessions:
# Navigate with arrow keys
# Shows numbered list of previous conversations
# Jump to specific conversation
# Resumes conversation #5
claude --history | grep " authentication "
# Find all conversations about authentication
↑ ↑ ↑ # Go back through prompts
Escape Escape # Show message list
claude -r # List all sessions
claude -r 12 # Resume session 12
claude -c # Continue last session
claude --export > conversation.md
# Archive old conversations
claude --archive --before " 2024-01-01 "
Efficient file referencing is crucial for providing context:
Using @ mentions
Refactor @UserService.js to use dependency injection
Update @components/Button.tsx to support dark mode
Drag and drop with Shift
Normal drag: Opens file in new tab
Shift + drag: References file in Claude Code
Glob patterns
Review all test files: @**/*.test.js
Update all React components: @components/**/*.tsx
Multiple file references
Ensure consistency between @User.model.js, @user.service.js, and @user.controller.js
Claude Code excels at understanding intent without specific syntax:
Instead of memorizing commands, just describe what you want:
"Fix the bug in user authentication"
"Add comprehensive tests for the payment module"
"Refactor this function to be more readable"
"Help me understand how the caching layer works"
"Create a new feature for exporting data to CSV"
"Review my code for security vulnerabilities"
"Optimize this query that's running slowly"
"Update the documentation for the API endpoints"
Natural Language Patterns
Claude Code understands:
Technical descriptions
Colloquial requests
Partial information
Context from previous messages
Implied requirements
Domain-specific terminology
Examples of natural language understanding:
# Vague request → Claude asks clarifying questions
> I see you want to improve performance. Could you specify:
> 2. What ' s the current performance?
"Do the same thing for the product service"
> I ' ll apply the same dependency injection pattern I used
> for UserService to the ProductService
"Make this production ready"
Claude Code provides sophisticated git integration:
"What files have I changed?"
"What's on the staging area?"
"Commit my changes with a descriptive message"
"Create a commit following conventional commits"
"Create a new branch called feature/user-auth"
"Switch to the main branch"
"Help me resolve these merge conflicts"
"Cherry-pick the auth fixes from develop"
"Rebase my feature branch on main"
"Squash the last 3 commits"
"Show me who last modified this function"
"Find when this bug was introduced"
"Generate a changelog from git history"
"Create a PR with a detailed description"
"Update the PR based on review comments"
Essential keyboard shortcuts for productivity:
- Escape - Stop current operation (not exit)
- Escape Escape - Show message navigation
- Tab - Command/file completion
- Shift+Enter - New line in prompt (after setup)
- Ctrl+C - Exit Claude Code
- Ctrl+R - Search command history
- Ctrl+V - Paste image (not Cmd+V on Mac)
- Shift+Drag - Reference file (not open)
- ↑/↓ - Navigate command history
- Page Up/Down - Scroll through output
- Home/End - Jump to start/end
- # - Quick CLAUDE.md update
- / - Start slash command
- @ - Start file reference
Platform Differences
macOS : Use Ctrl for special functions, not Cmd
Windows/Linux : Standard Ctrl shortcuts work
Terminal app : May need to configure key bindings
Perfect for automation and quick operations:
claude " format this SQL query " < query.sql > formatted.sql
claude " review this PR for security issues " < pr.diff
# Documentation generation
claude " generate JSDoc comments " < utils.js > documented.js
claude " add error handling " < " $file " > " safe_ $file "
git diff | claude -p " explain these changes " | tee explanation.md
claude " write tests for this function " < service.js > service.test.js
Integration examples:
files = $( git diff --cached --name-only --diff-filter=ACM | grep ' \.js$ ' )
claude " check for console.log statements " < " $file "
# .github/workflows/review.yml
claude " review for performance issues " < src/
Extend Claude Code with project-specific commands:
Create command directory
mkdir -p .claude/commands
Create command file
Create a new feature with our standard structure:
2. Set up folder structure:
- /features/ $ARGUMENTS /components/
- /features/ $ARGUMENTS /hooks/
- /features/ $ARGUMENTS /tests/
3. Create index files with exports
5. Create basic test setup
Use the command
Create nested commands
mkdir -p .claude/commands/db
Advanced command examples:
Perform comprehensive code review:
- Security vulnerabilities
# .claude/commands/refactor.md
Refactor following our patterns:
# .claude/commands/test/integration.md
Create integration tests for: $ARGUMENTS
Command Best Practices
Keep commands focused and specific
Use $ARGUMENTS for flexibility
Include context and requirements
Version control command files
Share useful commands with team
Combining these command-line techniques creates a powerful workflow:
claude --dangerously-skip-permissions
"Create user authentication with JWT"
"Add comprehensive tests"
3 # Jump to message about database schema
/cost # Monitor token usage
claude -c # Pick up where you left off
With command-line mastery achieved, you’re ready to tackle large, complex codebases. Continue to Large Codebase Management to learn strategies for enterprise-scale development.