AI Tools & Chatbots

How to Use Claude Code

Owned and published by DLTutu, an independent app-guide publisher. Editorial policy · Sources · Report a correction

Quick answer

Install the Claude Code CLI on macOS, Windows, or Linux, then open your project folder and run claude. Sign in with an eligible Claude or Console account, ask Claude to explain the project, and approve only the edits and commands you understand. Start with default or plan mode, then use CLAUDE.md to give Claude persistent project instructions. The first thing to set up is the project directory and its project guidance.

Key takeaways

  • YesClaude Code is Anthropic’s agentic coding tool for understanding, changing, testing, and reviewing code.
  • YesThe CLI works in macOS, Windows, and Linux, with additional access through VS Code, JetBrains IDEs, the Claude desktop app, and claude.ai/code.
  • YesYou must review proposed commands and code changes because permission prompts do not guarantee that every action is safe.
  • YesPlan mode lets Claude analyze a codebase and propose changes before editing source files.
  • YesCLAUDE.md gives Claude persistent instructions about commands, conventions, and project structure.
  • YesThe free Claude.ai plan does not include Claude Code; access requires an eligible paid plan, Console account, or supported cloud provider.

Claude Code is Anthropic’s agentic coding tool for work inside real software projects. It can read a codebase, edit files, run commands, use git, and connect external tools through MCP. It suits developers who want hands-on assistance as well as beginners who want a guided way to explore and modify code. You can use it from a terminal, supported IDEs, the Claude desktop app, or the web at claude.ai/code.

It covers terminal setup, VS Code integration, and practical habits for using it effectively. This guide shows how to install it, begin safely, control permissions, preserve project context, and automate a repeatable task. You will finish with a working setup and a practical example of adding a hook that formats edited files.

What is Claude Code and how does it work?

Claude Code is an agentic coding assistant that can inspect project files, make changes, run development commands, and assist with git workflows. The CLI is the command-line interface used to start Claude Code from a terminal. An agentic tool means Claude can choose and sequence tools to complete a task rather than only returning text. A permission mode controls whether Claude asks before edits or commands, runs some edits automatically, or stops while developing a plan. A session is one active Claude conversation, which can be cleared, resumed, or continued from the shell. CLAUDE.md is a plain-text instruction file that gives Claude persistent rules for a project. MCP, or Model Context Protocol, is a standard for connecting Claude Code to trusted external tools and data.

Before you start

  • YesAn eligible Claude Pro, Max, Ultra, Team, or Enterprise subscription, a Claude Console account, or access through Amazon Bedrock, Google Cloud, or Microsoft Foundry.
  • YesA Mac, Windows computer, or Linux computer running a supported operating system, with enough memory and an internet connection.
  • YesGit for Windows on native Windows is recommended so Claude Code can use the Bash tool.
  • YesA project folder and a text editor; VS Code, JetBrains IDEs, the Claude desktop app, and claude.ai/code are optional alternatives or additions.

How to use Claude Code, step by step

