# N8n Workflow Patterns

> Select, structure, and implement proven architectural patterns for n8n workflows including webhook ingestion, scheduled polling, queue processing, API integration, and AI sub-execution routing. Use when designing robust, idempotent workflow architectures in n8n.

- Skill: `revrebel/n8n-workflow-patterns` (Agent Skill)
- Install (CLI): `npx get-skill add revrebel/n8n-workflow-patterns`
- Raw SKILL.md: https://api.skillmd.com/api/skills/revrebel/n8n-workflow-patterns/raw
- Safety review: pending (external: skill-scanner PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- License: not_declared_upstream
- Author: REVREBEL (https://skillmd.com/u/revrebel)
- Updated: 2026-11-16
- Page: https://skillmd.com/skills/revrebel/n8n-workflow-patterns

---

# n8n Workflow Patterns

Implement resilient, operationally sound architectural patterns for n8n automated workflows.

## When to Use

Use this skill when:
- Designing a new n8n workflow from initial requirements before adding individual nodes.
- Structuring webhook ingestion, scheduled synchronization, rate-limited API integration, or event routing.
- Building modular orchestration layers that coordinate downstream tools or sub-workflows.
- Refactoring sprawling, monolithic n8n canvas layouts into maintainable architectural patterns.

Do not use this skill for:
- Detailed parameter troubleshooting on specific node types (use `n8n-node-configuration`).
- Writing Python script logic inside Code nodes (use `n8n-code-python`).
- Debugging execution validation errors and schema mismatches (use `n8n-validation-expert`).

## Prerequisites

- Access to an active n8n instance (self-hosted or n8n Cloud).
- Documented trigger types (Webhook, Cron/Schedule, Event, or Manual trigger).
- Target system credentials configured in n8n credential store.

## Core Architectural Patterns

### Pattern 1: Webhook Ingestion & Immediate Acknowledgment
Use for external webhooks requiring sub-second response times before long-running processing:
1. **Webhook Node**: Configure HTTP method, path, and `Response Mode: When Last Node Finishes` (or `Immediate`).
2. **Input Validation Node**: Verify payload signature and assert required fields.
3. **Respond to Webhook Node**: Return `200 OK` or `202 Accepted` immediately.
4. **Processing Pipeline**: Route payload to transformation, database, or sub-workflow nodes.

### Pattern 2: Scheduled Polling & Delta Sync
Use for recurring batch extraction and incremental state synchronization:
1. **Schedule Trigger**: Define cron schedule with timezone awareness.
2. **State Retrieval**: Read last sync timestamp or high-water mark from KV storage or database.
3. **Data Extraction**: Query external API with filtered time window (`since_timestamp`).
4. **Batch Processing**: Loop through extracted records using batching nodes.
5. **State Update**: Persist updated timestamp upon verified completion.

### Pattern 3: Queue & Work Item Processing
Use for high-throughput or rate-limited downstream destinations:
1. **Queue Trigger / Poller**: Consume items from message queue (Redis, RabbitMQ, SQS).
2. **Rate Limiting (Wait Node)**: Enforce concurrency limits or pacing between requests.
3. **Execution & Retry**: Wrap external HTTP calls with error-handling trigger branches.
4. **Queue Acknowledgment**: Delete or acknowledge message only upon successful persistence.

### Pattern 4: AI Agent Orchestration & Tool Execution
Use when coordinating AI models with deterministically callable n8n tools:
1. **Chat / Event Trigger**: Capture prompt or inbound task request.
2. **AI Agent Node**: Configure model provider, system prompt, and reasoning memory.
3. **Tool Connections**: Expose modular n8n Custom Code Tools or Sub-workflows as agent tools.
4. **Structured Output Parser**: Enforce JSON schema validation on model outputs.

## Safety & Governance

- Never pass unencrypted API tokens or credentials through workflow execution data.
- Ensure all webhook endpoints implement signature verification or secret query parameters.
- Wrap external service mutations in try-catch / Error Trigger pathways to prevent silent data drop.

## Completion Evidence

A successfully structured n8n workflow pattern produces:
- Clear separation between ingestion, validation, processing, and persistence stages.
- Documented trigger contracts and expected payload shapes.
- Configured Error Trigger workflow or error branch for failure alerting.

