AI 語音朗讀 · Edge TTS
Claude Code 是一套功能豐富的開發工具,但許多強大的功能鮮為人知。本文整理 15 項實用技巧,涵蓋跨裝置協作、自動化工作流、並行開發等高級用法,展示 Claude Code 遠超基礎認知的能力。
行動端開發工作流
Claude 提供 iOS 和 Android 應用程式,讓開發者無需開啟筆電即可隨時進行程式碼修改。透過在應用程式的「Code」分頁,使用者可在行動裝置端進行開發工作,大幅提升工作彈性。
跨平台會話同步與遠端控制
- 執行
claude --teleport或輸入/teleport指令,可將雲端會話無縫轉移至本地機器繼續工作 - 使用
/remote-control從手機或網路介面遠端控制本地運行的會話,支援多裝置間的協作
排程與迴圈自動化
/loop 和 /schedule 是 Claude Code 最強大的兩項功能。使用者可排程 Claude 在設定的時間間隔內自動執行,最長可達一週。例如使用 /loop 5m /babysit 可在本地自動處理程式碼審查、自動rebase 等重複性工作,大幅減少手動操作。
Agent 生命週期鉤子
hook 功能可在 Agent 執行過程中確定性地運行邏輯:
- 每次啟動 Claude 時動態載入上下文(SessionStart)
- 記錄模型執行的每條 bash 指令(PreToolUse)
- 將權限提示導向 WhatsApp 進行批准
遠端協作與 Dispatch
Dispatch 是 Claude Desktop 應用的安全遠端控制工具,作者每天都在使用。其主要用途包括:處理 Slack 和電子郵件、檔案管理、在非工作電腦環境下執行筆記本工作。Dispatch 可存取 MCPs、瀏覽器及其他工具,是離開電腦時保持生產力的關鍵。
前端開發的 Chrome 擴充功能
使用 Claude Code 進行前端工作時,最重要的原則是給予 Claude 驗證輸出的途徑。一旦提供回饋機制,Claude 會不斷迭代直至結果達到理想狀態——就像任何工程師一樣,如果你要求某人構建網站卻無法看到結果,工作效率會大幅下降。Chrome 擴充功能正是為此而設計。
自動化網路伺服器測試
Claude Desktop 應用內建功能,可自動啟動和測試網路伺服器。系統會在內建瀏覽器中執行測試,無需手動驗證。類似功能也可透過 CLI 或其他設置實現,但 Desktop 應用提供最便捷的整合體驗。
會話分支
開發過程中可能需要從現有會話分岔出獨立分支。有兩種方式實現:
- 在會話中執行
/branch指令 - 透過 CLI 執行
claude --resume <session-id> --fork-session
附帶查詢功能
/btw 指令可在 Agent 繼續工作的同時提出快速問題,無需中斷主要工作流,適合處理臨時疑問。
Git Worktrees 深度支援
Claude Code 內建完整的 git worktree 支援。Worktrees 對並行開發至關重要——作者同時運行數十個 Claude 會話,完全仰賴這項功能。使用 claude -w 可在新的 worktree 中啟動會話,支援在同一儲存庫內進行大規模並行工作。
批次工作分配
/batch 指令可將大規模程式碼異動分散到多個 worktree Agent 執行。系統會先進行問卷訪問,隨後自動分配工作到數十、數百甚至數千個 Agent,適用於大型程式碼遷移等可並行化的工作。這項功能充分發揮了 Claude Code 的並行處理潛力。
SDK 啟動最佳化
使用 --bare 標誌可將 SDK 啟動速度提升最多 10 倍。預設情況下,執行 claude -p 或 TypeScript/Python SDK 時,系統會搜尋本地 CLAUDE.md、設定和 MCPs。但對於非互動式使用,大多數情況下應明確指定要載入的內容,避免不必要的搜尋開銷。
擴展資料夾存取
跨多個儲存庫工作時,可在一個儲存庫啟動 Claude,再使用 --add-dir(或 /add-dir)讓 Claude 存取其他儲存庫。這不僅告知 Claude 儲存庫的內容,還授予其檔案系統權限,支援協作開發場景。
自訂 Agent 與系統提示
--agent 標誌允許為 Claude Code 定義自訂系統提示和工具集。自訂 Agent 是強大的原始功能,但常被忽視。使用者可在 .claude/agents 中定義新 Agent,然後以 claude --agent=<agent-name> 執行,實現高度客製化的開發流程。
語音輸入功能
作者透露大多數程式碼撰寫工作完全透過語音與 Claude 互動,而非鍵盤輸入。啟用方式包括在 CLI 執行 /voice 後按住空白鍵、在 Desktop 按下語音按鈕,或在 iOS 設定中啟用聽寫功能。這項功能展現了 Claude Code 對多模態互動的支援。
I wanted to share a bunch of my favorite hidden and under-utilized features in Claude Code. I'll focus on the ones I use the most.
— Boris Cherny (@bcherny) March 30, 2026
Here goes.
1/ Did you know Claude Code has a mobile app?
— Boris Cherny (@bcherny) March 30, 2026
Personally, I write a lot of my code from the iOS app. It's a convenient way to make changes without opening a laptop.
Download the Claude app for iOS/Android > Code tab on the left. pic.twitter.com/WiuGrbfeyI
2/ Move sessions back and forth between mobile/web/desktop and terminal
— Boris Cherny (@bcherny) March 30, 2026
Run "claude --teleport" or /teleport to continue a cloud session on your machine.
Or run /remote-control to control a locally running session from your phone/web. Personally, I have "Enable Remote Control…
3/ Two of the most powerful features in Claude Code: /loop and /schedule
— Boris Cherny (@bcherny) March 30, 2026
Use these to schedule Claude to run automatically at a set interval, for up to a week at a time.
I have a bunch of loops running locally:
- /loop 5m /babysit, to auto-address code review, auto-rebase, and…
4/ Use hooks to deterministically run logic as part of the agent lifecycle
— Boris Cherny (@bcherny) March 30, 2026
For example, use hooks to:
- Dynamically load in context each time you start Claude (SessionStart)
- Log every bash command the model runs (PreToolUse)
- Route permission prompts to WhatsApp for you to…
5/ Cowork Dispatch
— Boris Cherny (@bcherny) March 30, 2026
I use Dispatch every day to catch up on Slack and emails, manage files, and do things on my laptop when I'm not at a computer. When I'm not coding, I'm dispatching.
Dispatch is a secure remote control for the Claude Desktop app. It can use your MCPs, browser,…
6/ Use the Chrome extension for frontend work
— Boris Cherny (@bcherny) March 30, 2026
The most important tip for using Claude Code is: give Claude a way to verify its output. Once you do that, Claude will iterate until the result is great.
Think of it like any other engineer: if you ask someone to build a website but…
7/ Use the Claude Desktop app to have Claude automatically start and test web servers
— Boris Cherny (@bcherny) March 30, 2026
Along the same vein, the Desktop app bundles in the ability for Claude to automatically run your web server and even test it in a built-in browser.
You can set up something similar in CLI or…
8/ Fork your session
— Boris Cherny (@bcherny) March 30, 2026
People often ask how to fork an existing session. Two ways:
1. Run /branch from your session
2. From the CLI, run claude --resume <session-id> --fork-session pic.twitter.com/zqj1Iwh361
9/ Use /btw for side queries
— Boris Cherny (@bcherny) March 30, 2026
I use this all the time to answer quick questions while the agent works pic.twitter.com/hO02jUTWh2
10/ Use git worktrees
— Boris Cherny (@bcherny) March 30, 2026
Claude Code ships with deep support for git worktrees. Worktrees are essential for doing lots of parallel work in the same repository. I have dozens of Claudes running at all times, and this is how I do it.
Use claude -w to start a new session in a…
11/ Use /batch to fan out massive changesets
— Boris Cherny (@bcherny) March 30, 2026
/batch interviews you, then has Claude fan out the work to as many worktree agents as it takes (dozens, hundreds, even thousands) to get it done.
Use it for large code migrations and others kinds of parallelizable work.…
12/ Use --bare to speed up SDK startup by up to 10x
— Boris Cherny (@bcherny) March 30, 2026
By default, when you run claude -p (or the TypeScript or Python SDKs) we search for local CLAUDE.md's, settings, and MCPs.
But for non-interactive usage, most of the time you want to explicitly specify what to load via… pic.twitter.com/RfoK5lAsIR
13/ Use --add-dir to give Claude access to more folders
— Boris Cherny (@bcherny) March 30, 2026
When working across multiple repositories, I usually start Claude in one repo and use --add-dir (or /add-dir) to let Claude see the other repo. This not only tells Claude about the repo, but also gives it permissions to…
14/ Use --agent to give Claude Code a custom system prompt & tools
— Boris Cherny (@bcherny) March 30, 2026
Custom agents are a powerful primitive that often gets overlooked.
To use it, just define a new agent in .claude/agents, then run claude --agent=<your agent's name>https://t.co/BqVPwRthLv pic.twitter.com/JiB98KI5eA
15/ Use /voice to enable voice input
— Boris Cherny (@bcherny) March 30, 2026
Fun fact: I do most of my coding by speaking to Claude, rather than typing.
To do the same, run /voice in CLI then hold the space bar, press the voice button on Desktop, or enable dictation in your iOS settings.
