Skip to content
Skills Library
AI & agents · Building & coding

dify-workflow

/dify-workflow

设计、生成并部署 Dify 应用 DSL (workflow/advanced-chat)。当用户要求构建 Dify 工作流、生成/更新 DSL 文件或通过 Admin API 部署到 Dify 实例时使用。

Licence
MIT
Last repository change
19.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
28
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 19.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

设计、生成并部署 Dify 应用 DSL (workflow/advanced-chat)。当用户要求构建 Dify 工作流、生成/更新 DSL 文件或通过 Admin API 部署到 Dify 实例时使用。

Original author description

设计、生成并部署 Dify 应用 DSL (workflow/advanced-chat)。当用户要求构建 Dify 工作流、生成/更新 DSL 文件或通过 Admin API 部署到 Dify 实例时使用。

How it works

  1. 交互原则与凭证隔离
  2. 版本锚定 (Version Anchoring)
  3. 节点路由表
  4. 任务执行路径与校验关卡
  5. DSL 结构快速参考
  6. 常见 Schema 陷阱
  7. 模板与参考示例
Original SKILL.md headings · 126 lines, 606 words
SKILL.md preview
---
name: dify-workflow
description: 设计、生成并部署 Dify 应用 DSL (workflow/advanced-chat)。当用户要求构建 Dify 工作流、生成/更新 DSL 文件或通过 Admin API 部署到 Dify 实例时使用。
---

# Dify Workflow DSL 生成器

## 交互原则与凭证隔离

