From 6046c4c3348b02f2ca0da6a7ca14ba93bff61d8c Mon Sep 17 00:00:00 2001 From: jiangnan <1394485448@qq.com> Date: Tue, 24 Mar 2026 07:44:50 +0800 Subject: [PATCH] feat: add DeerFlow 2.0 support + workflow-runner skill - Install script detects deer_flow/ and copies skills to skills/custom/ - Add DeerFlow to README tool list and install instructions - Add docs/README.deerflow.md install guide - Add deerflow keyword to package.json - Include workflow-runner skill (20 skills total) --- .claude-plugin/marketplace.json | 4 +- .claude-plugin/plugin.json | 2 +- README.md | 6 +- bin/superpowers-zh.js | 3 +- docs/README.deerflow.md | 65 ++++++++++++ package.json | 3 +- skills/workflow-runner/SKILL.md | 172 ++++++++++++++++++++++++++++++++ 7 files changed, 248 insertions(+), 7 deletions(-) create mode 100644 docs/README.deerflow.md create mode 100644 skills/workflow-runner/SKILL.md diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index d974368..0cc715a 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -1,6 +1,6 @@ { "name": "superpowers-zh", - "description": "AI 编程超能力中文版:19 个 skills 库", + "description": "AI 编程超能力中文版:20 个 skills 库", "owner": { "name": "jnMetaCode", "url": "https://github.com/jnMetaCode" @@ -8,7 +8,7 @@ "plugins": [ { "name": "superpowers-zh", - "description": "AI 编程超能力中文版:19 个 skills(14 翻译 + 5 中国特色原创)", + "description": "AI 编程超能力中文版:20 个 skills(14 翻译 + 5 中国特色原创)", "version": "1.0.0", "source": "./", "author": { diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index ecaaeda..16580e9 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "superpowers-zh", - "description": "AI 编程超能力中文版:19 个 skills(14 翻译 + 5 中国特色原创)", + "description": "AI 编程超能力中文版:20 个 skills(14 翻译 + 5 中国特色原创)", "version": "1.0.0", "author": { "name": "jnMetaCode", diff --git a/README.md b/README.md index 8003c18..be78f0b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Chinese community edition of [superpowers](https://github.com/obra/superpowers), | 📦 翻译 Skills | 🇨🇳 中国特色 Skills | 🤖 支持工具 | |:---:|:---:|:---:| -| **14** | **5** | **Claude Code / Cursor / Codex / Kiro / Trae / Antigravity / VS Code / Gemini** | +| **14** | **5** | **Claude Code / Cursor / Codex / Kiro / DeerFlow / Trae / Antigravity / VS Code / Gemini** | --- @@ -77,6 +77,7 @@ cp -r superpowers-zh/skills /your/project/.claude/skills # Claude Code cp -r superpowers-zh/skills /your/project/.cursor/skills # Cursor cp -r superpowers-zh/skills /your/project/.codex/skills # Codex CLI cp -r superpowers-zh/skills /your/project/.kiro/steering # Kiro +cp -r superpowers-zh/skills /your/project/skills/custom # DeerFlow 2.0 cp -r superpowers-zh/skills /your/project/.trae/rules # Trae cp -r superpowers-zh/skills /your/project/.antigravity # Antigravity ``` @@ -89,12 +90,13 @@ cp -r superpowers-zh/skills /your/project/.antigravity # Antigravity |------|---------|------| | Claude Code | `CLAUDE.md` | 项目根目录 | | Kiro | `.kiro/steering/*.md` | 支持 always/globs/手动三种模式 | +| DeerFlow 2.0 | `skills/custom/*/SKILL.md` | 字节跳动开源 SuperAgent,自动发现自定义 skills | | Trae | `.trae/rules/project_rules.md` | 项目级规则 | | Antigravity | `GEMINI.md` 或 `AGENTS.md` | 项目根目录 | | VS Code | `.github/copilot-instructions.md` | Copilot 自定义指令 | | Cursor | `.cursor/rules/*.md` | 项目级规则目录 | -> **详细安装指南**:[Kiro](docs/README.kiro.md) · [Trae](docs/README.trae.md) · [Antigravity](docs/README.antigravity.md) · [VS Code](docs/README.vscode.md) · [Codex](docs/README.codex.md) · [OpenCode](docs/README.opencode.md) +> **详细安装指南**:[Kiro](docs/README.kiro.md) · [DeerFlow](docs/README.deerflow.md) · [Trae](docs/README.trae.md) · [Antigravity](docs/README.antigravity.md) · [VS Code](docs/README.vscode.md) · [Codex](docs/README.codex.md) · [OpenCode](docs/README.opencode.md) --- diff --git a/bin/superpowers-zh.js b/bin/superpowers-zh.js index bbcef19..2591161 100755 --- a/bin/superpowers-zh.js +++ b/bin/superpowers-zh.js @@ -15,6 +15,7 @@ const TARGETS = [ { name: 'Cursor', dir: '.cursor/skills', detect: '.cursor' }, { name: 'Codex CLI', dir: '.codex/skills', detect: '.codex' }, { name: 'Kiro', dir: '.kiro/steering', detect: '.kiro' }, + { name: 'DeerFlow', dir: 'skills/custom', detect: 'deer_flow' }, { name: 'Trae', dir: '.trae/rules', detect: '.trae' }, { name: 'Antigravity', dir: '.antigravity/skills', detect: '.antigravity' }, { name: 'VS Code', dir: '.github/superpowers', detect: '.github/copilot-instructions.md' }, @@ -36,7 +37,7 @@ function showHelp() { 说明: 自动检测当前项目使用的 AI 编程工具: - Claude Code / Cursor / Codex / Kiro / Trae / Antigravity / VS Code + Claude Code / Cursor / Codex / Kiro / DeerFlow / Trae / Antigravity / VS Code 将 ${countDirs(SKILLS_SRC)} 个 skills 安装到对应目录。 Claude Code 还会额外安装 agents 到 .claude/agents/。 如果未检测到任何工具,默认安装到 .claude/skills/ 和 .claude/agents/。 diff --git a/docs/README.deerflow.md b/docs/README.deerflow.md new file mode 100644 index 0000000..fd1adea --- /dev/null +++ b/docs/README.deerflow.md @@ -0,0 +1,65 @@ +# Superpowers 中文版 — DeerFlow 2.0 安装指南 + +在 [DeerFlow 2.0](https://github.com/bytedance/deer-flow)(字节跳动开源 SuperAgent)中使用 superpowers-zh 的完整指南。 + +## 快速安装 + +```bash +cd /your/deerflow-project +npx superpowers-zh +``` + +安装脚本会自动检测 `deer_flow/` 目录并将 skills 复制到 `skills/custom/`。 + +## 手动安装 + +```bash +git clone https://github.com/jnMetaCode/superpowers-zh.git +mkdir -p /your/deerflow-project/skills/custom +cp -r superpowers-zh/skills/* /your/deerflow-project/skills/custom/ +``` + +## 工作原理 + +DeerFlow 2.0 使用 **Custom Skills** 机制扩展 Agent 能力: + +- **目录**:`skills/custom/` +- **格式**:每个 skill 是一个目录,包含 `SKILL.md` 文件(Markdown + YAML frontmatter) +- **加载方式**:DeerFlow 自动扫描 `skills/custom/` 下的所有目录,通过 `description` 字段匹配 skill + +### Skills 格式兼容 + +superpowers-zh 的 SKILL.md 文件格式与 DeerFlow 自定义 skills 完全兼容。安装后,DeerFlow 会自动发现并加载所有 skills。 + +### 环境变量 + +如果你的 DeerFlow 项目不在当前目录,可以手动指定安装路径: + +```bash +export DEERFLOW_SKILLS_DIR=/path/to/deerflow/skills/custom +cp -r superpowers-zh/skills/* $DEERFLOW_SKILLS_DIR/ +``` + +## 使用 + +安装后,在 DeerFlow 对话中引用 skill 名称即可: + +- 「使用头脑风暴来分析这个需求」 +- 「用测试驱动开发来实现这个功能」 +- 「按系统化调试流程排查这个 bug」 + +DeerFlow 会根据 skill 的 `description` 自动匹配并加载。 + +## 更新 + +```bash +cd /your/deerflow-project +npx superpowers-zh +``` + +重新运行安装命令即可更新到最新版本。 + +## 获取帮助 + +- 提交 Issue:https://github.com/jnMetaCode/superpowers-zh/issues +- DeerFlow 文档:https://github.com/bytedance/deer-flow diff --git a/package.json b/package.json index adf5f8e..05a217e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "superpowers-zh", "version": "1.1.1", - "description": "AI 编程超能力中文版 — 14 个翻译 + 5 个中国特色原创 skills", + "description": "AI 编程超能力中文版 — 14 个翻译 + 6 个中国特色原创 skills", "type": "module", "main": ".opencode/plugins/superpowers.js", "bin": { @@ -29,6 +29,7 @@ "codex", "gemini", "kiro", + "deerflow", "trae", "antigravity", "vscode", diff --git a/skills/workflow-runner/SKILL.md b/skills/workflow-runner/SKILL.md new file mode 100644 index 0000000..ea4e5a4 --- /dev/null +++ b/skills/workflow-runner/SKILL.md @@ -0,0 +1,172 @@ +--- +name: workflow-runner +description: "在 Claude Code / OpenClaw / Cursor 中直接运行 agency-orchestrator YAML 工作流——无需 API key,使用当前会话的 LLM 作为执行引擎。当用户提供 .yaml 工作流文件或要求多角色协作完成任务时触发。" +--- + +# 工作流执行器:在 AI 工具内运行多角色编排 + +直接在当前会话中执行 agency-orchestrator 的 YAML 工作流,无需配置 API key。当前 LLM 就是执行引擎——依次扮演每个角色完成任务。 + +## 适用场景 + +- 用户提供了一个 `.yaml` 工作流文件(如 `运行 workflows/story-creation.yaml`) +- 用户要求多个角色协作完成任务(如"用产品经理和架构师一起评审这个 PRD") +- 用户安装了 `agency-agents-zh` 并希望直接在 AI 工具内编排多角色 + +## 执行流程(5 步) + +按以下顺序执行,不要跳步: + +### 第 1 步:解析工作流 + +用 Read 工具读取用户指定的 YAML 文件,提取以下字段: + +```yaml +name: "工作流名称" +agents_dir: "agency-agents-zh" # 角色定义目录 +inputs: # 输入变量 + - name: xxx + required: true/false + default: "默认值" +steps: # 执行步骤 + - id: step_id + role: "category/agent-name" # 角色路径 + task: "任务描述 {{变量}}" # 支持模板变量 + output: variable_name # 输出变量名 + depends_on: [other_step_id] # 依赖关系 +``` + +**忽略 `llm`、`concurrency`、`timeout`、`retry` 配置**——Skill 模式使用当前会话的 LLM,这些字段仅用于 CLI 模式。 + +**定位角色目录**:用 Bash `test -d` 按以下顺序检查,用第一个存在的: +1. 当前工作目录下的 `{agents_dir}/`(如 `./agency-agents-zh/`) +2. `../{agents_dir}/`(上级目录) +3. 相对于 YAML 文件所在目录的 `{agents_dir}/` +4. `node_modules/agency-agents-zh/` + +如果全部找不到,**停止执行**并提示用户: +``` +找不到角色目录。请先安装: + git clone --depth 1 https://github.com/jnMetaCode/agency-agents-zh.git + 或:npm install agency-agents-zh +``` + +### 第 2 步:收集输入 + +- 对每个 `required: true` 的输入,检查用户消息中是否已提供值 +- 未提供的必填输入:**立即向用户询问**,不要猜测或用空值 +- 有 `default` 的可选输入:使用默认值 +- 无默认值的可选输入:设为空字符串 + +### 第 3 步:构建执行顺序 + +根据 `depends_on` 进行拓扑排序,将步骤分成多个层级: + +- **无 depends_on 的步骤** → 第 1 层 +- **depends_on 全部在第 N 层或之前的步骤** → 第 N+1 层 +- **同一层内的步骤**互不依赖,可并行 + +在回复中展示执行计划: +``` +执行计划(共 N 步): + 第 1 层: [step_id] — 角色名 + 第 2 层: [step_a, step_b] — 并行 + 第 3 层: [step_id] — 角色名 +``` + +### 第 4 步:逐层执行 + +对每一层: + +#### 4a. 预读角色文件 + +用 Read 工具读取该层所有步骤的角色 `.md` 文件:`{角色目录}/{role}.md` + +从文件中提取: +- **角色名**:frontmatter 中的 `name` 字段 +- **角色 system prompt**:第二个 `---` 之后的全部 markdown 内容 + +#### 4b. 渲染 task 模板 + +将 task 中的 `{{变量名}}` 替换为: +- 来自 inputs 的用户输入值 +- 来自前序步骤 output 的结果文本 + +#### 4c. 执行 + +**单步骤层**:直接在主会话中扮演该角色执行。格式: + +``` +### Step N/Total: step_id(角色名) + +[以该角色身份完成 task,使用角色的专业知识和沟通风格] +``` + +**多步骤层(并行)**:使用 Agent 工具为每个步骤启动子代理。每个子代理的 prompt 必须包含: +- 角色文件的**完整文本内容**(不是路径——子代理可能无法读文件) +- 渲染后的 task 文本 +- 指令:"以上是你的角色定义,请以该角色身份完成以下任务,直接输出结果" + +#### 4d. 保存输出到上下文 + +如果 step 有 `output` 字段,将该步骤的输出文本存入变量上下文,供后续步骤的 `{{变量}}` 使用。 + +### 第 5 步:保存结果并展示 + +用 Write 工具将结果保存到文件: + +``` +.ao-output/{工作流名称}-{YYYY-MM-DD}/ +├── steps/ +│ ├── 1-{step_id}.md # 每步的输出 +│ ├── 2-{step_id}.md +│ └── ... +├── summary.md # 最后一步的完整输出(最终成果) +└── metadata.json # 基本元数据 +``` + +metadata.json 格式: +```json +{ + "name": "工作流名称", + "date": "2026-03-22", + "success": true, + "steps": [ + {"id": "step_id", "role": "category/agent", "status": "completed"}, + ... + ] +} +``` + +执行完毕后,向用户展示: +1. 最终成果(summary.md 的内容) +2. 文件保存位置 +3. 执行了几个步骤 + +## 重要规则 + + +- 每个步骤都必须真正扮演对应角色,使用该角色的专业知识和沟通风格,不能泛泛回答 +- 角色切换必须明确——每步开始时标注角色名 +- 不要跳过步骤或合并步骤,严格按 DAG 层级顺序执行 +- 如果角色文件找不到,告知用户并建议安装 agency-agents-zh +- 不要在没有读取角色 .md 文件的情况下执行步骤——必须先 Read 再执行 + + +## 没有 YAML 文件时的快捷模式 + +如果用户没有指定 YAML 文件,但描述了需要多角色协作的任务: + +1. 根据用户描述,**自动生成** YAML 工作流定义 +2. 展示给用户确认 +3. 确认后按上述流程执行 + +示例: +- 用户说"帮我用叙事学家和心理学家写个故事" → 生成 story-creation 类似的工作流 +- 用户说"让产品经理和架构师评审这个 PRD" → 生成 product-review 类似的工作流 + +## 故障处理 + +- **角色文件不存在**:提示用户运行 `ao init` 或 `npm install agency-agents-zh` +- **模板变量未定义**:检查上下文,如果是必填输入则向用户询问 +- **步骤执行失败**:标记该步骤为失败,跳过所有依赖它的下游步骤,继续执行其他独立步骤