n8n Workflow Patterns
Proven architectural patterns for building n8n workflows.
When to use
- Building a new n8n workflow from scratch.
- Designing or reviewing workflow structure.
- Choosing among the five core patterns.
- Planning error handling, retries, or async strategies.
- Asking about webhook, HTTP API, database, AI agent, or scheduled patterns.
- Resolving pattern-related gotchas (data nesting, branch loss, timeouts).
Required input contract
Before designing or recommending a workflow, identify:
- Trigger — webhook, schedule, manual, or service trigger.
- Primary data flow — what enters, what leaves, what is transformed.
- External systems — APIs, databases, message brokers, AI models.
- Latency budget — does the upstream caller need a synchronous response?
- Failure tolerance — silent retry, dead-letter queue, alerting, or human review.
- Cadence / volume — items per execution and executions per hour.
If a strategic decision is missing, ask one sharp question before drafting
the workflow.
The 5 core patterns
| # |
Pattern |
Trigger |
Shape |
| 1 |
Webhook Processing |
Webhook (HTTP) |
Webhook → Validate → Transform → Respond / Notify |
| 2 |
HTTP API Integration |
Manual / Schedule |
Trigger → HTTP Request → Transform → Action → Error Handler |
| 3 |
Database Operations |
Schedule |
Schedule → Query → Transform → Write → Verify |
| 4 |
AI Agent Workflow |
Webhook / Manual |
Trigger → AI Agent (Model + Tools + Memory) → Output |
| 5 |
Scheduled Tasks |
Schedule (cron) |
Schedule → Fetch → Process → Deliver → Log |
Detailed catalog with use cases per pattern: references/workflow-pattern-catalog.md.
Upstream depth: webhook_processing.md, http_api_integration.md,
database_operations.md, ai_agent_workflow.md, scheduled_tasks.md.
Pattern selection (decision logic)
Decide in this order:
- External HTTP call starts the workflow? → Webhook Processing.
- Workflow runs on a clock? → Scheduled Tasks.
- Primary action is fetching from an external API on demand? → HTTP API Integration.
- Workflow moves rows between data stores? → Database Operations.
- Requires multi-step reasoning or tool use? → AI Agent Workflow.
A workflow may blend patterns — the trigger names the primary pattern.
Full pattern-selection guide + workflow creation checklist:
references/pattern-selection-workflow.md.
Node orchestration constraints
These rules apply to every workflow.
- Sequential by default. Parallelism is opt-in via branching + Merge.
- Merge after IF / Switch. Each branch must merge or terminate
independently — without Merge, only one branch reaches downstream.
- Split In Batches when N > ~500. Caps load on downstream services.
- Error Trigger is workflow-level. It connects to nothing in the main
flow; it fires when any node fails.
- Continue On Fail is per-node. Use only where downstream tolerates
silent failure.
- Webhook response must be fast. Long work goes into a follow-on
workflow with a
202 Accepted handoff.
- Credentials live in n8n credential storage, never in node parameters
or code.
- Execution Order = v1 (connection-based). v0 (top-to-bottom) only for
documented legacy reasons.
- AI agents can only use connected tools. Tools that are not wired
cannot be discovered or invoked by the agent.
Common building blocks (compact)
| Role |
Nodes |
| Triggers |
Webhook, Schedule, Manual, Polling |
| Data sources |
HTTP Request, Postgres / MySQL / MongoDB, Service nodes, Code |
| Transformation |
Set, Code, IF / Switch, Merge |
| Outputs |
HTTP Request, Database, Communication (Email / Slack / Discord), Storage |
| Error handling |
Error Trigger, IF (error condition), Stop and Error, Continue On Fail |
Full per-component detail, data flow shapes (linear / branching / parallel /
loop / error-handler), and quick-start templates:
references/node-orchestration-and-templates.md.
Validation gates
Before activating a workflow:
Run n8n_autofix_workflow after validate_workflow reports issues, then
re-validate. Full gotcha catalog, anti-patterns, QA playbook:
references/error-handling-and-validation.md.
Output expectations
When delivering a workflow design or recommendation:
- Name the primary pattern.
- List the trigger and all nodes in order.
- Mark each branch boundary (IF / Switch / Merge).
- Note any Split In Batches and the batch size.
- State the error-handling strategy (Error Trigger, Continue On Fail, retries).
- Specify the response strategy for webhook patterns.
- Flag any pattern blend explicitly (e.g., "Scheduled Task with HTTP API secondary").
Minimal critical examples
Webhook → Slack
1. Webhook (path: /form-submit, POST)
2. Set (map form fields)
3. Slack (post to #notifications)
Scheduled report
1. Schedule (daily 09:00)
2. HTTP Request (fetch analytics)
3. Code (aggregate)
4. Email (send report)
5. Error Trigger → Slack (failure)
AI assistant
1. Webhook (/chat)
2. AI Agent
├─ ai_languageModel: OpenAI Chat Model
├─ ai_tool: HTTP Request Tool
├─ ai_tool: Database Tool
└─ ai_memory: Window Buffer Memory
3. Webhook Response
End-to-end worked examples (Stripe ingest, GitHub→Jira, DB sync, AI bot,
analytics report, 202-async, branching+merge, cursor loop):
references/examples.md.
Integration with other skills
| Phase |
Skill |
| Find nodes for the pattern |
n8n-mcp-tools-expert (search_nodes) |
| Understand node operations |
n8n-mcp-tools-expert (get_node) |
| Write expressions |
n8n-expression-syntax ({{ }}, webhook nesting) |
| Configure operations |
n8n-node-configuration |
| Custom logic |
n8n-code-javascript or n8n-code-python |
| Validate and auto-fix |
n8n-validation-expert (validate_workflow, n8n_autofix_workflow) |
| Create and deploy |
n8n-mcp-tools-expert (n8n_create_workflow, activateWorkflow) |
Reference map
| Need |
Read |
| Pattern selection guide + workflow creation checklist + pattern statistics |
references/pattern-selection-workflow.md |
| Five-pattern catalog + blend decision rules + anti-blend cases |
references/workflow-pattern-catalog.md |
| Common components, data-flow shapes, orchestration rules, quick-start templates |
references/node-orchestration-and-templates.md |
| Validation gates, common gotchas, anti-patterns, QA playbook |
references/error-handling-and-validation.md |
| End-to-end worked examples (all 5 patterns + 3 blends) |
references/examples.md |
| Upstream depth (per pattern) |
webhook_processing.md, http_api_integration.md, database_operations.md, ai_agent_workflow.md, scheduled_tasks.md |
1---2name: n8n-workflow-patterns3description: Proven workflow architectural patterns from real n8n workflows. Use when building new workflows, designing workflow structure, choosing workflow patterns, planning workflow architecture, or asking about webhook processing, HTTP API integration, database operations, AI agent workflows, or scheduled tasks.4---56# n8n Workflow Patterns78Proven architectural patterns for building n8n workflows.910## When to use1112- Building a new n8n workflow from scratch.13- Designing or reviewing workflow structure.14- Choosing among the five core patterns.15- Planning error handling, retries, or async strategies.16- Asking about webhook, HTTP API, database, AI agent, or scheduled patterns.17- Resolving pattern-related gotchas (data nesting, branch loss, timeouts).1819## Required input contract2021Before designing or recommending a workflow, identify:2223- **Trigger** — webhook, schedule, manual, or service trigger.24- **Primary data flow** — what enters, what leaves, what is transformed.25- **External systems** — APIs, databases, message brokers, AI models.26- **Latency budget** — does the upstream caller need a synchronous response?27- **Failure tolerance** — silent retry, dead-letter queue, alerting, or human review.28- **Cadence / volume** — items per execution and executions per hour.2930If a strategic decision is missing, ask one sharp question before drafting31the workflow.3233## The 5 core patterns3435| # | Pattern | Trigger | Shape |36|---|---------|---------|-------|37| 1 | Webhook Processing | Webhook (HTTP) | Webhook → Validate → Transform → Respond / Notify |38| 2 | HTTP API Integration | Manual / Schedule | Trigger → HTTP Request → Transform → Action → Error Handler |39| 3 | Database Operations | Schedule | Schedule → Query → Transform → Write → Verify |40| 4 | AI Agent Workflow | Webhook / Manual | Trigger → AI Agent (Model + Tools + Memory) → Output |41| 5 | Scheduled Tasks | Schedule (cron) | Schedule → Fetch → Process → Deliver → Log |4243Detailed catalog with use cases per pattern: `references/workflow-pattern-catalog.md`.44Upstream depth: `webhook_processing.md`, `http_api_integration.md`,45`database_operations.md`, `ai_agent_workflow.md`, `scheduled_tasks.md`.4647## Pattern selection (decision logic)4849Decide in this order:50511. **External HTTP call starts the workflow?** → Webhook Processing.522. **Workflow runs on a clock?** → Scheduled Tasks.533. **Primary action is fetching from an external API on demand?** → HTTP API Integration.544. **Workflow moves rows between data stores?** → Database Operations.555. **Requires multi-step reasoning or tool use?** → AI Agent Workflow.5657A workflow may blend patterns — the **trigger** names the primary pattern.5859Full pattern-selection guide + workflow creation checklist:60`references/pattern-selection-workflow.md`.6162## Node orchestration constraints6364These rules apply to every workflow.65661. **Sequential by default.** Parallelism is opt-in via branching + Merge.672. **Merge after IF / Switch.** Each branch must merge or terminate68 independently — without Merge, only one branch reaches downstream.693. **Split In Batches when N > ~500.** Caps load on downstream services.704. **Error Trigger is workflow-level.** It connects to nothing in the main71 flow; it fires when any node fails.725. **Continue On Fail is per-node.** Use only where downstream tolerates73 silent failure.746. **Webhook response must be fast.** Long work goes into a follow-on75 workflow with a `202 Accepted` handoff.767. **Credentials live in n8n credential storage**, never in node parameters77 or code.788. **Execution Order = v1 (connection-based)**. v0 (top-to-bottom) only for79 documented legacy reasons.809. **AI agents can only use connected tools.** Tools that are not wired81 cannot be discovered or invoked by the agent.8283## Common building blocks (compact)8485| Role | Nodes |86|------|-------|87| Triggers | Webhook, Schedule, Manual, Polling |88| Data sources | HTTP Request, Postgres / MySQL / MongoDB, Service nodes, Code |89| Transformation | Set, Code, IF / Switch, Merge |90| Outputs | HTTP Request, Database, Communication (Email / Slack / Discord), Storage |91| Error handling | Error Trigger, IF (error condition), Stop and Error, Continue On Fail |9293Full per-component detail, data flow shapes (linear / branching / parallel /94loop / error-handler), and quick-start templates:95`references/node-orchestration-and-templates.md`.9697## Validation gates9899Before activating a workflow:100101- [ ] Each node validated via `validate_node({nodeType, config})`.102- [ ] Full workflow validated via `validate_workflow`.103- [ ] Credentials configured at the node level, not in parameters.104- [ ] Webhook response strategy chosen; long work split off.105- [ ] Error Trigger workflow exists for production workflows.106- [ ] `Continue On Fail` only where silent failure is acceptable.107- [ ] Sample-data run executed; empty-data path tested.108- [ ] Execution Order = v1.109- [ ] Workflow name + notes describe purpose and data flow.110111Run `n8n_autofix_workflow` after `validate_workflow` reports issues, then112re-validate. Full gotcha catalog, anti-patterns, QA playbook:113`references/error-handling-and-validation.md`.114115## Output expectations116117When delivering a workflow design or recommendation:118119- Name the primary pattern.120- List the trigger and all nodes in order.121- Mark each branch boundary (IF / Switch / Merge).122- Note any Split In Batches and the batch size.123- State the error-handling strategy (Error Trigger, Continue On Fail, retries).124- Specify the response strategy for webhook patterns.125- Flag any pattern blend explicitly (e.g., "Scheduled Task with HTTP API secondary").126127## Minimal critical examples128129### Webhook → Slack130131```1321. Webhook (path: /form-submit, POST)1332. Set (map form fields)1343. Slack (post to #notifications)135```136137### Scheduled report138139```1401. Schedule (daily 09:00)1412. HTTP Request (fetch analytics)1423. Code (aggregate)1434. Email (send report)1445. Error Trigger → Slack (failure)145```146147### AI assistant148149```1501. Webhook (/chat)1512. AI Agent152 ├─ ai_languageModel: OpenAI Chat Model153 ├─ ai_tool: HTTP Request Tool154 ├─ ai_tool: Database Tool155 └─ ai_memory: Window Buffer Memory1563. Webhook Response157```158159End-to-end worked examples (Stripe ingest, GitHub→Jira, DB sync, AI bot,160analytics report, 202-async, branching+merge, cursor loop):161`references/examples.md`.162163## Integration with other skills164165| Phase | Skill |166|-------|-------|167| Find nodes for the pattern | `n8n-mcp-tools-expert` (`search_nodes`) |168| Understand node operations | `n8n-mcp-tools-expert` (`get_node`) |169| Write expressions | `n8n-expression-syntax` (`{{ }}`, webhook nesting) |170| Configure operations | `n8n-node-configuration` |171| Custom logic | `n8n-code-javascript` or `n8n-code-python` |172| Validate and auto-fix | `n8n-validation-expert` (`validate_workflow`, `n8n_autofix_workflow`) |173| Create and deploy | `n8n-mcp-tools-expert` (`n8n_create_workflow`, `activateWorkflow`) |174175## Reference map176177| Need | Read |178|------|------|179| Pattern selection guide + workflow creation checklist + pattern statistics | `references/pattern-selection-workflow.md` |180| Five-pattern catalog + blend decision rules + anti-blend cases | `references/workflow-pattern-catalog.md` |181| Common components, data-flow shapes, orchestration rules, quick-start templates | `references/node-orchestration-and-templates.md` |182| Validation gates, common gotchas, anti-patterns, QA playbook | `references/error-handling-and-validation.md` |183| End-to-end worked examples (all 5 patterns + 3 blends) | `references/examples.md` |184| Upstream depth (per pattern) | `webhook_processing.md`, `http_api_integration.md`, `database_operations.md`, `ai_agent_workflow.md`, `scheduled_tasks.md` |