Claude Code Advanced Usage Guide

Master the powerful features of Claude Code and boost your development efficiency

15 min read

Claude Code Command Reference

CommandPurpose
/bugReport bugs (send conversation to Anthropic)
/clearClear conversation history
/compact [instructions]Compress conversation with optional focus instructions
/configView/modify configuration
/costShow token usage statistics
/doctorCheck Claude Code installation health
/helpGet usage help
/initInitialize project with CLAUDE.md guide
/loginSwitch Anthropic account
/logoutLogout from Anthropic account
/memoryEdit CLAUDE.md memory file
/pr_commentsView pull request comments
/reviewRequest code review
/statusView account and system status
/terminal-setupInstall Shift+Enter line break binding (iTerm2 and VSCode only)
/vimEnter 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.md file
  • All subsequent conversations will include this file as context
  • You can manually edit claude.md to 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

/clear

When 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

  1. Context7 - Latest code documentation queries
  2. Neon Database - Database operations
  3. Browser MCP - Web page operations
  4. Stock MCP - Stock information queries

IDE Integration

VS Code Integration

  1. Install Plugin
    • Search and install "Claude Code for VS Code"
  2. Enable Integration
    /ide
    # Select VS Code
  3. Features
    • Auto-detect selected code in VS Code
    • Show diff comparison when code changes
    • Intuitive change confirmation interface

Best Practices

When Starting a Project

  1. Execute /init to analyze the project
  2. Configure necessary MCP services
  3. Set up commonly used hooks
  4. Create project-specific custom commands

During Daily Development

  1. Use /compact to keep context clean
  2. Properly use thinking intensity controls
  3. Leverage Sub Agents for complex tasks
  4. Regularly use /clear to reset conversations

Start Experiencing Claude Code

Use our platform to easily integrate Claude Code into your development workflow