n8n-workflow-patterns

软件研发 界面 · 动效 · 设计品味 7 文件 EN 原文

真实项目里的 n8n 工作流范式

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.

说明语言:英文

来源echoleesongclaude-skills-plugin ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/echoleesong/claude-skills-plugin --skill n8n-workflow-patterns

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: n8n-workflow-patterns description: 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. ---

n8n Workflow Patterns

Proven architectural patterns for building n8n workflows.


The 5 Core Patterns

Based on analysis of real workflow usage:

  1. Webhook Processing (Most Common)
  2. Receive HTTP requests → Process → Output
  3. Pattern: Webhook → Validate → Transform → Respond/Notify
  1. HTTP API Integration
  2. Fetch from REST APIs → Transform → Store/Use
  3. Pattern: Trigger → HTTP Request → Transform → Action → Error Handler
  1. Database Operations
  2. Read/Write/Sync database data
  3. Pattern: Schedule → Query → Transform → Write → Verify
  1. AI Agent Workflow
  2. AI agents with tools and memory
  3. Pattern: Trigger → AI Agent (Model + Tools + Memory) → Output
  1. Scheduled Tasks
  2. Recurring automation workflows
  3. Pattern: Schedule → Fetch → Process → Deliver → Log

Pattern Selection Guide

When to use each pattern:

Webhook Processing - Use when:

HTTP API Integration - Use when:

Database Operations - Use when:

AI Agent Workflow - Use when:

Scheduled Tasks - Use when:


Common Workflow Components

All patterns share these building blocks:

1. Triggers

2. Data Sources

3. Transformation

4. Outputs

5. Error Handling


Workflow Creation Checklist

When building ANY workflow, follow this checklist:

Planning Phase

Implementation Phase

Validation Phase

Deployment Phase


Data Flow Patterns

Linear Flow

Trigger → Transform → Action → End

Use when: Simple workflows with single path

Branching Flow

Trigger → IF → [True Path]
             └→ [False Path]

Use when: Different actions based on conditions

Parallel Processing

Trigger → [Branch 1] → Merge
       └→ [Branch 2] ↗

Use when: Independent operations that can run simultaneously

Loop Pattern

Trigger → Split in Batches → Process → Loop (until done)

Use when: Processing large datasets in chunks

Error Handler Pattern

Main Flow → [Success Path]
         └→ [Error Trigger → Error Handler]

Use when: Need separate error handling workflow


Common Gotchas

1. Webhook Data Structure

Problem: Can't access webhook payload data

Solution: Data is nested under $json.body

❌ {{$json.email}}
✅ {{$json.body.email}}

See: n8n Expression Syntax skill

2. Multiple Input Items

Problem: Node processes all input items, but I only want one

Solution: Use "Execute Once" mode or process first item only

{{$json[0].field}}  // First item only

3. Authentication Issues

Problem: API calls failing with 401/403

Solution:

4. Node Execution Order

Problem: Nodes executing in unexpected order

Solution: Check workflow settings → Execution Order

5. Expression Errors

Problem: Expressions showing as literal text

Solution: Use {{}} around expressions


Integration with Other Skills

These skills work together with Workflow Patterns:

n8n MCP Tools Expert - Use to:

n8n Expression Syntax - Use to:

n8n Node Configuration - Use to:

n8n Validation Expert - Use to:


Pattern Statistics

Common workflow patterns:

Most Common Triggers:

  1. Webhook - 35%
  2. Schedule (periodic tasks) - 28%
  3. Manual (testing/admin) - 22%
  4. Service triggers (Slack, email, etc.) - 15%

Most Common Transformations:

  1. Set (field mapping) - 68%
  2. Code (custom logic) - 42%
  3. IF (conditional routing) - 38%
  4. Switch (multi-condition) - 18%

Most Common Outputs:

  1. HTTP Request (APIs) - 45%
  2. Slack - 32%
  3. Database writes - 28%
  4. Email - 24%

Average Workflow Complexity:


Quick Start Examples

Example 1: Simple Webhook → Slack

1. Webhook (path: "form-submit", POST)
2. Set (map form fields)
3. Slack (post message to #notifications)

Example 2: Scheduled Report

1. Schedule (daily at 9 AM)
2. HTTP Request (fetch analytics)
3. Code (aggregate data)
4. Email (send formatted report)
5. Error Trigger → Slack (notify on failure)

Example 3: Database Sync

1. Schedule (every 15 minutes)
2. Postgres (query new records)
3. IF (check if records exist)
4. MySQL (insert records)
5. Postgres (update sync timestamp)

Example 4: AI Assistant

1. Webhook (receive chat message)
2. AI Agent
   ├─ OpenAI Chat Model (ai_languageModel)
   ├─ HTTP Request Tool (ai_tool)
   ├─ Database Tool (ai_tool)
   └─ Window Buffer Memory (ai_memory)
3. Webhook Response (send AI reply)

Example 5: API Integration

1. Manual Trigger (for testing)
2. HTTP Request (GET /api/users)
3. Split In Batches (process 100 at a time)
4. Set (transform user data)
5. Postgres (upsert users)
6. Loop (back to step 3 until done)

Detailed Pattern Files

For comprehensive guidance on each pattern:


Real Template Examples

From n8n template library:

Template #2947: Weather to Slack

Webhook Processing: Most common pattern

HTTP API: Common pattern

Database Operations: Common pattern

AI Agents: Growing in usage

Use search_templates and get_template from n8n-mcp tools to find examples!


Best Practices

✅ Do

❌ Don't


Summary

Key Points:

  1. 5 core patterns cover 90%+ of workflow use cases
  2. Webhook processing is the most common pattern
  3. Use the workflow creation checklist for every workflow
  4. Plan pattern → Select nodes → Build → Validate → Deploy
  5. Integrate with other skills for complete workflow development

Next Steps:

  1. Identify your use case pattern
  2. Read the detailed pattern file
  3. Use n8n MCP Tools Expert to find nodes
  4. Follow the workflow creation checklist
  5. Use n8n Validation Expert to validate

Related Skills:

同类技能
animateanimate-expoanimation-performanceanimation-vocabularyapple-designask-sonnerbrandkitbreak-ui
本页内容来自开源项目 echoleesong, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。