Claude Code之父Boris Cherny分享13个高效使用技巧

发布于 2026-01-06 · Claude Code之父Boris Cherny分享Claude Code的工作流和使用技巧,如何并行运行多个Claude实例、多平台协同工作、使用Opus 4.5模型、团队共享文件、计划模式...

Claude Code之父Boris Cherny把自己用Claude Code的工作流和技巧公开了一遍,一共13条:怎么并行跑多个Claude实例、怎么多平台协同、怎么用Claude Opus 4.5模型、团队怎么共享文件、怎么用计划模式起会话、怎么建斜杠命令、怎么用子代理、怎么格式化代码、怎么预设权限、怎么处理长时间任务等等。这几招对提升 AI 编程效率很实在,开发者值得照着学一遍。

中文译文

我是Claude Code的开发者Boris。老有人问我到底怎么用 Claude Code,所以我想把自己的配置展示一下。

我的配置挺简单!Claude Code 开箱就很好用,我个人没做太多定制。用 Claude Code 没有唯一正确的姿势:我们故意把它做成既能直接上手、也能随便你定制和改造的样子。Claude Code 团队里每个人用法都不一样。

具体是这样。

1、

在终端里同时跑5个Claude实例。标签页按1-5编号,靠系统通知来判断哪个Claude在等输入指令。https://code.claude.com/docs/en/terminal-config#iterm-2-system-notifications

2、

同时在 http://claude.ai/code 上再跑5-10个Claude实例,跟本地Claude并行干活。在终端写代码时,我经常把本地会话交给网页端(用&符号),或者在Chrome里手动起新会话,有时还会用–teleport参数在两端来回切。每天早上以及白天的工作里,我还会用手机(通过Claude iOS应用)开几个会话,晚点再回来看进度。

3、

所有任务都用支持深度思考的Opus 4.5模型。这是我用过的最好的编程模型——虽然比Sonnet版本更大、响应稍慢,但它几乎不需要人工引导,工具调用能力也更强,实际效率反而比小模型更高。

4、

我们团队共用一个为Claude Code代码库设置的 http://CLAUDE.md 文件。它 check in 到 git 里,全体成员每周都会协作更新好几轮。每次发现Claude的操作跑偏,我们就把这条记到 http://CLAUDE.md 里,Claude下次就能避开同样的问题。其他团队也各自维护着自己的 http://CLAUDE.md 文件,把内容及时更新当成基本职责。

5、

做代码审查时,我经常在同事的PR里标记@.claude,把该补进http://CLAUDE.md的内容当作 PR 的一部分。这块我们专门用Claude Code的Github Action(通过/install-github-action安装)。按@danshipper提出的“复利式工程”(Compounding Engineering)的说法,这就是我们团队的版本。

6、

大多数会话我都从规划模式开始(Plan mode,按两次shift+tab键)。如果目标是写一份Pull Request,就先在规划模式里和Claude来回沟通,直到方案让我满意。之后切到自动接受编辑模式(auto-accept edits mode),Claude通常一次就能搞定。一份好规划真的非常关键!

7、

每天要重复很多次的“内循环”(inner loop)工作流,我全部做成斜杠命令。这样既省得反复写提示词,Claude 自己也能调用这些工作流。命令都通过git管理,放在.claude/commands/目录里。比如/commit-push-pr这条斜杠命令,我和Claude每天要用几十次——它通过内联bash预计算git状态等信息,跑得快,省掉了跟模型来回沟通的时间。https://code.claude.com/docs/en/slash-commands#bash-command-execution

8、

有几个子智能体我用得很频繁:code-simplifier在Claude完成工作之后把代码再简化一遍,verify-app里写了端到端测试Claude Code的详细指令,等等。和斜杠命令一样,我把子智能体理解成「把我给大多数PR做的那些最常见工作流自动化掉」。https://code.claude.com/docs/en/sub-agents

9、

我们用PostToolUse钩子函数来格式化Claude生成的代码。Claude一般直接就能输出格式规范的代码,剩下的10%细节交给钩子,后面CI(持续集成)流程里就不会冒出格式错误。

10、

我不使用–dangerously-skip-permissions参数,而是用/permissions命令,把环境里确认安全的常用bash命令预先授权,省掉那些没必要的权限提示。这些设置大多存在.claude/settings.json文件里,并且和团队共享。

11、

Claude Code帮我把所有工具都调起来了:我经常通过MCP服务器搜索并发布Slack消息、跑BigQuery查询来分析数据(用bq命令行工具)、从Sentry抓错误日志,等等。我们的Slack MCP配置存在.mcp.json文件里,供团队共享使用。

12、

遇到耗时很长的任务,我一般三种办法挑一个:

  • (a) 让Claude做完之后,通过后台代理自己验一遍工作结果;
  • (b) 用一个代理Stop钩子,用更确定的方式做验证;
  • (c) 用ralph-wiggum插件。

同时在沙箱环境里,我会用–permission-mode=dontAsk或者–dangerously-skip-permissions参数,别让会话里的权限提示把Claude的连续工作流卡住。

https://github.com/anthropics/claude-plugins-official/tree/main/plugins/ralph-wiggum

https://code.claude.com/docs/en/hooks-guide

