{"id":"49bd06f1-885c-4c05-aadd-6014b059378c","shortId":"3fpRzs","kind":"skill","title":"dify-workflow","tagline":"Build, edit, validate, and export Dify AI workflow DSL files using the dify-workflow CLI. Use when: creating Dify workflows/chatflows/chat/agent/completion apps; adding nodes and edges to workflows; configuring LLM/tool/code/if-else/question-classifier nodes; validating DSL befor","description":"# Dify Workflow CLI Skill\n\nBuild, edit, validate, layout, and export Dify DSL files entirely from the command line.\nThe CLI is installed as `dify-workflow` (or `dify-workflow.exe` on Windows).\n\nIf the CLI is not yet installed in the current environment, use [PowerShell install script](./scripts/install.ps1) on Windows or [shell install script](./scripts/install.sh) on macOS/Linux.\n\n## When to Use\n\n- User asks to create a Dify workflow, chatflow, chat app, agent, or completion app\n- User asks to add/remove/update nodes or edges in a Dify YAML\n- User asks to validate a Dify DSL file before import\n- User asks to auto-layout node positions\n- User asks to generate a Mermaid diagram of a workflow\n- User asks to troubleshoot why a Dify import shows disconnected nodes or errors\n\n## Key Constraints\n\n- **DAG only**: Dify workflows must be directed acyclic graphs. No cycles allowed — Dify's frontend runs `getCycleEdges()` and silently removes all edges between cycle nodes, causing disconnections.\n- **Variable references**: Use `{{#node_id.variable#}}` syntax. Tool nodes output `text`/`files`/`json` (NOT `result`). LLM nodes output `text`.\n- **Node positioning**: Dify uses screen coordinates (origin top-left, X→right, Y→down). Use `layout` command to auto-arrange.\n- **PowerShell JSON**: On Windows PowerShell, avoid inline JSON with `--data`. Use `--data-file` with UTF-8 (no BOM) files instead.\n\n## Dify App Modes\n\nDify supports 5 app modes, split into two architectures:\n\n### Graph-based modes (use `workflow.nodes` + `workflow.edges`)\n| Mode | DSL `app.mode` | Description |\n|------|----------------|-------------|\n| **Workflow** | `workflow` | Single-run DAG execution, no conversation. Start → nodes → End. |\n| **Chatflow** | `advanced-chat` | Multi-turn conversation with graph canvas. Uses Answer nodes instead of End. |\n\n### Config-based modes (use `model_config` section)\n| Mode | DSL `app.mode` | Description |\n|------|----------------|-------------|\n| **Chat** | `chat` | Simple LLM chat with optional knowledge retrieval. No graph. |\n| **Agent** | `agent-chat` | Chat + tool calling. `agent_mode.enabled=true` with strategy (function_call/react). |\n| **Completion** | `completion` | Single-turn text generation. Supports `more_like_this`, requires `dataset_query_variable` for knowledge retrieval. |\n\n### Validation coverage by mode\n- **workflow / chatflow**: Full graph validation (node data, edges, cycles, connectivity, frontend crash prevention, publish checklist)\n- **chat / agent-chat / completion**: `model_config` validation (model, prompt, variables, dataset, agent_mode, features) via `model_config_validators/` package\n\n## Procedure: Create a Workflow from Scratch\n\nBefore editing a workflow, prefer this execution order:\n\n1. Ensure the CLI is installed\n2. Create or open a DSL file\n3. Add/update nodes and edges\n4. Run `validate`\n5. Run `checklist`\n6. Run `layout`\n7. Export or inspect with Mermaid\n\nIf the user asks for a complex node payload, prefer using templates in [assets](./assets/).\n\n### Step 1: Create base file\n\n```bash\ndify-workflow create --mode workflow --name \"My Workflow\" -o workflow.yaml\n# Templates: minimal (default), llm, if-else\n# Modes: workflow, chatflow, chat, agent, completion\n```\n\n### Step 2: Add nodes\n\n```bash\n# Add nodes one at a time\ndify-workflow edit add-node -f workflow.yaml --type llm --title \"GPT Node\" --id my_llm\n\n# With data (prefer --data-file on Windows to avoid escaping issues)\ndify-workflow edit add-node -f workflow.yaml --type code --title \"Process\" --id processor\ndify-workflow edit update-node -f workflow.yaml --id my_llm --data-file ./assets/llm-node-config.json\n```\n\n### Step 3: Add edges\n\n```bash\ndify-workflow edit add-edge -f workflow.yaml --source start_node --target my_llm\ndify-workflow edit add-edge -f workflow.yaml --source my_llm --target end_node\n\n# For branching nodes (if-else, question-classifier), specify --source-handle\ndify-workflow edit add-edge -f workflow.yaml -s ifelse_node -t happy_path --source-handle true\ndify-workflow edit add-edge -f workflow.yaml -s ifelse_node -t sad_path --source-handle false\n```\n\n### Step 4: Update node data\n\n```bash\ndify-workflow edit update-node -f workflow.yaml --id my_llm \\\n  -d '{\"model\": {\"provider\": \"openai\", \"name\": \"gpt-4o-mini\", \"mode\": \"chat\", \"completion_params\": {\"temperature\": 0.7}}}'\n\n# Or from file (recommended on Windows)\ndify-workflow edit update-node -f workflow.yaml --id my_llm --data-file llm_config.json\n\n# Ready-to-use templates are bundled in this skill\n# - ./assets/llm-node-config.json\n# - ./assets/question-classifier-config.json\n# - ./assets/http-request-config.json\n```\n\n### Step 5: Validate\n\n```bash\ndify-workflow validate workflow.yaml           # Human-readable\ndify-workflow validate workflow.yaml -j        # JSON output\ndify-workflow validate workflow.yaml --strict  # Warnings = errors\ndify-workflow checklist workflow.yaml          # Dify frontend pre-publish check\n```\n\n### Step 6: Layout and export\n\n```bash\ndify-workflow layout -f workflow.yaml          # Auto-arrange (tree strategy, in-place)\ndify-workflow layout -f workflow.yaml -o out.yaml --strategy hierarchical\ndify-workflow export workflow.yaml -o final.yaml\n```\n\n## Command Reference\n\nSee [commands reference](./references/commands.md) for full command details.\nSee [node types reference](./references/node-types.md) for all 22 node types and their data schemas.\nSee [patterns reference](./references/patterns.md) for common workflow patterns and PowerShell examples.\n\n## Bundled Resources\n\n- [install.ps1](./scripts/install.ps1): editable install for Windows PowerShell\n- [install.sh](./scripts/install.sh): editable install for bash/zsh\n- [llm-node-config.json](./assets/llm-node-config.json): LLM node payload template\n- [question-classifier-config.json](./assets/question-classifier-config.json): classifier payload template\n- [http-request-config.json](./assets/http-request-config.json): HTTP request node payload template\n\n## Quick Command Table\n\n| Command | Purpose |\n|---------|---------|\n| `create -o file.yaml` | Create new app (use `--mode` and `--template`) |\n| `edit add-node -f file.yaml --type TYPE --title TITLE` | Add a node |\n| `edit add-edge -f file.yaml --source SRC --target TGT` | Add an edge |\n| `edit update-node -f file.yaml --id ID -d JSON` | Update node data |\n| `edit remove-node -f file.yaml --id ID` | Remove node + cleanup edges |\n| `edit set-title -f file.yaml --id ID --title TEXT` | Rename a node |\n| `validate file.yaml` | Validate DSL |\n| `checklist file.yaml` | Pre-publish checks (mirrors Dify UI) |\n| `inspect file.yaml` | Tree view |\n| `inspect file.yaml -j` | JSON structure |\n| `inspect file.yaml -m` | Mermaid flowchart |\n| `layout -f file.yaml` | Auto-layout (tree default) |\n| `diff a.yaml b.yaml` | Compare two files |\n| `config set-model -f app.yaml --provider X --name Y` | Set model (chat/agent/completion) |\n| `config set-prompt -f app.yaml --text \"...\"` | Set prompt |\n\n## Troubleshooting\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| Nodes disconnected after Dify import | Cycle in graph → frontend strips edges | Run `validate` to detect cycles, remove back-edges |\n| Checklist errors in Dify UI | Missing required fields or invalid variable refs | Run `checklist` locally first |\n| Variable reference not found | Wrong output variable name (e.g. `.result` vs `.text`) | Tool nodes output `text`, not `result` |\n| Layout looks messy in Dify | No layout applied or wrong strategy | Run `layout -f file.yaml` (tree default) |\n| JSON parse error on Windows | PowerShell escaping issues | Use `--data-file` instead of `-d` |\n\n## Agent Behavior\n\n- Prefer `--data-file` over inline JSON on Windows\n- Prefer `inspect -m` when the user asks for a visual explanation of the graph\n- Prefer `checklist` in addition to `validate` before claiming a file is Dify-ready\n- Prefer `layout` before export when the user cares about Dify canvas appearance\n- If the user asks for a complex workflow, build it incrementally and validate after each major branch","tags":["dify","workflow","cli","akabane71","agent-skills","cli-anything","dify-tool","opencli","skills"],"capabilities":["skill","source-akabane71","skill-dify-workflow","topic-agent-skills","topic-cli","topic-cli-anything","topic-dify-tool","topic-opencli","topic-skills"],"categories":["dify-workflow-cli"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/Akabane71/dify-workflow-cli/dify-workflow","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add Akabane71/dify-workflow-cli","source_repo":"https://github.com/Akabane71/dify-workflow-cli","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (8,044 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:13:29.734Z","embedding":null,"createdAt":"2026-05-18T13:20:36.955Z","updatedAt":"2026-05-18T19:13:29.734Z","lastSeenAt":"2026-05-18T19:13:29.734Z","tsv":"'-8':245 '/assets':456 '/assets/http-request-config.json':711,850 '/assets/llm-node-config.json':557,709,839 '/assets/question-classifier-config.json':710,845 '/references/commands.md':793 '/references/node-types.md':802 '/references/patterns.md':815 '/scripts/install.ps1':83,826 '/scripts/install.sh':90,833 '0.7':676 '1':409,458 '2':415,488 '22':805 '3':422,559 '4':427,645 '4o':669 '5':255,430,713 '6':433,752 '7':436 'a.yaml':971 'acycl':171 'ad':26 'add':489,492,503,532,560,568,583,611,630,873,881,886,894 'add-edg':567,582,610,629,885 'add-nod':502,531,872 'add/remove/update':113 'add/update':423 'addit':1116 'advanc':287 'advanced-chat':286 'agent':106,325,327,377,387,485,1088 'agent-chat':326,376 'agent_mode.enabled':332 'ai':10 'allow':175 'answer':297 'app':25,105,109,251,256,866 'app.mode':271,312 'app.yaml':981,994 'appear':1138 'appli':1063 'architectur':261 'arrang':228,765 'ask':97,111,122,132,140,150,445,1105,1142 'asset':455 'auto':135,227,764,966 'auto-arrang':226,763 'auto-layout':134,965 'avoid':234,524 'b.yaml':972 'back':1020 'back-edg':1019 'base':264,304,460 'bash':462,491,562,649,715,756 'bash/zsh':837 'befor':37 'behavior':1089 'bom':247 'branch':594,1155 'build':4,42,1147 'bundl':705,823 'call':331 'call/react':337 'canva':295,1137 'care':1134 'caus':189,1000 'chat':104,288,314,315,318,328,329,375,378,484,672 'chat/agent/completion':988 'chatflow':103,285,361,483 'check':750,944 'checklist':374,432,743,939,1022,1035,1114 'claim':1120 'classifi':601,846 'cleanup':920 'cli':19,40,57,70,412 'code':537 'command':54,224,788,791,796,857,859 'common':817 'compar':973 'complet':108,338,339,379,486,673 'complex':448,1145 'config':303,308,381,392,976,989 'config-bas':302 'configur':32 'connect':369 'constraint':163 'convers':281,292 'coordin':213 'coverag':357 'crash':371 'creat':22,99,396,416,459,466,861,864 'current':77 'cycl':174,187,368,1007,1017 'd':662,905,1087 'dag':164,278 'data':238,241,366,516,519,555,648,696,810,909,1083,1092 'data-fil':240,518,554,695,1082,1091 'dataset':350,386 'default':476,969,1072 'descript':272,313 'detail':797 'detect':1016 'diagram':145 'diff':970 'difi':2,9,17,23,38,48,62,101,119,126,155,166,176,210,250,253,464,499,528,543,564,579,607,626,651,684,717,725,733,741,745,758,772,782,946,1005,1025,1060,1125,1136 'dify-readi':1124 'dify-workflow':1,16,61,463,498,527,542,563,578,606,625,650,683,716,724,732,740,757,771,781 'dify-workflow.exe':65 'direct':170 'disconnect':158,190,1003 'dsl':12,36,49,127,270,311,420,938 'e.g':1046 'edg':29,116,185,367,426,561,569,584,612,631,887,896,921,1012,1021 'edit':5,43,402,501,530,545,566,581,609,628,653,686,827,834,871,884,897,910,922 'els':480,598 'end':284,301,591 'ensur':410 'entir':51 'environ':78 'error':161,739,1023,1075 'escap':525,1079 'exampl':822 'execut':279,407 'explan':1109 'export':8,47,437,755,784,1130 'f':505,534,549,570,585,613,632,657,690,761,775,875,888,901,914,926,963,980,993,1069 'fals':643 'featur':389 'field':1029 'file':13,50,128,200,242,248,421,461,520,556,679,697,975,1084,1093,1122 'file.yaml':863,876,889,902,915,927,936,940,949,953,958,964,1070 'final.yaml':787 'first':1037 'fix':1001 'flowchart':961 'found':1041 'frontend':178,370,746,1010 'full':362,795 'function':336 'generat':142,344 'getcycleedg':180 'gpt':510,668 'gpt-4o-mini':667 'graph':172,263,294,324,363,1009,1112 'graph-bas':262 'handl':605,623,642 'happi':619 'hierarch':780 'http':851 'http-request-config.json':849 'human':722 'human-read':721 'id':512,540,551,659,692,903,904,916,917,928,929 'if-els':478,596 'ifels':616,635 'import':130,156,1006 'in-plac':768 'increment':1149 'inlin':235,1095 'inspect':439,948,952,957,1100 'instal':59,74,81,88,414,828,835 'install.ps1':825 'install.sh':832 'instead':249,299,1085 'invalid':1031 'issu':526,1080 'j':729,954 'json':201,230,236,730,906,955,1073,1096 'key':162 'knowledg':321,354 'layout':45,136,223,435,753,760,774,962,967,1056,1062,1068,1128 'left':217 'like':347 'line':55 'llm':204,317,477,508,514,553,577,589,661,694,840 'llm-node-config.json':838 'llm/tool/code/if-else/question-classifier':33 'llm_config.json':698 'local':1036 'look':1057 'm':959,1101 'macos/linux':92 'major':1154 'mermaid':144,441,960 'messi':1058 'mini':670 'minim':475 'mirror':945 'miss':1027 'mode':252,257,265,269,305,310,359,388,467,481,671,868 'model':307,380,383,391,663,979,987 'multi':290 'multi-turn':289 'must':168 'name':469,666,984,1045 'new':865 'node':27,34,114,137,159,188,197,205,208,283,298,365,424,449,490,493,504,511,533,548,574,592,595,617,636,647,656,689,799,806,841,853,874,883,900,908,913,919,934,1002,1051 'node_id.variable':194 'o':472,777,786,862 'one':494 'open':418 'openai':665 'option':320 'order':408 'origin':214 'out.yaml':778 'output':198,206,731,1043,1052 'packag':394 'param':674 'pars':1074 'path':620,639 'pattern':813,819 'payload':450,842,847,854 'place':770 'posit':138,209 'powershel':80,229,233,821,831,1078 'pre':748,942 'pre-publish':747,941 'prefer':405,451,517,1090,1099,1113,1127 'prevent':372 'procedur':395 'process':539 'processor':541 'prompt':384,992,997 'provid':664,982 'publish':373,749,943 'purpos':860 'queri':351 'question':600 'question-classifi':599 'question-classifier-config.json':844 'quick':856 'readabl':723 'readi':700,1126 'ready-to-us':699 'recommend':680 'ref':1033 'refer':192,789,792,801,814,1039 'remov':183,912,918,1018 'remove-nod':911 'renam':932 'request':852 'requir':349,1028 'resourc':824 'result':203,1047,1055 'retriev':322,355 'right':219 'run':179,277,428,431,434,1013,1034,1067 'sad':638 'schema':811 'scratch':400 'screen':212 'script':82,89 'section':309 'see':790,798,812 'set':924,978,986,991,996 'set-model':977 'set-prompt':990 'set-titl':923 'shell':87 'show':157 'silent':182 'simpl':316 'singl':276,341 'single-run':275 'single-turn':340 'skill':41,708 'skill-dify-workflow' 'sourc':572,587,604,622,641,890 'source-akabane71' 'source-handl':603,621,640 'specifi':602 'split':258 'src':891 'start':282,573 'step':457,487,558,644,712,751 'strategi':335,767,779,1066 'strict':737 'strip':1011 'structur':956 'support':254,345 'symptom':999 'syntax':195 'tabl':858 'target':575,590,892 'temperatur':675 'templat':453,474,703,843,848,855,870 'text':199,207,343,931,995,1049,1053 'tgt':893 'time':497 'titl':509,538,879,880,925,930 'tool':196,330,1050 'top':216 'top-left':215 'topic-agent-skills' 'topic-cli' 'topic-cli-anything' 'topic-dify-tool' 'topic-opencli' 'topic-skills' 'tree':766,950,968,1071 'troubleshoot':152,998 'true':333,624 'turn':291,342 'two':260,974 'type':507,536,800,807,877,878 'ui':947,1026 'updat':547,646,655,688,899,907 'update-nod':546,654,687,898 'use':14,20,79,95,193,211,222,239,266,296,306,452,702,867,1081 'user':96,110,121,131,139,149,444,1104,1133,1141 'utf':244 'valid':6,35,44,124,356,364,382,393,429,714,719,727,735,935,937,1014,1118,1151 'variabl':191,352,385,1032,1038,1044 'via':390 'view':951 'visual':1108 'vs':1048 'warn':738 'window':67,85,232,522,682,830,1077,1098 'workflow':3,11,18,31,39,63,102,148,167,273,274,360,398,404,465,468,471,482,500,529,544,565,580,608,627,652,685,718,726,734,742,759,773,783,818,1146 'workflow.edges':268 'workflow.nodes':267 'workflow.yaml':473,506,535,550,571,586,614,633,658,691,720,728,736,744,762,776,785 'workflows/chatflows/chat/agent/completion':24 'wrong':1042,1065 'x':218,983 'y':220,985 'yaml':120 'yet':73","prices":[{"id":"71b94d47-ae3e-4859-a672-7e945b4ee498","listingId":"49bd06f1-885c-4c05-aadd-6014b059378c","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"Akabane71","category":"dify-workflow-cli","install_from":"skills.sh"},"createdAt":"2026-05-18T13:20:36.955Z"}],"sources":[{"listingId":"49bd06f1-885c-4c05-aadd-6014b059378c","source":"github","sourceId":"Akabane71/dify-workflow-cli/dify-workflow","sourceUrl":"https://github.com/Akabane71/dify-workflow-cli/tree/main/skills/dify-workflow","isPrimary":false,"firstSeenAt":"2026-05-18T13:20:36.955Z","lastSeenAt":"2026-05-18T19:13:29.734Z"}],"details":{"listingId":"49bd06f1-885c-4c05-aadd-6014b059378c","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"Akabane71","slug":"dify-workflow","github":{"repo":"Akabane71/dify-workflow-cli","stars":8,"topics":["agent-skills","cli","cli-anything","dify-tool","opencli","skills"],"license":null,"html_url":"https://github.com/Akabane71/dify-workflow-cli","pushed_at":"2026-04-08T06:57:57Z","description":"让AI使用的Dify-WorkFlow-CLI工具","skill_md_sha":"7b03557a98cfb775635fe819d1c3a18468c4ccbe","skill_md_path":"skills/dify-workflow/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/Akabane71/dify-workflow-cli/tree/main/skills/dify-workflow"},"layout":"multi","source":"github","category":"dify-workflow-cli","frontmatter":{"name":"dify-workflow","description":"Build, edit, validate, and export Dify AI workflow DSL files using the dify-workflow CLI. Use when: creating Dify workflows/chatflows/chat/agent/completion apps; adding nodes and edges to workflows; configuring LLM/tool/code/if-else/question-classifier nodes; validating DSL before Dify import; auto-layout node positions; generating Mermaid diagrams; troubleshooting Dify import errors. Supports all 5 Dify app modes and 22 node types."},"skills_sh_url":"https://skills.sh/Akabane71/dify-workflow-cli/dify-workflow"},"updatedAt":"2026-05-18T19:13:29.734Z"}}