Information
Anthropic home page ⌘K Go to claude.ai Search... Navigation Claude Code npm install -g @anthropic-ai/claude-code npm install -g Before you begin Check system requirements Install and authenticate Core features and workflows Security and privacy by design From questions to solutions in seconds # Ask questions about your codebase # Ask questions about your codebase claude > how does our authentication system work? > # Create a commit with one command # Create a commit with one command claude commit # Fix issues across multiple files # Fix issues across multiple files claude "fix the type errors in the auth module" "fix the type errors in the auth module" Initialize your project Use Claude Code for common tasks Understand unfamiliar code > what does the payment processing system do? > find where user permissions are checked > explain how the caching layer works Automate Git operations > commit my changes > create a pr > which commit added tests for markdown back in December? > rebase on main and resolve any merge conflicts Edit code intelligently > add input validation to the signup form > refactor the logger to use the new API > fix the race condition in the worker queue Test and debug your code > run tests for the auth module and fix failures > find and fix security vulnerabilities > explain why this test is failing Encourage deeper thinking > think about how we should architect the new payment service > think hard about the edge cases in our authentication flow Control Claude Code with commands CLI commands Slash commands Manage permissions and security Tools available to Claude Protect against prompt injection Configure network access Configure Claude Code Configuration options Global configuration Auto-updater permission options Recommended: Create a new user-writable npm prefix # First, save a list of your existing global packages for later migration # First, save a list of your existing global packages for later migration npm list -g --depth=0 > ~/npm-global-packages.txt npm -g --depth = 0 > # Create a directory for your global packages # Create a directory for your global packages mkdir -p ~/.npm-global mkdir -p # Configure npm to use the new directory path # Configure npm to use the new directory path npm config set prefix ~/.npm-global npm set # Note: Replace ~/.bashrc with ~/.zshrc, ~/.profile, or other appropriate file for your shell # Note: Replace ~/.bashrc with ~/.zshrc, ~/.profile, or other appropriate file for your shell echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc echo 'export PATH=~/.npm-global/bin:$PATH' >> # Apply the new PATH setting # Apply the new PATH setting source ~/.bashrc source # Now reinstall Claude Code in the new location # Now reinstall Claude Code in the new location npm install -g @anthropic-ai/claude-code npm install -g # Optional: Reinstall your previous global packages in the new location # Optional: Reinstall your previous global packages in the new location # Look at ~/npm-global-packages.txt and install packages you want to keep # Look at ~/npm-global-packages.txt and install packages you want to keep # npm install -g package1 package2 package3... # npm install -g package1 package2 package3... Disabling the auto-updater claude config set -g autoUpdaterStatus disabled set -g Project configuration # Let npm test to run without approval # Let npm test to run without approval claude config add allowedTools "Bash(npm test)" add "Bash(npm test)" # Let npm test and any of its sub-commands to run without approval # Let npm test and any of its sub-commands to run without approval claude config add allowedTools "Bash(npm test:*)" add "Bash(npm test:*)" # Instruct Claude to ignore node_modules # Instruct Claude to ignore node_modules claude config add ignorePatterns node_modules add claude config add ignorePatterns "node_modules/**" add "node_modules/**" Optimize your terminal setup Themes and appearance Line breaks Notification setup claude config set --global preferredNotifChannel terminal_bell set --global Handling large inputs Manage costs effectively Track your costs Reduce token usage Use with third-party APIs Connect to Amazon Bedrock CLAUDE_CODE_USE_BEDROCK=1 CLAUDE_CODE_USE_BEDROCK = 1 ANTHROPIC_MODEL='us.anthropic.claude-3-7-sonnet-20250219-v1:0' ANTHROPIC_MODEL = 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' DISABLE_PROMPT_CACHING=1 DISABLE_PROMPT_CACHING = 1 Connect to Google Vertex AI CLAUDE_CODE_USE_VERTEX=1 CLAUDE_CODE_USE_VERTEX = 1 CLOUD_ML_REGION=us-east5 CLOUD_ML_REGION = ANTHROPIC_VERTEX_PROJECT_ID=your-project-id ANTHROPIC_VERTEX_PROJECT_ID = Development container reference implementation Key features Getting started in 4 steps Configuration breakdown Security features Customization options Next steps License and data usage How we use your data Feedback transcripts Privacy safeguards License Embeddings Claude Code tutorials x linkedin On this page Learn about Claude Code, an agentic coding tool made by Anthropic. Currently in beta as a research preview. Do NOT use sudo npm install -g as this can lead to permission issues and security risks. If you encounter permission errors, see the configuration section for recommended solutions. Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster through natural language commands. By integrating directly with your development environment, Claude Code streamlines your workflow without requiring additional servers or complex setup. Claude Code’s key capabilities include: Research preview Code is in beta as a research preview. We’re gathering developer feedback on AI collaboration preferences, which workflows benefit most from AI assistance, and how to improve the agent experience. This early version will evolve based on user feedback. We plan to enhance tool execution reliability, support for long-running commands, terminal rendering, and Claude’s self-knowledge of its capabilities in the coming weeks. Report bugs directly with the /bug command or through our GitHub repository. Troubleshooting WSL installation Currently, Claude Code does not run directly in Windows, and instead requires WSL. If you encounter issues in WSL: OS/platform detection issues: If you receive an error during installation, WSL may be using Windows npm. Try: Node not found errors: If you see exec: node: not found when running claude, your WSL environment may be using a Windows installation of Node.js. You can confirm this with which npm and which node, which should point to Linux paths starting with /usr/ rather than /mnt/c/. To fix this, try installing Node via your Linux distribution’s package manager or via nvm. Install Claude Code Run in your terminal: npm install -g @anthropic-ai/claude-code Do NOT use sudo npm install -g as this can lead to permission issues and security risks. If you encounter permission errors, see the configuration section for recommended solutions. Navigate to your project Start Claude Code Complete authentication Follow the one-time OAuth process with your Console account. You’ll needactive billing at console.anthropic.com. Claude Code operates directly in your terminal, understanding your project context and taking real actions. No need to manually add files to context - Claude will explore your codebase as needed. Claude Code uses claude-3-7-sonnet-20250219 by default. Your code’s security is paramount. Claude Code’s architecture ensures: For first-time users, we recommend: Claude Code operates directly in your terminal, understanding your project context and taking real actions. No need to manually add files to context - Claude will explore your codebase as needed. For complex problems, explicitly ask Claude to think more deeply: CLI flags: Control Claude’s behavior within a session: Claude Code uses a tiered permission system to balance power and safety: Claude Code has access to a set of powerful tools that help it understand and modify your codebase: Prompt injection is a technique where an attacker attempts to override or manipulate an AI assistant’s instructions by inserting malicious text. Claude Code includes several safeguards against these attacks: Best practices for working with untrusted content: While these protections significantly reduce risk, no system is completelyimmune to all attacks. Always maintain good security practices when workingwith any AI tool. Claude Code requires access to: Allowlist these URLs when using Claude Code in containerized environments. Configure Claude Code by running claude config in your terminal, or the /config command when using the interactive REPL. Claude Code supports global and project-level configuration. To manage your configurations, use the following commands: By default config changes your project configuration. To manage your global configuration, use the --global (or -g) flag. To set a global configuration, use claude config set -g : When Claude Code detects that it doesn’t have sufficient permissions to write to your global npm prefix directory (required for automatic updates), you’ll see a warning that points to this documentation page. For detailed solutions to auto-updater issues, see the troubleshooting guide. Why we recommend this option: Since Claude Code is actively developing, we recommend setting up auto-updates using the recommended option above. If you prefer to disable the auto-updater instead of fixing permissions, you can use: Manage project configuration with claude config set (without the -g flag): For example: Claude Code works best when your terminal is properly configured. Follow these guidelines to optimize your experience. Supported shells: Claude cannot control the theme of your terminal. That’s handled by your terminal application. You can match Claude Code’s theme to your terminal during onboarding or any time via the /config command You have several options for entering linebreaks into Claude Code: To set up Option+Enter in your terminal: For Mac Terminal.app: For iTerm2 and VSCode terminal: Tip for iTerm2 and VSCode users: Run /terminal-setup within Claude Code to automatically configure Shift+Enter as a more intuitive alternative. Never miss when Claude completes a task with proper notification configuration: Enable sound alerts when tasks complete: For macOS users: Don’t forget to enable notification permissions in System Settings → Notifications → [Your Terminal App]. For iTerm 2 alerts when tasks complete: Note that these notifications are specific to iTerm 2 and not available in the default macOS Terminal. When working with extensive code or long instructions: By configuring these settings, you’ll create a smoother, more efficient workflow with Claude Code. Claude Code consumes tokens for each interaction. Typical usage costs range from $5-10 per developer per day, but can exceed $100 per hour during intensive use. Costs can vary significantly based on: For team deployments, we recommend starting with a small pilot group toestablish usage patterns before wider rollout. Claude Code requires access to both Claude 3.7 Sonnet and Claude 3.5 Haikumodels, regardless of which API provider you use. Optional: Override the default model (Claude 3.7 Sonnet is used by default): If you don’t have prompt caching enabled, also set: Requires standard AWS SDK credentials (e.g., ~/.aws/credentials or relevant environment variables like AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). Contact Amazon Bedrock for prompt caching for reduced costs and higher rate limits. Users will need access to both Claude 3.7 Sonnet and Claude 3.5 Haiku modelsin their AWS account. If you have a model access role, you may need to requestaccess to these models if they’re not already available. Claude Code on Vertex AI currently only supports the us-east5 region. Makesure your project has quota allocated in this specific region. Users will need access to both Claude 3.7 Sonnet and Claude 3.5 Haiku modelsin their Vertex AI project. Requires standard GCP credentials configured through google-auth-library. For the best experience, contact Google for heightened rate limits. Claude Code provides a development container configuration for teams that need consistent, secure environments. This preconfigured devcontainer setup works seamlessly with VS Code’s Remote - Containers extension and similar tools. The container’s enhanced security measures (isolation and firewall rules) allow you to run claude --dangerously-skip-permissions to bypass permission prompts for unattended operation. We’ve included a reference implementation that you can customize for your needs. While the devcontainer provides substantial protections, no system iscompletely immune to all attacks. Always maintain good security practices andmonitor Claude’s activities. The devcontainer setup consists of three primary components: The container implements a multi-layered security approach with its firewall configuration: The devcontainer configuration is designed to be adaptable to your needs: Step-by-step guides for common tasks Solutions for common issues with Claude Code Clone our development container reference implementation. Claude Code is provided as a Beta research preview under Anthropic’s Commercial Terms of Service. We aim to be fully transparent about how we use your data. We may use feedback to improve our products and services, but we will not train generative models using your feedback from Claude Code. Given their potentially sensitive nature, we store user feedback transcripts for only 30 days. If you choose to send us feedback about Claude Code, such as transcripts of your usage, Anthropic may use that feedback to debug related issues and improve Claude Code’s functionality (e.g., to reduce the risk of similar bugs occurring in the future). We will not train generative models using this feedback. We have implemented several safeguards to protect your data, including limited retention periods for sensitive information, restricted access to user session data, and clear policies against using feedback for model training. For full details, please review our Commercial Terms of Service and Privacy Policy. © Anthropic PBC. All rights reserved. Use is subject to Anthropic’s Commercial Terms of Service. Was this page helpful?