Checked against the official pages: [1][2][3][4][5][6]

  1. Check your requirements

    Confirm that you have macOS, Windows, or Ubuntu, Debian, or Alpine Linux, plus an internet connection and an eligible account. Claude Code requires an internet connection and the minimum age stated in Anthropic’s applicable terms. The free Claude.ai plan does not include access. If you want to use the web or the Claude desktop app’s Code tab, you also need a paid subscription.

  2. Install the CLI on macOS or Linux

    Open your terminal and run curl -fsSL https://claude.ai/install.sh | bash. If you prefer Homebrew, run brew install --cask claude-code instead. Homebrew installations do not auto-update unless you opt in, so run brew upgrade claude-code when you need an update. Use only Anthropic’s official installation source for your operating system.

  3. Install the CLI on Windows

    In Windows PowerShell, run irm https://claude.ai/install.ps1 | iex. You can alternatively run winget install Anthropic.ClaudeCode. On native Windows, install Git for Windows so Claude Code can use the Bash tool. WinGet installations do not auto-update unless you opt in; use winget upgrade Anthropic.ClaudeCode to update.

  4. Verify the installation

    Open a new terminal window and run claude --version. For a deeper check of the installation, run claude doctor. Review any reported path, connection, or configuration problems before continuing. These checks are available from the CLI and do not require entering a project.

  5. Install the IDE integration

    In VS Code, open the Extensions view, search for "Claude Code," and install the extension. Open the Command Palette, run Claude Code: Open in New Tab, and follow the sign-in flow. For JetBrains IDEs, install the Claude Code plugin from the JetBrains Marketplace. The JetBrains plugin requires the CLI to be installed separately.

  6. Open a project and sign in

    Navigate to the project directory with cd /path/to/your/project, replacing the example path with your own. Run claude in the terminal. On first use, follow the browser prompts to log in, and use /login later if you need to switch accounts. The Claude desktop app’s Code tab and claude.ai/code also require a paid subscription.

  7. Ask Claude about the project

    Start with a low-risk question such as what does this project do?, where is the main entry point?, or explain the folder structure. Claude reads relevant files as needed, so you do not have to paste the entire codebase into the prompt. Check the files and explanations Claude provides before asking it to change anything.

  8. Approve a small change

    Ask for a contained task, such as adding a hello world function to the main file. Claude will display the proposed change before applying it. Select Yes to approve the change, then inspect the resulting diff and run the appropriate test or build command. Starting with a small edit makes it easier to verify Claude’s behavior.

  9. Choose a permission mode

    Press Shift+Tab to cycle through default, acceptEdits, and plan modes. The default mode prompts before edits and commands, while acceptEdits automatically approves file edits in the working directory. You can also start a session with claude --permission-mode plan. Auto mode reduces prompts but does not guarantee that an action is safe.

  10. Plan before editing

    Enter plan mode with Shift+Tab or begin a prompt with /plan. Claude can read files and propose changes without editing source code in this mode. Review the plan, press Ctrl+G to edit it in your editor, and then approve it or keep planning. This is useful for changes that touch several files or important behavior.

  11. Add project memory

    Run /init to generate a starting CLAUDE.md containing useful build commands and project conventions. Shared project instructions belong in ./CLAUDE.md, personal instructions in ~/.claude/CLAUDE.md, and private per-project notes in CLAUDE.local.md. Use /memory to manage auto memory. Keep instructions specific and avoid placing secrets in these files.

  12. Use git and core commands

    Ask what files have I changed?, request a commit with a descriptive message, or ask Claude to create a branch called feature/quickstart. Claude can stage changes, write commit messages, create branches, and open pull requests, but you should review each result. Inside a session, use /help to list commands, /clear for a new conversation, /resume to reopen an old one, and /exit to quit.

  13. Connect MCP and add a hook

    Add an MCP server with claude mcp add --transport http <name> <url>, then run /mcp inside a session to authenticate. Use --scope project to share trusted servers through .mcp.json. To automate formatting, add a "hooks" block to .claude/settings.json with a PostToolUse hook and an Edit|Write matcher, then run /hooks and confirm that it loaded.

Key Claude Code features explained

1

Codebase analysis

Claude can inspect project files to explain the architecture, locate entry points, and trace relationships between components. Use it first when you are unfamiliar with a repository or need a map before making changes.

2

Multi-file editing

Claude can propose coordinated edits across several files instead of treating every change as an isolated prompt. Inspect the complete diff and run the project’s tests, especially when the task changes shared interfaces or configuration.

3

Permission modes

Default mode asks before edits and commands, acceptEdits approves working-directory edits automatically, and plan mode separates analysis from implementation. Choose the least permissive mode that still supports your task.

4

Persistent project instructions

CLAUDE.md carries project-specific guidance across sessions, while /init creates a starting file and /memory manages auto memory. Keep the file focused on repeatable commands, conventions, and constraints.

5

Git integration

Claude can stage changes, draft commit messages, create branches, and open pull requests. These actions still require review, particularly when they affect the default branch or include sensitive files.

6

MCP and hooks

MCP connects Claude Code to trusted external tools, while hooks run configured actions after tool use. Use MCP for approved data sources and hooks for deterministic tasks such as formatting edited files.

