跳到正文
Skillpedia
智能体29k · #9788

workflow-authoring

它能做什么

它是一份参考资料,讲解如何编写工作流背后的脚本,涵盖并行与顺序步骤、检查和恢复运行。适合为迁移或审计等大型任务构建可复用智能体工作流的人。

适用场景

  • ✓当你在为一个需要把工作分给多个智能体的工作流编写脚本时。
  • ✓当迁移或审计等大型任务需要并行步骤和检查时。
  • ✓当你需要在并行运行步骤和顺序运行步骤之间做选择时。

技能链接

https://github.com/QwenLM/qwen-code/blob/main/packages/core/src/skills/bundled/workflow-authoring/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/QwenLM/qwen-code/blob/main/packages/core/src/skills/bundled/workflow-authoring/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我编写一个工作流脚本,并行审计这个仓库中的每个模块,然后把发现的问题合并起来。”

每周 5 个新技能,1 分钟读完。

工作原理

该参考说明如何组织脚本、何时分发工作、如何验证结果,以及如何合并结果。它本身不会启动运行。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Workflow authoring reference

Everything below is about writing the script. Whether a workflow may run at all is decided by the Workflow tool's own opt-in rule — this reference does not authorize a run.

Reach for one to be comprehensive (decompose the work and cover every part in parallel), to be confident (independent perspectives and adversarial checks before an answer is committed to), or to take on scale a single context cannot hold — migrations, audits, broad sweeps. The script is where that structure is encoded: what fans out, what verifies, what synthesizes. Parallelism on its own is not a reason; work that is already one short sequence of edits belongs in the main loop.

Scout first, then orchestrate

The strongest pattern is hybrid: discover the work list in the main loop (list the files, scope the diff, read the failing test), then hand that list to a workflow. You do not need to know the shape of the work before the task — only before the orchestration step. When the work has distinct phases, run several small workflows across turns and read each result before choosing the next, rather than authoring one large script that runs unattended.

Common single-phase shapes: understand (parallel readers over subsystems, merged into one map), design (independent approaches, judged, then synthesized), review (dimensions, find, verify each finding), research (broad sweep, deep read, synthesis), migrate (discover sites, transform each under isolation: 'worktree', verify).

Script contract

The source is wrapped as an async IIFE, so top-level await and a top-level return are both legal — and a trailing expression is not a return value. End every successful path with an explicit return.

It is plain JavaScript, not TypeScript, and it cannot import anything. A script with a dynamic import() anywhere in it — even in a branch that never runs — is refused before it starts, so none of its agents runs first; do file, network, and package work inside an agent instead.

The script may start with a literal export const meta = {...} declaration with name, description, and optionally whenToUse and phases: [{ title, detail? }]. It must be a pure literal — no variables, calls, or interpolation — and it is stripped before execution, so nothing in the script body can read it. Fields outside that list are dropped. The approval dialog prints the name, the description, and each phase title with its detail as a one-line explanation beside it: give every phase a detail, because for a run that may dispatch hundreds of agents it is what the user reads before approving. In a workflow an extension ships, whenToUse also lists the workflow for the model to start when a request matches it; leave it out and the workflow runs only when someone asks for it by name.

Injected globals, and nothing else:

  • phase(title) — open a phase. Everything dispatched afterwards is attributed to it in the live phase tree, until the next phase opens.
  • log(msg) — one line into the run log the user watches.
  • agent(prompt, opts?) — dispatch one subagent. See agent() options.
  • parallel(thunks) — run thunks through the shared concurrency window, resolving to a position-aligned array. parallel() itself rejects on invalid arguments.
  • pipeline(items, ...stages) — run each item through the stages independently. See Default to pipeline().
  • workflow(nameOrRef, args?, { stepId }?) — run a saved workflow inline. See Saved workflows and workflow().
  • args — the structured value the caller passed, or undefined.
  • budget — { total, spent(), remaining() }. See Scaling to the token budget.

Pass THUNKS to parallel(), not eager calls: parallel([() => agent(...)]), not parallel([agent(...)]). The eager form is refused outright: a non-function element rejects the whole batch, and by then every agent() in it has already been admitted, counted against the caps, and spent — with its result discarded.

Each list a single call takes — the thunks of parallel(), and the items and the stages of pipeline() — holds at most 4096 entries. A longer list rejects the whole call before any of its thunks or stages runs; it is never truncated. Like any invalid argument, that rejection can be caught, and inside an outer parallel()/pipeline() it becomes that slot's null. The limit is per call, not per run: split a larger input into batches of thunks and await each in turn. Batching does not

常见问题

阅读它会启动工作流吗?

不会。它只说明如何编写脚本,运行仍需你的批准。

什么时候不应使用工作流?

如果工作只是一小段连续的编辑,就应放在普通的循环中完成。

我可以分阶段运行吗?

可以。该参考建议跨多轮运行小型工作流,并在进入下一步之前阅读每个结果。

详情

作者的原始描述

Reference for writing a Workflow tool script (script API and gotchas, agent() options, pipeline() vs parallel(), verification and convergence patterns, resume, worked example). Load before authoring a script for a workflow the user already opted into; it does not itself authorize running one.

repo: QwenLM/qwen-code

热度

GitHub 星标
29k
排名
#9788
许可证
Apache-2.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能