# 令我徹底重新諗過嘅 Claude Code 設定指南 > Author: Tony Lee > Published: 2026-02-08 > URL: https://tonylee.im/zh-HK/blog/claude-code-expert-complete-setup-guide/ > Reading time: 2 minutes > Language: zh-HK > Tags: ai, claude-code, developer-tools, productivity, workflow ## Canonical https://tonylee.im/zh-HK/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 配置。由 Context Window 管理到 MCP Server 篩選、Skills/Hooks/子代理分工,全套設定即學即用。 ## Summary 令我徹底重新諗過嘅 Claude Code 設定指南 is part of Tony Lee's ongoing coverage of AI agents, developer tools, startup strategy, and AI industry shifts. ## Outline - 200K Context Window 係假象 - 實際得返 70K - Skills vs Hooks vs 子代理 - 角色分工先係關鍵 - mgrep 同 Git Worktrees 係真正嘅殺手鐧 - mgrep - Git Worktrees - Zed 編輯器 - 規則結構化確保一致性 - 核心原則 ## Content 尋日有個 Anthropic 黑客松得獎者公開咗佢嘅 Claude Code 設定指南,我即刻逐樣照住做。搞咗成日,效果係真實可見嘅。 呢份指南嚟自 affaan(@affaanmustafa),佢連續用咗 Claude Code 10個月。睇完佢嘅配置之後,我第一個念頭係:「我呢段時間究竟喺度搞緊乜?」 指南以 GitHub repo 嘅形式公開,核心訊息好清楚:唔係越多越好,而係剛剛好就夠。 ## 200K Context Window 係假象 - 實際得返 70K Claude Code 嘅 200K context window 係理論上限。如果你載入太多 MCP server 同 plugin,實際可用嘅 context 會跌到大約 70K。 affaan 嘅做法: 1. 配置 14 個 MCP server,但每個項目只啟用 5-6 個。 2. 同一時間啟用嘅工具控制喺 80 個以下。 佢實際嘅配置包括 GitHub、Supabase、Vercel、Railway、Cloudflare 系列、ClickHouse 等 - 總共 14 個 server。但佢會透過 `disabledMcpServers` 明確停用唔用嘅嗰啲。我跟住呢個模式做之後,回應質素有明顯提升。 ## Skills vs Hooks vs 子代理 - 角色分工先係關鍵 呢三個概念一開始好容易搞混,但區分清楚好重要。 - **Skills**:放喺 `~/.claude/skills`。用一個指令(例如 `/refactor-clean`)就可以跑起成套工作流。 - **Hooks**:事件驅動嘅自動化。編輯 `.ts` 檔案之後自動用 Prettier 格式化、偵測到 `console.log` 就出警告等等。hookify 插件可以透過對話直接生成 hook。 - **子代理**:放喺 `~/.claude/agents`。planner、architect、tdd-guide、security-reviewer 呢類專責角色,負責處理委派落嚟嘅任務。 affaan 喺三個執行時間點設定 hook - PreToolUse、PostToolUse 同 Stop - 自動處理格式化、型別檢查同安全審計。呢個模式亦得到 Boris Cherny 嘅認可。 ## mgrep 同 Git Worktrees 係真正嘅殺手鐧 指南入面最實用嘅貼士: ### mgrep 比 ripgrep 更準確,內建網頁搜尋支援。一句 `/mgrep 'function handleSubmit'` 就可以同時搜尋本地檔案同網頁。 ### Git Worktrees 同時做多個功能嗰陣,建立獨立嘅 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 將佢嘅理念歸納成五條原則: - **將配置當成微調,唔係架構設計。** 細小而精準嘅調整,好過大刀闊斧嘅改造。 - **Context window 係寶貴資源。** 唔用嘅嘢就停用佢。 - **善用並行執行。** 用 `/fork` 同 worktree 同時跑多個代理。 - **將重複工作自動化。** Hook 可以消除拖慢你嘅手動步驟。 - **限制子代理嘅職責範圍。** 每個代理只負責一個明確、細小嘅責任。 過度配置適得其反。只保留你真正用緊嘅工具處於啟用狀態,先係真正嘅生產力。對大部分人嚟講,「減」係最難嘅部分,而呢份指南正正提醒咗呢一點。 補充一個個人經驗:喺瀏覽器自動化方面,我發現 Vercel 嘅 agent-browser 比原指南入面提到嘅 Playwright 等工具穩定得多。佢處理嘅速度同任務範圍完全係另一個層次。 完整配置可以喺 affaan 嘅 GitHub repo 搵到。與其成套照抄,不如理解每個選擇背後嘅理由,再根據自己嘅工作流去調整。真正嘅價值就喺呢度。 ## Related URLs - Author: https://tonylee.im/en/author/ - Publication: https://tonylee.im/en/blog/about/ - Related article: https://tonylee.im/zh-HK/blog/eight-hooks-that-guarantee-ai-agent-reliability/ - Related article: https://tonylee.im/zh-HK/blog/medvi-two-person-430m-ai-compressed-funnel/ - Related article: https://tonylee.im/zh-HK/blog/claude-code-layers-over-tools-2026/ ## Citation - Author: Tony Lee - Site: tonylee.im - Canonical URL: https://tonylee.im/zh-HK/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-HK/blog/ This content is original and authored by Tony Lee. Please attribute when quoting or referencing.