autorenew

Claude Code Tips & Tricks

This article covers common commands, shortcuts, and advanced techniques for Claude Code to help you use this AI programming assistant more efficiently.

1. Common Commands

1.1 Basic Commands

# Help command
claude --help

# Check version
claude --version
# List MCP
claude mcp list

# MCP help
claude mcp --help
# Config help
claude config --help

# List configurations
claude config list

1.4 Session Commands

CommandDescriptionUse Case
/clearClear contextWhen you need to start fresh, or feel the AI can no longer solve the problem
/compactCompress conversationRestart conversation without losing previous memory
/costShow costsMax users don’t need this, API users can check their usage
/login /logoutLogin/LogoutSwitch accounts etc.
/modelSwitch model$200 tier can switch to Opus model, $100 tier has no choice
/statusStatusCheck current CC status
/doctorDiagnoseCheck CC installation status

2. Auto-Edit Mode

Use Case: When you don’t want to confirm every file creation

How to Use: Press Shift + Tab once to enter this mode


3. Specify Files

Use Case: When you need to operate on a specific file

How to Use: Use the @ symbol to specify files directly


4. Deep Thinking

Use Case: When facing difficult problems, planning solutions, refactoring code, or solving complex bugs

How to Use: Use keywords like ultrathink or think deeply in your prompts


5. Plan Mode

Use Case: When planning projects in early stages or solving complex issues

How to Use: Press Shift + Tab twice to see this option

It will ask if you want to continue:


6. Paste Images

Use Case: When adjusting page structure or troubleshooting errors

How to Use:


7. YOLO Mode

Use Case: Refactoring code, new projects, or fixing bugs

How to Use:

claude --dangerously-skip-permissions

💡 After entering this mode, you can still adjust it using the Shift + Tab shortcut


8. Memory Files

8.1 Global Memory File

Location: ~/.claude/CLAUDE.md

8.2 Project Memory File

Location: CLAUDE.md file in your project directory

💡 For existing projects with code, it’s recommended to use the /init command to auto-generate


9. Use Previous Message Prompts

Use Case: When you want to restore a previous conversation

How to Use: Press Esc twice


10. How to Restore Code

Use Case: When you regret the code changes and want to revert

How to Use:


11. Resume Conversation / View Chat History

How to Use:

# Use /resume command
/resume

# Or use these flags
claude -c  # Continue last conversation
claude -r  # Resume conversation

12. Execute Terminal Commands

Use Case: Check current directory or execute special commands

How to Use: Use ! (exclamation mark) to enter command mode

# Check current directory
! pwd

# List files
! ll

13. Monitor Usage

# Check usage
npx ccusage@latest

# Real-time usage monitoring
npx ccusage@latest blocks --live

14. Background Service

Use Case: When completing features, Claude Code usually starts a service for accessing interfaces or UI. Without background service capability, Claude Code stays stuck on the service startup screen, preventing other conversation needs.

How to Use: Ctrl + B


15. Other Shortcuts

ShortcutFunction
Ctrl + JNew line
Ctrl + BBackground service
Shift + TabSwitch modes (once for auto-edit, twice for Plan mode)
Esc × 2Use previous message prompts

Summary

Mastering these Claude Code techniques can significantly boost your AI programming efficiency:

Hope this article helps you use Claude Code more effectively!