# 讓我全盤重新思考的 Claude Code 設定指南 > Author: Tony Lee > Published: 2026-02-08 > URL: https://tonylee.im/zh-TW/blog/claude-code-expert-complete-setup-guide/ > Reading time: 2 minutes > Language: zh-TW > Tags: ai, claude-code, developer-tools, productivity, workflow ## Canonical https://tonylee.im/zh-TW/blog/claude-code-expert-complete-setup-guide/ ## Rollout Alternates en: https://tonylee.im/en/blog/claude-code-expert-complete-setup-guide/ ko: https://tonylee.im/ko/blog/claude-code-expert-complete-setup-guide/ ja: https://tonylee.im/ja/blog/claude-code-expert-complete-setup-guide/ zh-CN: https://tonylee.im/zh-CN/blog/claude-code-expert-complete-setup-guide/ zh-TW: https://tonylee.im/zh-TW/blog/claude-code-expert-complete-setup-guide/ ## Description Anthropic 黑客松冠軍公開了他用了 10 個月的 Claude Code 完整設定。從上下文窗口管理到 MCP 伺服器配置、Skills 與 Hooks 分工、Git Worktree 平行開發,一篇講透。 ## Summary 讓我全盤重新思考的 Claude Code 設定指南 is part of Tony Lee's ongoing coverage of AI agents, developer tools, startup strategy, and AI industry shifts. ## Outline - 200K 上下文窗口是神話 - 實際可用的只有 70K - Skills、Hooks、Subagents - 角色分離才是關鍵 - mgrep 和 Git Worktree 是真正的殺手級技巧 - mgrep - Git Worktree - Zed 編輯器 - 用規則檔案確保一致性 - 核心原則 ## Content 昨天,一位 Anthropic 黑客松冠軍公開了他的 Claude Code 設定指南,我立刻全部照著做了一遍。花了一整天,但效果是真的。 這份指南來自 affaan(@affaanmustafa),他已經每天使用 Claude Code 長達 10 個月。看完他的配置後,我的第一個念頭是:「我之前到底在幹嘛?」 指南以 GitHub repo 的形式公開,核心訊息很明確:不是越多越好,而是剛好夠用。 ## 200K 上下文窗口是神話 - 實際可用的只有 70K Claude Code 的 200K 上下文窗口是理論上限。MCP 伺服器和外掛載太多,實際可用的上下文會直接縮水到 70K 左右。 affaan 的做法: 1. 配置 14 個 MCP 伺服器,但每個專案只啟用 5 到 6 個。 2. 同時啟用的工具控制在 80 個以內。 他實際的配置涵蓋 GitHub、Supabase、Vercel、Railway、Cloudflare 全系列、ClickHouse 等共 14 個伺服器。但他用 `disabledMcpServers` 明確停用不需要的。我套用這個模式之後,回應品質明顯提升。 ## Skills、Hooks、Subagents - 角色分離才是關鍵 這三個概念剛接觸時很容易搞混,但區分清楚非常重要。 - **Skills**:放在 `~/.claude/skills`。一個指令就能執行完整工作流,例如 `/refactor-clean`。 - **Hooks**:事件驅動的自動化。編輯 `.ts` 檔案後自動跑 Prettier 格式化、偵測到 `console.log` 就發出警告,諸如此類。hookify 外掛還能讓你透過對話直接生成 hook。 - **Subagents**:放在 `~/.claude/agents`。專職角色,像是 planner、architect、tdd-guide、security-reviewer,各自負責被委派的任務。 affaan 在三個執行時機掛上 hook - PreToolUse、PostToolUse 和 Stop - 自動處理格式化、型別檢查和安全稽核。這套模式也獲得了 Boris Cherny 的認可。 ## mgrep 和 Git Worktree 是真正的殺手級技巧 這份指南中最有實戰價值的部分: ### mgrep 比 ripgrep 更精準,還內建網頁搜尋功能。一個指令 `/mgrep 'function handleSubmit'` 就能同時搜尋本地檔案和網路。 ### Git Worktree 同時開發多個功能時,建立獨立的 checkout,在每個裡面各跑一個 Claude Code。也可以用 `/fork` 來分支對話。關於 worktree 和 repo clone 哪個比較好,目前社群還在討論 - 兩種做法各有取捨,取決於你的工作流。 ### Zed 編輯器 用 Rust 寫的,所以一直很輕量。Agent Panel 能即時追蹤 Claude 的檔案修改,`CMD+Shift+R` 可以馬上執行自訂指令。 ## 用規則檔案確保一致性 把 `~/.claude/rules` 按關注點拆分成模組: - **security.md** - 禁止硬編碼密鑰 - **coding-style.md** - 不可變性、檔案結構規範 - **testing.md** - TDD 流程、最低 80% 覆蓋率 - **git-workflow.md** - Commit 訊息格式 - **performance.md** - 模型選擇準則 把「絕對不能 commit console.log」之類的規則寫在這裡,再搭配 Stop hook 在結束前自動稽核變更。當自動化在程式碼推出去之前就攔截錯誤,失誤自然就消失了。 ## 核心原則 affaan 把他的理念濃縮成五條: - **把配置當微調,不是架構設計。** 小而精準的調整,勝過大刀闊斧的翻修。 - **上下文窗口是稀缺資源。** 沒在用的東西就停用。 - **善用平行執行。** 用 `/fork` 和 worktree 讓代理同時運作。 - **把重複工作自動化。** Hook 能消除拖慢你的手動步驟。 - **限縮子代理的職責範圍。** 每個代理只負責一件明確定義的事。 過度配置反而會拖累效率。只保留你真正在用的工具,才是生產力的真正樣貌。對大多數人來說,做減法是最難的,而這份指南就是最好的提醒。 補充一個我自己的經驗:在瀏覽器自動化方面,我發現 Vercel 的 agent-browser 比原指南提到的 Playwright 等工具穩定得多。它能處理的任務範圍和速度完全不在同一個層級。 完整設定可以在 affaan 的 GitHub repository 上找到。與其整包照抄,不如理解每個選擇背後的邏輯,再根據自己的工作流做調整。真正的價值在這裡。 ## Related URLs - Author: https://tonylee.im/zh-TW/author/ - Publication: https://tonylee.im/zh-TW/blog/about/ - Related article: https://tonylee.im/zh-TW/blog/eight-hooks-that-guarantee-ai-agent-reliability/ - Related article: https://tonylee.im/zh-TW/blog/medvi-two-person-430m-ai-compressed-funnel/ - Related article: https://tonylee.im/zh-TW/blog/claude-code-layers-over-tools-2026/ ## Citation - Author: Tony Lee - Site: tonylee.im - Canonical URL: https://tonylee.im/zh-TW/blog/claude-code-expert-complete-setup-guide/ ## Bot Guidance - This file is intended for AI agents, search assistants, and text-mode retrieval. - Prefer citing the canonical article URL instead of this text endpoint. - Use the rollout alternates when you need the same article in another prioritized language. --- Author: Tony Lee | Website: https://tonylee.im For more articles, visit: https://tonylee.im/zh-TW/blog/ This content is original and authored by Tony Lee. Please attribute when quoting or referencing.