15確保您擁有:15確保您擁有:
16 16
17* 已開啟的終端或命令提示字元17* 已開啟的終端或命令提示字元
18 * 如果您從未使用過終端,請查看[終端指南](/zh-TW/terminal-guide)18 * 如果您從未使用過終端,請查看[終端指南](/docs/zh-TW/terminal-guide)
19* 一個可以使用的程式碼專案19* 一個可以使用的程式碼專案
20* 一個 [Claude 訂閱](https://claude.com/pricing?utm_source=claude_code\&utm_medium=docs\&utm_content=quickstart_prereq)(Pro、Max、Team 或 Enterprise)、[Claude Console](https://console.anthropic.com/) 帳戶,或透過[支援的雲端提供商](/zh-TW/third-party-integrations)存取20* 一個 [Claude 訂閱](https://claude.com/pricing?utm_source=claude_code\&utm_medium=docs\&utm_content=quickstart_prereq)(Pro、Max、Team 或 Enterprise)、[Claude Console](https://platform.claude.com/) 帳戶,或透過[支援的雲端提供商](/docs/zh-TW/third-party-integrations)存取
21 21
22<Note>22<Note>
23 本指南涵蓋終端 CLI。Claude Code 也可在[網頁](https://claude.ai/code)、[桌面應用程式](/zh-TW/desktop)、[VS Code](/zh-TW/vs-code) 和 [JetBrains IDE](/zh-TW/jetbrains)、[Slack](/zh-TW/slack) 中使用,以及透過 [GitHub Actions](/zh-TW/github-actions) 和 [GitLab](/zh-TW/gitlab-ci-cd) 進行 CI/CD。請參閱[所有介面](/zh-TW/overview#use-claude-code-everywhere)。23 本指南涵蓋終端 CLI。Claude Code 也可在[網頁](https://claude.ai/code)、[桌面應用程式](/docs/zh-TW/desktop)、[VS Code](/docs/zh-TW/vs-code) 和 [JetBrains IDE](/docs/zh-TW/jetbrains)、[Slack](/docs/zh-TW/slack) 中使用,以及透過 [GitHub Actions](/docs/zh-TW/github-actions) 和 [GitLab](/docs/zh-TW/gitlab-ci-cd) 進行 CI/CD。請參閱[所有介面](/docs/zh-TW/overview#use-claude-code-everywhere)。
24</Note>24</Note>
25 25
26<h2 id="step-1-install-claude-code">26<h2 id="step-1-install-claude-code">
51 51
52 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.52 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.
53 53
54 If the install command fails with `syntax error near unexpected token '<'`, a `403`, or another curl error, see [Troubleshoot installation](/en/troubleshoot-install#find-your-error) to match the error to a fix and for alternative install methods.54 If the install command fails with `syntax error near unexpected token '<'`, a `403`, or another curl error, see [Troubleshoot installation](/docs/en/troubleshoot-install#find-your-error) to match the error to a fix and for alternative install methods.
55 55
56 [Git for Windows](https://git-scm.com/downloads/win) 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.56 [Git for Windows](https://git-scm.com/downloads/win) 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.
57 57
83 </Tab>83 </Tab>
84</Tabs>84</Tabs>
85 85
86You can also install with [apt, dnf, or apk](/en/setup#install-with-linux-package-managers) on Debian, Fedora, RHEL, and Alpine.86You can also install with [apt, dnf, or apk](/docs/en/setup#install-with-linux-package-managers) on Debian, Fedora, RHEL, and Alpine.
87
88若要確認安裝成功,請執行:
89
90```bash theme={null}
91claude --version
92```
93
94此命令會列印版本號碼,後面跟著 `(Claude Code)`。
87 95
88<h2 id="step-2-log-in-to-your-account">96<h2 id="step-2-log-in-to-your-account">
89 步驟 2:登入您的帳戶97 步驟 2:登入您的帳戶
95claude103claude
96```104```
97 105
98對於 Claude 訂閱或 Console 帳戶,請按照提示在瀏覽器中完成驗證。若要稍後切換帳戶或重新驗證,請在執行中的工作階段內輸入 `/login`:106對於 Claude 訂閱或 Console 帳戶,請按照提示在瀏覽器中完成驗證。如果您已設定 `ANTHROPIC_API_KEY` 環境變數,Claude Code 會略過登入提示,改為要求您核准該金鑰。若要稍後切換帳戶或重新驗證,請在執行中的工作階段內輸入 `/login`:
99 107
100```text theme={null}108```text wrap theme={null}
101/login109/login
102```110```
103 111
104您可以使用以下任何帳戶類型登入:112您可以使用以下任何帳戶類型登入:
105 113
106* [Claude Pro、Max、Team 或 Enterprise](https://claude.com/pricing?utm_source=claude_code\&utm_medium=docs\&utm_content=quickstart_login)(推薦)114* [Claude Pro、Max、Team 或 Enterprise](https://claude.com/pricing?utm_source=claude_code\&utm_medium=docs\&utm_content=quickstart_login)(推薦)
107* [Claude Console](https://console.anthropic.com/)(具有預付額度的 API 存取)。首次登入時,Console 中會自動建立「Claude Code」工作區以進行集中成本追蹤。115* [Claude Console](https://platform.claude.com/)(具有預付額度的 API 存取)。首次登入時,Console 中會自動建立「Claude Code」工作區以進行集中成本追蹤。
108* [Amazon Bedrock、Google Cloud 的 Agent Platform 或 Microsoft Foundry](/zh-TW/third-party-integrations)(企業雲端提供商)116* [Amazon Bedrock、Google Cloud 的 Agent Platform 或 Microsoft Foundry](/docs/zh-TW/third-party-integrations)(企業雲端提供商)
109* 自行託管的 [Claude 應用程式閘道](/zh-TW/claude-apps-gateway)(如果您的組織執行一個的話):您的管理員會預先設定閘道 URL,`/login` 會直接在 **Cloud gateway** 畫面上開啟,供您使用公司 SSO 登入117* 自行託管的 [Claude 應用程式閘道](/docs/zh-TW/claude-apps-gateway)(如果您的組織執行一個的話):您的管理員會預先設定閘道 URL,`/login` 會直接在 **Cloud gateway** 畫面上開啟,供您使用公司 SSO 登入
110 118
111登入後,您的認證將被儲存,您無需再次登入。119登入後,您的認證將被儲存,您無需再次登入。深入瞭解 [認證管理](/docs/zh-TW/authentication#credential-management)。
112 120
113<h2 id="step-3-start-your-first-session">121<h2 id="step-3-start-your-first-session">
114 步驟 3:啟動您的第一個工作階段122 步驟 3:啟動您的第一個工作階段
121claude129claude
122```130```
123 131
124您將看到 Claude Code 提示,其中顯示版本、目前的模型和工作目錄。輸入 `/help` 以查看可用命令,或輸入 `/resume` 以繼續之前的對話。132將 `/path/to/your/project` 替換為您要處理的專案路徑。
125 133
126<Tip>134您將看到 Claude Code 提示,其中顯示版本、目前的模型和工作目錄。輸入 `/help` 以查看可用命令,或輸入 `/resume` 以繼續之前的對話。
127 登入後(步驟 2),您的認證將儲存在您的系統上。在[認證管理](/zh-TW/authentication#credential-management)中了解更多。
128</Tip>
129 135
130<h2 id="step-4-ask-your-first-question">136<h2 id="step-4-ask-your-first-question">
131 步驟 4:提出您的第一個問題137 步驟 4:提出您的第一個問題
133 139
134讓我們從了解您的程式碼庫開始。嘗試以下命令之一:140讓我們從了解您的程式碼庫開始。嘗試以下命令之一:
135 141
136```text theme={null}142```text wrap theme={null}
137what does this project do?143what does this project do?
138```144```
139 145
140Claude 將分析您的檔案並提供摘要。您也可以提出更具體的問題:146Claude 將分析您的檔案並提供摘要。您也可以提出更具體的問題:
141 147
142```text theme={null}148```text wrap theme={null}
143what technologies does this project use?149what technologies does this project use?
144```150```
145 151
146```text theme={null}152```text wrap theme={null}
147where is the main entry point?153where is the main entry point?
148```154```
149 155
150```text theme={null}156```text wrap theme={null}
151explain the folder structure157explain the folder structure
152```158```
153 159
154您也可以詢問 Claude 其自身的功能:160您也可以詢問 Claude 其自身的功能:
155 161
156```text theme={null}162```text wrap theme={null}
157what can Claude Code do?163what can Claude Code do?
158```164```
159 165
160```text theme={null}166```text wrap theme={null}
161how do I create custom skills in Claude Code?167how do I create custom skills in Claude Code?
162```168```
163 169
164```text theme={null}170```text wrap theme={null}
165can Claude Code work with Docker?171can Claude Code work with Docker?
166```172```
167 173
175 181
176現在讓我們讓 Claude Code 進行一些實際的編碼。嘗試一個簡單的任務:182現在讓我們讓 Claude Code 進行一些實際的編碼。嘗試一個簡單的任務:
177 183
178```text theme={null}184```text wrap theme={null}
179add a hello world function to the main file185add a hello world function to the main file
180```186```
181 187
182Claude Code 將:188Claude Code 找到適當的檔案並向您顯示變更。如果它在進行變更前詢問,請選擇 **是** 以批准。
183 189
1841. 找到適當的檔案190Auto mode 是 [內建的起始權限模式](/docs/zh-TW/permission-modes#eliminate-prompts-with-auto-mode),適用於 Pro、Max 和 Team 方案上的互動式終端工作階段:分類器會檢查動作而不是由您檢查,Claude 可以在不詢問的情況下編輯大多數檔案並執行大多數命令。在其他方案上,Manual mode 是內建的起始權限模式。對於您安裝後立即開始的工作階段,請參閱 [安裝或升級後的第一個工作階段](/docs/zh-TW/env-vars#first-session-after-an-install-or-upgrade)。
1852. 向您顯示建議的變更
1863. 要求您的批准
1874. 進行編輯
188 191
189<Note>192<Note>
190 Claude Code 在修改檔案前始終要求許可。您可以批准個別變更或為工作階段啟用「全部接受」模式。193 您的設定或您的組織可以設定不同的起始權限模式。[工作階段開始時的權限模式](/docs/zh-TW/permission-modes#which-mode-a-session-starts-in) 列出了相關內容。隨時按 `Shift+Tab` 以切換您所在工作階段的權限模式。
191</Note>194</Note>
192 195
193<h2 id="step-6-use-git-with-claude-code">196<h2 id="step-6-use-git-with-claude-code">
196 199
197Claude Code 使 Git 操作變得對話式:200Claude Code 使 Git 操作變得對話式:
198 201
199```text theme={null}202```text wrap theme={null}
200what files have I changed?203what files have I changed?
201```204```
202 205
203```text theme={null}206```text wrap theme={null}
204commit my changes with a descriptive message207commit my changes with a descriptive message
205```208```
206 209
207您也可以提示進行更複雜的 Git 操作:210您也可以提示進行更複雜的 Git 操作:
208 211
209```text theme={null}212```text wrap theme={null}
210create a new branch called feature/quickstart213create a new branch called feature/quickstart
211```214```
212 215
213```text theme={null}216```text wrap theme={null}
214show me the last 5 commits217show me the last 5 commits
215```218```
216 219
217```text theme={null}220```text wrap theme={null}
218help me resolve merge conflicts221help me resolve merge conflicts
219```222```
220 223
226 229
227用自然語言描述您想要的內容:230用自然語言描述您想要的內容:
228 231
229```text theme={null}232```text wrap theme={null}
230add input validation to the user registration form233add input validation to the user registration form
231```234```
232 235
233或修復現有問題:236或修復現有問題:
234 237
235```text theme={null}238```text wrap theme={null}
236there's a bug where users can submit empty forms - fix it239there's a bug where users can submit empty forms - fix it
237```240```
238 241
251 254
252**重構程式碼**255**重構程式碼**
253 256
254```text theme={null}257```text wrap theme={null}
255refactor the authentication module to use async/await instead of callbacks258refactor the authentication module to use async/await instead of callbacks
256```259```
257 260
258**編寫測試**261**編寫測試**
259 262
260```text theme={null}263```text wrap theme={null}
261write unit tests for the calculator functions264write unit tests for the calculator functions
262```265```
263 266
264**更新文件**267**更新文件**
265 268
266```text theme={null}269```text wrap theme={null}
267update the README with installation instructions270update the README with installation instructions
268```271```
269 272
270**程式碼審查**273**程式碼審查**
271 274
272```text theme={null}275```text wrap theme={null}
273review my changes and suggest improvements276review my changes and suggest improvements
274```277```
275 278
288| 命令 | 功能 | 範例 |291| 命令 | 功能 | 範例 |
289| ------------------- | ------------- | ----------------------------------- |292| ------------------- | ------------- | ----------------------------------- |
290| `claude` | 啟動互動模式 | `claude` |293| `claude` | 啟動互動模式 | `claude` |
291| `claude "task"` | 執行一次性任務 | `claude "fix the build error"` |294| `claude "task"` | 使用初始提示啟動互動模式 | `claude "fix the build error"` |
292| `claude -p "query"` | 執行一次性查詢,然後退出 | `claude -p "explain this function"` |295| `claude -p "query"` | 執行一次性查詢,然後退出 | `claude -p "explain this function"` |
293| `claude -c` | 在目前目錄中繼續最近的對話 | `claude -c` |296| `claude -c` | 在目前目錄中繼續最近的對話 | `claude -c` |
294| `claude -r` | 恢復之前的對話 | `claude -r` |297| `claude -r` | 恢復之前的對話 | `claude -r` |
296**工作階段命令**299**工作階段命令**
297 300
298| 命令 | 功能 | 範例 |301| 命令 | 功能 | 範例 |
299| ---------------- | -------------- | -------- |302| ------------------- | -------------- | -------- |
300| `/clear` | 清除對話歷史 | `/clear` |303| `/clear` | 清除對話歷史 | `/clear` |
301| `/help` | 顯示可用命令 | `/help` |304| `/help` | 顯示可用命令 | `/help` |
302| `/exit` 或 Ctrl+D | 退出 Claude Code | `/exit` |305| `/exit` 或 Ctrl+D 兩次 | 退出 Claude Code | `/exit` |
303 306
304請參閱 [CLI 參考](/zh-TW/cli-reference)以取得完整的 shell 命令清單,以及 [命令參考](/zh-TW/commands)以取得完整的工作階段命令清單。307請參閱 [CLI 參考](/docs/zh-TW/cli-reference)以取得完整的 shell 命令清單,以及 [命令參考](/docs/zh-TW/commands)以取得完整的工作階段命令清單。
305 308
306<h2 id="pro-tips-for-beginners">309<h2 id="pro-tips-for-beginners">
307 初學者的專業提示310 初學者的專業提示
308</h2>311</h2>
309 312
310如需更多資訊,請參閱[最佳實踐](/zh-TW/best-practices)和[常見工作流程](/zh-TW/common-workflows)。313如需更多資訊,請參閱[最佳實踐](/docs/zh-TW/best-practices)和[常見工作流程](/docs/zh-TW/common-workflows)。
311 314
312<AccordionGroup>315<AccordionGroup>
313 <Accordion title="對您的請求要具體">316 <Accordion title="對您的請求要具體">
319 <Accordion title="使用逐步說明">322 <Accordion title="使用逐步說明">
320 將複雜任務分解為步驟:323 將複雜任務分解為步驟:
321 324
322 ```text theme={null}325 ```text wrap theme={null}
323 1. create a new database table for user profiles326 1. create a new database table for user profiles
324 2. create an API endpoint to get and update user profiles327 2. create an API endpoint to get and update user profiles
325 3. build a webpage that allows users to see and edit their information328 3. build a webpage that allows users to see and edit their information
329 <Accordion title="讓 Claude 先探索">332 <Accordion title="讓 Claude 先探索">
330 在進行變更之前,讓 Claude 了解您的程式碼:333 在進行變更之前,讓 Claude 了解您的程式碼:
331 334
332 ```text theme={null}335 ```text wrap theme={null}
333 analyze the database schema336 analyze the database schema
334 ```337 ```
335 338
336 ```text theme={null}339 ```text wrap theme={null}
337 build a dashboard showing products that are most frequently returned by our UK customers340 build a dashboard showing products that are most frequently returned by our UK customers
338 ```341 ```
339 </Accordion>342 </Accordion>
353現在您已經學習了基礎知識,請探索更多進階功能:356現在您已經學習了基礎知識,請探索更多進階功能:
354 357
355<CardGroup cols={2}>358<CardGroup cols={2}>
356 <Card title="Claude Code 如何運作" icon="microchip" href="/zh-TW/how-claude-code-works">359 <Card title="Claude Code 如何運作" icon="microchip" href="/docs/zh-TW/how-claude-code-works">
357 了解代理迴圈、內建工具以及 Claude Code 如何與您的專案互動360 了解代理迴圈、內建工具以及 Claude Code 如何與您的專案互動
358 </Card>361 </Card>
359 362
360 <Card title="最佳實踐" icon="star" href="/zh-TW/best-practices">363 <Card title="最佳實踐" icon="star" href="/docs/zh-TW/best-practices">
361 透過有效的提示和專案設定獲得更好的結果364 透過有效的提示和專案設定獲得更好的結果
362 </Card>365 </Card>
363 366
364 <Card title="常見工作流程" icon="graduation-cap" href="/zh-TW/common-workflows">367 <Card title="常見工作流程" icon="graduation-cap" href="/docs/zh-TW/common-workflows">
365 常見任務的逐步指南368 常見任務的逐步指南
366 </Card>369 </Card>
367 370
368 <Card title="擴展 Claude Code" icon="puzzle-piece" href="/zh-TW/features-overview">371 <Card title="擴展 Claude Code" icon="puzzle-piece" href="/docs/zh-TW/features-overview">
369 使用 CLAUDE.md、skills、hooks、MCP 等進行自訂372 使用 CLAUDE.md、skills、hooks、MCP 等進行自訂
370 </Card>373 </Card>
371</CardGroup>374</CardGroup>