- **需求澄清**:若用户描述不足以确定节点或输入/输出流程,优先澄清输入输出变量与核心节点,确认后开始生成。
- **凭证隔离**:严格隔离敏感凭证。最终回复与导出产物中仅包含 App ID、DSL 文件路径、节点统计与部署状态,禁止泄露 `ADMIN_API_KEY`。
- **关联 Skill 约定**:涉及 Console Admin API 操作时,先读取并遵守 [dify-deploy](file:///d:/源自C盘/桌面/Aeson-skills/Skills/dify-deploy/SKILL.md)。

## 版本锚定 (Version Anchoring)

每次生成前按顺序执行:
1. 读取 `references/config.yml`,获取 `dsl_version` 与 `reference_dsl`。
2. 若 `reference_dsl` 非空,读取 `references/user-reference/<文件名>` 作为基准 schema。
3. 读取 `references/version-deltas.md` 查找版本差异。
4. 约束:输出 YAML 的 `version` 必须匹配 `dsl_version`,且仅使用目标版本支持的节点与字段。

## 节点路由表

| 节点 | 类型标识 | 用途 | 关键参数 | Schema 路径 |
|------|----------|------|----------|-------------|
| Start | `start` | 入口节点;定义输入变量 | `variables` | `references/nodes/start.md` |
| End | `end` | Workflow 模式终端;声明输出 | `outputs` | `references/nodes/end.md` |
| Answer | `answer` | Chatflow 模式流式输出 | `answer`, `variables` | `references/nodes/answer.md` |
| LLM | `llm` | 调用大语言模型 | `model`, `prompt_template`, `context`, `vision` | `references/nodes/llm.md` |
| Knowledge Retrieval | `knowledge-retrieval` | 知识库文档检索 | `query_variable_selector`, `dataset_ids`, `retrieval_mode` | `references/nodes/knowledge-retrieval.md` |
| Code | `code` | 执行 Python3/JS/JSON | `code_language`, `code`, `variables`, `outputs` | `references/nodes/code.md` |
| HTTP Request | `http-request` | HTTP API 调用 | `method`, `url`, `headers`, `body`, `authorization` | `references/nodes/http-request.md` |
| If/Else | `if-else` | 条件分支 (IF/ELIF/ELSE) | `cases` | `references/nodes/if-else.md` |
| Variable Aggregator | `variable-aggregator` | 合并多分支变量 | `output_type`, `variables` | `references/nodes/variable-aggregator.md` |
| Iteration | `iteration` | 数组循环遍历 | `iterator_selector`, `iterator_input_type`, `output_selector` | `references/nodes/iteration.md` |
| Document Extractor | `document-extractor` | 文件文本提取 (PDF/DOCX) | `variable_selector`, `is_array_file` | `references/nodes/document-extractor.md` |
| Template Transform | `template-transform` | Jinja2 模板渲染 | `template`, `variables` | `references/nodes/template-transform.md` |
| Question Classifier | `question-classifier` | LLM 意图分类 | `query_variable_selector`, `model`, `classes` | `references/nodes/question-classifier.md` |
| Parameter Extractor | `parameter-extractor` | LLM 结构化参数提取 | `query`, `model`, `parameters`, `reasoning_mode` | `references/nodes/parameter-extractor.md` |
| Tool | `tool` | 调用外部工具 | `provider_id`, `provider_type`, `tool_name`, `tool_parameters` | `references/nodes/tool.md` |

## 任务执行路径与校验关卡

### 执行路径

1. **解析与模式确定**:批处理用 `workflow` 模式(Start -> End);对话交互用 `advanced-chat` 模式(Start -> Answer)。
2. **节点选择与模板匹配**:优先匹配 `## 模板匹配` 中的预设模板;无匹配时依据路由表 schema 逐个组装。
3. **构图与边连接**:
   - 节点 ID 格式:13 位时间戳字符串(如 `"1711536487001"`)。
   - 坐标规划:起始点 `{x: 80, y: 282}`,X 轴增量 `+300px`,分支 Y 轴增量 `+200px`。
   - 边 ID 格式:`{sourceId}-{sourceHandle}-{targetId}-{targetHandle}`,`targetHandle` 统一为 `"target"`。分支 sourceHandle 分别为 `"true"`/`case_id`/`"false"` 或类别 ID。
4. **部署与更新**(如适用):覆盖更新前先导出原 DSL 保存为备份文件。API 异常卡住时报告排查建议,未获明确授权禁止直连数据库。

### 校验关卡 (Validation Gate)

交付产物前必须完成以下 4 项校验:
- [ ] **语法与命名**:默认输出为当前目录的 `<kebab-case-name>.dify.yml`(按需输出 `.dify.json`)。所有字符串节点 ID 显式加引号。
- [ ] **拓扑完整性**:所有 Edge 的 `source` 和 `target` ID 在 Graph Nodes 中真实存在,边 `type` 为 `"custom"`。
- [ ] **变量引用合法性**:节点变量引用为 `{{#nodeId.variableName#}}`,系统变量为 `sys` 前缀(`workflow` 模式严禁引用 `sys.query`)。
- [ ] **Provider 正确性**:`model.provider` 遵循 `"langgenius/<provider>/<provider>"` 格式,且使用真实模型标识(如 `gpt-4o-mini`、`deepseek-chat`)。

## DSL 结构快速参考

```yaml
version: "<dsl_version from config.yml>"
kind: app
app:
  name: "工作流名称"
  mode: "advanced-chat"           # 或 "workflow"
  description: "..."
  icon: "\U0001F916"
  icon_background: "#FFEAD5"
  icon_type: emoji
  use_icon_as_answer_icon: false
dependencies: []
workflow:
  environment_variables: []
  conversation_variables: []
  features:
    file_upload:
      enabled: false
    opening_statement: ""         # 仅 chatflow
    retriever_resource:
      enabled: false
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []       # 仅 chatflow
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
  graph:
    nodes: []                     # 节点对象数组
    edges: []                     # 边对象数组
    viewport:
      x: 0
      y: 0
      zoom: 0.7
```
完整字段级规范参照 `references/dsl-format.md`。

## 常见 Schema 陷阱

1. **变量形状差异**:
   - `code` / `llm` / `template-transform` / `parameter-extractor`:`[{ variable: "arg", value_selector: ["node_id", "field"], value_type: "string" }]`
   - `variable-aggregator`:裸嵌套列表 `[["node1_id", "output"], ["node2_id", "output"]]`
   - `document-extractor`:扁平列表 `variable_selector: ["upstream_id", "field"]`
2. **Memory 作用域**:`memory` 块仅存在于 `advanced-chat` 模式的 LLM 节点,`workflow` 模式及迭代内部节点必须省略。
3. **迭代节点约束**:内层节点须包含 `parentId: <iteration_id>`、`data.isInIteration: true`、`zIndex: 1002`,坐标为相对坐标(初始约 `{x: 24, y: 68}`)。`iterator_input_type` 必须与真实元素匹配(如 `"array[file]"`)。
4. **特定节点输出形状**:End 节点 `outputs` 为列表;Code 节点 `outputs` 为字典。
5. **Edge Data 字段**:包含 `sourceType`、`targetType`、`isInIteration`、`isInLoop`。迭代内边补充 `iteration_id` 与 `zIndex: 1002`。

## 模板与参考示例

与已知模式高度匹配时优先使用预设模板,按需调整字段:

| 模板 | 路径 | 匹配条件 |
|------|------|----------|
| Chatbot | `references/templates/chatbot.yml` | 简单对话:Start -> LLM -> Answer |
| RAG | `references/templates/rag.yml` | 知识库问答:Start -> Knowledge Retrieval -> LLM -> Answer |
| Agent | `references/templates/agent.yml` | 带分类/参数提取的工具 Agent |
| Translation | `references/templates/translation.yml` | 文本转换/翻译 |

### 完整示例文件指针 (Progressive Disclosure)

- **Minimal Chatbot DSL**:对应完整 DSL 见 [`examples/simple-chatbot.yml`](file:///d:/源自C盘/桌面/Aeson-skills/Skills/dify-workflow/examples/simple-chatbot.yml)
- **RAG with Rerank DSL**:对应完整 DSL 见 [`examples/rag-with-rerank.yml`](file:///d:/源自C盘/桌面/Aeson-skills/Skills/dify-workflow/examples/rag-with-rerank.yml)
Files in this package (28)
  • SKILL.md 8 KB
  • agents/openai.yaml 1 KB
  • examples/rag-with-rerank.yml 8 KB
  • examples/simple-chatbot.yml 4 KB
  • references/config.yml 1 KB
  • references/dsl-format.md 25 KB
  • references/edge-and-layout.md 10 KB
  • references/version-deltas.md 3 KB
  • references/nodes/answer.md 9 KB
  • references/nodes/code.md 3 KB
  • references/nodes/document-extractor.md 4 KB
  • references/nodes/end.md 8 KB
  • references/nodes/http-request.md 6 KB
  • references/nodes/if-else.md 6 KB
  • references/nodes/iteration.md 8 KB
  • references/nodes/knowledge-retrieval.md 9 KB
  • references/nodes/llm.md 9 KB
  • references/nodes/parameter-extractor.md 5 KB
  • references/nodes/question-classifier.md 4 KB
  • references/nodes/start.md 9 KB
  • references/nodes/template-transform.md 3 KB
  • references/nodes/tool.md 5 KB
  • references/nodes/variable-aggregator.md 4 KB
  • references/templates/agent.yml 7 KB
  • references/templates/chatbot.yml 4 KB
  • references/templates/rag.yml 5 KB
  • references/templates/translation.yml 6 KB
  • references/user-reference/README.md 1 KB

Versions

The database has no other skills named dify-workflow.

Database snapshot: 13.11.2026 · package version 60ba77d68eb0 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100validate-dify-dsl
    Validates the core nodes of a Dify DSL YAML file (workflow / chatflow export) against graphon, the graph engine schemas Dify itself uses. Reports invalid fields per node. Scope is core nodes only — triggers, knowledge-retrieval, agent, human-input, edges, and graph structure are…
  • 100dify
    Dify is an open-source platform for building LLM apps such as chatbots, agents, workflows and RAG knowledge bases, and it exposes every published app as a REST API. Use when a user asks to self-host Dify with Docker Compose, configure Dify environment variables, call a Dify app…
  • 100skills-to-dify-workflow
    Converts Claude Code skill folders (SKILL.md + scripts/ + references/ + assets/) into Dify-importable workflow DSL (YAML files). Analyzes the entire skill directory structure to map scripts to code nodes, references to LLM prompts, and assets to templates. Also generates a React…
  • 100dify-chatflow-builder
    用 Dify Chatflow / Workflow 搭建生产级多轮对话应用的方法与踩坑库,可配合对话逐步指导搭建。当用户说要搭一个 Dify 对话流、工作流或智能体,或需要设计状态机与多场景分诊、配置节点与变量、编写节点级提示词、排查运行报错、接入 HTTP / Swagger / MCP 接口与飞书、实现富媒体组件返回、优化响应延迟,或在对话流、工作流、Agent 三种形态之间选型时使用。
  • 100dify-knowledge-base-search
    Dify dataset retrieve API for knowledge base chunk search/testing. Use when integrating or debugging Dify knowledge base retrieval requests, retrieval_model options, or response shaping.
  • 100dify-knowledge-base-upload
    Upload local files to a Dify pipeline knowledge base through the published pipeline datasource flow and optionally apply existing metadata fields. Use when the target dataset is a published rag_pipeline/local_file knowledge base or ordinary Dify document create APIs return completed with 0 chunks.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.