n8n workflow automation with retries, logging, and review queues
PURPOSE
Designs and outputs n8n workflow JSON with robust triggers, idempotency, error handling, logging, retries, and human-in-the-loop review queues.
WHEN TO USE
- TRIGGERS:
- Build an n8n workflow that runs every Monday and emails the compliance summary.
- Add error handling and retries to this workflow, plus a review queue for failures.
- Create a webhook workflow that logs every run and writes a status row to a tracker.
- Make this n8n flow idempotent so it does not duplicate records when it reruns.
- Instrument this workflow with audit logs and a human approval step.
- DO NOT USE WHEN…
- You need code-only automation without n8n (use a scripting/CI skill).
- You need to bypass security controls or hide audit trails.
- You need to purchase or recommend prohibited items/services.
INPUTS
- REQUIRED:
- Workflow intent: trigger type + schedule/timezone + success criteria.
- Targets: where to write results (email/Drive/Sheet/DB) and required fields.
- OPTIONAL:
- Existing n8n workflow JSON to modify.
- Sample payloads / example records.
- Definition of dedup keys (what makes a record unique).
- EXAMPLES:
- Cron: Monday 08:00 Europe/London; send summary email + Drive upload
- Webhook: receive JSON; route to folders
OUTPUTS
- Default (read-only): a workflow design spec (nodes, data contracts, failure modes).
- If explicitly requested:
workflow.json (n8n importable JSON) + runbook.md (from template).
Success = workflow is idempotent, logs every run, retries safely, and routes failures to a review queue.
WORKFLOW
- Clarify trigger:
- Cron/webhook/manual; schedule/timezone; concurrency expectations.
- Define data contract:
- input schema, required fields, and validation rules.
- Design idempotency:
- choose dedup key(s) and storage (DB/Sheet) to prevent duplicates on retries.
- Add observability:
- generate
run_id, log start/end, store status row and error details.
- Implement error handling:
- per-node error branches, retry with backoff, and final failure notification.
- Add human-in-the-loop (HITL) review queue:
- write failed items to a queue (Sheet/DB) and require approval to reprocess.
- “No silent failure” gates:
- if counts/thresholds fail, stop workflow and alert.
- Output:
- If asked for JSON: produce importable n8n workflow JSON + runbook.
- STOP AND ASK THE USER if:
- destination systems are unknown,
- no dedup key exists,
- credential strategy (env vars) is not specified,
- the workflow needs privileged access not yet approved.
OUTPUT FORMAT
If outputting n8n workflow JSON, conform to:
{
"name": "<workflow name>",
"nodes": [ { "name": "Trigger", "type": "n8n-nodes-base.cron", "parameters": {}, "position": [0,0] } ],
"connections": {},
"settings": {},
"active": false
}
Also output runbook.md using assets/runbook-template.md.
SAFETY & EDGE CASES
- Read-only by default; only emit workflow JSON when explicitly requested.
- Do not include secrets in JSON; reference env vars/credential names only.
- Include audit logging + failure notifications; avoid workflows that can silently drop data.
- Prefer least privilege: call only required APIs and minimize scopes.
EXAMPLES
Input: “Cron every Monday, email compliance summary, retry failures.”
Output: Node map + workflow.json with Cron → Fetch → Aggregate → Email, plus error branches to review queue.
Input: “Webhook that logs runs and writes status row.”
Output: Webhook → Validate → Process → Append status row; on error → log + notify + queue.
1---
2name: n8n-workflow-automation
3description: Designs and outputs n8n workflow JSON with robust triggers, idempotency, error handling, logging, retries, and human-in-the-loop review queues. Use when you need an auditable automation that won’t silently fail.
4metadata:
5 source: https://skillmd.com/skills/danstrem2/n8n-workflow-automation
6---
7
8# n8n workflow automation with retries, logging, and review queues
9
10## PURPOSE
11Designs and outputs n8n workflow JSON with robust triggers, idempotency, error handling, logging, retries, and human-in-the-loop review queues.
12
13## WHEN TO USE
14- TRIGGERS:
15 - Build an n8n workflow that runs every Monday and emails the compliance summary.
16 - Add error handling and retries to this workflow, plus a review queue for failures.
17 - Create a webhook workflow that logs every run and writes a status row to a tracker.
18 - Make this n8n flow idempotent so it does not duplicate records when it reruns.
19 - Instrument this workflow with audit logs and a human approval step.
20- DO NOT USE WHEN…
21 - You need code-only automation without n8n (use a scripting/CI skill).
22 - You need to bypass security controls or hide audit trails.
23 - You need to purchase or recommend prohibited items/services.
24
25## INPUTS
26- REQUIRED:
27 - Workflow intent: trigger type + schedule/timezone + success criteria.
28 - Targets: where to write results (email/Drive/Sheet/DB) and required fields.
29- OPTIONAL:
30 - Existing n8n workflow JSON to modify.
31 - Sample payloads / example records.
32 - Definition of dedup keys (what makes a record unique).
33- EXAMPLES:
34 - Cron: Monday 08:00 Europe/London; send summary email + Drive upload
35 - Webhook: receive JSON; route to folders
36
37## OUTPUTS
38- Default (read-only): a workflow design spec (nodes, data contracts, failure modes).
39- If explicitly requested: `workflow.json` (n8n importable JSON) + `runbook.md` (from template).
40Success = workflow is idempotent, logs every run, retries safely, and routes failures to a review queue.
41
42
43## WORKFLOW
441. Clarify trigger:
45 - Cron/webhook/manual; schedule/timezone; concurrency expectations.
462. Define data contract:
47 - input schema, required fields, and validation rules.
483. Design idempotency:
49 - choose dedup key(s) and storage (DB/Sheet) to prevent duplicates on retries.
504. Add observability:
51 - generate `run_id`, log start/end, store status row and error details.
525. Implement error handling:
53 - per-node error branches, retry with backoff, and final failure notification.
546. Add human-in-the-loop (HITL) review queue:
55 - write failed items to a queue (Sheet/DB) and require approval to reprocess.
567. “No silent failure” gates:
57 - if counts/thresholds fail, stop workflow and alert.
588. Output:
59 - If asked for JSON: produce importable n8n workflow JSON + runbook.
609. STOP AND ASK THE USER if:
61 - destination systems are unknown,
62 - no dedup key exists,
63 - credential strategy (env vars) is not specified,
64 - the workflow needs privileged access not yet approved.
65
66
67## OUTPUT FORMAT
68If outputting **n8n workflow JSON**, conform to:
69
70```json
71{
72 "name": "<workflow name>",
73 "nodes": [ { "name": "Trigger", "type": "n8n-nodes-base.cron", "parameters": {}, "position": [0,0] } ],
74 "connections": {},
75 "settings": {},
76 "active": false
77}
78```
79
80Also output `runbook.md` using `assets/runbook-template.md`.
81
82
83## SAFETY & EDGE CASES
84- Read-only by default; only emit workflow JSON when explicitly requested.
85- Do not include secrets in JSON; reference env vars/credential names only.
86- Include audit logging + failure notifications; avoid workflows that can silently drop data.
87- Prefer least privilege: call only required APIs and minimize scopes.
88
89
90## EXAMPLES
91- Input: “Cron every Monday, email compliance summary, retry failures.”
92 Output: Node map + `workflow.json` with Cron → Fetch → Aggregate → Email, plus error branches to review queue.
93
94- Input: “Webhook that logs runs and writes status row.”
95 Output: Webhook → Validate → Process → Append status row; on error → log + notify + queue.
96