概述
Claude Code 是一個代理編碼工具,可以讀取您的程式碼庫、編輯檔案、執行命令,並與您的開發工具整合。可在您的終端機、IDE、桌面應用程式和瀏覽器中使用。
Claude Code 是一個由 AI 驅動的編碼助手,可幫助您建立功能、修復錯誤和自動化開發任務。它理解您的整個程式碼庫,並可以跨多個檔案和工具工作以完成任務。
開始使用
選擇您的環境以開始使用。大多數介面需要 Claude 訂閱或 Anthropic Console 帳戶。終端機 CLI 和 VS Code 也支援第三方提供商。
功能完整的 CLI,用於直接在您的終端機中使用 Claude Code。編輯檔案、執行命令,並從命令列管理您的整個專案。
To install Claude Code, use one of the following methods:
macOS, Linux, WSL:
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Windows CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
If you see The token '&&' is not a valid statement separator, you're in PowerShell, not CMD. If you see 'irm' is not recognized as an internal or external command, you're in CMD, not PowerShell. Your prompt shows PS C:\ when you're in PowerShell and C:\ without the PS when you're in CMD.
Git for Windows is recommended on native Windows so Claude Code can use the Bash tool. If Git for Windows is not installed, Claude Code uses PowerShell as the shell tool instead. WSL setups do not need Git for Windows.
Native installations automatically update in the background to keep you on the latest version.
brew install --cask claude-code
Homebrew offers two casks. claude-code tracks the stable release channel, which is typically about a week behind and skips releases with major regressions. claude-code@latest tracks the latest channel and receives new versions as soon as they ship.
Homebrew installations do not auto-update. Run brew upgrade claude-code or brew upgrade claude-code@latest, depending on which cask you installed, to get the latest features and security fixes.
winget install Anthropic.ClaudeCode
WinGet installations do not auto-update. Run winget upgrade Anthropic.ClaudeCode periodically to get the latest features and security fixes.
You can also install with [apt, dnf, or apk](/anthropic/claude-code/history/docs/en/2026-06-16-2157..2026-06-17-1702/setup/#install-with-linux-package-managers) on Debian, Fedora, RHEL, and Alpine.
然後在任何專案中啟動 Claude Code:
```bash theme={null}
cd your-project
claude
```
首次使用時,系統會提示您登入。就這麼簡單
<Tip>
請參閱[進階設定](/anthropic/claude-code/history/docs/zh-TW/2026-06-16-2157..2026-06-17-1702/setup/)以了解安裝選項、手動更新或卸載說明。如果遇到問題,請造訪[安裝疑難排解](/anthropic/claude-code/history/docs/zh-TW/2026-06-16-2157..2026-06-17-1702/troubleshoot-install/)。
</Tip>
VS Code 擴充功能在您的編輯器中直接提供內嵌差異、@-提及、計畫審查和對話歷史記錄。
或在擴充功能檢視中搜尋「Claude Code」(Mac 上為 Cmd+Shift+X,Windows/Linux 上為 Ctrl+Shift+X)。安裝後,開啟命令選擇板(Cmd+Shift+P / Ctrl+Shift+P),輸入「Claude Code」,然後選擇在新標籤中開啟。
一個獨立應用程式,用於在 IDE 或終端機外執行 Claude Code。以視覺方式審查差異、並排執行多個工作階段、排程重複任務,以及啟動雲端工作階段。
下載並安裝:
- macOS(Intel 和 Apple Silicon)
- Windows(x64)
- Windows ARM64
安裝後,啟動 Claude,登入,然後按一下程式碼標籤以開始編碼。需要付費訂閱。
在您的瀏覽器中執行 Claude Code,無需本機設定。啟動長時間執行的任務,並在完成時檢查,處理您本機沒有的儲存庫,或並行執行多個任務。可在桌面瀏覽器和 Claude iOS 應用程式上使用。
在 claude.ai/code 開始編碼。
IntelliJ IDEA、PyCharm、WebStorm 和其他 JetBrains IDE 的外掛程式,具有互動式差異檢視和選擇內容共享。
從 JetBrains Marketplace 安裝 Claude Code 外掛程式,然後重新啟動您的 IDE。外掛程式需要單獨安裝的 Claude Code CLI;請參閱 JetBrains 設定步驟。
您可以做什麼
以下是您可以使用 Claude Code 的一些方式:
```bash theme={null}
claude "write tests for the auth module, run them, and fix any failures"
```
建立功能和修復錯誤
用純文字描述您想要的內容。Claude Code 規劃方法、跨多個檔案編寫程式碼,並驗證其是否有效。
對於錯誤,貼上錯誤訊息或描述症狀。Claude Code 透過您的程式碼庫追蹤問題、識別根本原因並實施修復。請參閱常見工作流程以了解更多範例。
建立提交和拉取請求
Claude Code 直接與 git 配合使用。它暫存變更、編寫提交訊息、建立分支並開啟拉取請求。
claude "commit my changes with a descriptive message"
在 CI 中,您可以使用 GitHub Actions 或 GitLab CI/CD 自動化程式碼審查和問題分類。
使用 MCP 連接您的工具
Model Context Protocol (MCP) 是一個開放標準,用於將 AI 工具連接到外部資料來源。使用 MCP,Claude Code 可以讀取 Google Drive 中的設計文件、更新 Jira 中的票證、從 Slack 提取資料,或使用您自己的自訂工具。MCP 快速入門端到端連接您的第一個伺服器。
使用說明、skills 和 hooks 進行自訂
執行代理團隊並建立自訂代理
生成多個 Claude Code 代理,同時處理任務的不同部分。主導代理協調工作、指派子任務並合併結果。
若要在平行執行多個完整工作階段並從一個螢幕監視它們,請使用背景代理。對於完全自訂的工作流程,Agent SDK 可讓您建立由 Claude Code 的工具和功能驅動的自己的代理,並完全控制編排、工具存取和權限。
使用 CLI 進行管道、指令碼和自動化
Claude Code 是可組合的,遵循 Unix 哲學。將日誌管道傳入其中、在 CI 中執行它,或將其與其他工具鏈接:
# 分析最近的日誌輸出
tail -200 app.log | claude -p "Slack me if you see any anomalies"
# 在 CI 中自動化翻譯
claude -p "translate new strings into French and raise a PR for review"
# 跨檔案的大量操作
git diff main --name-only | claude -p "review these changed files for security issues"
請參閱 CLI 參考以了解完整的命令和旗標集。
排程重複任務
在任何地方使用 Claude Code
每個介面都連接到相同的基礎 Claude Code 引擎,因此您的 CLAUDE.md 檔案、設定和 MCP servers 可在所有介面中工作。
除了上述終端機、VS Code、JetBrains、桌面和網頁環境外,Claude Code 還與 CI/CD、聊天和瀏覽器工作流程整合:
| 我想要... | 最佳選項 |
|---|---|
| 從我的手機或其他裝置繼續本機工作階段 | 遠端控制 |
| 從 Telegram、Discord、iMessage 或我自己的 webhooks 推送事件到工作階段 | Channels |
| 在本機啟動任務,在行動裝置上繼續 | 網頁或 Claude iOS 應用程式 |
| 按重複排程執行 Claude | Routines 或桌面排程任務 |
| 自動化 PR 審查和問題分類 | GitHub Actions 或 GitLab CI/CD |
| 在每個 PR 上獲得自動程式碼審查 | GitHub Code Review |
| 將 Slack 中的錯誤報告路由到拉取請求 | Slack |
| 除錯即時網頁應用程式 | Chrome |
| 為您自己的工作流程建立自訂代理 | Agent SDK |
後續步驟
安裝 Claude Code 後,這些指南可幫助您深入了解。