## AI Tool: Claude Code ### What is Claude Code? Claude Code is Anthropic's **agentic coding tool** that lives in your terminal. Unlike chat-based AI assistants, Claude Code can: - Run terminal commands - Understand your entire codebase - Make Git commits and create PRs - Read, create, and edit files directly - Access web for up-to-date information --- ### Installation ```bash # macOS / Linux / Ubuntu (Recommended) curl -fsSL https://claude.ai/install.sh | bash # Or via npm (Node.js 18+) # Similar to other AI CLI tools like Codex, Gemini CLI npm install -g @anthropic-ai/claude-code ``` Start using: ```bash cd your-project claude ``` #### Verify Installation with claude doctor After installation, run `claude doctor` to check your setup: ```bash claude doctor ``` --- ### Project Setup with CLAUDE.md #### Initialize with /init Run `/init` inside Claude Code to create a `CLAUDE.md` file: ``` > /init ``` This generates a project context file that defines: - Code style guidelines - Project-specific rules - Important context about your codebase Claude will follow these guidelines automatically in every session. --- ### Context Management #### Check Context Usage ``` > /status # Show current session info > /usage # Show token usage and cost > /model # Show or change current model ``` #### Reduce Context with /compact When context gets too long, use `/compact` to summarize the conversation: ``` > /compact # Summarize and reduce context ``` --- ### Conversation Management #### Inside Claude Code ``` > /resume # Open session picker > /rename new-name # Rename current session ``` --- ### Advanced Features #### Plan Mode (Read-only Analysis) Use `Shift+Tab` to switch to Plan Mode for safe code exploration without making changes. Good for: - Reviewing code safely - Code exploration before changes - Multi-step implementation planning #### Extended Thinking (ultrathink) For complex problems, use `ultrathink` keyword to enable deeper reasoning: ``` > ultrathink: analyze the security of this authentication flow ``` This allocates more tokens for Claude to think through problems step-by-step. #### File References with @ Quick way to include files without waiting for Claude to read them: ``` > Explain the logic in @src/utils/auth.js > What's the structure of @src/components? > Compare @file1.js and @file2.js ``` #### Bash Mode with `!` Prefix Run bash commands directly without going through Claude by prefixing your input with `!`: ``` > ! npm test > ! git status > ! ls -la ``` Bash mode features: - Runs commands directly without Claude interpretation - Adds command output to conversation context #### Custom Slash Commands Create your own slash commands using Markdown files: **Project commands**: ```bash= # Create .claude/commands/ directory mkdir -p .claude/commands # Example: Create /optimize command echo "Analyze this code for performance issues:" > .claude/commands/optimize.md ``` **Personal commands** (available across all projects): ```bash= ```# Create ~/.claude/commands/ directory mkdir -p ~/.claude/commands # Example: Create /security-review command echo "Review this code for security vulnerabilities:" > ~/.claude/commands/security-review.md ``` Usage: Type `/<command-name>` to execute your custom command. --- ### IDE Integration Claude Code integrates with IDEs: - **VS Code**: Install extension from marketplace - **JetBrains IDEs**: Plugin available for PyCharm - **Chrome Extension** (beta): Quick access from browser Setup in Claude Code: ``` > /ide # Configure IDE integration ``` --- ### Tips 1. **Always Review**: AI-generated code still needs human review 2. **Be Specific**: Make sure Claude understands what you want to do 3. **Use Caution with Auto-Accept**: Be careful when using "accept edits on" mode --- ### Resources - Official Docs: https://code.claude.com/docs