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.
Add this skill
npx mdskills install czlonkowski/n8n-workflow-patternsComprehensive pattern library with clear selection guidance, actionable checklists, and strong examples
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---1112## The 5 Core Patterns1314Based on analysis of real workflow usage:15161. **[Webhook Processing](webhook_processing.md)** (Most Common)17 - Receive HTTP requests → Process → Output18 - Pattern: Webhook → Validate → Transform → Respond/Notify19202. **[HTTP API Integration](http_api_integration.md)**21 - Fetch from REST APIs → Transform → Store/Use22 - Pattern: Trigger → HTTP Request → Transform → Action → Error Handler23243. **[Database Operations](database_operations.md)**25 - Read/Write/Sync database data26 - Pattern: Schedule → Query → Transform → Write → Verify27284. **[AI Agent Workflow](ai_agent_workflow.md)**29 - AI agents with tools and memory30 - Pattern: Trigger → AI Agent (Model + Tools + Memory) → Output31325. **[Scheduled Tasks](scheduled_tasks.md)**33 - Recurring automation workflows34 - Pattern: Schedule → Fetch → Process → Deliver → Log3536---3738## Pattern Selection Guide3940### When to use each pattern:4142**Webhook Processing** - Use when:43- Receiving data from external systems44- Building integrations (Slack commands, form submissions, GitHub webhooks)45- Need instant response to events46- Example: "Receive Stripe payment webhook → Update database → Send confirmation"4748**HTTP API Integration** - Use when:49- Fetching data from external APIs50- Synchronizing with third-party services51- Building data pipelines52- Example: "Fetch GitHub issues → Transform → Create Jira tickets"5354**Database Operations** - Use when:55- Syncing between databases56- Running database queries on schedule57- ETL workflows58- Example: "Read Postgres records → Transform → Write to MySQL"5960**AI Agent Workflow** - Use when:61- Building conversational AI62- Need AI with tool access63- Multi-step reasoning tasks64- Example: "Chat with AI that can search docs, query database, send emails"6566**Scheduled Tasks** - Use when:67- Recurring reports or summaries68- Periodic data fetching69- Maintenance tasks70- Example: "Daily: Fetch analytics → Generate report → Email team"7172---7374## Common Workflow Components7576All patterns share these building blocks:7778### 1. Triggers79- **Webhook** - HTTP endpoint (instant)80- **Schedule** - Cron-based timing (periodic)81- **Manual** - Click to execute (testing)82- **Polling** - Check for changes (intervals)8384### 2. Data Sources85- **HTTP Request** - REST APIs86- **Database nodes** - Postgres, MySQL, MongoDB87- **Service nodes** - Slack, Google Sheets, etc.88- **Code** - Custom JavaScript/Python8990### 3. Transformation91- **Set** - Map/transform fields92- **Code** - Complex logic93- **IF/Switch** - Conditional routing94- **Merge** - Combine data streams9596### 4. Outputs97- **HTTP Request** - Call APIs98- **Database** - Write data99- **Communication** - Email, Slack, Discord100- **Storage** - Files, cloud storage101102### 5. Error Handling103- **Error Trigger** - Catch workflow errors104- **IF** - Check for error conditions105- **Stop and Error** - Explicit failure106- **Continue On Fail** - Per-node setting107108---109110## Workflow Creation Checklist111112When building ANY workflow, follow this checklist:113114### Planning Phase115- [ ] Identify the pattern (webhook, API, database, AI, scheduled)116- [ ] List required nodes (use search_nodes)117- [ ] Understand data flow (input → transform → output)118- [ ] Plan error handling strategy119120### Implementation Phase121- [ ] Create workflow with appropriate trigger122- [ ] Add data source nodes123- [ ] Configure authentication/credentials124- [ ] Add transformation nodes (Set, Code, IF)125- [ ] Add output/action nodes126- [ ] Configure error handling127128### Validation Phase129- [ ] Validate each node configuration (validate_node)130- [ ] Validate complete workflow (validate_workflow)131- [ ] Test with sample data132- [ ] Handle edge cases (empty data, errors)133134### Deployment Phase135- [ ] Review workflow settings (execution order, timeout, error handling)136- [ ] Activate workflow using `activateWorkflow` operation137- [ ] Monitor first executions138- [ ] Document workflow purpose and data flow139140---141142## Data Flow Patterns143144### Linear Flow145```146Trigger → Transform → Action → End147```148**Use when**: Simple workflows with single path149150### Branching Flow151```152Trigger → IF → [True Path]153 └→ [False Path]154```155**Use when**: Different actions based on conditions156157### Parallel Processing158```159Trigger → [Branch 1] → Merge160 └→ [Branch 2] ↗161```162**Use when**: Independent operations that can run simultaneously163164### Loop Pattern165```166Trigger → Split in Batches → Process → Loop (until done)167```168**Use when**: Processing large datasets in chunks169170### Error Handler Pattern171```172Main Flow → [Success Path]173 └→ [Error Trigger → Error Handler]174```175**Use when**: Need separate error handling workflow176177---178179## Common Gotchas180181### 1. Webhook Data Structure182**Problem**: Can't access webhook payload data183184**Solution**: Data is nested under `$json.body`185```javascript186❌ {{$json.email}}187✅ {{$json.body.email}}188```189See: n8n Expression Syntax skill190191### 2. Multiple Input Items192**Problem**: Node processes all input items, but I only want one193194**Solution**: Use "Execute Once" mode or process first item only195```javascript196{{$json[0].field}} // First item only197```198199### 3. Authentication Issues200**Problem**: API calls failing with 401/403201202**Solution**:203- Configure credentials properly204- Use the "Credentials" section, not parameters205- Test credentials before workflow activation206207### 4. Node Execution Order208**Problem**: Nodes executing in unexpected order209210**Solution**: Check workflow settings → Execution Order211- v0: Top-to-bottom (legacy)212- v1: Connection-based (recommended)213214### 5. Expression Errors215**Problem**: Expressions showing as literal text216217**Solution**: Use {{}} around expressions218- See n8n Expression Syntax skill for details219220---221222## Integration with Other Skills223224These skills work together with Workflow Patterns:225226**n8n MCP Tools Expert** - Use to:227- Find nodes for your pattern (search_nodes)228- Understand node operations (get_node)229- Create workflows (n8n_create_workflow)230- Deploy templates (n8n_deploy_template)231- Use ai_agents_guide for AI pattern guidance232233**n8n Expression Syntax** - Use to:234- Write expressions in transformation nodes235- Access webhook data correctly ({{$json.body.field}})236- Reference previous nodes ({{$node["Node Name"].json.field}})237238**n8n Node Configuration** - Use to:239- Configure specific operations for pattern nodes240- Understand node-specific requirements241242**n8n Validation Expert** - Use to:243- Validate workflow structure244- Fix validation errors245- Ensure workflow correctness before deployment246247---248249## Pattern Statistics250251Common workflow patterns:252253**Most Common Triggers**:2541. Webhook - 35%2552. Schedule (periodic tasks) - 28%2563. Manual (testing/admin) - 22%2574. Service triggers (Slack, email, etc.) - 15%258259**Most Common Transformations**:2601. Set (field mapping) - 68%2612. Code (custom logic) - 42%2623. IF (conditional routing) - 38%2634. Switch (multi-condition) - 18%264265**Most Common Outputs**:2661. HTTP Request (APIs) - 45%2672. Slack - 32%2683. Database writes - 28%2694. Email - 24%270271**Average Workflow Complexity**:272- Simple (3-5 nodes): 42%273- Medium (6-10 nodes): 38%274- Complex (11+ nodes): 20%275276---277278## Quick Start Examples279280### Example 1: Simple Webhook → Slack281```2821. Webhook (path: "form-submit", POST)2832. Set (map form fields)2843. Slack (post message to #notifications)285```286287### Example 2: Scheduled Report288```2891. Schedule (daily at 9 AM)2902. HTTP Request (fetch analytics)2913. Code (aggregate data)2924. Email (send formatted report)2935. Error Trigger → Slack (notify on failure)294```295296### Example 3: Database Sync297```2981. Schedule (every 15 minutes)2992. Postgres (query new records)3003. IF (check if records exist)3014. MySQL (insert records)3025. Postgres (update sync timestamp)303```304305### Example 4: AI Assistant306```3071. Webhook (receive chat message)3082. AI Agent309 ├─ OpenAI Chat Model (ai_languageModel)310 ├─ HTTP Request Tool (ai_tool)311 ├─ Database Tool (ai_tool)312 └─ Window Buffer Memory (ai_memory)3133. Webhook Response (send AI reply)314```315316### Example 5: API Integration317```3181. Manual Trigger (for testing)3192. HTTP Request (GET /api/users)3203. Split In Batches (process 100 at a time)3214. Set (transform user data)3225. Postgres (upsert users)3236. Loop (back to step 3 until done)324```325326---327328## Detailed Pattern Files329330For comprehensive guidance on each pattern:331332- **[webhook_processing.md](webhook_processing.md)** - Webhook patterns, data structure, response handling333- **[http_api_integration.md](http_api_integration.md)** - REST APIs, authentication, pagination, retries334- **[database_operations.md](database_operations.md)** - Queries, sync, transactions, batch processing335- **[ai_agent_workflow.md](ai_agent_workflow.md)** - AI agents, tools, memory, langchain nodes336- **[scheduled_tasks.md](scheduled_tasks.md)** - Cron schedules, reports, maintenance tasks337338---339340## Real Template Examples341342From n8n template library:343344**Template #2947**: Weather to Slack345- Pattern: Scheduled Task346- Nodes: Schedule → HTTP Request (weather API) → Set → Slack347- Complexity: Simple (4 nodes)348349**Webhook Processing**: Most common pattern350- Most common: Form submissions, payment webhooks, chat integrations351352**HTTP API**: Common pattern353- Most common: Data fetching, third-party integrations354355**Database Operations**: Common pattern356- Most common: ETL, data sync, backup workflows357358**AI Agents**: Growing in usage359- Most common: Chatbots, content generation, data analysis360361Use `search_templates` and `get_template` from n8n-mcp tools to find examples!362363---364365## Best Practices366367### ✅ Do368369- Start with the simplest pattern that solves your problem370- Plan your workflow structure before building371- Use error handling on all workflows372- Test with sample data before activation373- Follow the workflow creation checklist374- Use descriptive node names375- Document complex workflows (notes field)376- Monitor workflow executions after deployment377378### ❌ Don't379380- Build workflows in one shot (iterate! avg 56s between edits)381- Skip validation before activation382- Ignore error scenarios383- Use complex patterns when simple ones suffice384- Hardcode credentials in parameters385- Forget to handle empty data cases386- Mix multiple patterns without clear boundaries387- Deploy without testing388389---390391## Summary392393**Key Points**:3941. **5 core patterns** cover 90%+ of workflow use cases3952. **Webhook processing** is the most common pattern3963. Use the **workflow creation checklist** for every workflow3974. **Plan pattern** → **Select nodes** → **Build** → **Validate** → **Deploy**3985. Integrate with other skills for complete workflow development399400**Next Steps**:4011. Identify your use case pattern4022. Read the detailed pattern file4033. Use n8n MCP Tools Expert to find nodes4044. Follow the workflow creation checklist4055. Use n8n Validation Expert to validate406407**Related Skills**:408- n8n MCP Tools Expert - Find and configure nodes409- n8n Expression Syntax - Write expressions correctly410- n8n Validation Expert - Validate and fix errors411- n8n Node Configuration - Configure specific operations412
Full transparency — inspect the skill content before installing.