每项任务的专属框架:Claude Code 中的动态工作流
Last week, we released dynamic workflows in Claude Code. Claude can now write its own harness on the fly, custom-built for the task at hand.
上周,我们在 Claude Code 中发布了动态工作流。Claude 现在可以即时编写自己的harness,为手头的任务量身定制。
While the default Claude Code harness is built for coding, it is also useful for many other types of tasks because, as it turns out, many tasks resemble coding tasks. But there are certain classes of tasks where we have had to build custom harnesses on top of Claude Code to achieve peak performance such as Research, security analysis, agent teams, or Code Review.
虽然默认的 Claude Code harness 是为编码而构建的,但它也适用于许多其他类型的任务,因为事实证明,许多任务都类似于编码任务。但是,对于某些类别的任务,我们必须在 Claude Code 之上构建自定义 harness 以实现最佳性能,例如Research、security analysis、agent teams或Code Review。
Workflows allow you to dynamically create harnesses that enable Claude to solve all of those problems and more natively inside of Claude Code. You can also share and re-use these workflows with others.
工作流允许你动态创建 harness,使 Claude 能够在 Claude Code 中原生解决所有这些问题及更多问题。你还可以与他人共享和重复使用这些工作流。
In this article, I’ll cover my initial workflows experiences and learnings so you can take full advantage.
在本文中,我将介绍我最初的工作流经验和心得,以便你能充分利用它们。
That said, best practices are still developing! Dynamic workflows often use more tokens, so think carefully about when and how to use them. Note: this post is also available on the Claude Blog
话虽如此,最佳实践仍在不断发展!动态工作流通常会消耗更多 token,因此请仔细考虑何时以及如何使用它们。注意:这篇文章也发布在 Claude Blog 上
Example prompts
提示词示例
Before diving into the technical details, I’d like to start with some example prompts to get you thinking about the possibilities with workflows:
在深入探讨技术细节之前,我想先分享一些提示词示例,启发您思考工作流的各种可能性:
- "This test fails maybe 1 in 50 runs. Set up a workflow to reproduce it, form theories and adversarially test them in worktrees /goal don't stop until one theory works."
- “这个测试大概每 50 次运行会失败 1 次。设置一个工作流来重现它,提出假设并在 worktrees 中进行对抗性测试 /goal 直到有一个假设成功才停止。”
- "Using a workflow, go through my last 50 sessions and mine them for corrections I keep making and turn the recurring ones into CLAUDE.md rule...