13、

最后一个小窍门:想让Claude Code交出漂亮的成果,最关键的一点大概就是——给Claude一套验证自己工作的机制。有了这个反馈循环,最终结果的质量能翻2-3倍。

比如我每次往http://claude.ai/code提交改动,Claude都会通过Chrome扩展跑一遍全流程测试:自己打开浏览器、检测用户界面,一直迭代到代码跑得通、用户体验顺为止。

验证机制得看具体领域——可能是一条简单的bash命令,也可能是一整套测试套件,或者是在浏览器/手机模拟器里测应用。这块的投入一定要舍得,把验证体系做扎实。

英文原文

I’m Boris and I created Claude Code. Lots of people have asked how I use Claude Code, so I wanted to show off my setup a bit.

My setup might be surprisingly vanilla! Claude Code works great out of the box, so I personally don’t customize it much. There is no one correct way to use Claude Code: we intentionally build it in a way that you can use it, customize it, and hack it however you like. Each person on the Claude Code team uses it very differently.

So, here goes.

1/ I run 5 Claudes in parallel in my terminal. I number my tabs 1-5, and use system notifications to know when a Claude needs input

https://code.claude.com/docs/en/terminal-config#iterm-2-system-notifications

2/ I also run 5-10 Claudes on http://claude.ai/code, in parallel with my local Claudes. As I code in my terminal, I will often hand off local sessions to web (using &), or manually kick off sessions in Chrome, and sometimes I will –teleport back and forth. I also start a few sessions from my phone (from the Claude iOS app) every morning and throughout the day, and check in on them later.

3/ I use Opus 4.5 with thinking for everything. It’s the best coding model I’ve ever used, and even though it’s bigger & slower than Sonnet, since you have to steer it less and it’s better at tool use, it is almost always faster than using a smaller model in the end.

4/ Our team shares a single http://CLAUDE.md for the Claude Code repo. We check it into git, and the whole team contributes multiple times a week. Anytime we see Claude do something incorrectly we add it to the http://CLAUDE.md, so Claude knows not to do it next time. Other teams maintain their own http://CLAUDE.md‘s. It is each team’s job to keep theirs up to date.

5/ During code review, I will often tag @.claude on my coworkers’ PRs to add something to the http://CLAUDE.md as part of the PR. We use the Claude Code Github action (/install-github-action) for this. It’s our version of @danshipper‘s Compounding Engineering

6/ Most sessions start in Plan mode (shift+tab twice). If my goal is to write a Pull Request, I will use Plan mode, and go back and forth with Claude until I like its plan. From there, I switch into auto-accept edits mode and Claude can usually 1-shot it. A good plan is really important!

7/ I use slash commands for every “inner loop” workflow that I end up doing many times a day. This saves me from repeated prompting, and makes it so Claude can use these workflows, too. Commands are checked into git and live in .claude/commands/. For example, Claude and I use a /commit-push-pr slash command dozens of times every day. The command uses inline bash to pre-compute git status and a few other pieces of info to make the command run quickly and avoid back-and-forth with the model (https://code.claude.com/docs/en/slash-commands#bash-command-execution)

8/ I use a few subagents regularly: code-simplifier simplifies the code after Claude is done working, verify-app has detailed instructions for testing Claude Code end to end, and so on. Similar to slash commands, I think of subagents as automating the most common workflows that I do for most PRs. https://code.claude.com/docs/en/sub-agents
9/ We use a PostToolUse hook to format Claude’s code. Claude usually generates well-formatted code out of the box, and the hook handles the last 10% to avoid formatting errors in CI later.
10/ I don’t use –dangerously-skip-permissions. Instead, I use /permissions to pre-allow common bash commands that I know are safe in my environment, to avoid unnecessary permission prompts. Most of these are checked into .claude/settings.json and shared with the team.
11/ Claude Code uses all my tools for me. It often searches and posts to Slack (via the MCP server), runs BigQuery queries to answer analytics questions (using bq CLI), grabs error logs from Sentry, etc. The Slack MCP configuration is checked into our .mcp.json and shared with the team.
12/ For very long-running tasks, I will either (a) prompt Claude to verify its work with a background agent when it’s done, (b) use an agent Stop hook to do that more deterministically, or (c) use the ralph-wiggum plugin (originally dreamt up by@GeoffreyHuntley). I will also use either –permission-mode=dontAsk or –dangerously-skip-permissions in a sandbox to avoid permission prompts for the session, so Claude can cook without being blocked on me.
https://github.com/anthropics/claude-plugins-official/tree/main/plugins/ralph-wiggum https://code.claude.com/docs/en/hooks-guide
13/ A final tip: probably the most important thing to get great results out of Claude Code — give Claude a way to verify its work. If Claude has that feedback loop, it will 2-3x the quality of the final result. Claude tests every single change I land to http://claude.ai/code using the Claude Chrome extension. It opens a browser, tests the UI, and iterates until the code works and the UX feels good. Verification looks different for each domain. It might be as simple as running a bash command, or running a test suite, or testing the app in a browser or phone simulator. Make sure to invest in making this rock-solid. https://code.claude.com/docs/en/chrome
0

相关文章

0 条评论

后参与评论

暂无评论,来抢沙发。