[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-7938997a-e3f5-40d4-b99b-67148f2904be":3,"$fdUeWC8CM7U45Wm1EtNtLGSQBNvm6nAMVKm_zfH4MMyk":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"7938997a-e3f5-40d4-b99b-67148f2904be","n8n-workflow-patterns","经过验证的建筑模式，用于构建n8n工作流程。","cat_prod_automation","mod_productivity","sickn33,productivity","---\nname: n8n-workflow-patterns\ndescription: \"Proven architectural patterns for building n8n workflows.\"\nrisk: unknown\nsource: community\n---\n\n# n8n Workflow Patterns\n\nProven architectural patterns for building n8n workflows.\n\n## When to Use\n- You need to choose an architectural pattern for an n8n workflow before building it.\n- The task involves webhook processing, API integration, scheduled jobs, database sync, or AI-agent workflow design.\n- You want a high-level workflow structure rather than node-by-node troubleshooting.\n\n---\n\n## The 5 Core Patterns\n\nBased on analysis of real workflow usage:\n\n1. **Webhook Processing** (Most Common)\n   - Receive HTTP requests → Process → Output\n   - Pattern: Webhook → Validate → Transform → Respond\u002FNotify\n\n2. **[HTTP API Integration]**\n   - Fetch from REST APIs → Transform → Store\u002FUse\n   - Pattern: Trigger → HTTP Request → Transform → Action → Error Handler\n\n3. **Database Operations**\n   - Read\u002FWrite\u002FSync database data\n   - Pattern: Schedule → Query → Transform → Write → Verify\n\n4. **AI Agent Workflow**\n   - AI agents with tools and memory\n   - Pattern: Trigger → AI Agent (Model + Tools + Memory) → Output\n\n5. **Scheduled Tasks**\n   - Recurring automation workflows\n   - Pattern: Schedule → Fetch → Process → Deliver → Log\n\n---\n\n## Pattern Selection Guide\n\n### When to use each pattern:\n\n**Webhook Processing** - Use when:\n- Receiving data from external systems\n- Building integrations (Slack commands, form submissions, GitHub webhooks)\n- Need instant response to events\n- Example: \"Receive Stripe payment webhook → Update database → Send confirmation\"\n\n**HTTP API Integration** - Use when:\n- Fetching data from external APIs\n- Synchronizing with third-party services\n- Building data pipelines\n- Example: \"Fetch GitHub issues → Transform → Create Jira tickets\"\n\n**Database Operations** - Use when:\n- Syncing between databases\n- Running database queries on schedule\n- ETL workflows\n- Example: \"Read Postgres records → Transform → Write to MySQL\"\n\n**AI Agent Workflow** - Use when:\n- Building conversational AI\n- Need AI with tool access\n- Multi-step reasoning tasks\n- Example: \"Chat with AI that can search docs, query database, send emails\"\n\n**Scheduled Tasks** - Use when:\n- Recurring reports or summaries\n- Periodic data fetching\n- Maintenance tasks\n- Example: \"Daily: Fetch analytics → Generate report → Email team\"\n\n---\n\n## Common Workflow Components\n\nAll patterns share these building blocks:\n\n### 1. Triggers\n- **Webhook** - HTTP endpoint (instant)\n- **Schedule** - Cron-based timing (periodic)\n- **Manual** - Click to execute (testing)\n- **Polling** - Check for changes (intervals)\n\n### 2. Data Sources\n- **HTTP Request** - REST APIs\n- **Database nodes** - Postgres, MySQL, MongoDB\n- **Service nodes** - Slack, Google Sheets, etc.\n- **Code** - Custom JavaScript\u002FPython\n\n### 3. Transformation\n- **Set** - Map\u002Ftransform fields\n- **Code** - Complex logic\n- **IF\u002FSwitch** - Conditional routing\n- **Merge** - Combine data streams\n\n### 4. Outputs\n- **HTTP Request** - Call APIs\n- **Database** - Write data\n- **Communication** - Email, Slack, Discord\n- **Storage** - Files, cloud storage\n\n### 5. Error Handling\n- **Error Trigger** - Catch workflow errors\n- **IF** - Check for error conditions\n- **Stop and Error** - Explicit failure\n- **Continue On Fail** - Per-node setting\n\n---\n\n## Workflow Creation Checklist\n\nWhen building ANY workflow, follow this checklist:\n\n### Planning Phase\n- [ ] Identify the pattern (webhook, API, database, AI, scheduled)\n- [ ] List required nodes (use search_nodes)\n- [ ] Understand data flow (input → transform → output)\n- [ ] Plan error handling strategy\n\n### Implementation Phase\n- [ ] Create workflow with appropriate trigger\n- [ ] Add data source nodes\n- [ ] Configure authentication\u002Fcredentials\n- [ ] Add transformation nodes (Set, Code, IF)\n- [ ] Add output\u002Faction nodes\n- [ ] Configure error handling\n\n### Validation Phase\n- [ ] Validate each node configuration (validate_node)\n- [ ] Validate complete workflow (validate_workflow)\n- [ ] Test with sample data\n- [ ] Handle edge cases (empty data, errors)\n\n### Deployment Phase\n- [ ] Review workflow settings (execution order, timeout, error handling)\n- [ ] Activate workflow using `activateWorkflow` operation\n- [ ] Monitor first executions\n- [ ] Document workflow purpose and data flow\n\n---\n\n## Data Flow Patterns\n\n### Linear Flow\n```\nTrigger → Transform → Action → End\n```\n**Use when**: Simple workflows with single path\n\n### Branching Flow\n```\nTrigger → IF → [True Path]\n             └→ [False Path]\n```\n**Use when**: Different actions based on conditions\n\n### Parallel Processing\n```\nTrigger → [Branch 1] → Merge\n       └→ [Branch 2] ↗\n```\n**Use when**: Independent operations that can run simultaneously\n\n### Loop Pattern\n```\nTrigger → Split in Batches → Process → Loop (until done)\n```\n**Use when**: Processing large datasets in chunks\n\n### Error Handler Pattern\n```\nMain Flow → [Success Path]\n         └→ [Error Trigger → Error Handler]\n```\n**Use when**: Need separate error handling workflow\n\n---\n\n## Common Gotchas\n\n### 1. Webhook Data Structure\n**Problem**: Can't access webhook payload data\n\n**Solution**: Data is nested under `$json.body`\n```javascript\n❌ {{$json.email}}\n✅ {{$json.body.email}}\n```\nSee: n8n Expression Syntax skill\n\n### 2. Multiple Input Items\n**Problem**: Node processes all input items, but I only want one\n\n**Solution**: Use \"Execute Once\" mode or process first item only\n```javascript\n{{$json[0].field}}  \u002F\u002F First item only\n```\n\n### 3. Authentication Issues\n**Problem**: API calls failing with 401\u002F403\n\n**Solution**:\n- Configure credentials properly\n- Use the \"Credentials\" section, not parameters\n- Test credentials before workflow activation\n\n### 4. Node Execution Order\n**Problem**: Nodes executing in unexpected order\n\n**Solution**: Check workflow settings → Execution Order\n- v0: Top-to-bottom (legacy)\n- v1: Connection-based (recommended)\n\n### 5. Expression Errors\n**Problem**: Expressions showing as literal text\n\n**Solution**: Use {{}} around expressions\n- See n8n Expression Syntax skill for details\n\n---\n\n## Integration with Other Skills\n\nThese skills work together with Workflow Patterns:\n\n**n8n MCP Tools Expert** - Use to:\n- Find nodes for your pattern (search_nodes)\n- Understand node operations (get_node)\n- Create workflows (n8n_create_workflow)\n- Deploy templates (n8n_deploy_template)\n- Use ai_agents_guide for AI pattern guidance\n\n**n8n Expression Syntax** - Use to:\n- Write expressions in transformation nodes\n- Access webhook data correctly ({{$json.body.field}})\n- Reference previous nodes ({{$node[\"Node Name\"].json.field}})\n\n**n8n Node Configuration** - Use to:\n- Configure specific operations for pattern nodes\n- Understand node-specific requirements\n\n**n8n Validation Expert** - Use to:\n- Validate workflow structure\n- Fix validation errors\n- Ensure workflow correctness before deployment\n\n---\n\n## Pattern Statistics\n\nCommon workflow patterns:\n\n**Most Common Triggers**:\n1. Webhook - 35%\n2. Schedule (periodic tasks) - 28%\n3. Manual (testing\u002Fadmin) - 22%\n4. Service triggers (Slack, email, etc.) - 15%\n\n**Most Common Transformations**:\n1. Set (field mapping) - 68%\n2. Code (custom logic) - 42%\n3. IF (conditional routing) - 38%\n4. Switch (multi-condition) - 18%\n\n**Most Common Outputs**:\n1. HTTP Request (APIs) - 45%\n2. Slack - 32%\n3. Database writes - 28%\n4. Email - 24%\n\n**Average Workflow Complexity**:\n- Simple (3-5 nodes): 42%\n- Medium (6-10 nodes): 38%\n- Complex (11+ nodes): 20%\n\n---\n\n## Quick Start Examples\n\n### Example 1: Simple Webhook → Slack\n```\n1. Webhook (path: \"form-submit\", POST)\n2. Set (map form fields)\n3. Slack (post message to #notifications)\n```\n\n### Example 2: Scheduled Report\n```\n1. Schedule (daily at 9 AM)\n2. HTTP Request (fetch analytics)\n3. Code (aggregate data)\n4. Email (send formatted report)\n5. Error Trigger → Slack (notify on failure)\n```\n\n### Example 3: Database Sync\n```\n1. Schedule (every 15 minutes)\n2. Postgres (query new records)\n3. IF (check if records exist)\n4. MySQL (insert records)\n5. Postgres (update sync timestamp)\n```\n\n### Example 4: AI Assistant\n```\n1. Webhook (receive chat message)\n2. AI Agent\n   ├─ OpenAI Chat Model (ai_languageModel)\n   ├─ HTTP Request Tool (ai_tool)\n   ├─ Database Tool (ai_tool)\n   └─ Window Buffer Memory (ai_memory)\n3. Webhook Response (send AI reply)\n```\n\n### Example 5: API Integration\n```\n1. Manual Trigger (for testing)\n2. HTTP Request (GET \u002Fapi\u002Fusers)\n3. Split In Batches (process 100 at a time)\n4. Set (transform user data)\n5. Postgres (upsert users)\n6. Loop (back to step 3 until done)\n```\n\n---\n\n## Detailed Pattern Files\n\nFor comprehensive guidance on each pattern:\n\n- **webhook_processing.md** - Webhook patterns, data structure, response handling\n- **http_api_integration** - REST APIs, authentication, pagination, retries\n- **database_operations.md** - Queries, sync, transactions, batch processing\n- **ai_agent_workflow.md** - AI agents, tools, memory, langchain nodes\n- **scheduled_tasks.md** - Cron schedules, reports, maintenance tasks\n\n---\n\n## Real Template Examples\n\nFrom n8n template library:\n\n**Template #2947**: Weather to Slack\n- Pattern: Scheduled Task\n- Nodes: Schedule → HTTP Request (weather API) → Set → Slack\n- Complexity: Simple (4 nodes)\n\n**Webhook Processing**: Most common pattern\n- Most common: Form submissions, payment webhooks, chat integrations\n\n**HTTP API**: Common pattern\n- Most common: Data fetching, third-party integrations\n\n**Database Operations**: Common pattern\n- Most common: ETL, data sync, backup workflows\n\n**AI Agents**: Growing in usage\n- Most common: Chatbots, content generation, data analysis\n\nUse `search_templates` and `get_template` from n8n-mcp tools to find examples!\n\n---\n\n## Best Practices\n\n### ✅ Do\n\n- Start with the simplest pattern that solves your problem\n- Plan your workflow structure before building\n- Use error handling on all workflows\n- Test with sample data before activation\n- Follow the workflow creation checklist\n- Use descriptive node names\n- Document complex workflows (notes field)\n- Monitor workflow executions after deployment\n\n### ❌ Don't\n\n- Build workflows in one shot (iterate! avg 56s between edits)\n- Skip validation before activation\n- Ignore error scenarios\n- Use complex patterns when simple ones suffice\n- Hardcode credentials in parameters\n- Forget to handle empty data cases\n- Mix multiple patterns without clear boundaries\n- Deploy without testing\n\n---\n\n## Summary\n\n**Key Points**:\n1. **5 core patterns** cover 90%+ of workflow use cases\n2. **Webhook processing** is the most common pattern\n3. Use the **workflow creation checklist** for every workflow\n4. **Plan pattern** → **Select nodes** → **Build** → **Validate** → **Deploy**\n5. Integrate with other skills for complete workflow development\n\n**Next Steps**:\n1. Identify your use case pattern\n2. Read the detailed pattern file\n3. Use n8n MCP Tools Expert to find nodes\n4. Follow the workflow creation checklist\n5. Use n8n Validation Expert to validate\n\n**Related Skills**:\n- n8n MCP Tools Expert - Find and configure nodes\n- n8n Expression Syntax - Write expressions correctly\n- n8n Validation Expert - Validate and fix errors\n- n8n Node Configuration - Configure specific operations\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,120,878,"2026-05-16 13:30:23",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"效率工具","productivity","mdi-lightning-bolt-outline","文档处理、数据分析、自动化工作流",4,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"自动化","automation","mdi-robot-outline","工作流自动化、批处理",3,101,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"a50db63b-31f4-4e2a-8d1d-d91e0e1612ca","1.0.0","n8n-workflow-patterns.zip",4656,"uploads\u002Fskills\u002F7938997a-e3f5-40d4-b99b-67148f2904be\u002Fn8n-workflow-patterns.zip","6a09e708a8c4e6b93b4c38bbfd47b20037c2cd6de1b0ed7550d32afc11aa8e22","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":11671}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]