Claude Code Command Reference
| Command | Purpose |
|---|---|
| /bug | Report bugs (send conversation to Anthropic) |
| /clear | Clear conversation history |
| /compact [instructions] | Compress conversation with optional focus instructions |
| /config | View/modify configuration |
| /cost | Show token usage statistics |
| /doctor | Check Claude Code installation health |
| /help | Get usage help |
| /init | Initialize project with CLAUDE.md guide |
| /login | Switch Anthropic account |
| /logout | Logout from Anthropic account |
| /memory | Edit CLAUDE.md memory file |
| /pr_comments | View pull request comments |
| /review | Request code review |
| /status | View account and system status |
| /terminal-setup | Install Shift+Enter line break binding (iTerm2 and VSCode only) |
| /vim | Enter vim mode to switch between insert and command modes |
Project Initialization
Use the cd command to navigate to your project directory, then start Claude Code.
Core Commands
1. /init - Project Analysis Initialization
Function: Let Claude Code read all files in the folder and generate a project knowledge base
/init- Automatically analyze current folder structure
- Save project knowledge to
claude.mdfile - All subsequent conversations will include this file as context
- You can manually edit
claude.mdto add important information
Best Practices:
- Must execute before starting work on a new project
- Add CSS frameworks, special configurations, etc. to
claude.md
2. /compact - Context Compression
Function: Compress conversation context, improve AI focus, and reduce token consumption
/compact [instruction description]- Exclude irrelevant conversation content
- Preserve important contextual information
- Add compression instructions after the command
3. /clear - Clear Conversation History
Function: Clear AI conversation history and maintain clean context
/clearWhen to use:
- Before starting new tasks
- When context becomes too cluttered
- When you need to refocus
Permission Management
/permissions Command
Function: Customize tool usage rules and control Claude Code's permissions
Add Allow Rules
/permissions
# Select Allow rule
# Example: Bash(git commit:*) - Allow auto git commit
Maximum Permission Mode
# Add parameter on startup
claude --dangerously-skip-permissions
ccr code --dangerously-skip-permissions
- Give Claude Code maximum permissions
- No manual confirmation needed for tool usage
- Use with caution, suitable for trusted environments
MCP Service Integration
MCP (Model Context Protocol) is the middleware layer between AI and external tools.
Installing MCP Services
# Project-level installation
claude mcp add [name] -- npx [parameters]
# Example: Install Context7
claude mcp add context7 -- npx @context7/mcp-server
Useful MCP Recommendations
- Context7 - Latest code documentation queries
- Neon Database - Database operations
- Browser MCP - Web page operations
- Stock MCP - Stock information queries
IDE Integration
VS Code Integration
- Install Plugin
- Search and install "Claude Code for VS Code"
- Enable Integration/ide# Select VS Code
- Features
- Auto-detect selected code in VS Code
- Show diff comparison when code changes
- Intuitive change confirmation interface
Best Practices
When Starting a Project
- Execute
/initto analyze the project - Configure necessary MCP services
- Set up commonly used hooks
- Create project-specific custom commands
During Daily Development
- Use
/compactto keep context clean - Properly use thinking intensity controls
- Leverage Sub Agents for complex tasks
- Regularly use
/clearto reset conversations
Start Experiencing Claude Code
Use our platform to easily integrate Claude Code into your development workflow
