CLI Tips
34 practical Claude Code CLI tips to boost your development efficiency
Need an API key? Sign up →Endpoints & base URLs →
On This Page
- Basic Operations
- Slash Commands
- 6. /help - View All Commands
- 7. /clear - Clear Conversation
- 8. /compact - Compress History
- 9. /context - Check Context Usage
- 10. /model - Switch Models
- 11. /memory - Edit Project Memory
- 12. /init - Initialize Project Config
- 13. Just say "Commit these changes"
- 14. /review - Code Review
- 15. /resume - Resume Session
- Context Management
- Plan Mode
- Subagents
- CLAUDE.md Configuration
- Git Workflow
- Testing & Debugging
- Advanced Tips
- Efficiency Comparison
- Best Practices Summary
- Next Steps
This guide compiles 34 practical Claude Code tips, from basic operations to advanced features, helping you maximize Claude Code's potential.
Basic Operations¶
1. Tab Autocomplete for File Paths¶
Press Tab after typing @ to autocomplete file paths—no need to remember full paths.
2. Use @ to Reference Files Precisely¶
> Analyze security in @src/utils/auth.ts
> Compare @v1/api.js with @v2/api.js
Direct file references are more accurate than describing file locations.
3. Pipe Input for Analysis¶
git diff | claude "explain these changes"
cat error.log | claude "analyze error causes"
npm test 2>&1 | claude "analyze test failures"
4. Keyboard Shortcuts¶
| Shortcut | Function |
|---|---|
Tab |
Autocomplete file paths |
Esc |
Interrupt current output |
Ctrl+C |
Cancel current operation |
↑ / ↓ |
Browse command history |
Shift+Tab (three times from auto, twice from default) |
Enter plan mode |
Alt+Tab / Option+Tab |
Toggle thinking mode |
5. Use ! for Quick Commands¶
Prefix with ! to execute shell commands directly:
> !git status
> !npm run build
Slash Commands¶
6. /help - View All Commands¶
> /help
Shows all available slash commands and shortcuts.
7. /clear - Clear Conversation¶
> /clear
Clear context before starting new tasks to avoid interference from previous conversations.
8. /compact - Compress History¶
> /compact
Use when context gets too long—compresses history to save tokens while keeping core information.
9. /context - Check Context Usage¶
> /context
Shows current context usage percentage. Consider compacting or starting a new session at 60%.
10. /model - Switch Models¶
> /model opus
> /model sonnet
-
Opus 5.5: Complex tasks, architecture design, difficult problems (the current main flagship)
-
Sonnet 5.5: Daily coding, quick iterations (cost-effective)
-
Haiku 5.5: Lightweight, fast, simple tasks
Aliases (opus / sonnet / haiku) are resolved by Claude Code to the latest version; to pin a model, write the full ID, for example /model claude-opus-5-5, /model claude-sonnet-5-5 or /model claude-haiku-5-5. Use /effort to adjust thinking intensity (see the Adaptive Thinking guide).
11. /memory - Edit Project Memory¶
> /memory
Opens CLAUDE.md file for editing project standards and preferences.
12. /init - Initialize Project Config¶
> /init
Let Claude analyze your project and generate a CLAUDE.md configuration file.
13. Just say "Commit these changes"¶
> Commit these changes
Automatically analyzes changes, generates proper commit messages, and commits.
Note: /commit is not a built-in Claude Code command (it is not in the official built-in command list). It only works if you or a plugin provide a custom command or skill. Otherwise, just ask Claude to commit in natural language.
14. /review - Code Review¶
> /review
Reviews current changes for potential issues.
15. /resume - Resume Session¶
> /resume
Resume a previous conversation session to continue unfinished work.
Context Management¶
As of 2026-10-15, the Claude Code documentation states that Opus 4.7 and later, Sonnet 5 and later, and Haiku 5.5 run with a 1M token context window by default, while Opus 4.6 and Sonnet 4.6 need the [1m] variant and otherwise get 200K. Keep one session focused on one task, use /context to monitor usage, /compact to compress history, and /clear to start fresh.
For detailed context management strategies (including long-session overflow handling) → Context Management
Plan Mode¶
19. Enter Plan Mode¶
Press Shift+Tab to switch to plan mode (three times from the default auto mode, twice from default). Claude will research and create plans without modifying code.
20. Plan Before Execute¶
For complex tasks, have Claude create a plan first:
> Analyze this feature requirement and create an implementation plan, don't write code yet
Confirm the plan before execution to reduce rework.
21. Execute Complex Tasks Step by Step¶
Break large tasks into smaller steps:
> Step 1: Analyze the existing auth system
> Step 2: Design the new JWT approach
> Step 3: Implement core functionality
> Step 4: Add tests
Subagents¶
22. Use Explore Agent for Fast Search¶
The Explore agent specializes in fast codebase searches:
> Use the Explore agent to find all payment handling code
23. Use Plan Agent for Design¶
The Plan agent specializes in implementation planning:
> Use the Plan agent to design the user permission system
24. Background Agents for Parallel Tasks¶
Launch multiple background agents to process tasks in parallel for better efficiency.
CLAUDE.md Configuration¶
CLAUDE.md is a project-level config file that Claude reads automatically on startup. Use /init to generate one, or create it manually. Define code standards, common commands, and project architecture to avoid repeating yourself every session.
Full configuration guide with examples → CLAUDE.md Configuration
Git Workflow¶
28. Smart Commit Messages¶
> Commit these changes
Claude analyzes all changes and generates proper commit messages.
29. Create PR Descriptions¶
> Create a PR description for the current branch
Automatically generates PR descriptions with change summary and test plan.
30. Analyze PR Changes¶
gh pr diff 123 | claude "review this PR"
Testing & Debugging¶
31. Have Claude Write Tests¶
> Write unit tests for @src/services/UserService.ts
Let Claude write tests to verify its own code correctness.
32. Analyze Test Failures¶
npm test 2>&1 | claude "analyze failures and fix"
33. Debug Errors¶
> Analyze this error: [paste error message]
> Debug the issue in @src/pages/Login.tsx
Advanced Tips¶
34. Use Screenshots/Images¶
Claude Code supports image understanding:
> Look at this screenshot @screenshot.png and analyze UI issues
Efficiency Comparison¶
| Scenario | Traditional | Claude Code |
|---|---|---|
| Find code | grep + manual browsing | @file or Explore agent |
| Write tests | Manual + debugging | /review + auto-generate |
| Git commit | Think message + write | say "Commit these changes" |
| Code review | Line-by-line review | /review smart analysis |
| Understand code | Read docs + read code | Just ask Claude |
Best Practices Summary¶
-
Be specific: Clearly describe requirements with constraints
-
Use references: Use
@to specify files, avoid guessing -
Step by step: Break complex tasks into smaller steps
-
Interrupt early: Press
Escimmediately if output is wrong -
Stay focused: One session for one task
-
Compact regularly: Use
/compactwhen context gets long -
Plan first: Create plans before complex tasks
-
Let AI test: Have Claude write tests to verify its code
Next Steps¶
-
Learn Workflow Tips for efficient development processes
-
Explore Context Management for long-session and token overflow handling
-
Set up CLAUDE.md Configuration to customize Claude's behavior for your project
-
Check out Codex Integration to use another AI tool
Get started with QCode
One API key for Claude Code, Codex and more — billed per token, per-model prices on qcode.cc/models