Tips & shortcuts

  • Use plan mode for unfamiliar repositories or changes that affect multiple components; it lets you inspect the approach before source files are edited.
  • Run /help inside a session to discover available commands without leaving the terminal.
  • Use claude -c to continue the latest conversation, claude -r to resume an earlier one, and claude -p "query" for a one-off question.
  • Pipe logs into claude -p or run Claude Code in CI when you need repeatable analysis instead of an interactive session.
  • Ask Claude to explain its proposed edits and commands before approving them, especially when the task touches authentication, payments, or deployment.
  • Use skills to package repeatable workflows and subagents to divide larger work into independent parts.
  • Keep a project CLAUDE.md concise and update it when build commands, conventions, or project structure change.

Common mistakes to avoid

  • Do not approve a large change before reading its diff; begin with one contained edit and expand only after verifying the result.
  • Do not use bypassPermissions outside an isolated container or virtual machine because it offers no protection against prompt injection.
  • Do not pipe untrusted content directly into Claude Code; review the content and any commands it produces first.
  • Do not store API keys, passwords, or private credentials in CLAUDE.md, hooks files, or MCP server definitions.
  • Do not assume the JetBrains plugin includes the CLI; install and verify the CLI separately.

Troubleshooting

claude --version is not recognized

Open a new terminal after installation so the updated command path can load, then run claude --version again. Run claude doctor for a deeper installation check. If you installed through Homebrew or WinGet without automatic updates, run the corresponding upgrade command.

Claude Code cannot find the project

Exit the current session with /exit, navigate to the project directory with cd /path/to/your/project, and run claude from inside it. Confirm that the path contains the files you expect before asking Claude to inspect the repository.

The login flow does not complete

Check that you can reach claude.ai in a browser and that your account is eligible for Claude Code. Use /login inside the terminal session to retry or switch accounts. If you rely on a cloud provider, confirm that your organization’s access is configured correctly.

The Bash tool fails on native Windows

Install Git for Windows so Claude Code can use its Bash tool, then open a new terminal and start another session. If you need WSL-based sandboxing, run Claude Code inside a supported WSL environment instead of native Windows.

An MCP server or hook does not work

Run /mcp or /hooks inside the session and check whether the tool loaded. For project-scoped MCP servers, confirm that the server is defined in .mcp.json and approve it when prompted. For hooks, validate the JSON in .claude/settings.json and confirm that the matcher matches the intended tool.

Privacy & safety

Keep Claude in default or plan mode when exploring unfamiliar code, and review every proposed command, edit, branch, commit, and pull request. Use bypassPermissions only inside an isolated container or virtual machine because it does not protect against prompt injection, and do not pipe untrusted content into Claude Code. Connect only MCP servers you trust, especially ones that fetch external content, and review project servers in .mcp.json before first use. Install Claude Code only from Anthropic’s official installer, Homebrew, or WinGet; do not install the npm package with sudo. Credentials are stored in the macOS Keychain when available and in a restricted file on Linux and Windows, but secrets should still be kept out of project instructions and prompts.

Sources

These are the developers' and platforms' own pages we checked this guide against. What an app does is taken from them; which app suits whom is our editorial judgement. Links open the official site.

  1. Advanced setup - Claude Code Docs code.claude.com
  2. Install.sh claude.ai
  3. Install.ps1 claude.ai
  4. Quickstart - Claude Code Docs code.claude.com
  5. Overview - Claude Code Docs code.claude.com
  6. Choose a permission mode - Claude Code Docs code.claude.com
  7. How Claude remembers your project - Claude Code Docs code.claude.com
  8. Connect Claude Code to tools via MCP - Claude Code Docs code.claude.com
  9. Automate actions with hooks - Claude Code Docs code.claude.com
  10. Security - Claude Code Docs code.claude.com

Frequently asked questions

Is Claude Code free?

No, Claude Code is not included with the free Claude.ai plan. You need an eligible Claude Pro, Max, Ultra, Team, or Enterprise subscription, a Claude Console account, or access through Amazon Bedrock, Google Cloud, or Microsoft Foundry. Availability and billing depend on the access route you choose, so check Anthropic’s official documentation for current terms. The CLI, IDE integrations, desktop Code tab, and web access at claude.ai/code use this same eligible-account requirement.

Is Claude Code safe to use?

