Workflow architect
Design production-grade n8n workflows from requirements. Use this skill whenever the user wants to build, design, architect, or plan an n8n workflow or automation — including phrases like "build me a workflow", "design an automation", "create an n8n flow", "how should I structure this in n8n", or any request involving connecting services (webhooks, APIs, databases, LLMs, email, WhatsApp, Stripe, Google Sheets, etc.) through n8n. Also use when the user describes a business process and wants it automated. Always use this skill before generating n8n workflow JSON or recommending node structures — do not rely on memory of n8n node names or expression syntax.
By- name:
- workflow-architect
- description:
- Design production-grade n8n workflows from requirements. Use this skill whenever the user wants to build, design, architect, or plan an n8n workflow or automation — including phrases like "build me a workflow", "design an automation", "create an n8n flow", "how should I structure this in n8n", or any request involving connecting services (webhooks, APIs, databases, LLMs, email, WhatsApp, Stripe, Google Sheets, etc.) through n8n. Also use when the user describes a business process and wants it automated. Always use this skill before generating n8n workflow JSON or recommending node structures — do not rely on memory of n8n node names or expression syntax.
n8n Workflow Architect
You are designing a production n8n workflow, not a demo. The workflow must survive real data, real failures, and real volume.
Core principles (apply every time)
Real node names, not guesses. n8n is strict about capitalization and spacing. Use
Google SheetsnotGooglesheets.HTTP RequestnotHttpRequest.Webhooknotwebhook trigger. If unsure, say so — don't invent.Expression syntax is
={{ $json.field }}. The leading=marks the whole field as an expression. Without it, n8n treats the value as a literal string. This is the #1 hallucination source.Every external call needs an error branch. Wrap API calls in an
IFor usecontinueOnFail: true+ a downstreamIFthat checks{{ $json.error }}. Never assume third parties don't fail.Idempotency by default. If the workflow could be retriggered (webhook, cron, polling), include a checkpoint — a MySQL/Postgres lookup on a natural key, or a
Google Sheetsrow check. Reference themysql-checkpointingskill for the pattern.Sub-workflows for reuse. If logic exceeds ~8 nodes or is called from multiple places (e.g., error handling, notifications), extract into an
Execute Workflowsub-workflow.
Workflow design process
Follow these steps in order. Skipping steps produces demo-quality output.
Step 1: Clarify the trigger
Ask (or infer) exactly ONE trigger type:
| Trigger | Use when |
|---|---|
Webhook |
External system pushes events (Stripe, Meta, custom APIs) |
Schedule Trigger |
Recurring jobs (daily reports, hourly polls) |
Manual Trigger |
Admin-triggered, testing |
Form Trigger |
User-facing intake |
Chat Trigger |
Conversational agents |
Execute Workflow Trigger |
Called by another workflow |
Webhooks in production need: signature verification (HMAC), idempotency key extraction, and a 200 response within 3s (use Respond to Webhook early, process async).
Step 2: Map the happy path
Draft the node sequence as a numbered list BEFORE writing JSON. Each node gets:
- Node type (exact n8n name)
- Purpose (one sentence)
- Key config (the one or two parameters that matter)
Example:
1. Webhook (POST /stripe-events) — receives Stripe events
2. Code — verify HMAC signature against STRIPE_SIGNING_SECRET header
3. IF — branch on signature valid
4. Respond to Webhook — return 200 immediately (no payload)
5. MySQL — SELECT from processed_webhooks WHERE event_id = {{ $('Webhook').item.json.body.id }}
...
Step 3: Add error paths
For EACH external call node, answer:
- What failure modes exist? (timeout, 4xx, 5xx, rate limit, malformed response)
- What's the recovery? (retry with backoff, fallback vendor, dead-letter queue, alert)
Common patterns:
- Retry with backoff:
Waitnode (exponential: 2^n seconds) → loop back viaExecute Workflowcalling itself with a retry counter - Fallback vendor:
IFon error → alternative vendor node (e.g., WhatsApp fails → Twilio SMS) - Dead letter: Error →
MySQLinsert intofailed_jobstable with payload + error message
Step 4: Wire the LLM steps correctly
If using LLMs (Claude, OpenAI, Groq), reference the chain-llm-pattern skill for multi-step reasoning. Key rules:
- Use the LangChain nodes (
AI Agent,Basic LLM Chain,Information Extractor) for structured outputs, NOT rawHTTP Requestto the LLM API — the LangChain nodes handle JSON parsing, retries, and token accounting. - For JSON outputs, use
Information Extractorwith an explicit schema, not "please return JSON" in a system prompt. - Set
maxTokensexplicitly — n8n defaults can silently truncate. - Pin an example input during development (right-click node → "Pin Data") so downstream nodes have stable schemas to build against.
Step 5: Output
Produce the workflow as valid n8n workflow JSON. Structure:
{
"name": "Workflow Name",
"nodes": [...],
"connections": {...},
"settings": { "executionOrder": "v1" }
}
Every node needs id (UUID), name (unique in workflow), type (exact n8n type), typeVersion (integer), position ([x, y]), and parameters (node-specific config).
Use typeVersion: 1 as a safe default unless you know a newer version is required.
For connections, main is the default output — branching nodes (IF, Switch) have multiple output indices.
If the user asked for a description rather than importable JSON, produce a clean numbered list matching Step 2 format and offer to generate JSON.
Anti-patterns to refuse
Do NOT produce workflows that:
- Store credentials inline (always use n8n credential references:
{{ $credentials.apiKey }}) - Poll an API every minute when a webhook exists
- Use
Functionnodes for logic that has a purpose-built node (e.g.,Split In Batches,Merge,Item Lists) - Return raw LLM output to end users without validation
- Assume a list/array is always populated (always handle empty arrays)
When the user's request is vague
Don't guess — ask ONE consolidated clarifying question covering:
- Trigger source + frequency
- External services involved
- What happens on failure (silent drop? alert? retry?)
- Data destination
One question, not five. Move fast.
Reference files
references/node-catalog.md— curated list of battle-tested nodes for common tasksreferences/expressions-cheatsheet.md— n8n expression syntax, common patterns, gotchas
Open this reference as its own page
n8n Expressions Cheatsheet
n8n expressions are JavaScript-flavored, evaluated per-item, and prefixed with = to mark a field as an expression.
The single most common bug
✓ ={{ $json.email }} // expression — evaluates per item
✗ {{ $json.email }} // literal string — sent as-is to the destination
Without the leading =, n8n treats the entire value as a literal string. The UI hides this — always check the JSON view if expressions aren't interpolating.
Accessing data
// Current item's JSON
{{ $json.field }}
{{ $json.nested.field }}
{{ $json["field-with-dash"] }} // bracket notation for non-identifier keys
// Optional chaining for safety
{{ $json.customer?.email ?? 'unknown' }}
// Array access
{{ $json.items[0].name }}
{{ $json.items?.[0]?.name ?? '' }}
// All items in current node input
{{ $input.all() }} // array of { json, binary }
{{ $input.first().json.x }}
{{ $input.last().json.x }}
{{ $input.item.json.x }} // current item being processed
// Output of a previous node
{{ $('Webhook').item.json.body.email }}
{{ $('Set').first().json.id }}
{{ $('Split In Batches').all().map(i => i.json.id) }}
Use the exact node name including spaces, in single or double quotes.
Built-in helpers
// Date / time (Luxon)
{{ $now }} // current DateTime
{{ $now.toISO() }} // 2026-04-26T12:34:56.000Z
{{ $now.toFormat('yyyy-MM-dd') }} // 2026-04-26
{{ $now.minus({ days: 7 }).toISO() }} // 1 week ago
{{ $now.plus({ hours: 2 }) }}
{{ DateTime.fromISO($json.timestamp) }} // parse ISO string
// Today's start / end
{{ $today.startOf('day').toISO() }}
{{ $today.endOf('day').toISO() }}
// Environment vars (self-hosted)
{{ $env.MY_SECRET }}
// Workflow + execution metadata
{{ $workflow.id }}
{{ $workflow.name }}
{{ $execution.id }}
{{ $execution.mode }} // 'webhook' | 'manual' | 'trigger' | etc.
// Item index in the current batch
{{ $itemIndex }}
// Run index (incremented on each manual run)
{{ $runIndex }}
String operations
{{ $json.name.trim() }}
{{ $json.name.toLowerCase() }}
{{ $json.email.split('@')[1] }} // extract domain
{{ $json.text.replace(/\s+/g, ' ') }} // collapse whitespace
{{ $json.title.startsWith('Sr.') }}
{{ `Hello ${$json.name}, your code is ${$json.code}` }} // template literal
Number / math
{{ $json.amount * 1.07 }}
{{ Math.round($json.score * 100) / 100 }} // 2 decimals
{{ Number($json.price.replace(/,/g, '')) }} // string with commas → number
{{ Math.max($json.a, $json.b) }}
Boolean / conditional
{{ $json.amount > 100 ? 'high' : 'low' }}
{{ $json.status === 'paid' && $json.shipped }}
{{ !$json.disabled }}
Arrays
{{ $json.items.length }}
{{ $json.items.filter(i => i.active) }}
{{ $json.items.map(i => i.id) }}
{{ $json.items.reduce((sum, i) => sum + i.price, 0) }}
{{ $json.items.find(i => i.id === '123') }}
{{ $json.items.includes('foo') }}
JSON
{{ JSON.stringify($json) }}
{{ JSON.parse($json.payload_string) }}
Common patterns
Build a SQL-friendly value
INSERT INTO orders (id, email, amount, created_at)
VALUES (
'{{ $json.order_id }}',
'{{ $json.email.toLowerCase() }}',
{{ $json.amount }},
'{{ $now.toISO() }}'
)
Compute an idempotency key
={{ require('crypto').createHash('sha256').update(JSON.stringify($json)).digest('hex') }}
(Available in Code node, not in expressions — copy logic into a Code node and pass through.)
Conditional API URL
={{ $json.env === 'prod' ? 'https://api.example.com' : 'https://staging.api.example.com' }}/v1/users/{{ $json.user_id }}
Default values
={{ $json.email ?? $json.contact_email ?? 'no-email@unknown.com' }}
Safe nested access with fallbacks
={{ $json.user?.profile?.address?.city ?? 'Unknown' }}
Gotchas
- Whole field is the expression: a field is either fully literal or fully an expression — you can't put
=in the middle. To mix literals and expressions, use template literals:={{ \Hello ${$json.name}` }}`. - Quoting: inside expressions, use single quotes for strings to avoid escaping. Double quotes work too but conflict with JSON.
$nodeis deprecated. Use$('Node Name')instead.- No top-level
awaitin expressions. For async logic, use aCodenode. require()only works inCodenode, not in expressions.- Date arithmetic uses Luxon, not native
Date..minus({ days: 7 }), not.setDate(...).
Code node specifics
// Run Once for All Items mode
const items = $input.all();
return items.map(item => ({
json: { ...item.json, processed: true }
}));
// Run Once for Each Item mode (cleaner for per-item)
return {
json: { ...$json, doubled: $json.amount * 2 }
};
In Code, use $input.all() and return an array of { json: {...}, binary: {...} } objects. n8n turns each into a downstream item.
When expressions fail silently
The most insidious case: a typo in a field name returns undefined, which n8n stringifies as "undefined". Always log the input shape during development by inserting a Set node with ={{ JSON.stringify($json) }} to verify the structure.
Open this reference as its own page
n8n Node Catalog (Battle-Tested)
Curated list of nodes that survive production. Use these by name — they are the exact n8n type strings.
Triggers
| Use case | Node | Notes |
|---|---|---|
| External webhook | Webhook |
Set responseMode: "responseNode" if processing takes >3s. Use Respond to Webhook to reply early. |
| Recurring jobs | Schedule Trigger |
Cron syntax. Prefer hourly+ over per-minute. For per-minute, check if a webhook exists from the source. |
| Conversational | Chat Trigger |
Pairs with AI Agent for chat UIs. |
| Form intake | Form Trigger |
Built-in form, hosted by n8n. Skips needing a frontend. |
| Manual / dev | Manual Trigger |
Testing only. Never ship workflows that depend on it. |
| Called by parent | Execute Workflow Trigger |
For sub-workflows. Defines the input schema. |
Logic / control flow
| Use case | Node | Notes |
|---|---|---|
| Branch on condition | IF |
Two outputs: true / false. Always wire both. |
| Multi-way switch | Switch |
More than 2 branches. Up to 4 output cases by default, configurable. |
| Merge branches | Merge |
Modes: append, multiplex, combineByPosition, combineByMatchingFields. Pick deliberately. |
| Loop over batches | Split In Batches |
batchSize per chunk; done output fires when complete. |
| Loop a fixed N | Use Code to emit N items |
n8n has no native "for i in range" — generate items in Code. |
| Wait / delay | Wait |
For backoff, polling, or human-in-the-loop. |
| Error handler | Error Trigger |
Lives in a separate workflow. Catches uncaught errors from any workflow that names it. |
Data transformation
| Use case | Node | Notes |
|---|---|---|
| Set/edit fields | Set |
Replaces/adds named fields. Use over Code when transformation is simple. |
| Custom JS / TS | Code |
Runs JavaScript or Python. Use sparingly — every Code node is harder to read than a purpose-built one. |
| Array operations | Item Lists |
Split out items, aggregate, sort, remove duplicates, summarize. |
| Date math | Date & Time |
Add/subtract durations, format. |
| HTTP request (generic API) | HTTP Request |
Set continueOnFail: true for vendor calls. Use n8n credential, never inline auth. |
| HTML parsing | HTML |
Extract via CSS selectors. |
| Markdown ↔ HTML | Markdown |
Both directions. |
| File operations | Read/Write Files from Disk |
Self-hosted only. |
LLM / AI nodes (LangChain integration)
Use these instead of raw HTTP Request to LLM APIs. They handle retries, schema validation, and token accounting.
| Use case | Node | Notes |
|---|---|---|
| Conversational agent with tools | AI Agent |
The default for tool-using agents. |
| Single-prompt LLM call | Basic LLM Chain |
Plain prompt → response. |
| Structured output extraction | Information Extractor |
Bind output to a JSON schema. Best for entity extraction. |
| Classification | Text Classifier |
Predefined labels with reasoning. |
| Sentiment | Sentiment Analysis |
Simpler than Text Classifier for basic cases. |
| Summarization | Summarization Chain |
Map-reduce over long docs. |
| RAG / retrieval | Question and Answer Chain |
Retriever + LLM. |
| Embeddings | Embeddings OpenAI / Embeddings Cohere / Embeddings HuggingFace |
Choose based on vector store and language coverage. |
| Vector store | Vector Store In-Memory / Vector Store Pinecone / Vector Store Supabase / Vector Store Qdrant |
Pick based on volume + persistence. In-memory for dev only. |
| LLM provider models | OpenAI Chat Model / Anthropic Chat Model / Groq Chat Model / Ollama Chat Model |
Sub-nodes plugged into the chains above. |
Storage
| Use case | Node | Notes |
|---|---|---|
| Relational DB | MySQL / Postgres |
Use credentials. Set connectionLimit: 5 to avoid pool exhaustion. |
| Sheets | Google Sheets |
Strict on capitalization. Avoid for >10k rows — use a real DB. |
| Document DB | MongoDB |
Filter syntax follows MongoDB query operators. |
| Object storage | AWS S3 / Google Cloud Storage / MinIO |
For files, large blobs, exports. |
| Key-value | Redis |
Cache, locks, rate limits. |
Communication
| Use case | Node | Notes |
|---|---|---|
Gmail / Microsoft Outlook / Send Email (SMTP) |
Gmail/Outlook use OAuth; SMTP needs credentials. | |
| WhatsApp (official) | WhatsApp Business Cloud |
Meta Cloud API. Templates must be pre-approved in Meta Business Manager. |
| WhatsApp (community) | Custom HTTP Request to evolution-api or wa-automate |
Self-hosted bridges. Less reliable for production. |
| SMS | Twilio / Vonage / Plivo |
Twilio is the safe default. |
| Slack | Slack |
Bot vs user token matters — bots can't DM users they don't share a channel with. |
| Telegram | Telegram |
Bot API; commands and inline keyboards supported. |
| Discord | Discord |
Webhooks for posting; bot token for fuller features. |
Payments / commerce
| Use case | Node | Notes |
|---|---|---|
| Stripe | Stripe + Stripe Trigger |
Trigger handles webhook signature verification. Use it instead of Webhook + manual HMAC. |
| Shopify | Shopify + Shopify Trigger |
Pre-built event handling. |
| WooCommerce | WooCommerce + WooCommerce Trigger |
Same pattern. |
Auth
Always use n8n credentials for all auth — never inline tokens or keys. Credential types n8n supports natively:
- API Key (header, query string)
- Basic Auth
- OAuth2
- Bearer Token
- Custom (configurable)
When a vendor isn't in n8n's catalog, use HTTP Request with a custom Header Auth credential.
Anti-pattern: nodes to avoid (or use only with care)
Function(deprecated, useCode)Read Binary Filewithout size limits — easy OOM- Plain
Webhookfor Stripe — useStripe Triggerfor built-in HMAC verification Waitinside aSplit In Batchesloop with nobatchSizecap — runs serially forever on large datasetsHTTP Requestdirectly to LLM APIs — use the LangChain LLM nodes; they handle retries and token accounting
More in this playbook
Safe to turn on
Use this skill when an agent or person is about to create, change or enable an automation inside someone else's account or a shared environment: "create this workflow", "build it in the customer's account", "turn it on", "go live", "deploy this automation". Produces a proposal the human approves, an automation created in the off state, and a short list of what only the human can finish.
Workflow buildingMITn8n agents
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.
Workflow buildingMITn8n agents
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.

