← W1 | CLAUDE CODE

Claude Code 基本操作

安裝完 Claude Code 之後,做以下設定讓操作更順暢。

1

切換 Model

Claude Code 預設使用 Sonnet,但寫 code 請一定切到 Opus,不要為了省錢使用 Sonnet。

# 在 Claude Code 中輸入
/model

# 會跳出模型選單,用方向鍵選擇後按 Enter 即可

方案建議

最低要求:USD $20/月的 Pro Plan,才能使用 Claude Code。

強烈推薦:USD $100/月以上的 Max Plan。額度更充裕,而且可以使用 Fable 5 模型來做文件寫作和長文生成。

模型用途

Opus寫 code 首選,推理能力最強,程式碼品質最高
Fable 5適合高強度、高複雜的專案開發(需 Max Plan)
Sonnet速度快但能力較弱,不建議用來寫 code
Haiku最快最便宜,只適合簡單查詢
2

設定權限(用 Prompt 直接叫 AI 改)

預設情況下,Claude Code 每次執行指令都會問你確認,非常煩。你不需要自己改設定檔,直接在 Claude Code 裡面用英文下指令就好。

自動允許常用指令

把以下 prompt 貼進 Claude Code,它會自動幫你修改 settings:

Please update my project .claude/settings.json to allow the following
commands automatically without asking for confirmation:

Allow:
- git, python, conda, pip, npm, yarn, node
- cat, ls, find, grep, mkdir, cp, mv
- WebSearch, WebFetch

Deny:
- Bash(rm *)

禁止危險操作

上面的 prompt 已經包含 deny rm 了。這會防止 AI 自動刪除檔案,需要刪除時它會先問你確認。

AI 修改完後,settings.json 會長這樣

{
  "permissions": {
    "allow": [
      "Bash(git *)",
      "Bash(python *)",
      "Bash(conda *)",
      "Bash(pip *)",
      "Bash(npm *)",
      "Bash(yarn *)",
      "Bash(node *)",
      "Bash(cat *)",
      "Bash(ls *)",
      "Bash(find *)",
      "Bash(grep *)",
      "Bash(mkdir *)",
      "Bash(cp *)",
      "Bash(mv *)",
      "WebSearch",
      "WebFetch"
    ],
    "deny": [
      "Bash(rm *)"
    ]
  }
}