dify-dsl-generator by wwwzhouhui/skills_collection
npx skills add https://github.com/wwwzhouhui/skills_collection --skill dify-dsl-generator专业的 Dify 工作流 DSL/YML 文件自动生成工具,基于对 86+ 实际工作流案例的深度学习,能够根据用户的业务需求自动生成符合 Dify 规范的完整工作流配置文件。
生成一个 Dify 工作流用于 [业务需求描述]
帮我生成一个 Dify 工作流 DSL 文件:
- 功能: [工作流要实现的功能]
- 输入: [用户输入的内容]
- 处理步骤: [详细的处理逻辑]
- 输出: [期望的输出结果]
- 使用插件: [需要的插件,可选]
基于对 86+ 真实工作流案例的学习,Dify DSL YML 文件遵循以下结构:
app:
description: '工作流描述'
icon: 🤖
icon_background: '#FFEAD5'
mode: advanced-chat # 或 workflow, agent-chat
name: 工作流名称
use_icon_as_answer_icon: false
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
模式说明:
advanced-chat: 高级对话模式(chatflow)workflow: 工作流模式agent-chat: AI Agent 模式dependencies:
- current_identifier: null
type: marketplace
value:
marketplace_plugin_unique_identifier: 插件唯一标识符
常用插件:
langgenius/openai_api_compatible: OpenAI 兼容接口bowenliang123/md_exporter: Markdown 导出器kind: app
version: 0.3.0
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
enabled: false
speech_to_text:
enabled: false
text_to_speech:
enabled: false
graph:
edges: []
nodes: []
- data:
desc: ''
title: 开始
type: start
variables:
- label: 用户输入
max_length: 1000
options: []
required: true
type: paragraph # 或 text-input, select, file
variable: query
id: 'start'
position:
x: 100
y: 300
type: custom
width: 244
height: 90
变量类型:
paragraph: 段落文本(多行)text-input: 单行文本select: 下拉选择file: 文件上传number: 数字- data:
context:
enabled: false
variable_selector: []
model:
completion_params:
temperature: 0.7
max_tokens: 2000
mode: chat
name: gpt-4
provider: openai
prompt_template:
- id: 唯一ID
role: system
text: 系统提示词
- id: 唯一ID
role: user
text: 用户提示词 {{#变量引用#}}
title: LLM节点
type: llm
vision:
enabled: false
id: '节点ID'
position:
x: 400
y: 300
type: custom
常用模型provider:
openai: OpenAIlanggenius/openai_api_compatible/openai_api_compatible: 兼容接口anthropic: Claudealibaba: 通义千问变量引用格式:
{{#节点ID.输出变量#}}: 引用其他节点的输出{{#sys.query#}}: 引用系统变量(用户输入){{#节点ID.text#}}: 引用LLM输出文本- data:
code: |
import json
def main(arg1: str, arg2: str) -> dict:
# 处理逻辑
result = process(arg1, arg2)
return {
"result": result,
"status": "success"
}
code_language: python3
outputs:
result:
type: string
status:
type: string
title: 代码执行
type: code
variables:
- value_selector:
- '前置节点ID'
- 输出变量
variable: arg1
id: '节点ID'
position:
x: 700
y: 300
type: custom
代码语言:
python3: Python 3javascript: JavaScript (部分版本支持)输出类型:
string: 字符串number: 数字object: 对象array[string]: 字符串数组array[number]: 数字数组array[object]: 对象数组- data:
authorization:
config: null
type: no-auth
body:
data: '{"key": "{{#变量#}}"}'
type: json
headers: ''
method: post
timeout:
max_connect_timeout: 0
max_read_timeout: 0
max_write_timeout: 0
title: HTTP请求
type: http-request
url: https://api.example.com/endpoint
id: '节点ID'
position:
x: 1000
y: 300
type: custom
HTTP方法:
get: GET 请求post: POST 请求put: PUT 请求patch: PATCH 请求delete: DELETE 请求认证类型:
no-auth: 无认证api-key: API Keybearer: Bearer Token- data:
cases:
- case_id: case1
conditions:
- comparison_operator: contains
id: 条件ID
value: 期望值
variable_selector:
- '节点ID'
- 变量名
id: case1
logical_operator: and
logical_operator: or
title: 条件判断
type: if-else
id: '节点ID'
position:
x: 1300
y: 300
type: custom
比较运算符:
contains: 包含not contains: 不包含is: 等于is not: 不等于empty: 为空not empty: 不为空逻辑运算符:
and: 与or: 或- data:
provider_id: 工具提供者ID
provider_name: 工具提供者名称
provider_type: builtin # 或 api
title: 工具调用
tool_configurations: {}
tool_label: 工具标签
tool_name: 工具名称
tool_parameters:
参数名:
type: mixed
value: '{{#变量#}}'
type: tool
id: '节点ID'
position:
x: 1600
y: 300
type: custom
工具类型:
builtin: 内置工具(如搜索、天气等)api: API 工具plugin: 插件工具- data:
answer: |
{{#LLM节点ID.text#}}
{{#代码节点ID.result#}}
title: 直接回复
type: answer
variables: []
id: answer
position:
x: 1900
y: 300
type: custom
- data:
advanced_settings: null
desc: ''
groups:
- group_name: 分组1
output_type: string
variables:
- value_selector:
- '节点ID'
- 变量名
variable: 输出变量名
title: 变量聚合器
type: variable-aggregator
id: '节点ID'
position:
x: 2200
y: 300
type: custom
- data:
instruction: 提取指令说明
is_array: false
model:
completion_params: {}
mode: chat
name: gpt-4
provider: openai
parameters:
- description: 参数描述
name: 参数名
required: true
type: string
query:
- role: user
text: '{{#输入变量#}}'
reasoning_mode: prompt
title: 参数提取
type: parameter-extractor
id: '节点ID'
position:
x: 2500
y: 300
type: custom
edges:
- data:
isInIteration: false
isInLoop: false
sourceType: start
targetType: llm
id: 源节点ID-source-目标节点ID-target
source: '源节点ID'
sourceHandle: source
target: '目标节点ID'
targetHandle: target
type: custom
zIndex: 0
连接规则:
sourceType 和 targetType 必须与实际节点类型匹配推荐布局:
示例布局:
Start(100,300) → LLM(400,300) → Code(700,300) → Answer(1000,300)
分支布局:
→ Branch1(1100,150)
If-Else(800,300) →
→ Branch2(1100,450)
基于 86+ 真实工作流案例的学习总结:
需求 : 上传图片 → OCR 识别 → 提取文字
节点流程 :
关键配置 :
需求 : 文本描述 → 生成HTML代码 → 保存为文件
节点流程 :
关键配置 :
需求 : 用户问题 → SQL 查询 → 图表展示
节点流程 :
关键配置 :
需求 : 复杂任务 → Agent 自主规划 → 调用工具 → 返回结果
节点流程 :
关键配置 :
你是一个专业的 SQL 专家。根据用户的自然语言问题生成准确的 SQL 查询语句。
数据库schema:
{{#数据库结构#}}
用户问题: {{#sys.query#}}
要求:
1. 只输出 SQL 语句,不要有其他说明
2. 确保 SQL 语法正确
3. 使用合适的 JOIN 和 WHERE 条件
从以下文本中提取指定信息:
文本内容:
{{#输入文本#}}
提取要求:
- 提取所有日期
- 提取所有人名
- 提取所有金额
以 JSON 格式输出:
{
"dates": [],
"names": [],
"amounts": []
}
根据用户需求生成完整的 HTML 页面。
需求: {{#用户需求#}}
要求:
1. 生成完整的 HTML 文档
2. 包含必要的 CSS 样式
3. 添加必要的 JavaScript 交互
4. 确保代码格式规范
5. 只输出 HTML 代码,不要 markdown 代码块标记
1747991890414){{#节点ID.变量名#}} 格式❌ 变量引用错误: {{节点ID.变量}} ✅ 正确格式: {{#节点ID.变量#}}
❌ 缺少节点连接: 节点孤立未连接 ✅ 确保所有节点都在 edges 中有连接关系
❌ ID 重复: 多个节点使用相同 ID ✅ 每个节点使用唯一 ID
❌ Position 重叠: 多个节点坐标相同 ✅ 合理规划节点位置,避免重叠
❌ 依赖缺失: 使用插件但未在 dependencies 中声明 ✅ 使用插件时必须添加对应的 dependency
生成的 DSL 文件必须是完整的、可直接导入 Dify 的 YAML 格式:
app:
# App 配置
dependencies:
# 依赖列表
kind: app
version: 0.3.0
workflow:
conversation_variables: []
environment_variables: []
features:
# 功能配置
graph:
edges:
# 连接关系
nodes:
# 节点定义
自动触发 dify-dsl-generator skill 的关键词:
参考资源:
Weekly Installs
195
Repository
GitHub Stars
179
First Seen
Jan 22, 2026
Security Audits
Installed on
opencode170
codex164
gemini-cli160
github-copilot148
kimi-cli137
amp135
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
62,200 周安装