Claude Code can be safe when you review its actions and restrict what it may change. It can edit files, run commands, use git, and connect external tools, so approval does not mean an action is automatically correct. Use default or plan mode for unfamiliar projects, inspect diffs and commands, and run sensitive work in a virtual machine or isolated container. Avoid bypassPermissions outside that protected environment, and never pipe untrusted content or store credentials in project instructions.

Can I use Claude Code on an iPhone or Android?

Claude Code is not a native iPhone or Android coding environment. It runs on macOS, Windows, and Linux and is also available through VS Code, JetBrains IDEs, the Claude desktop app, and claude.ai/code. If you only have a phone, use the web interface for supported interactions, but complete terminal, IDE, and local project work requires a computer. Do not install an unofficial mobile app that claims to provide the full Claude Code CLI.

Can I use Claude Code on a computer?

Yes, Claude Code is designed for a computer and supports macOS, Windows, and Linux. Install the CLI, open a terminal, navigate to a project folder, and run claude. VS Code and JetBrains users can use the official integrations, while the Claude desktop app and claude.ai/code provide additional interfaces. You need an internet connection and an eligible account, and the free Claude.ai plan does not include Claude Code.

Do I need to know how to code before using Claude Code?

No, but you should be able to read basic code and recognize whether a command or change is appropriate. Claude Code can explain a project, locate entry points, and make edits, which makes it useful for learning. Start with a small repository, ask Claude to explain the folder structure, and inspect each diff before approval. If you cannot evaluate the result, use plan mode or ask Claude to explain the proposed change in plain language.

Do I need a Claude subscription to use Claude Code?

You need one eligible form of access: a Claude Pro, Max, Ultra, Team, or Enterprise subscription, a Claude Console account, or access through Amazon Bedrock, Google Cloud, or Microsoft Foundry. The free Claude.ai plan does not include Claude Code. The Claude desktop app’s Code tab specifically requires a paid subscription, and claude.ai/code is another supported interface. Check Anthropic’s official account documentation for current availability.

What is CLAUDE.md and where should I put it?

CLAUDE.md is a plain-text file that gives Claude Code persistent instructions about a project’s commands, structure, conventions, and constraints. Run /init to create a starting version, then review and refine it. Put shared project instructions in ./CLAUDE.md, personal instructions in ~/.claude/CLAUDE.md, and private per-project notes in CLAUDE.local.md. Do not put passwords, API keys, or other credentials in these files.

What is MCP in Claude Code?

MCP, or Model Context Protocol, is a way to connect Claude Code to external tools and data. Add an HTTP server with claude mcp add --transport http <name> <url>, then run /mcp inside a session to authenticate. Project-scoped servers are stored in .mcp.json and need your approval before first use. Connect only servers you trust, particularly because servers that fetch external content can introduce prompt-injection risks.

Does Claude Code work natively on Windows?

Yes, Claude Code supports native Windows, and you can install it with irm https://claude.ai/install.ps1 | iex or winget install Anthropic.ClaudeCode. Git for Windows is recommended so Claude Code can use the Bash tool. Sandboxing is supported in WSL but not in native Windows or an older WSL generation. If you need stronger isolation for sensitive tasks, run it inside a supported WSL environment, container, or virtual machine.

How do I use Claude Code in VS Code?

In VS Code, open the Extensions view, search for “Claude Code,” and install the extension. Open the Command Palette, run “Claude Code: Open in New Tab,” and follow the sign-in flow. The CLI must be installed separately for JetBrains IDEs, but VS Code integration follows the extension setup. You still need an eligible Claude or Console account.

How do I use Claude Code in a terminal?

Open a terminal in your project folder and run `claude`. On first use, follow the browser prompts to sign in, and use `/login` later to switch accounts. The CLI supports macOS, Windows, and Linux. You can verify the installation with `claude doctor`, then ask Claude to explain the project before requesting a small, reviewable change.

How can I use Claude Code effectively?

Use plan mode to inspect a codebase and review proposed changes before editing, especially when work touches several files or important behavior. Add project-specific guidance through `CLAUDE.md`, begin with contained tasks, and inspect each diff and command before approval. Keep default or plan mode for unfamiliar projects, and review branches, commits, and pull requests before accepting them.

Spotted something out of date? Report a change

Tell us what changed. We check every report against official sources before we update a guide — nothing is published automatically.

We store what you send to review it. See our privacy policy.