n8n Sub-workflows
Sub-workflows are reusable functions. The
Execute Workflow Trigger
declares input parameters, the body does work, the last node returns output. Callers invoke it like any other node.
That framing opens up the function-shaped wins: encapsulation, reuse, testability, replaceability. It's the primary reuse mechanism in n8n, and unfortunately underused.
Without sub-workflows, the same logic gets duplicated across workflows. Bug fixes happen in multiple places, one gets missed, and "identical" copies drift.
Non-negotiables
Search before you build.
Before writing logic that handles a generic problem, check if a sub-workflow already exists. Filter by tag (
search_workflows({ tags: ['subworkflow'] })
, a domain tag) and/or keyword (
query: '
n8n-subworkflows-official
安装
npx skills add https://github.com/n8n-io/skills --skill n8n-subworkflows-official